diff options
author | Andreas Huber <andih@google.com> | 2011-08-26 16:02:19 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-08-26 16:02:19 -0700 |
commit | cb67cd1b51ff9ab221e3124cf7e546515fef3c87 (patch) | |
tree | 9bc33d4f184b31279929c4f59544444fe5442984 /media/libmediaplayerservice/nuplayer | |
parent | 8d9d585ce5b1aa284289a27dda048c6317b104e7 (diff) | |
download | frameworks_av-cb67cd1b51ff9ab221e3124cf7e546515fef3c87.zip frameworks_av-cb67cd1b51ff9ab221e3124cf7e546515fef3c87.tar.gz frameworks_av-cb67cd1b51ff9ab221e3124cf7e546515fef3c87.tar.bz2 |
Signal errors to the client instead of asserting in ACodec.
Also make sure NuPlayer can properly shutdown in certain edge cases.
Change-Id: Iceb16d600d87ba66c802e60e95bf62f66487a453
Diffstat (limited to 'media/libmediaplayerservice/nuplayer')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 6 | ||||
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp | 45 |
2 files changed, 32 insertions, 19 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index 7fb141a..1f08a91 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -316,9 +316,11 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) { &cropLeft, &cropTop, &cropRight, &cropBottom)); LOGV("Video output format changed to %d x %d " - "(crop: %d, %d, %d, %d)", + "(crop: %d x %d @ (%d, %d))", width, height, - cropLeft, cropTop, cropRight, cropBottom); + (cropRight - cropLeft + 1), + (cropBottom - cropTop + 1), + cropLeft, cropTop); notifyListener( MEDIA_SET_VIDEO_SIZE, diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp index 35ed43f..8f213da 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp @@ -395,29 +395,40 @@ void NuPlayer::Renderer::onQueueBuffer(const sp<AMessage> &msg) { postDrainVideoQueue(); } - if (mSyncQueues && !mAudioQueue.empty() && !mVideoQueue.empty()) { - int64_t firstAudioTimeUs; - int64_t firstVideoTimeUs; - CHECK((*mAudioQueue.begin()).mBuffer->meta() - ->findInt64("timeUs", &firstAudioTimeUs)); - CHECK((*mVideoQueue.begin()).mBuffer->meta() - ->findInt64("timeUs", &firstVideoTimeUs)); + if (!mSyncQueues || mAudioQueue.empty() || mVideoQueue.empty()) { + return; + } - int64_t diff = firstVideoTimeUs - firstAudioTimeUs; + sp<ABuffer> firstAudioBuffer = (*mAudioQueue.begin()).mBuffer; + sp<ABuffer> firstVideoBuffer = (*mVideoQueue.begin()).mBuffer; - LOGV("queueDiff = %.2f secs", diff / 1E6); + if (firstAudioBuffer == NULL || firstVideoBuffer == NULL) { + // EOS signalled on either queue. + syncQueuesDone(); + return; + } - if (diff > 100000ll) { - // Audio data starts More than 0.1 secs before video. - // Drop some audio. + int64_t firstAudioTimeUs; + int64_t firstVideoTimeUs; + CHECK(firstAudioBuffer->meta() + ->findInt64("timeUs", &firstAudioTimeUs)); + CHECK(firstVideoBuffer->meta() + ->findInt64("timeUs", &firstVideoTimeUs)); - (*mAudioQueue.begin()).mNotifyConsumed->post(); - mAudioQueue.erase(mAudioQueue.begin()); - return; - } + int64_t diff = firstVideoTimeUs - firstAudioTimeUs; - syncQueuesDone(); + LOGV("queueDiff = %.2f secs", diff / 1E6); + + if (diff > 100000ll) { + // Audio data starts More than 0.1 secs before video. + // Drop some audio. + + (*mAudioQueue.begin()).mNotifyConsumed->post(); + mAudioQueue.erase(mAudioQueue.begin()); + return; } + + syncQueuesDone(); } void NuPlayer::Renderer::syncQueuesDone() { |