Merge "This reverts an earlier change 4aeec2da39fce4de9b07b694d59fd308ffb3d491"
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 @@
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()
diff --git a/media/libstagefright/AudioPlayer.cpp b/media/libstagefright/AudioPlayer.cpp
index 07b9522..fcea848 100644
--- a/media/libstagefright/AudioPlayer.cpp
+++ b/media/libstagefright/AudioPlayer.cpp
@@ -306,9 +306,7 @@
}
if (mReachedEOS) {
- memset(data, 0, size);
-
- return size;
+ return 0;
}
bool postSeekComplete = false;