summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/omx/GraphicBufferSource.cpp
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2013-10-23 13:39:43 -0700
committerAndy McFadden <fadden@android.com>2013-10-23 13:39:43 -0700
commitbdfd4885aa4d7b3f3f591118927a3f4aec593096 (patch)
tree44496e45de950a515fdd431f06e06a4f25d41743 /media/libstagefright/omx/GraphicBufferSource.cpp
parent95c03858e2ab4fb693a2bfe47b3caa806e43c044 (diff)
downloadframeworks_av-bdfd4885aa4d7b3f3f591118927a3f4aec593096.zip
frameworks_av-bdfd4885aa4d7b3f3f591118927a3f4aec593096.tar.gz
frameworks_av-bdfd4885aa4d7b3f3f591118927a3f4aec593096.tar.bz2
Check for NULL buffer in repeat-latest
Repeating the most-recent buffer appears to fail when the producer disconnects. This adds a NULL check to avoid crashing. Bug 10607920 Change-Id: Ied036004425f046fcf9c26303823681f3fddb99e
Diffstat (limited to 'media/libstagefright/omx/GraphicBufferSource.cpp')
-rw-r--r--media/libstagefright/omx/GraphicBufferSource.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/media/libstagefright/omx/GraphicBufferSource.cpp b/media/libstagefright/omx/GraphicBufferSource.cpp
index cf43e94..f295e5a 100644
--- a/media/libstagefright/omx/GraphicBufferSource.cpp
+++ b/media/libstagefright/omx/GraphicBufferSource.cpp
@@ -384,6 +384,23 @@ bool GraphicBufferSource::repeatLatestSubmittedBuffer_l() {
if (mLatestSubmittedBufferId < 0 || mSuspended) {
return false;
}
+ if (mBufferSlot[mLatestSubmittedBufferId] == NULL) {
+ // This can happen if the remote side disconnects, causing
+ // onBuffersReleased() to NULL out our copy of the slots. The
+ // buffer is gone, so we have nothing to show.
+ //
+ // To be on the safe side we try to release the buffer.
+ ALOGD("repeatLatestSubmittedBuffer_l: slot was NULL");
+ mBufferQueue->releaseBuffer(
+ mLatestSubmittedBufferId,
+ mLatestSubmittedBufferFrameNum,
+ EGL_NO_DISPLAY,
+ EGL_NO_SYNC_KHR,
+ Fence::NO_FENCE);
+ mLatestSubmittedBufferId = -1;
+ mLatestSubmittedBufferFrameNum = 0;
+ return false;
+ }
int cbi = findAvailableCodecBuffer_l();
if (cbi < 0) {