summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/timedtext/TimedTextPlayer.cpp
diff options
context:
space:
mode:
authorInsun Kang <insun@google.com>2012-09-20 21:03:44 +0900
committerInsun Kang <insun@google.com>2012-09-20 22:20:26 +0900
commit23580bb8d6cafbc2b65dd0a4ce1acb52562d1b05 (patch)
tree9674f693e29d36d50df581d61d7040e9b756dfa8 /media/libstagefright/timedtext/TimedTextPlayer.cpp
parent74e58c55bc5259b957a51f1bb44a5911ad1f8400 (diff)
downloadframeworks_av-23580bb8d6cafbc2b65dd0a4ce1acb52562d1b05.zip
frameworks_av-23580bb8d6cafbc2b65dd0a4ce1acb52562d1b05.tar.gz
frameworks_av-23580bb8d6cafbc2b65dd0a4ce1acb52562d1b05.tar.bz2
Bug fix: MediaPlayer's deselectTrack() for subtitle.
o Previously, deselectTrack() actually doesn't work properly in TimedTextDriver / TimedTextPlayer. o Ignores select track operation when the same track is selected in a row. Bug: 7200096 TESTED=runtest -d cts-media -c android.media.cts.MediaPlayerTest Change-Id: If7feac294cf9b358f616be45574bc2e26001c887
Diffstat (limited to 'media/libstagefright/timedtext/TimedTextPlayer.cpp')
-rw-r--r--media/libstagefright/timedtext/TimedTextPlayer.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/media/libstagefright/timedtext/TimedTextPlayer.cpp b/media/libstagefright/timedtext/TimedTextPlayer.cpp
index e3bdd8a..9fb0afe 100644
--- a/media/libstagefright/timedtext/TimedTextPlayer.cpp
+++ b/media/libstagefright/timedtext/TimedTextPlayer.cpp
@@ -183,11 +183,20 @@ void TimedTextPlayer::onMessageReceived(const sp<AMessage> &msg) {
break;
}
case kWhatSetSource: {
+ mSendSubtitleGeneration++;
sp<RefBase> obj;
msg->findObject("source", &obj);
- if (obj == NULL) break;
if (mSource != NULL) {
mSource->stop();
+ mSource.clear();
+ mSource = NULL;
+ }
+ // null source means deselect track.
+ if (obj == NULL) {
+ mPendingSeekTimeUs = kInvalidTimeUs;
+ mPaused = false;
+ notifyListener();
+ break;
}
mSource = static_cast<TimedTextSource*>(obj.get());
status_t err = mSource->start();
@@ -217,6 +226,7 @@ void TimedTextPlayer::doRead(MediaSource::ReadOptions* options) {
int64_t startTimeUs = 0;
int64_t endTimeUs = 0;
sp<ParcelEvent> parcelEvent = new ParcelEvent();
+ CHECK(mSource != NULL);
status_t err = mSource->read(&startTimeUs, &endTimeUs,
&(parcelEvent->parcel), options);
if (err == WOULD_BLOCK) {