diff options
author | Chong Zhang <chz@google.com> | 2015-02-06 15:07:14 -0800 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2015-02-09 13:52:20 -0800 |
commit | 56a7ed6982ce5100ed6fa5442931b2f39851a08c (patch) | |
tree | be1abbcf7b5f89992cf6e037691ea9851136b213 | |
parent | 12271e22014c2e2cd0ecdb9938ff8b618c68bc56 (diff) | |
download | frameworks_base-56a7ed6982ce5100ed6fa5442931b2f39851a08c.zip frameworks_base-56a7ed6982ce5100ed6fa5442931b2f39851a08c.tar.gz frameworks_base-56a7ed6982ce5100ed6fa5442931b2f39851a08c.tar.bz2 |
media: discard duplicate CEA-608 ctrl code
bug: 19297083
Change-Id: I6c108e2c597e7b3fd770306a26e110208dc5ece0
-rw-r--r-- | media/java/android/media/ClosedCaptionRenderer.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/media/java/android/media/ClosedCaptionRenderer.java b/media/java/android/media/ClosedCaptionRenderer.java index d34b21b..e3680e9 100644 --- a/media/java/android/media/ClosedCaptionRenderer.java +++ b/media/java/android/media/ClosedCaptionRenderer.java @@ -154,6 +154,7 @@ class CCParser { private int mMode = MODE_PAINT_ON; private int mRollUpSize = 4; + private int mPrevCtrlCode = INVALID; private CCMemory mDisplay = new CCMemory(); private CCMemory mNonDisplay = new CCMemory(); @@ -260,6 +261,13 @@ class CCParser { private boolean handleCtrlCode(CCData ccData) { int ctrlCode = ccData.getCtrlCode(); + + if (mPrevCtrlCode != INVALID && mPrevCtrlCode == ctrlCode) { + // discard double ctrl codes (but if there's a 3rd one, we still take that) + mPrevCtrlCode = INVALID; + return true; + } + switch(ctrlCode) { case RCL: // select pop-on style @@ -325,10 +333,12 @@ class CCParser { break; case INVALID: default: - // not handled + mPrevCtrlCode = INVALID; return false; } + mPrevCtrlCode = ctrlCode; + // handled return true; } |