summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshray Kulkarni <ashrayk@codeaurora.org>2015-09-02 17:51:20 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2015-10-14 02:01:41 -0700
commit6ecd037c7f1ed53116d5f1bc02f8eb1a7f3bd01c (patch)
tree47c590f33babb242ddce282d0d6185497194c228
parent834d6a83c1c69d7adfc27d5acdcd9080f59eff1d (diff)
downloadandroid_hardware_qcom_media-6ecd037c7f1ed53116d5f1bc02f8eb1a7f3bd01c.tar.gz
android_hardware_qcom_media-6ecd037c7f1ed53116d5f1bc02f8eb1a7f3bd01c.tar.bz2
android_hardware_qcom_media-6ecd037c7f1ed53116d5f1bc02f8eb1a7f3bd01c.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.h2
-rw-r--r--mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp11
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 c36fd0ed..f1fb0b4d 100644
--- a/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
+++ b/mm-video-v4l2/vidc/vdec/inc/omx_vdec.h
@@ -868,8 +868,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 87952662..b6a83f12 100644
--- a/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
+++ b/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp
@@ -558,6 +558,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),
@@ -8499,8 +8500,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) {
@@ -8536,11 +8537,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;