[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1004594: qtwebengine-opensource-src: FTBFS with ffmpeg 5.0



Hi Dmitry

On 2022-02-04 23:00:41 +0300, Dmitry Shachnev wrote:
> Control: tags -1 - pending
> 
> Hi Sebastian!
> 
> On Sun, Jan 30, 2022 at 09:34:10PM +0100, Sebastian Ramacher wrote:
> > qtwebengine-opensource-src FTBFS with ffmpeg 5.0 (available in
> > experimental):
> 
> I backported some upstream commits which make it better, but not completely.
> 
> My current problem is that I don't see any replacement for this code in
> Chromium's media/filters/ffmpeg_demuxer.cc:
> 
>   if (stream->first_dts != kNoFFmpegTimestamp &&
>       stream->codecpar->codec_id != AV_CODEC_ID_HEVC &&
>       stream->codecpar->codec_id != AV_CODEC_ID_H264 &&
>       stream->codecpar->codec_id != AV_CODEC_ID_MPEG4) {
>     const base::TimeDelta first_pts =
>         ConvertFromTimeBase(stream->time_base, stream->first_dts);
>     if (first_pts < start_time)
>       start_time = first_pts;
>   }
> 
> Here stream is AVStream*. In FFmpeg 5, that class does not have first_dts
> member. FFmpeg's own code uses ffstream() to cast such a pointer to FFStream*,
> but both FFStream struct and ffstream() function are private API.
> 
> Upstream Chromium uses a bundled copy of FFMpeg and they patched it to add
> av_stream_get_first_dts() function which exposes that member [1].
> 
> So my questions are:
> 
> - Do you know how to write equivalent code using only public API?

This came up on ffmpeg-devel [1]. Their suggestion is to keep track of
that value in chromium similar to [2]. That is: as long as the first DTS
was not store, take PTS from the first packet that has it and compute it
from PTS.

Cheers

[1] https://ffmpeg.org/pipermail/ffmpeg-devel/2021-September/285401.html
[2] https://github.com/FFmpeg/FFmpeg/commit/ab4f299e23

> 
> - If no, maybe you can add av_stream_get_first_dts() function so that Chromium
> can use it? I can file a bug upstream asking to make it official for the next
> release.
> 
> - Alternatively, maybe you can install libavutil's internal.h header, so I can
> take FFStream and ffstream() definitions from there?
> 
> I hate both second and third solutions, but nothing better came to my mind.
> 
> [1]: https://chromium.googlesource.com/chromium/third_party/ffmpeg/+/refs/heads/master/libavformat/utils.c#95
> 
> --
> Dmitry Shachnev



-- 
Sebastian Ramacher

Attachment: signature.asc
Description: PGP signature


Reply to: