summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Shih <robertshih@google.com>2014-07-29 16:58:01 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-07-28 22:45:16 +0000
commit0ec1f33ed4e953c7468b41a7c611faeb9bb7ae91 (patch)
tree617623e4c02171ae63ebfe13a3fe267df8d44c97
parent4dc680607181e6a76f4e91a39366c4f5dfb7b03e (diff)
parentbace25b0fbcd5101d2db288b0c70c4a239f0e815 (diff)
downloadframeworks_av-0ec1f33ed4e953c7468b41a7c611faeb9bb7ae91.zip
frameworks_av-0ec1f33ed4e953c7468b41a7c611faeb9bb7ae91.tar.gz
frameworks_av-0ec1f33ed4e953c7468b41a7c611faeb9bb7ae91.tar.bz2
Merge "GenericSource: start/stop tracks correctly on selection" into lmp-dev
-rw-r--r--media/libmediaplayerservice/nuplayer/GenericSource.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/media/libmediaplayerservice/nuplayer/GenericSource.cpp b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
index 4c6a59c..0b09f58 100644
--- a/media/libmediaplayerservice/nuplayer/GenericSource.cpp
+++ b/media/libmediaplayerservice/nuplayer/GenericSource.cpp
@@ -137,7 +137,6 @@ void NuPlayer::GenericSource::initFromDataSource(
}
if (track != NULL) {
- CHECK_EQ(track->start(), (status_t)OK);
mSources.push(track);
int64_t durationUs;
if (meta->findInt64(kKeyDuration, &durationUs)) {
@@ -184,6 +183,7 @@ void NuPlayer::GenericSource::start() {
ALOGI("start");
if (mAudioTrack.mSource != NULL) {
+ CHECK_EQ(mAudioTrack.mSource->start(), (status_t)OK);
mAudioTrack.mPackets =
new AnotherPacketSource(mAudioTrack.mSource->getFormat());
@@ -191,6 +191,7 @@ void NuPlayer::GenericSource::start() {
}
if (mVideoTrack.mSource != NULL) {
+ CHECK_EQ(mVideoTrack.mSource->start(), (status_t)OK);
mVideoTrack.mPackets =
new AnotherPacketSource(mVideoTrack.mSource->getFormat());
@@ -255,7 +256,11 @@ void NuPlayer::GenericSource::onMessageReceived(const sp<AMessage> &msg) {
}
+ if (track->mSource != NULL) {
+ track->mSource->stop();
+ }
track->mSource = source;
+ track->mSource->start();
track->mIndex = trackIndex;
status_t avail;
@@ -529,6 +534,7 @@ status_t NuPlayer::GenericSource::selectTrack(size_t trackIndex, bool select) {
if (track == NULL) {
return INVALID_OPERATION;
}
+ track->mSource->stop();
track->mSource = NULL;
track->mPackets->clear();
return OK;
@@ -545,7 +551,11 @@ status_t NuPlayer::GenericSource::selectTrack(size_t trackIndex, bool select) {
return OK;
}
track->mIndex = trackIndex;
+ if (track->mSource != NULL) {
+ track->mSource->stop();
+ }
track->mSource = mSources.itemAt(trackIndex);
+ track->mSource->start();
if (track->mPackets == NULL) {
track->mPackets = new AnotherPacketSource(track->mSource->getFormat());
} else {