From patchwork Fri Mar 3 21:08:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 40580 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d046:b0:cd:afd7:272c with SMTP id hv6csp1078042pzb; Fri, 3 Mar 2023 13:08:44 -0800 (PST) X-Google-Smtp-Source: AK7set+F7rpPNOjq2FTBwYudIHhoMS6mq8SgVZP9LnP6eGXWPiSJrLBkspq0iLkES08RggEubVdd X-Received: by 2002:a17:907:d093:b0:8f7:60c8:269c with SMTP id vc19-20020a170907d09300b008f760c8269cmr3594120ejc.29.1677877723981; Fri, 03 Mar 2023 13:08:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677877723; cv=none; d=google.com; s=arc-20160816; b=DoN8i50tKEAR7C/YDb/TUKFkgXVDTNEdc3w/hMpPWrwBsuaDHF1a/2yV5UCuJBt4+N Be10BT6BuDwIPAjqsepgPJjyKZ7xP8Jx3YucLDBkTikA7hQB3AVC6lRKRp6DldQe6Idf 25Gl2UGEgrgMOqzVmP6AudVZkBw+q2DmqVslIxupUCw5FT3kU1k2DyMNJDCkJdKfidvu oAnB0Ps/PIsu/oswBulCGVKNQBNaPgudcPcvyb+OJ1Xx0QX+I/flsBWzL3VtYothb9tc xLmf3pkM+nmkNoHZZkAPZxTTCS1Y4Z4r3DwX351Zt2fuAMRUESsmEk9FRTIpV6tAS9bb b3AQ== 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=ZaP5UoIpKJuFYNOGMmNcBRVC4MPstiRqTkT9ETfFFMU=; b=SPDxBBPFLN4WZh99Z5DN6RByKhC+bkuOhjXo5vpSF0neN3LuXYUJe7MvpzREXWMrjt JV3BuVWu9GbhYxKGQw3ApxOEhzBvHU6NvxY1zzCQWeuu1Q0AnBZbAAqvuH17PItk5yz6 UkPlCFpCMn0EhxJu7a0RO9aYWzNapp6tStFZi73TzlqW1NQgBoyl3sc2t3F+D5ynSDLA t8aQ4YptOJL4LFQZRqc5Y1vnz49TKoqHjpm0KeeRKJrN1fOkJq9TAMkfa7hmPFg7G/hW KMWtBe34JmoD9RYH0IL74VnzXS8J3OBN9f0JXyf73U8adT6hqqtAuVevZeCDrlHFEvlN rYlQ== 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=Me4pApb0; 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 lu13-20020a170906facd00b008c25e1c05desi3046273ejb.392.2023.03.03.13.08.43; Fri, 03 Mar 2023 13:08:43 -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=Me4pApb0; 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 6D01A68BA7F; Fri, 3 Mar 2023 23:08:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1852968B5A9 for ; Fri, 3 Mar 2023 23:08:22 +0200 (EET) Received: by mail-qv1-f51.google.com with SMTP id nv15so2647130qvb.7 for ; Fri, 03 Mar 2023 13:08:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ltnglobal-com.20210112.gappssmtp.com; s=20210112; t=1677877700; 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=Ycgax3oW1DYgug24+ybNqPPwJ+WSNv+LpSok9HP0hd4=; b=Me4pApb0qSzFmobAe5az0j3Eg0IrGUZwON0wnhpsBz+rFLhLg4STBXyqhjtTmKBIt6 evvFrvWa5F8oQluaTSfKQzgCFOcHeoogF832SjGGrKv6kw+VHaJuen7/GwL2ZHduof/w L5h4/IOEx3OYic3QMDrXpxr8g1vPXIDkp4X6VLm001NBbp1eBlEDabQu0FQXRt5o+Qi3 HPIooLjaO47fOLrO+0uoN0CYnEYrbA+PUA9YzCM68JOl2ST/TdQEu9UpkSXSlQJX+dwS e4ATTpRLQ/eCXIWb6StT+WrCl6WSxUlTDz21yDYGo7c3ynLhN8hXfcqGK5RxNU8KSI1r XiWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677877700; 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=Ycgax3oW1DYgug24+ybNqPPwJ+WSNv+LpSok9HP0hd4=; b=WW+SAQtKWvGjQSl5jUfrmDMnkAcNy6xdqM0//0/TvTXO56Tk9mFTwVeQah2wCuUhQf 6wSd01M4XEhvIPbCTJKvxUvFk3MGIsESoMw/Zjau6f/ML2rKN9gMFQ8qLN+ClOP3wDhI W0uzpiUcYAxqOLZuKsudfA52zMdsRTy86A7iroTdBmQYsCSPYyp8FroewI6TVpkXR+Os 8mledrFHRj+g/mwu4Kx96nFYnFBydBXuDZaBdfKaM87tiCbMYIyu8tGlelGWoqc7fA83 Ajoy4LrUkDEfg/nKyQrfQ7wEVEBJq2yMJ945Mpzpzta3Svy+DrWD6dNVueA5rXSnrZy0 morw== X-Gm-Message-State: AO0yUKVoBmSNtCebIT+MryYHTCYCEoqhWSKtoN64sxxZIehiE0mfgsVp 8ddDQdnbwOfQ6zdbCJF+1mxkYS6HWV/eI1VbsJU= X-Received: by 2002:a05:6214:d49:b0:56e:ab08:670b with SMTP id 9-20020a0562140d4900b0056eab08670bmr5904209qvr.34.1677877700664; Fri, 03 Mar 2023 13:08:20 -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 e10-20020a05620a014a00b0071a02d712b0sm2442991qkn.99.2023.03.03.13.08.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Mar 2023 13:08:20 -0800 (PST) From: Devin Heitmueller X-Google-Original-From: Devin Heitmueller To: ffmpeg-devel@ffmpeg.org Date: Fri, 3 Mar 2023 16:08:14 -0500 Message-Id: <20230303210815.23692-2-dheitmueller@ltnglobal.com> X-Mailer: git-send-email 2.35.1.655.ga68dfadae5 In-Reply-To: <20230303210815.23692-1-dheitmueller@ltnglobal.com> References: <20230303210815.23692-1-dheitmueller@ltnglobal.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 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: 55gKBblH6kUL 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 5a435ddc78..573b9e687c 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 || @@ -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)