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.
Showing the changes to libavdevice/decklink_dec.cpp (1 of 5 files). Show all
Unified · Split
| @@ -703,6 +703,16 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 702 unmodified lines | |||
| 703 | return S_OK; | 703 | return S_OK; |
| 704 | } | 704 | } |
| 705 | 705 | ||
| 706 | // Drop the frames till system's timestamp aligns with the configured value. | ||
| 707 | if (0 == ctx->frameCount && cctx->timestamp_align) { | ||
| 708 | AVRational remainder = av_make_q(av_gettime() % cctx->timestamp_align, 1000000); | ||
| 709 | AVRational frame_duration = av_inv_q(ctx->video_st->r_frame_rate); | ||
| 710 | if (av_cmp_q(remainder, frame_duration) > 0) { | ||
| 711 | ++ctx->dropped; | ||
| 712 | return S_OK; | ||
| 713 | } | ||
| 714 | } | ||
| 715 | |||
| 706 | ctx->frameCount++; | 716 | ctx->frameCount++; |
| 707 | if (ctx->audio_pts_source == PTS_SRC_WALLCLOCK || ctx->video_pts_source == PTS_SRC_WALLCLOCK) | 717 | if (ctx->audio_pts_source == PTS_SRC_WALLCLOCK || ctx->video_pts_source == PTS_SRC_WALLCLOCK) |
| 708 | wallclock = av_gettime_relative(); | 718 | wallclock = av_gettime_relative(); |