disp_vf->height = di_buf_i->vframe->height;
disp_vf->duration = di_buf_i->vframe->duration;
disp_vf->pts = di_buf_i->vframe->pts;
+ disp_vf->pts_us64 = di_buf_i->vframe->pts_us64;
disp_vf->flag = di_buf_i->vframe->flag;
disp_vf->canvas0Addr = di_post_idx[di_post_stru.canvas_id][0];
disp_vf->canvas1Addr = di_post_idx[di_post_stru.canvas_id][0];
int i = 0, drop_flag = 0;
di_lock_irqfiq_save(irq_flag2);
- if ((frame_count == 0) && check_drop)
+ if ((frame_count == 0) && check_drop) {
di_post_stru.start_pts = di_buf->vframe->pts;
+ di_post_stru.start_pts_us64 = di_buf->vframe->pts_us64;
+ }
if ((check_drop && (frame_count < start_frame_drop_count))
|| throw_flag) {
drop_flag = 1;
} else {
if (check_drop && (frame_count == start_frame_drop_count)) {
if ((di_post_stru.start_pts)
- && (di_buf->vframe->pts == 0))
+ && (di_buf->vframe->pts == 0)) {
di_buf->vframe->pts = di_post_stru.start_pts;
+ di_buf->vframe->pts_us64 = di_post_stru.start_pts_us64;
+ }
di_post_stru.start_pts = 0;
}
for (i = 0; i < 3; i++) {
outtime = timestamp_pcrscr_get();
if (outtime == 0 || outtime == 0xffffffff)
outtime = pTable->last_checkout_pts;
- timestampe_delayed = (pTable->last_checkin_pts - outtime) / 90;
+ if (pTable->last_checkin_pts > outtime)
+ timestampe_delayed = (pTable->last_checkin_pts - outtime) / 90;
pTable->last_pts_delay_ms = timestampe_delayed;
if (get_buf_by_type_cb && stbuf_level_cb && stbuf_space_cb) {
if ((timestampe_delayed < 10)
type)))
diff = diff2;
}
- delay_ms = diff * 1000 / (1 + pTable->last_avg_bitrate / 8);
+ delay_ms = (diff * 1000) / (int)(1 + pTable->last_avg_bitrate / 8);
if ((timestampe_delayed < 10) ||
((abs
(timestampe_delayed - delay_ms) > (3 * 1000))
*/
if (!pTable->first_lookup_ok) {
*val = pTable->first_checkin_pts;
- *uS64 = (u64)(*val) << 32;
+ *uS64 = div64_u64((u64)pTable->first_checkin_pts * 100, 9);
pTable->first_lookup_ok = 1;
pTable->first_lookup_is_fail = 1;
#define AMLVIDEO_POOL_SIZE 16
/*extern bool omx_secret_mode;*/
+static u32 omx_freerun_index = 0;
+
#define DUR2PTS(x) ((x) - ((x) >> 4))
#define DUR2PTS_RM(x) ((x) & 0xf)
/* unsigned long flags; */
/* spin_lock_irqsave(&lock, flags); */
struct vivi_dev *dev = (struct vivi_dev *)op_arg;
+ int avail_count = vfq_level(&dev->q_ready) + vfq_level(&dev->q_omx);
states->vf_pool_size = AMLVIDEO_POOL_SIZE;
states->buf_recycle_num = 0;
- states->buf_free_num = AMLVIDEO_POOL_SIZE - vfq_level(&dev->q_ready);
- states->buf_avail_num = vfq_level(&dev->q_ready);
+ states->buf_free_num = AMLVIDEO_POOL_SIZE - avail_count;
+ states->buf_avail_num = avail_count;
/* spin_unlock_irqrestore(&lock, flags); */
return 0;
}
dev->first_frame = 0;
vfq_init(&dev->q_ready, AMLVIDEO_POOL_SIZE + 1,
&dev->amlvideo_pool_ready[0]);
+ vfq_init(&dev->q_omx, AMLVIDEO_POOL_SIZE + 1,
+ &dev->amlvideo_pool_omx[0]);
}
if (type == VFRAME_EVENT_PROVIDER_REG) {
AMLVIDEO_DBG("AML:VFRAME_EVENT_PROVIDER_REG\n");
omx_secret_mode = true;
vfq_init(&dev->q_ready, AMLVIDEO_POOL_SIZE + 1,
&dev->amlvideo_pool_ready[0]);
+ vfq_init(&dev->q_omx, AMLVIDEO_POOL_SIZE + 1,
+ &dev->amlvideo_pool_omx[0]);
vf_provider_init(&dev->video_vf_prov,
dev->vf_provider_name,
&amlvideo_vf_provider, dev);
dev->first_frame = 0;
vfq_init(&dev->q_ready, AMLVIDEO_POOL_SIZE + 1,
&dev->amlvideo_pool_ready[0]);
+ vfq_init(&dev->q_omx, AMLVIDEO_POOL_SIZE + 1,
+ &dev->amlvideo_pool_omx[0]);
vf_notify_receiver(dev->vf_provider_name,
VFRAME_EVENT_PROVIDER_RESET, data);
static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p)
{
+ u32 index;
+ struct vframe_s *vf;
+ struct vivi_dev *dev = video_drvdata(file);
+ while ((vf = vfq_peek(&dev->q_omx)))
+ {
+ index = (u32)vf->pts_us64;
+ if (p->index > index)
+ {
+ vf_put(vfq_pop(&dev->q_omx), dev->vf_receiver_name);
+ printk("vidioc_qbuf skip: index:%u:%u\n", p->index, index);
+ continue;
+ }
+ else if (p->index == index)
+ {
+ vf = (vfq_pop(&dev->q_omx));
+ if (p->flags & V4L2_BUF_FLAG_DONE)
+ vf_put(vf, dev->vf_receiver_name);
+ else
+ vfq_push(&dev->q_ready, vf);
+ }
+ break;
+ }
return 0;
}
dev->am_parm.master_display_colour
= dev->vf->prop.master_display_colour;
+ if (!dev->vf->pts_us64)
+ dev->vf->pts_us64 = ((u64)dev->vf->pts * 100) / 9;
+
if (dev->vf->pts_us64) {
dev->first_frame = 1;
pts_us64 = dev->vf->pts_us64;
if (dev->vf->next_vf_pts_valid)
dev->vf->next_vf_pts = next_vf->pts;
- vfq_push(&dev->q_ready, dev->vf);
- p->index = 0;
+ p->index = omx_freerun_index;
p->timestamp.tv_sec = pts_us64 >> 32;
p->timestamp.tv_usec = pts_us64 & 0xFFFFFFFF;
dev->last_pts_us64 = pts_us64;
+ dev->vf->pts_us64 = omx_freerun_index++;
+ vfq_push(&dev->q_omx, dev->vf);
if ((dev->vf->type & VIDTYPE_COMPRESS) != 0) {
p->timecode.type = dev->vf->compWidth;
}
p->sequence = dev->frame_num++;
- vf_notify_receiver(
- dev->vf_provider_name,
- VFRAME_EVENT_PROVIDER_VFRAME_READY,
- NULL);
-
return ret;
}