Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure with 1.1 and ffmpeg 5 #29

Closed
thesamesam opened this issue May 15, 2022 · 13 comments
Closed

Build failure with 1.1 and ffmpeg 5 #29

thesamesam opened this issue May 15, 2022 · 13 comments

Comments

@thesamesam
Copy link

thesamesam commented May 15, 2022

Hi,

Forwarding a downstream report in Gentoo. aqualung 1.1 fails to build with ffmpeg 5 like so:

x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I../..    -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-4 -pthread        -Wall -O2 -march=znver3 -pipe -g -ggdb3 -c -o dec_vorbis.o dec_vorbis.c
dec_lavc.c: In function ‘decode_audio’:
dec_lavc.c:122:15: warning: implicit declaration of function ‘avcodec_decode_audio4’; did you mean ‘avcodec_decode_subtitle2’? [-Wimplicit-function-declaration]
  122 |         ret = avcodec_decode_audio4(avctx, &frame, &got_frame, avpkt);
      |               ^~~~~~~~~~~~~~~~~~~~~
      |               avcodec_decode_subtitle2
dec_lavc.c: In function ‘decode_lavc’:
dec_lavc.c:200:9: warning: implicit declaration of function ‘av_free_packet’; did you mean ‘av_get_packet’? [-Wimplicit-function-declaration]
  200 |         av_free_packet(&packet);
      |         ^~~~~~~~~~~~~~
      |         av_get_packet
dec_lavc.c: In function ‘lavc_decoder_open’:
dec_lavc.c:274:48: error: ‘AVStream’ has no member named ‘codec’
  274 |                 if (pd->avFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
      |                                                ^~
dec_lavc.c:282:67: error: ‘AVStream’ has no member named ‘codec’
  282 |      pd->avCodecCtx = pd->avFormatCtx->streams[pd->audioStream]->codec;
      |                                                                ^~

dec_lavc.c:292:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  292 |         pd->avCodec = avcodec_find_decoder(pd->avCodecCtx->codec_id);
      |                     ^
file_decoder.c: In function ‘file_decoder_init’:
file_decoder.c:175:9: warning: implicit declaration of function ‘av_register_all’ [-Wimplicit-function-declaration]
  175 |         av_register_all();
      |         ^~~~~~~~~~~~~~~
make[3]: *** [Makefile:477: dec_lavc.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/var/tmp/portage/media-sound/aqualung-1.1-r101/work/aqualung-1.1/src/decoder'
make[2]: *** [Makefile:1282: all-recursive] Error 1
make[2]: Leaving directory '/var/tmp/portage/media-sound/aqualung-1.1-r101/work/aqualung-1.1/src'
make[1]: *** [Makefile:444: all-recursive] Error 1

The full log (gzipped) is at https://bugs.gentoo.org/attachment.cgi?id=766043.

@jeremyevans
Copy link
Owner

Thanks for the report. It would be great to get a pull request to support ffmpeg 5 while keeping current ffmpeg 4 support. Unfortunately, this is not something I'll be able to work on until OpenBSD upgrades to ffmpeg 5. Until ffmpeg 5 support is added, you'll probably want to use --without-lavc when configuring.

oahong pushed a commit to oahong/exhereses-cn that referenced this issue Aug 27, 2022
* outdated
* fails to build
* becomes even more broken with ffmpeg 5:
  jeremyevans/aqualung#29
@brad0
Copy link
Contributor

brad0 commented Apr 19, 2023

Thanks for the report. It would be great to get a pull request to support ffmpeg 5 while keeping current ffmpeg 4 support. Unfortunately, this is not something I'll be able to work on until OpenBSD upgrades to ffmpeg 5. Until ffmpeg 5 support is added, you'll probably want to use --without-lavc when configuring.

I'm working on this now. I can provide you a diff for testing. I came across this issue when checking the upstream status of various ports.

@jeremyevans
Copy link
Owner

@brad0 That sounds great. If the patch keeps things working with ffmpeg 4 but allows building with ffmpeg 5, I'd be eager to accept it.

@brad0
Copy link
Contributor

brad0 commented Apr 19, 2023

@brad0 That sounds great. If the patch keeps things working with ffmpeg 4 but allows building with ffmpeg 5, I'd be eager to accept it.

Sorry I wasn't clear. I was referring to the OpenBSD FFmpeg port.

@jeremyevans
Copy link
Owner

Sure, if you have a patch for the OpenBSD ffmpeg port, I can test with that and see if I can get aqualung updated to support that.

@brad0
Copy link
Contributor

brad0 commented Jun 3, 2023

Anyway, aqualung is one of very few left on my list that needs to be fixed for FFmpeg 5 and newer API. I sent you the port diff for 6.

@jeremyevans
Copy link
Owner

Yes, thank you for that. I've been fairly busy and haven't had time to test the port you sent, but I'll try to make time in the next week or two.

@jeremyevans
Copy link
Owner

After considerable work, I was able to get aqualung compiling with ffmpeg 6. I tested it and it crashed at runtime on OpenBSD, due to a MAP_STACK issue:

[aqualung]70584/354291 sp=1a7d8a06d20 inside 1a7d8a53000-1a7d8ad2fff: not MAP_STACK

I then tried with ffmpeg 4 (the version currently in OpenBSD ports) on a different machine and got similar MAP_STACK-related crashes, using a few different file types (aac, avi, mpc (when configured with --without-mpc)).

I was able to fix the MAP_STACK issue by reducing MAX_AUDIO_FRAME_SIZE, to avoid the lavc decoder trying to use a gigantic stack frame.

I've pushed up the changes, so the master branch should now compile with ffmpeg 6 and ffmpeg 4 (and hopefully ffmpeg 5 as well).

@thesamesam @tomscii @brad0 If you could test the master branch, to confirm this fixes things, that would be great. After some successful test reports, I'd be OK with releasing Aqualung 1.2 with these changes.

@tomscii
Copy link
Collaborator

tomscii commented Jun 4, 2023 via email

@brad0
Copy link
Contributor

brad0 commented Jun 4, 2023

You updated to the new channel layout API too. Thanks. I'll test out a bit and get back to you.

@brad0
Copy link
Contributor

brad0 commented Jun 4, 2023

Testing with FFmpeg 6 on OpenBSD.

I was able to play a variety of formats (MP3, M4A, FLAC, Ogg Vorbis, AC3, a handful of others) without issue.

Although randomly aqualung crashed a bunch of times. But running it under the debugger, the traces I see when it does crash does not seem like they have anything to do with FFmpeg.

@jeremyevans
Copy link
Owner

Thanks for the feedback. I'll run with the master branch for a few days, and assuming no problems, release 1.2 later in the week.

@brad0
Copy link
Contributor

brad0 commented Jun 5, 2023

Thanks for the feedback. I'll run with the master branch for a few days, and assuming no problems, release 1.2 later in the week.

Thank you.

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

No branches or pull requests

4 participants