From patchwork Thu Feb 23 22:25:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 40477 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp756774pzk; Thu, 23 Feb 2023 14:25:48 -0800 (PST) X-Google-Smtp-Source: AK7set9rhAhDl0W1+PJuuUSDIm62OAq2TV4EpmSzlLnom7bKWJASmBCW42hs7YRITgMR1up2OxdP X-Received: by 2002:a17:907:d50c:b0:889:ed81:dff7 with SMTP id wb12-20020a170907d50c00b00889ed81dff7mr21370085ejc.9.1677191148045; Thu, 23 Feb 2023 14:25:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677191148; cv=none; d=google.com; s=arc-20160816; b=WheHV8lL6T75aiuPnWTIQCzaxoj+L1V8mpRXE4f6NFWu8G8zGX9Q0T8iiidCobwJdb mN+Km56VrtbbCe6BJwJ0JFR85HLgGldBdQlwHd23QHW2TAvvy+UM0Nk4fhmBzegSDURU u0nqyLMs5TGihgc0QAceK9Mx1IzrTKscOvvn7Sqr2GSiiHDDKT9FDtQgldfAB5q7eDHy AJv1HIouM0dudaXuJRZFsf0gfmottfX1umgaiHvhX564WBNkGAnhqdJPY2zQV3chXAMY OeLotkX0tyElSvfgE3wM9ntOV+o4UZ9npVK2P1Jc1GZzENeq1f2JhdV7M7pbAlUGCZIc lsgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=kStqU2wwcVlMD2/Wl9tyI1FYFDgTVKx3kNDkfs3tZcM=; b=NuLOf1SXSjh7UmVi5KcDCp5rksgx/8sO8mX4b9cYkRbBNruwrbcLpAkSASsyUaV5oN gUNedSO8VwrSI/vtQDmsnQEHj5GWFrq5WBDiS6wDVvzPGVLqk/qMrc1qoLcKfU0ZlfP/ 9Na0jxKuKow+7n42ixl5c+VrfyRADUNsd2KirOEzxkajD5ivNSiBIZNovjmoxpBcRKUq 7xhy72FIRAhYQ5WQDkvRU1EB/LUy7+/9VR7S/lcjTTHGkzcPLszgQhnL/Pt7rjPfuQc2 eQw9JgyeXS8jwugxxrbYIfwZ4VgEgvnP8lZxHcXX1CxoJnd5J8QSf59k+UYcLuWor05J RN8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ltnglobal-com.20210112.gappssmtp.com header.s=20210112 header.b=B2C3ze6W; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bm28-20020a0564020b1c00b004af6c39cabfsi3478859edb.119.2023.02.23.14.25.46; Thu, 23 Feb 2023 14:25:48 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ltnglobal-com.20210112.gappssmtp.com header.s=20210112 header.b=B2C3ze6W; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1960B68C049; Fri, 24 Feb 2023 00:25:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BDE8A68BEFF for ; Fri, 24 Feb 2023 00:25:20 +0200 (EET) Received: by mail-qt1-f172.google.com with SMTP id h16so12547667qta.8 for ; Thu, 23 Feb 2023 14:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ltnglobal-com.20210112.gappssmtp.com; s=20210112; t=1677191119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ruDCDZu6qftUc/aRAbA91KTeBDJiprd56Gie4sEiaeE=; b=B2C3ze6Wq7WxI6kk5eOj2P1TRvotuh279FfcrsKlKxbbBiQWVseHHK2t7vHhrbcAzW KwtMe3ML/sqs3v7UuO6TnLDrFowb5rH20s/b2nj3EMaYThL5pBbb2OI5JrDPOXBdZdAp QYR/OPFUCS9yU864K95vtbrntFdJeIGclAeSmIwOeKceVIsdPL5/zZhgcOsYHJKLVAsv mZ362OVTMw5ImS0mSzssegiz70OVOXsvxl/6/UxAurCCpd77ijuFfMOcVuhsYC71UMQG 88a2T873YvbDiJwrFlLRHhZ4jeaAhvrJL7fb+JiLBvbOc57sw6VNZ8m7EYWemlIZS3Wx 1xAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677191119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ruDCDZu6qftUc/aRAbA91KTeBDJiprd56Gie4sEiaeE=; b=XKciECppVkuea0Sv3zi0Kb/Mv6990bFR/zVl7n4DK2QBNSb5nqTipSXoPaweS1A7et mbPBrYt02XTMSpOlYGEbAsSOwWM8OVgQ30poXT7+D3RUtYBqWvWFAU2XejiVBm2SSXgz JgSNQD6rH5KZXUPJi1hI5EjaGqsaeF5J/FYV9pJb22sMMBCPaUkMCyxglii8FGVhWCds O8GP/JzkkC+x3bQHrGPmdrirtC8OxPNGtvD77ksuCcThIl3PBZLXpCIuQBqMwWgnaafw 9crjb6yK6XeLTiSRVUi8Zt+jU5uTfAkrk9udh/Fp2bmM3pxV0gQ2ECStG86XSXZTc8AB pCNw== X-Gm-Message-State: AO0yUKXFkZ/Gx2G8U4HfGr0y2mWnsInxc/qVz+x7jiz1wHp7UBVs9DXx RGq51ewaBYVgkYjVO8nMGfwSp2KwGfyxrP+k X-Received: by 2002:a05:622a:592:b0:3b6:334b:2cbc with SMTP id c18-20020a05622a059200b003b6334b2cbcmr22118591qtb.65.1677191118779; Thu, 23 Feb 2023 14:25:18 -0800 (PST) Received: from klab-nyc-kernellabs2.localdomain (pool-71-105-132-214.nycmny.fios.verizon.net. [71.105.132.214]) by smtp.gmail.com with ESMTPSA id s75-20020a37a94e000000b0073d873df3fesm9537062qke.30.2023.02.23.14.25.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Feb 2023 14:25:18 -0800 (PST) From: Devin Heitmueller X-Google-Original-From: Devin Heitmueller To: ffmpeg-devel@ffmpeg.org Date: Thu, 23 Feb 2023 17:25:12 -0500 Message-Id: <20230223222513.3759-3-dheitmueller@ltnglobal.com> X-Mailer: git-send-email 2.35.1.655.ga68dfadae5 In-Reply-To: <20230223222513.3759-1-dheitmueller@ltnglobal.com> References: <20230223222513.3759-1-dheitmueller@ltnglobal.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] decklink: Fix setting of last_pts to only be set for video X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Devin Heitmueller Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: mXaEkm9YPaHY 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 --- libavdevice/decklink_enc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index c3dc2c0cac..f7daf37654 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -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 || @@ -628,8 +630,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)