Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 565668 - media-plugins/gst-plugins-libav-1.6 is broken with libav
Summary: media-plugins/gst-plugins-libav-1.6 is broken with libav
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: GStreamer package maintainers
URL: https://bugzilla.gnome.org/show_bug.c...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-13 11:27 UTC by Siuchung Cheung (Clement)
Modified: 2015-12-29 13:22 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
libav.patch (libav.patch,2.36 KB, patch)
2015-11-14 05:55 UTC, Siuchung Cheung (Clement)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Siuchung Cheung (Clement) 2015-11-13 11:27:11 UTC
For both 1.6.0 and 1.6.1, it compiles with libav and emerge is successful but produce a plugin that does not actually work.

Reproducible: Always

Steps to Reproduce:
1. emerge gst-plugins-libav to upgrade to 1.6 or above

Actual Results:  
During emerge:
 * QA Notice: Package triggers severe warnings which indicate that it
 *            may exhibit random runtime failures.
 * /var/tmp/portage/media-plugins/gst-plugins-libav-1.6.1/work/gst-libav-1.6.1/ext/libav/gstavauddec.c:359:7: warning: implicit declaration of function 'av_frame_get_channel_layout' [-Wimplicit-function-declaration]
 * /var/tmp/portage/media-plugins/gst-plugins-libav-1.6.1/work/gst-libav-1.6.1/ext/libav/gstavauddec.c:366:7: warning: implicit declaration of function 'av_frame_get_sample_rate' [-Wimplicit-function-declaration]
 * /var/tmp/portage/media-plugins/gst-plugins-libav-1.6.1/work/gst-libav-1.6.1/ext/libav/gstavauddec.c:388:5: warning: implicit declaration of function 'av_frame_get_channels' [-Wimplicit-function-declaration]
 * /var/tmp/portage/media-plugins/gst-plugins-libav-1.6.1/work/gst-libav-1.6.1/ext/libav/gstavauddec.c:359:7: warning: implicit declaration of function 'av_frame_get_channel_layout' [-Wimplicit-function-declaration]
 * /var/tmp/portage/media-plugins/gst-plugins-libav-1.6.1/work/gst-libav-1.6.1/ext/libav/gstavauddec.c:366:7: warning: implicit declaration of function 'av_frame_get_sample_rate' [-Wimplicit-function-declaration]
 * /var/tmp/portage/media-plugins/gst-plugins-libav-1.6.1/work/gst-libav-1.6.1/ext/libav/gstavauddec.c:388:5: warning: implicit declaration of function 'av_frame_get_channels' [-Wimplicit-function-declaration]

 * Please do not file a Gentoo bug and instead report the above QA
 * issues directly to the upstream developers of this software.
 * Homepage: http://gstreamer.freedesktop.org/modules/gst-libav.html
strip: x86_64-pc-linux-gnu-strip --strip-unneeded -R .comment -R .GCC.command.line -R .note.gnu.gold-version
   usr/lib32/gstreamer-1.0/libgstlibav.so
   usr/lib64/gstreamer-1.0/libgstlibav.so

And sure enough it does not work:
[:~] % gst-inspect-1.0 -b

(gst-plugin-scanner:6030): GStreamer-WARNING **: Failed to load plugin '/usr/lib64/gstreamer-1.0/libgstlibav.so': /usr/lib64/gstreamer-1.0/libgstlibav.so: undefined symbol: av_frame_get_sample_rate
Blacklisted files:
  libgstlibav.so

Total count: 1 blacklisted file

Firefox lost the ability to play h264 videos. Same for "gst-launch-1.0 playbin uri=xxx". Many other decoding capabilities provided by libav plugin broken.

Expected Results:  
Actual working plugin installed on system.

This happens because of this change from upstream: http://cgit.freedesktop.org/gstreamer/gst-libav/commit/?id=7afaf5c02050fcac18006abfdc01287f8dba16eb

The functions are present only in ffmpeg and not in libav.

It appears that since 1.6, gstreamer have switched their internal copy from libav 11.4 to ffmpeg 2.8.

http://cgit.freedesktop.org/gstreamer/gst-libav/tree/ChangeLog
2015-06-30 12:05:46 +0200  Sebastian Dröge <sebastian@centricular.com>

	* .gitmodules:
	* configure.ac:
	* ext/libav/Makefile.am:
	* gst-libs/ext/libav:
	  Switch from libav v11.4 to ffmpeg n2.7.1
	  ffmpeg seems to be the one of the two forks, which is most widely used by
	  Linux distributions and in general. Also Google is using it for e.g. Chrome
	  and has engineers working on finding and fixing security issues in it.
	  https://bugzilla.gnome.org/show_bug.cgi?id=751607

And they went from 2.7.1 to 2.8 here:
https://bugzilla.gnome.org/show_bug.cgi?id=754920

Now we can agree or disagree with their decision but what have here is that the compile works because it's using headers from their private copy. But linker can never find those ffmpeg specific symbols.

For this particular problem, it would be enough to temporarily revert the offending diff to get libav to work. But I'm not sure what we can do if upstream abandon libav support and more of these issues show up.

I think we have to at least fail the 1.6+ ebuilds when libav flag is set instead of silently breaking lots of decoding features in gstreamer.

Another option is to turn off --with-system-libav in econf if libav use flag is set. Just use the internal ffmpeg provided by upstream.
Comment 1 Pacho Ramos gentoo-dev 2015-11-13 14:44:43 UTC
what libav version are you running?
Comment 2 Pacho Ramos gentoo-dev 2015-11-13 14:45:24 UTC
For this concrete case we could maybe revert http://cgit.freedesktop.org/gstreamer/gst-libav/commit/?id=7afaf5c02050fcac18006abfdc01287f8dba16eb when libav is used... could you confirm if it solves the problem? (I use ffmpeg for a long time)
Comment 3 Pacho Ramos gentoo-dev 2015-11-13 15:24:19 UTC
(In reply to Pacho Ramos from comment #2)
> For this concrete case we could maybe revert
> http://cgit.freedesktop.org/gstreamer/gst-libav/commit/
> ?id=7afaf5c02050fcac18006abfdc01287f8dba16eb when libav is used... could you
> confirm if it solves the problem? (I use ffmpeg for a long time)

Anyway, I would also report this issue with upstream to see if they are willing to help a bit to get the "system-libav" option working again ;)

Maybe they didn't break compat with libav on purpose and the are willing to fix the bug :/
Comment 4 Siuchung Cheung (Clement) 2015-11-14 05:55:26 UTC
Created attachment 416902 [details, diff]
libav.patch

Turns out that's still not enough:
[:~] % gst-inspect-1.0 -b

(gst-plugin-scanner:5998): GStreamer-WARNING **: Failed to load plugin '/usr/lib64/gstreamer-1.0/libgstlibav.so': /usr/lib64/gstreamer-1.0/libgstlibav.so: undefined symbol: av_frame_get_channels
Blacklisted files:
  libgstlibav.so

Total count: 1 blacklisted file

That comes from this commit: http://cgit.freedesktop.org/gstreamer/gst-libav/commit/ext/libav/gstavauddec.c?id=3b6c656e2552c936a17ff6bb9a0e753fcc42e4ce

This combined patch "fixes" both issues and I can verify that the plugin actually works with libav-11.3-r1. (But you must close firefox and reopen it for the fix to take effect.)

I put "fix" in quotes because the 2nd revert removes functionality! I cannot even recreate that change without ffmpeg accessors. Because in libav, there's simply no such field called channel in that struct. The functionality is just not there in libav.

That's it. I'm spending my weekend going back to ffmpeg. But those who want to stay on libav are free to drop this path in the right place under /etc/portage/patches/ for now.
Comment 5 Pacho Ramos gentoo-dev 2015-11-14 08:00:10 UTC
Can you please report this bug to upstream -> bugzilla.gnome.org 

Otherwise they will be deviating from libav and making it harder to keep it compatible with it :/

Thanks a lot
Comment 6 Pacho Ramos gentoo-dev 2015-11-16 21:54:57 UTC
Looks like upstream won't help on keeping it working for libav :(

Maybe we should use bundled ffmpeg when "libav" USE is set
Comment 7 Pacho Ramos gentoo-dev 2015-11-19 19:22:20 UTC
Reading the upstream report, using the bundled ffmpeg will be the only option for "libav" USE
Comment 8 Pacho Ramos gentoo-dev 2015-12-29 13:22:33 UTC
[master 97bb55c] media-plugins/gst-plugins-libav: We need to rely on internal ffmpeg copy for letting libav users to use the plugin as upstream has decided to stop trying to make this compatible with libav lib
 1 file changed, 70 insertions(+)
 create mode 100644 media-plugins/gst-plugins-libav/gst-plugins-libav-1.6.2-r1.ebuild