History

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.

Devin Heitmueller committed 3 years ago

Commit 25d09ac1 parent 8fd345f1 file · +2 −2Browse files

Unified · Split

libavdevice/decklink_enc.cpp+2−2
@@ -441,6 +441,8 @@ static int decklink_write_video_packet(AVFormatContext *avctx, AVPacket *pkt) · 440 unmodified lines
441 uint32_t buffered;441 uint32_t buffered;
442 HRESULT hr;442 HRESULT hr;
443 443
444 ctx->last_pts = FFMAX(ctx->last_pts, pkt->pts);
445
444 if (st->codecpar->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) {446 if (st->codecpar->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME) {
445 if (tmp->format != AV_PIX_FMT_UYVY422 ||447 if (tmp->format != AV_PIX_FMT_UYVY422 ||
446 tmp->width != ctx->bmd_width ||448 tmp->width != ctx->bmd_width ||
@@ -629,8 +631,6 @@ int ff_decklink_write_packet(AVFormatContext *avctx, AVPacket *pkt) · 182 unmodified lines
629 struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;631 struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx;
630 AVStream *st = avctx->streams[pkt->stream_index];632 AVStream *st = avctx->streams[pkt->stream_index];
631 633
632 ctx->last_pts = FFMAX(ctx->last_pts, pkt->pts);
633
634 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)634 if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
635 return decklink_write_video_packet(avctx, pkt);635 return decklink_write_video_packet(avctx, pkt);
636 else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)636 else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t