diff options
author | Andreas Huber <andih@google.com> | 2011-04-04 11:43:40 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-04-04 11:43:40 -0700 |
commit | 51c1e0e86a0ad95bf3d890a9a2f51e54b8ef9444 (patch) | |
tree | 622fba590fbbf4fafcdf3230ee6d25ae4976ca65 /media/libmediaplayerservice/MediaPlayerService.cpp | |
parent | 94baecca5e14b083c46615a1bcf18ea6cf7cad46 (diff) | |
download | frameworks_av-51c1e0e86a0ad95bf3d890a9a2f51e54b8ef9444.zip frameworks_av-51c1e0e86a0ad95bf3d890a9a2f51e54b8ef9444.tar.gz frameworks_av-51c1e0e86a0ad95bf3d890a9a2f51e54b8ef9444.tar.bz2 |
This reverts an earlier change 4aeec2da39fce4de9b07b694d59fd308ffb3d491
Instead of returning 0-filled buffers after EOS from AudioTrack we do this
work in AudioOutput instead. That way the EOS signal (0 frames returned)
is preserved in AudioCache which otherwise would lead to a heap size overflow
filling everything with zeroes.
Change-Id: I7e07429ba887957a4340dd4b21eef4bba76248cd
related-to-bug: 3514073
Diffstat (limited to 'media/libmediaplayerservice/MediaPlayerService.cpp')
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerService.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index 5eecbde..9c9ac97 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -1449,8 +1449,15 @@ void MediaPlayerService::AudioOutput::CallbackWrapper( size_t actualSize = (*me->mCallback)( me, buffer->raw, buffer->size, me->mCallbackCookie); - buffer->size = actualSize; + if (actualSize == 0 && buffer->size > 0) { + // We've reached EOS but the audio track is not stopped yet, + // keep playing silence. + + memset(buffer->raw, 0, buffer->size); + actualSize = buffer->size; + } + buffer->size = actualSize; } int MediaPlayerService::AudioOutput::getSessionId() |