diff --git a/drivers/amlogic/ionvideo/ionvideo.c b/drivers/amlogic/ionvideo/ionvideo.c index 6c21c7bfbf52..9866b8eab69c 100755 --- a/drivers/amlogic/ionvideo/ionvideo.c +++ b/drivers/amlogic/ionvideo/ionvideo.c @@ -15,6 +15,9 @@ static int is_actived = 0; static unsigned video_nr = 13; + +static u64 last_pts_us64 = 0; + module_param(video_nr, uint, 0644); MODULE_PARM_DESC(video_nr, "videoX start number, 13 is autodetect"); @@ -135,22 +138,19 @@ int is_ionvideo_active(void) { return is_actived; } EXPORT_SYMBOL(is_ionvideo_active); -#if 0 + static void videoc_omx_compute_pts(struct ionvideo_dev *dev, struct vframe_s* vf) { - if (vf->pts) { - timestamp_vpts_set(vf->pts); - dev->receiver_register = 0; - dev->pts = vf->pts_us64; - } else if (dev->receiver_register){ - timestamp_vpts_set(0); - dev->receiver_register = 0; - dev->pts = timestamp_vpts_get(); - } else { - timestamp_vpts_inc(DUR2PTS(vf->duration)); - dev->pts = timestamp_vpts_get(); + if (dev->pts == 0) { + if (dev->receiver_register == 0) { + dev->pts = last_pts_us64 + (DUR2PTS(vf->duration)*100/9); + } } + if (dev->receiver_register) { + dev->receiver_register = 0; + } + last_pts_us64 = dev->pts; } -#endif + static int ionvideo_fillbuff(struct ionvideo_dev *dev, struct ionvideo_buffer *buf) { struct vframe_s* vf; @@ -196,6 +196,7 @@ static int ionvideo_fillbuff(struct ionvideo_dev *dev, struct ionvideo_buffer *b vf_put(vf, RECEIVER_NAME); return ret; } + videoc_omx_compute_pts(dev, vf); vf_put(vf, RECEIVER_NAME); buf->vb.v4l2_buf.timestamp.tv_sec = dev->pts >> 32; buf->vb.v4l2_buf.timestamp.tv_usec = dev->pts & 0xFFFFFFFF; @@ -732,12 +733,6 @@ static int vidioc_synchronization_dqbuf(struct file *file, void *priv, struct v4 static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p){ if (freerun_mode == 0) { - static int t = 0; - if (t == timestamp_pcrscr_get()) { - return -EAGAIN; - } else { - t = timestamp_pcrscr_get(); - } return vidioc_synchronization_dqbuf(file, priv, p); } return vb2_ioctl_dqbuf(file, priv, p);