summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinu Gorle <sgorle@codeaurora.org>2014-08-29 19:40:27 +0530
committerBalamurugan Alagarsamy <balaga@codeaurora.org>2014-11-27 11:49:38 +0530
commitaf1b9fb77839d1fed4af03f8db9783e410f51d70 (patch)
treee3728e3e3be655078875dc38b7833c570e6a3117
parent1fd9381be59f2a8c464beb0f54c43d0927abf00f (diff)
downloadandroid_hardware_qcom_media-af1b9fb77839d1fed4af03f8db9783e410f51d70.tar.gz
android_hardware_qcom_media-af1b9fb77839d1fed4af03f8db9783e410f51d70.tar.bz2
android_hardware_qcom_media-af1b9fb77839d1fed4af03f8db9783e410f51d70.zip
mm-video-v4l2: vidc: move flush waiting logic to appropriate place
If a flush arrives while codec-config buffers are in the ETB queue, both flush and ETB are sent to the video driver which can cause corruption in output frames. Move flush waiting logic so that flush is deferred until the headers are consumed Change-Id: Id0647bfc749ac7e4af975530ac82210cc93023f2 CRs-Fixed: 703100
-rw-r--r--mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
index 5ea9bae4..9f6ae2b2 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
@@ -2016,18 +2016,6 @@ OMX_ERRORTYPE omx_vdec::send_command(OMX_IN OMX_HANDLETYPE hComp,
DEBUG_PRINT_ERROR("send_command(): ERROR OMX_CommandFlush "
"to invalid port: %lu", param1);
return OMX_ErrorBadPortIndex;
- } else if (cmd == OMX_CommandFlush && (param1 == OMX_CORE_INPUT_PORT_INDEX ||
- param1 == OMX_ALL)) {
- while (android_atomic_add(0, &m_queued_codec_config_count) > 0) {
- struct timespec ts;
-
- clock_gettime(CLOCK_REALTIME, &ts);
- ts.tv_sec += 2;
- if (sem_timedwait(&m_safe_flush, &ts)) {
- DEBUG_PRINT_ERROR("Failed to wait for EBDs of CODEC CONFIG buffers");
- break;
- }
- }
}
post_event((unsigned)cmd,(unsigned)param1,OMX_COMPONENT_GENERATE_COMMAND);
@@ -2362,6 +2350,22 @@ OMX_ERRORTYPE omx_vdec::send_command_proxy(OMX_IN OMX_HANDLETYPE hComp,
#ifdef _MSM8974_
send_codec_config();
#endif
+ if (cmd == OMX_CommandFlush && (param1 == OMX_CORE_INPUT_PORT_INDEX ||
+ param1 == OMX_ALL)) {
+ while (android_atomic_add(0, &m_queued_codec_config_count) > 0) {
+ struct timespec ts;
+
+ clock_gettime(CLOCK_REALTIME, &ts);
+ ts.tv_sec += 2;
+ DEBUG_PRINT_LOW("waiting for %d EBDs of CODEC CONFIG buffers ",
+ m_queued_codec_config_count);
+ if (sem_timedwait(&m_safe_flush, &ts)) {
+ DEBUG_PRINT_ERROR("Failed to wait for EBDs of CODEC CONFIG buffers");
+ break;
+ }
+ }
+ }
+
if (OMX_CORE_INPUT_PORT_INDEX == param1 || OMX_ALL == param1) {
BITMASK_SET(&m_flags, OMX_COMPONENT_INPUT_FLUSH_PENDING);
}
@@ -6955,6 +6959,7 @@ OMX_ERRORTYPE omx_vdec::empty_buffer_done(OMX_HANDLETYPE hComp,
sem_getvalue(&m_safe_flush, &pending_flush_waiters),
/* 0 == there /are/ waiters depending on POSIX implementation */
pending_flush_waiters <= 0 ) {
+ DEBUG_PRINT_LOW("sem post for %d EBD of CODEC CONFIG buffer", m_queued_codec_config_count);
sem_post(&m_safe_flush);
}