mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-06 01:07:36 +08:00
avdevice/decklink_dec: add option to align capture start time
This option is useful for maintaining input synchronization across N different hardware devices deployed for 'N-way' redundancy. The system time of different hardware devices should be synchronized with protocols such as NTP or PTP, before using this option. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:

committed by
Marton Balint

parent
449b1dcd7d
commit
c0ee4e0ac2
@@ -703,6 +703,16 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// Drop the frames till system's timestamp aligns with the configured value.
|
||||
if (0 == ctx->frameCount && cctx->timestamp_align) {
|
||||
AVRational remainder = av_make_q(av_gettime() % cctx->timestamp_align, 1000000);
|
||||
AVRational frame_duration = av_inv_q(ctx->video_st->r_frame_rate);
|
||||
if (av_cmp_q(remainder, frame_duration) > 0) {
|
||||
++ctx->dropped;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
ctx->frameCount++;
|
||||
if (ctx->audio_pts_source == PTS_SRC_WALLCLOCK || ctx->video_pts_source == PTS_SRC_WALLCLOCK)
|
||||
wallclock = av_gettime_relative();
|
||||
|
Reference in New Issue
Block a user