[Libav-user] Reuse of format context after free and reallocate?

Paul B Mahol onemda at gmail.com
Wed Mar 3 14:05:50 EET 2021


On Wed, Mar 3, 2021 at 12:54 PM Paul B Mahol <onemda at gmail.com> wrote:

>
>
> On Wed, Mar 3, 2021 at 5:22 AM william keeling <williamkeeling at hotmail.com>
> wrote:
>
>>  I did some digging and found the error is coming from this code in
>> flvenv.c line 921.
>>
>>   if (pkt->dts < -flv->delay) {
>>         av_log(s, AV_LOG_WARNING,
>>                "Packets are not in the proper order with respect to
>> DTS\n");
>>         return AVERROR(EINVAL);
>>
>> flv is a pointer to  FLVContext from AVFormatContext->priv_data.
>>
>> Looks like the avformat_write_header()/avformat_init_output uses the
>> state of the muxer at the last run even if the AVFormatContext has been
>> freed and reallocated.
>> So how do I get the FLVContext to be initlized as if a fresh run. Or how
>> do I free the old FLVContext so when avformat_write_header() initlizes the
>> priv_data it is fresh.
>> ------------------------------
>> *From:* Libav-user <libav-user-bounces at ffmpeg.org> on behalf of william
>> keeling <WilliamKeeling at hotmail.com>
>> *Sent:* Monday, March 1, 2021 2:32 PM
>> *To:* libav-user at ffmpeg.org <libav-user at ffmpeg.org>
>> *Subject:* [Libav-user] Reuse of format context after free and
>> reallocate?
>>
>>
>> I have a program the creates flash format stream and is work the first
>> time thru but when I process the second stream, I get DTS/PTS non
>> monotonically errors.
>>
>> After each stream I free and reallocate all contexts:
>>
>> avcodec_free_context() of all streams video and audio
>>
>> avformat_free_context()
>>
>> avio_close()
>>
>>
>>
>> What am I missing so the format context can be reallocate and used?
>>
>
> Looks like to be real bug to me.
>

But have you actually called avformat free context?

Have you used valgrind to show you typical programming mistakes you may
done.


>
>
>>
>>
>> Thanks William
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/libav-user
>>
>> To unsubscribe, visit link above, or email
>> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210303/19708579/attachment.html>


More information about the Libav-user mailing list