From 46da121c84a6f343e262b89a7ec4ac7941d58028 Mon Sep 17 00:00:00 2001 From: "Christopher R. Palmer" Date: Tue, 12 Jan 2016 21:40:02 -0500 Subject: nuplayer: Allow devices to force a flush when surface changes This fixes some playback problems on the Zenfone2 (running on 5.0 based blobs). The problems are easily reproduced by viewing a video in Chrome and then switching to full-screen mode. The change in surface causes the log to get flooded with messages like: dc_device_post: Buffer ID=14460 not imported by D until Android crashes. With this change, it ends up correctly mapping the surfaces after the flush fixing the problem. The code that is being #ifdef'ed out was added in M in commit commit a81c6229638a4db56752dd77a6610e0f0971e877 Author: Lajos Molnar Date: Fri Jul 10 19:17:45 2015 -0700 nuplayer: use codec->setSurface when possible to avoid seeking Bug: 22414719 Change-Id: I0442e12af960f86a0fc090b4a469c62ba638a1a0 and it appears that our blobs simply cannot handle this optimization and therefore we need a means by which to disable it. Change-Id: I105d647e724f5b63ef5cb0852481ecd2990c2d5e --- media/libmediaplayerservice/nuplayer/Android.mk | 4 ++++ media/libmediaplayerservice/nuplayer/NuPlayer.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'media/libmediaplayerservice') diff --git a/media/libmediaplayerservice/nuplayer/Android.mk b/media/libmediaplayerservice/nuplayer/Android.mk index fbb1276..ff2a202 100644 --- a/media/libmediaplayerservice/nuplayer/Android.mk +++ b/media/libmediaplayerservice/nuplayer/Android.mk @@ -38,6 +38,10 @@ ifeq ($(TARGET_BOARD_PLATFORM),msm8974) LOCAL_CFLAGS += -DTARGET_8974 endif +ifeq ($(TARGET_NUPLAYER_CANNOT_SET_SURFACE_WITHOUT_A_FLUSH),true) +LOCAL_CFLAGS += -DCANNOT_SET_SURFACE_WITHOUT_A_FLUSH +endif + LOCAL_CLANG := true LOCAL_MODULE:= libstagefright_nuplayer diff --git a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp index caac70b..1835101 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayer.cpp @@ -660,7 +660,10 @@ void NuPlayer::onMessageReceived(const sp &msg) { // When mStarted is true, mSource must have been set. if (mSource == NULL || !mStarted || mSource->getFormat(false /* audio */) == NULL // NOTE: mVideoDecoder's mSurface is always non-null - || (mVideoDecoder != NULL && mVideoDecoder->setVideoSurface(surface) == OK)) { +#ifndef CANNOT_SET_SURFACE_WITHOUT_A_FLUSH + || (mVideoDecoder != NULL && mVideoDecoder->setVideoSurface(surface) == OK) +#endif + ) { performSetSurface(surface); break; } -- cgit v1.1