1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

avdevice/decklink_enc: fix setting of last_pts to only be set for video

The ff_decklink_write_packet() was always caching the last pts
received, to be used when calling StopScheduledPlayback(). However
because audio and video are on different timebases and the call to
StopScheduledPlayback() expects the video timebase, we'll end up
sending a weird value to the stop routine if the last packet
received contained audio.

Move the setting of last_pts to just be for the video stream.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Devin Heitmueller 2023-03-03 16:08:14 -05:00 committed by Marton Balint
parent 8fd345f018
commit 25d09ac0eb

View File

@ -441,6 +441,8 @@ static int decklink_write_video_packet(AVFormatContext *avctx, AVPacket *pkt)
uint32_t buffered;
HRESULT hr;
ctx->last_pts = FFMAX(ctx->last_pts, pkt->pts);
if (st->codecpar->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) {
if (tmp->format != AV_PIX_FMT_UYVY422 ||
tmp->width != ctx->bmd_width ||
@ -629,8 +631,6 @@ int ff_decklink_write_packet(AVFormatContext *avctx, AVPacket *pkt)
struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
AVStream *st = avctx->streams[pkt->stream_index];
ctx->last_pts = FFMAX(ctx->last_pts, pkt->pts);
if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
return decklink_write_video_packet(avctx, pkt);
else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)