diff options
author | Ashray Kulkarni <ashrayk@codeaurora.org> | 2015-09-02 17:51:20 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-10-14 02:24:03 -0700 |
commit | a54c5d4c058afb318071667feb4ed48387e3d2e7 (patch) | |
tree | f3a76a03d4ce3e42f1d7456c99bdccf87ef77dd4 | |
parent | 24eb0763d796b83ca0b4f5c6193a4ff168d0ea06 (diff) | |
download | android_hardware_qcom_media-a54c5d4c058afb318071667feb4ed48387e3d2e7.tar.gz android_hardware_qcom_media-a54c5d4c058afb318071667feb4ed48387e3d2e7.tar.bz2 android_hardware_qcom_media-a54c5d4c058afb318071667feb4ed48387e3d2e7.zip |
mm-video-v4l2: vdec: fix fps issues in arbitrary mode
During arbitrary mode, if multiple frames have same timestamp then the
output fps is adjusted to give incremental timestamps This results in
av sync issues. This change updates timestamp adjustment calculation
to ensure proper playback fps.
Change-Id: I0d92392fa04afd81c86511bd3b716df5d01eee72
-rw-r--r-- | mm-video-v4l2/vidc/vdec/inc/omx_vdec.h | 2 | ||||
-rw-r--r-- | mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h index 399d867f..722b7ba5 100644 --- a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h +++ b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h @@ -913,8 +913,8 @@ class omx_vdec: public qc_omx_component OMX_U32 m_demux_entries; OMX_U32 m_disp_hor_size; OMX_U32 m_disp_vert_size; - OMX_S64 prev_ts; + OMX_S64 prev_ts_actual; bool rst_prev_ts; OMX_U32 frm_int; 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 23715d5d..75e47ae6 100644 --- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp +++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp @@ -577,6 +577,7 @@ omx_vdec::omx_vdec(): m_error_propogated(false), m_disp_hor_size(0), m_disp_vert_size(0), prev_ts(LLONG_MAX), + prev_ts_actual(LLONG_MAX), rst_prev_ts(true), frm_int(0), in_reconfig(false), @@ -9270,8 +9271,8 @@ void omx_vdec::set_frame_rate(OMX_S64 act_timestamp) OMX_U32 new_frame_interval = 0; if (VALID_TS(act_timestamp) && VALID_TS(prev_ts) && act_timestamp != prev_ts && llabs(act_timestamp - prev_ts) > 2000) { - new_frame_interval = client_set_fps ? frm_int : - llabs(act_timestamp - prev_ts); + new_frame_interval = client_set_fps ? frm_int : (act_timestamp - prev_ts) > 0 ? + llabs(act_timestamp - prev_ts) : llabs(act_timestamp - prev_ts_actual); if (new_frame_interval != frm_int || frm_int == 0) { frm_int = new_frame_interval; if (frm_int) { @@ -9307,11 +9308,13 @@ void omx_vdec::adjust_timestamp(OMX_S64 &act_timestamp) { if (rst_prev_ts && VALID_TS(act_timestamp)) { prev_ts = act_timestamp; + prev_ts_actual = act_timestamp; rst_prev_ts = false; } else if (VALID_TS(prev_ts)) { bool codec_cond = (drv_ctx.timestamp_adjust)? - (!VALID_TS(act_timestamp) || act_timestamp < prev_ts || llabs(act_timestamp - prev_ts) <= 2000) : - (!VALID_TS(act_timestamp) || act_timestamp <= prev_ts); + (!VALID_TS(act_timestamp) || act_timestamp < prev_ts_actual || llabs(act_timestamp - prev_ts_actual) <= 2000) : + (!VALID_TS(act_timestamp) || act_timestamp <= prev_ts_actual); + prev_ts_actual = act_timestamp; //unadjusted previous timestamp if (frm_int > 0 && codec_cond) { DEBUG_PRINT_LOW("adjust_timestamp: original ts[%lld]", act_timestamp); act_timestamp = prev_ts + frm_int; |