diff options
author | Marco Nelissen <marcone@google.com> | 2014-05-28 15:23:14 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2014-05-28 15:23:14 -0700 |
commit | dd114d19f65d8a5cdfddbaf6d3ef8119c6169b28 (patch) | |
tree | df8064291ebf7bd7f761656b8aa5a8826f2d8fa4 | |
parent | 5584c58c7c952b5ed891bbff3b00a0be3f96196d (diff) | |
download | frameworks_av-dd114d19f65d8a5cdfddbaf6d3ef8119c6169b28.zip frameworks_av-dd114d19f65d8a5cdfddbaf6d3ef8119c6169b28.tar.gz frameworks_av-dd114d19f65d8a5cdfddbaf6d3ef8119c6169b28.tar.bz2 |
Fix some NuPlayer issues.
Fixes OnSeekCompleted callback and calling getDuration immediately
after prepare().
Change-Id: Ie58c509005cded278a0e50c87240b0a2d920b7d7
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 13 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index d8d939a..857e703 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -1376,16 +1376,15 @@ void NuPlayer::onSourceNotify(const sp<AMessage> &msg) { sp<NuPlayerDriver> driver = mDriver.promote(); if (driver != NULL) { - driver->notifyPrepareCompleted(err); - } - - int64_t durationUs; - if (mDriver != NULL && mSource->getDuration(&durationUs) == OK) { - sp<NuPlayerDriver> driver = mDriver.promote(); - if (driver != NULL) { + // notify duration first, so that it's definitely set when + // the app received the "prepare complete" callback. + int64_t durationUs; + if (mSource->getDuration(&durationUs) == OK) { driver->notifyDuration(durationUs); } + driver->notifyPrepareCompleted(err); } + break; } diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp index e4850f0..280b5af 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp @@ -284,6 +284,10 @@ status_t NuPlayerDriver::seekTo(int msec) { case STATE_PREPARED: { mStartupSeekTimeUs = seekTimeUs; + // pretend that the seek completed. It will actually happen when starting playback. + // TODO: actually perform the seek here, so the player is ready to go at the new + // location + notifySeekComplete(); break; } |