diff options
author | Lajos Molnar <lajos@google.com> | 2014-09-09 20:08:39 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2014-09-09 20:40:54 -0700 |
commit | 178e506350ef41609daaf307f598ef0bc4f82c71 (patch) | |
tree | ee782d0b688545138cfd8e12ea445e54bc436471 /media/libmediaplayerservice | |
parent | c99d333f59b5559248a5bf3135b7ef85b5f40133 (diff) | |
download | frameworks_av-178e506350ef41609daaf307f598ef0bc4f82c71.zip frameworks_av-178e506350ef41609daaf307f598ef0bc4f82c71.tar.gz frameworks_av-178e506350ef41609daaf307f598ef0bc4f82c71.tar.bz2 |
mediaplayer: limit number of outstanding buffer requests
Bug: 14679336
Change-Id: I94a20ada30a9a25065329a85fc884d32d154d029
Diffstat (limited to 'media/libmediaplayerservice')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp index c9be0dd..ab7906a 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDecoderPassThrough.cpp @@ -115,9 +115,12 @@ void NuPlayer::DecoderPassThrough::requestABuffer() { notify->post(); mPendingBuffers++; - sp<AMessage> message = new AMessage(kWhatRequestABuffer, id()); - message->setInt32("generation", mBufferGeneration); - message->post(); + // pending buffers will already result in requestABuffer + if (mPendingBuffers < kMaxPendingBuffers) { + sp<AMessage> message = new AMessage(kWhatRequestABuffer, id()); + message->setInt32("generation", mBufferGeneration); + message->post(); + } return; } @@ -155,9 +158,7 @@ void android::NuPlayer::DecoderPassThrough::onInputBufferFilled( void NuPlayer::DecoderPassThrough::onBufferConsumed(int32_t size) { mPendingBuffers--; mCachedBytes -= size; - sp<AMessage> message = new AMessage(kWhatRequestABuffer, id()); - message->setInt32("generation", mBufferGeneration); - message->post(); + requestABuffer(); } void NuPlayer::DecoderPassThrough::onFlush() { |