summaryrefslogtreecommitdiffstats
path: root/media/libmediaplayerservice/nuplayer
diff options
context:
space:
mode:
authorRobert Shih <robertshih@google.com>2014-07-25 14:14:34 -0700
committerRobert Shih <robertshih@google.com>2014-07-28 13:06:42 -0700
commitbace25b0fbcd5101d2db288b0c70c4a239f0e815 (patch)
treeb9ba2e40b3a02ba0ca5083b644f092238222603c /media/libmediaplayerservice/nuplayer
parentef9c5ade2308f9eb6f222db3c4796e196f0ab76c (diff)
downloadframeworks_av-bace25b0fbcd5101d2db288b0c70c4a239f0e815.zip
frameworks_av-bace25b0fbcd5101d2db288b0c70c4a239f0e815.tar.gz
frameworks_av-bace25b0fbcd5101d2db288b0c70c4a239f0e815.tar.bz2
GenericSource: start/stop tracks correctly on selection
Change-Id: I10343151f930a4ab778a6d2574ab5165af2013ba
Diffstat (limited to 'media/libmediaplayerservice/nuplayer')
-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 {