From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 9E0BB44901 for ; Tue, 27 Sep 2022 12:16:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DF67168B9BD; Tue, 27 Sep 2022 15:16:44 +0300 (EEST) Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 477D568B515 for ; Tue, 27 Sep 2022 15:16:38 +0300 (EEST) Message-ID: <50da0297-e4e3-c593-ed92-0045d1f8b158@zanevaniperen.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zanevaniperen.com; s=key1; t=1664280996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FiQKzyZGdT+oIm6F68HVXWOpFjnDChfWWeKjfWCD6AM=; b=kPu9ZSJrAb1TFG3ZpGtY5s6fqNmUUgYfl+AgrK2V0hmmxyNVDIVU0r7lau45GS8JPsflSN 9BT2xJcE1BlNWqYi7Hhpjwha55TowPi3djHrHpPa7/jf+Kj03dibp9Jy9GtO2bALEdN9MW x0MBBjPQYjLuhTPYal4Cch190G7wBlBJ8L4cfAu4DhPC+KjSiRwYAXRktyRLoZduUImy8q +bveqwOgiOmi7rsHDLxVLWLhzL1ecLwUzuBQBXRtTLQGb1TGi9CMwZrFTEpoCqyZPRu6Yc V7X0XE4WcHE+QFE4zJ73+f/qkhYB2xM0n+SfF359Dpiqo/IoDwTg4ld9goR78Q== Date: Tue, 27 Sep 2022 22:16:31 +1000 MIME-Version: 1.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220919152618.1169-1-pal@sandflow.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zane van Iperen In-Reply-To: <20220919152618.1169-1-pal@sandflow.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: zanevaniperen.com Subject: Re: [FFmpeg-devel] [PATCH v2] format/imfdec: improve error handling when selecting tracks for playback 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: lgtm, will apply On 20/9/22 01:26, pal@sandflow.com wrote: > From: Pierre-Anthony Lemieux > > --- > libavformat/imfdec.c | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > > diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c > index 5bbe7a53f8..9ba8b6de8b 100644 > --- a/libavformat/imfdec.c > +++ b/libavformat/imfdec.c > @@ -681,8 +681,11 @@ static IMFVirtualTrackPlaybackCtx *get_next_track_with_minimum_timestamp(AVForma > { > IMFContext *c = s->priv_data; > IMFVirtualTrackPlaybackCtx *track; > - > AVRational minimum_timestamp = av_make_q(INT32_MAX, 1); > + > + if (!c->track_count) > + return NULL; > + > for (uint32_t i = c->track_count; i > 0; i--) { > av_log(s, AV_LOG_TRACE, "Compare track %d timestamp " AVRATIONAL_FORMAT > " to minimum " AVRATIONAL_FORMAT > @@ -697,8 +700,6 @@ static IMFVirtualTrackPlaybackCtx *get_next_track_with_minimum_timestamp(AVForma > } > } > > - av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n", > - track->index, av_q2d(track->current_timestamp), av_q2d(minimum_timestamp)); > return track; > } > > @@ -761,6 +762,14 @@ static int imf_read_packet(AVFormatContext *s, AVPacket *pkt) > > track = get_next_track_with_minimum_timestamp(s); > > + if (!track) { > + av_log(s, AV_LOG_ERROR, "No track found for playback\n"); > + return AVERROR_INVALIDDATA; > + } > + > + av_log(s, AV_LOG_DEBUG, "Found track %d to read at timestamp %lf\n", > + track->index, av_q2d(track->current_timestamp)); > + > ret = get_resource_context_for_timestamp(s, track, &resource); > if (ret) > return ret; _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".