aboutsummaryrefslogtreecommitdiffstats
path: root/videocodec
diff options
context:
space:
mode:
authorAndy Qiu <junhai.qiu@intel.com>2014-08-26 17:00:58 -0700
committerPatrick Tjin <pattjin@google.com>2014-09-09 21:08:13 -0700
commit94dfa71f4dcfb338d0c4d63d53c867acee23ba97 (patch)
treeb0c0132c7b1405d935bba54c451efab563fcece1 /videocodec
parent34569a16a3f752d435f896cbec97ad8913db207d (diff)
downloadandroid_hardware_intel_common_omx-components-94dfa71f4dcfb338d0c4d63d53c867acee23ba97.tar.gz
android_hardware_intel_common_omx-components-94dfa71f4dcfb338d0c4d63d53c867acee23ba97.tar.bz2
android_hardware_intel_common_omx-components-94dfa71f4dcfb338d0c4d63d53c867acee23ba97.zip
Wait till all frames flipped before session is closed.
Bug:17308418 BZ: 219166 Change-Id: I77ce3d64f14a603d6957e88bdc6cc66faa13a89e Signed-off-by: Andy Qiu <junhai.qiu@intel.com>
Diffstat (limited to 'videocodec')
-rwxr-xr-x[-rw-r--r--]videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.cpp42
-rwxr-xr-x[-rw-r--r--]videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.h2
2 files changed, 43 insertions, 1 deletions
diff --git a/videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.cpp b/videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.cpp
index 3b54a34..a7db86f 100644..100755
--- a/videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.cpp
+++ b/videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.cpp
@@ -115,6 +115,8 @@ OMX_ERRORTYPE OMXVideoDecoderAVCSecure::ProcessorInit(void) {
}
OMX_ERRORTYPE OMXVideoDecoderAVCSecure::ProcessorDeinit(void) {
+
+ WaitForFrameDisplayed();
// Session should be torn down in ProcessorStop, delayed to ProcessorDeinit
// to allow remaining frames completely rendered.
LOGI("Calling Drm_DestroySession.");
@@ -570,6 +572,46 @@ void OMXVideoDecoderAVCSecure::KeepAliveTimerCallback() {
}
}
+void OMXVideoDecoderAVCSecure::WaitForFrameDisplayed() {
+ int fd = open("/dev/card0", O_RDWR, 0);
+ if (fd <= 0) {
+ LOGE("Failed to open card 0 device");
+ return;
+ }
+
+ // Wait up to 200ms until both overlay planes are disabled
+ int status = 3;
+ int retry = 20;
+ while (retry--) {
+ for (int i = 0; i < 2; i++) {
+ if (status & (1 << i)) {
+ struct drm_psb_register_rw_arg arg;
+ memset(&arg, 0, sizeof(struct drm_psb_register_rw_arg));
+ arg.get_plane_state_mask = 1;
+ arg.plane.type = DC_OVERLAY_PLANE;
+ arg.plane.index = i;
+ int ret = drmCommandWriteRead(fd, DRM_PSB_REGISTER_RW, &arg, sizeof(arg));
+ if (ret != 0) {
+ LOGE("Failed to query status of overlay plane %d, ret = %d", i, ret);
+ status &= ~(1 << i);
+ } else if (arg.plane.ctx == PSB_DC_PLANE_DISABLED) {
+ status &= ~(1 << i);
+ }
+ }
+ }
+ if (status == 0) {
+ break;
+ }
+ // Sleep 10ms then query again
+ usleep(10000);
+ }
+
+ if (status != 0) {
+ LOGE("Overlay planes not disabled, status %d", status);
+ }
+ close(fd);
+}
+
OMX_ERRORTYPE OMXVideoDecoderAVCSecure::SetMaxOutputBufferCount(OMX_PARAM_PORTDEFINITIONTYPE *p) {
OMX_ERRORTYPE ret;
CHECK_TYPE_HEADER(p);
diff --git a/videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.h b/videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.h
index 0668320..67639b5 100644..100755
--- a/videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.h
+++ b/videocodec/securevideo/moorefield/OMXVideoDecoderAVCSecure.h
@@ -54,7 +54,7 @@ private:
void MemFreeDataBuffer(OMX_U8 *pBuffer);
static void KeepAliveTimerCallback(sigval v);
void KeepAliveTimerCallback();
- //bool EnableIEDSession(bool enable);
+ void WaitForFrameDisplayed();
OMX_ERRORTYPE PrepareWVCDecodeBuffer(OMX_BUFFERHEADERTYPE *buffer, buffer_retain_t *retain, VideoDecodeBuffer *p);
OMX_ERRORTYPE PrepareCENCDecodeBuffer(OMX_BUFFERHEADERTYPE *buffer, buffer_retain_t *retain, VideoDecodeBuffer *p);
OMX_ERRORTYPE PreparePRASFDecodeBuffer(OMX_BUFFERHEADERTYPE *buffer, buffer_retain_t *retain, VideoDecodeBuffer *p);