Skip to content

fix build with ffmpeg-8#29811

Open
layangankertas wants to merge 1 commit intotelegramdesktop:devfrom
layangankertas:ffmpeg-8
Open

fix build with ffmpeg-8#29811
layangankertas wants to merge 1 commit intotelegramdesktop:devfrom
layangankertas:ffmpeg-8

Conversation

@layangankertas
Copy link

@layangankertas layangankertas commented Sep 22, 2025

fix build with ffmpeg-8

Fixes: #29713

fix build with ffmpeg-8
@CLAassistant
Copy link

CLAassistant commented Sep 22, 2025

CLA assistant check
All committers have signed the CLA.

@ilya-fedin
Copy link
Contributor

Add Fixes: #29713 to the PR description

@ilya-fedin
Copy link
Contributor

The CI has failed with /usr/src/tdesktop/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp:697:1: error: control reaches end of non-void function [-Werror=return-type]

@layangankertas
Copy link
Author

layangankertas commented Sep 23, 2025

in my Slackware, build success
this is my build log
build-log.txt
build.ninja.txt
ldd-Telegram.txt
telegram-desktop.SlackBuild.tar.gz

@ilya-fedin
Copy link
Contributor

The CI has stronger checks. Please read the error, from my reading of the code it's completely justified, the new code is bugged

@layangankertas
Copy link
Author

layangankertas commented Sep 23, 2025

AVStream now deprecated in ffmpeg 8.
reference to fix this issue chromium/chromium@84d1d7a in file media/filters/audio_video_metadata_extractor.cc

@ilya-fedin
Copy link
Contributor

Not sure what you mean? You have to fix the bug you introduced in the new code and the CI points you at.

@lfos
Copy link
Contributor

lfos commented Sep 25, 2025

The following simpler patch seems to work; i.e., at least successfully builds, haven't fully tested the functionality for potential regressions:

diff --git a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp
index 9ccdb15592..f261b7d6dc 100644
--- a/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp
+++ b/Telegram/SourceFiles/ffmpeg/ffmpeg_utility.cpp
@@ -683,10 +683,10 @@ int DurationByPacket(const Packet &packet, AVRational timeBase) {
 }
 
 int ReadRotationFromMetadata(not_null<AVStream*> stream) {
-       const auto displaymatrix = av_stream_get_side_data(
-               stream,
-               AV_PKT_DATA_DISPLAYMATRIX,
-               nullptr);
+       const auto displaymatrix = av_packet_side_data_get(
+               stream->codecpar->coded_side_data,
+               stream->codecpar->nb_coded_side_data,
+               AV_PKT_DATA_DISPLAYMATRIX);
        auto theta = 0;
        if (displaymatrix) {
                theta = -round(av_display_rotation_get((int32_t*)displaymatrix));

@fossdd
Copy link

fossdd commented Sep 25, 2025

@lfos do you mind opening a new PR so it can run the CI and stuff?

@lfos
Copy link
Contributor

lfos commented Sep 25, 2025

@fossdd - Sure, you can find it here: #29822

@ilya-fedin
Copy link
Contributor

Updates to this PR will trigger the CI immediately. New PR will have to wait until CI run is approved.

@mishr4
Copy link

mishr4 commented Oct 14, 2025

The patch from @lfos does fix the FFmpeg 8 API change (AVStream → codecpar->coded_side_data), but u still need a return at the end of that function.
also sanity-check that coded_side_data isn’t null before calling av_packet_side_data_get

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fails to build with FFmpeg 8

6 participants