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 72B6E42640 for ; Mon, 25 Apr 2022 10:14:01 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 22AA568B2F9; Mon, 25 Apr 2022 13:13:59 +0300 (EEST) Received: from out162-62-57-49.mail.qq.com (out162-62-57-49.mail.qq.com [162.62.57.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9AF8868B2EE for ; Mon, 25 Apr 2022 13:13:51 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1650881627; bh=oIZeqSZY6phs6e3cQMNNYX2m619zOEtETmQnrXFu0Z0=; h=From:Subject:Date:References:To:In-Reply-To; b=SZGH8jSZ6RC72Dp3/ucABwAaVQZ25K4PJJDfW6z3aRqfUnlRxNZXyJLHXVOKOfzh4 bxWdwXsA2WHAkES2xbgH/XLHKjJLLr0eyFDKZRxJsooU7Z37Ra1D8gsOyiKXTDquYB xq1LaVlq3L9XJ0bbPxwuv/e3Loz3pU0/E/amrDtk= Received: from [192.168.255.10] ([113.108.77.63]) by newxmesmtplogicsvrszc8.qq.com (NewEsmtp) with SMTP id 36E8165E; Mon, 25 Apr 2022 18:13:46 +0800 X-QQ-mid: xmsmtpt1650881626t6nip8h3a Message-ID: X-QQ-XMAILINFO: NY/MPejODIJVySPVDcpTxOAVJRpHcK2n5zeAKeEimxWCz35MEA9pjj1P22l4Kh NCRi8AtF1n8D2pfKEcy9QBYD8dD76WFAjV3FMldy1EYrhvSVJNTGdxdvAalB05fVwbnQPTEt+uza a0vsKWeH/t+GMVt9FxMfUr41ENJJlTDmAe413ZTDLSA3fRN55TXbYcC08cdRFJkUk1e9p6FUlPH4 pCTNWE1V8Kt4XPuZ4Tzzq8LSQ4bEGPp4cmr0aR7W2KrpHRwR2P1KsTZA71SG3agCuZ4lDPDpLOf3 WdCChZbigphhDybFjpOPpASn581MipPEI/K53WgR1lVfIP5FWRJBWrnjXhgFecQeoR0mRpX7IRe2 g2YRGswhl1SSG1kPUYK7E9ZWk21sCsfXA3glSA3W8FVlrhLcWWXiGt8viObSZW8uGwi72OVglZva WiwypwWrzFkTNolEi1uLHKk/uUjUJHSEge5b08UsGT0xsXnYF3CRgfeN8jkfpKeA6anw6J7X2pHR t1M461tzXLXbdf4KKUzIOSyfrNO4Y8/muP3bR0AJ0N8MZYI7MNThSGrOp5NtVdcXfYgEe1n1WWIo BdUSVy3CW2r52LRWAR0hbhy6P9WkChq2wbcWVsCxoVx/Vo+VxRMrZs0EGq0EssFYNL3I0T0N+HQo 83gXr75UXiH1LtnITZRzQ1APU73HM1EvMPvaWVy0u7/TvNPyTOK0JJMu5MAgzIIrb4Rg7blLAwbn bR+c+fRNaWvWNLsxKalrUS97EEFRHS9pS9/OjNc7NlJi+00wR47eALWwjmGhUKrCKKAmL8WutkQG yCsfhZ+iDAne9McoTh9vh0674F3AguSkHJhqdqWWdIICl8SEEleHX7DDFRGaXOUn5TTiIVgeIer1 Ml9dLTcSaopCPWM94teVYytuQ8PMA7pji2Y9sJNPdtVF9MoEPOCN2f2FWro5h7cQ== From: =?utf-8?B?InpoaWxpemhhbyjotbXlv5fnq4spIg==?= Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Mon, 25 Apr 2022 18:13:48 +0800 References: To: FFmpeg development discussions and patches In-Reply-To: X-OQ-MSGID: <82562B96-A9D1-4D15-92D7-216D8485578C@foxmail.com> X-Mailer: Apple Mail (2.3654.60.0.2.21) Subject: Re: [FFmpeg-devel] [PATCH] avformat/mov: fix missing extra data updating 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > On Mar 30, 2022, at 2:04 AM, Zhao Zhili wrote: > > The stsc_index is checked and updated for the next sample. If the > next sample needs to update stsd_index and stsc_index, then only > stsc_index is updated, which leads to a missing > AV_PKT_DATA_NEW_EXTRADATA. For example, the sample in the second > chunk needs to update both. > > entry[0] > first_chunk = 1 > samples_per_chunk = 3 > sample_description_index = 1 > entry[1] > first_chunk = 2 > samples_per_chunk = 1 > sample_description_index = 2 > entry[2] > first_chunk = 3 > samples_per_chunk = 8 > sample_description_index = 2 > > The fix is simple: first check and update stsd_index for current > sample, then check and update stsc_index for the next. > --- > libavformat/mov.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index 6c847de164..c9d4f2ef43 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -8591,20 +8591,20 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) > > /* Multiple stsd handling. */ > if (sc->stsc_data) { > - /* Keep track of the stsc index for the given sample, then check > - * if the stsd index is different from the last used one. */ > + if (sc->stsc_data[sc->stsc_index].id > 0 && > + sc->stsc_data[sc->stsc_index].id - 1 < sc->stsd_count && > + sc->stsc_data[sc->stsc_index].id - 1 != sc->last_stsd_index) { > + ret = mov_change_extradata(sc, pkt); > + if (ret < 0) > + return ret; > + } > + > + /* Update the stsc index for the next sample */ > sc->stsc_sample++; > if (mov_stsc_index_valid(sc->stsc_index, sc->stsc_count) && > mov_get_stsc_samples(sc, sc->stsc_index) == sc->stsc_sample) { > sc->stsc_index++; > sc->stsc_sample = 0; > - /* Do not check indexes after a switch. */ > - } else if (sc->stsc_data[sc->stsc_index].id > 0 && > - sc->stsc_data[sc->stsc_index].id - 1 < sc->stsd_count && > - sc->stsc_data[sc->stsc_index].id - 1 != sc->last_stsd_index) { > - ret = mov_change_extradata(sc, pkt); > - if (ret < 0) > - return ret; > } > } > Multi sample entry is a less used feature. Since we have it, better keep it work. This patch fixed a corner case. Will apply this week unless there are objections. _______________________________________________ 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".