From patchwork Mon Jul 27 03:23:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 21275 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id BD00944A0F1 for ; Mon, 27 Jul 2020 06:24:02 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 84EA168B615; Mon, 27 Jul 2020 06:24:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1560968B5EA for ; Mon, 27 Jul 2020 06:23:57 +0300 (EEST) Received: by mail-ej1-f67.google.com with SMTP id w9so15529497ejc.8 for ; Sun, 26 Jul 2020 20:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uG1hapQu8QeRX6aFb2srVRR8qNATFfxSoBHK02FW9qA=; b=Gk8I47ZAWkGn8CESBvlz/Rw8FgIRMdW7GTHsH0XqSN56tBKEumzwbR4v0t0bz51D6O qXmYRduRLe6yqymrrKiq7/1lsnSiCVxCBcvEcWG3nG7u287mhCj09G/uNddogfWRJz54 zuS/jnMjY3LWp7GThfIMKbGP0uSg1u5x2+yso32JbmBuNKXkXQWxWbxEg47ecUmisU4u oDwN1mQ016JjpWh35yiEoUbBZh/iMlbsBCTptThNs16KsAoMb+BKSkKMC3uvuT7HmOHS WvsDOkMunReguBXlZ4Fbw5KensErsd5av+pAMJPi/RRAkfnw14Do8TXl7714Ippjc2Sh DNrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=uG1hapQu8QeRX6aFb2srVRR8qNATFfxSoBHK02FW9qA=; b=ozR6bTRkfTYZ2Vkvu74MTj3a+XHcDHcGHiOB45h9axRFknmwHbqH75UDDCtqhSy8pq 1Gbk+zS/fhvRYpoanwb7iHLRllYbKzydSyPGW/6QmLoXJ2zietj918R/jSgHEoxg2lla j8Mx+mMFsJ26aNG4Ag/Y13BrSd2HYL4+nZOwleX/wa8e0SXHU9pd5LjR6TMUCAkai0N4 RUMaKBZZ3hyb+aKwf+LpNrVdgKTFYKa0RupT/V16Y+/Q2m3mW0hf1Xc9P89SqhVVcopv P3qUkIyW60EuDNB3GKWj325VlDCMUOt3tTnLCUkRrHocctl0szX5Bfcu2rpH1XMGpk8r oj1A== X-Gm-Message-State: AOAM530CplbcuDsVXiRWYjzEzTmnxlzOBq4h36CGLTYKQeTtJ1xTRZpy Bli5PWffu7bGhht+0qniR/2Jl6lY X-Google-Smtp-Source: ABdhPJww3GW7cm/gcGIs54XrET4a6Pz1xsXB5U4mrMWX0WTkbTSqRtOxtGpO5UNE3u1EVRwvj3VMOw== X-Received: by 2002:a17:906:c1c3:: with SMTP id bw3mr11061828ejb.8.1595820235979; Sun, 26 Jul 2020 20:23:55 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc10296.dynamic.kabel-deutschland.de. [188.193.2.150]) by smtp.gmail.com with ESMTPSA id g6sm6110848ejz.19.2020.07.26.20.23.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Jul 2020 20:23:55 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Jul 2020 05:23:48 +0200 Message-Id: <20200727032348.17362-1-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/3dostr: Return directly after having read packet X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Avoids an avio_skip(s->pb, 0). Signed-off-by: Andreas Rheinhardt --- libavformat/3dostr.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/libavformat/3dostr.c b/libavformat/3dostr.c index 6c49f7589c..3ec3c4393e 100644 --- a/libavformat/3dostr.c +++ b/libavformat/3dostr.c @@ -110,15 +110,12 @@ static int threedostr_read_header(AVFormatContext *s) static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt) { - unsigned chunk, size, found_ssmp = 0; + unsigned chunk, size; AVStream *st = s->streams[0]; int64_t pos; int ret = 0; - while (!found_ssmp) { - if (avio_feof(s->pb)) - return AVERROR_EOF; - + while (!avio_feof(s->pb)) { pos = avio_tell(s->pb); chunk = avio_rl32(s->pb); size = avio_rb32(s->pb); @@ -143,9 +140,7 @@ static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pos = pos; pkt->stream_index = 0; pkt->duration = size / st->codecpar->channels; - size = 0; - found_ssmp = 1; - break; + return ret; default: av_log(s, AV_LOG_DEBUG, "skipping unknown chunk: %X\n", chunk); break; @@ -154,7 +149,7 @@ static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt) avio_skip(s->pb, size); } - return ret; + return AVERROR_EOF; } AVInputFormat ff_threedostr_demuxer = {