From 1de1d15673020bc0bfb72dbb8bb95a4ac199acc8 Mon Sep 17 00:00:00 2001 From: Diogo Ferreira Date: Tue, 1 Dec 2015 15:52:30 +0000 Subject: stagefright: handleSetSurface: Don't dereference null graphic buffers In metadata mode and when buffers are owned by the native window , it is possible that the graphics buffer is null. This is fine since we don't have to attach it to a surface. However, the logging was trying to dereference this graphic buffer which caused media to crash sporadically. This fixes the flakiness in android.media.cts.MediaPlayerTest#testVideoSurfaceResetting Change-Id: I89f30ca1177d7118da5a7b0ffbbb91370f9b54ab --- media/libstagefright/ACodec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'media/libstagefright/ACodec.cpp') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index f7cc4cd..54c648c 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -725,7 +725,7 @@ status_t ACodec::handleSetSurface(const sp &surface) { if (storingMetadataInDecodedBuffers() && !mLegacyAdaptiveExperiment && info.mStatus == BufferInfo::OWNED_BY_NATIVE_WINDOW) { - ALOGV("skipping buffer %p", info.mGraphicBuffer->getNativeBuffer()); + ALOGV("skipping buffer %p", info.mGraphicBuffer.get() ? info.mGraphicBuffer->getNativeBuffer() : 0x0); continue; } ALOGV("attaching buffer %p", info.mGraphicBuffer->getNativeBuffer()); -- cgit v1.1