running ffmpeg as a component in release mode

92 views
Skip to first unread message

sfc...@gmail.com

unread,
Aug 22, 2018, 2:34:58 PM8/22/18
to chromium-dev
Hi,

I've been building ffmpeg as a component library in earlier builders of Chromium and it had worked out all right without any issues (last version ok for m66). After I upgraded to m68 and built ffmpeg as libffmpeg.so under Linux, playing any mp4 video leads to an immediate crash. The stack backtrace is like this:

 #0  0x00007ffff7ad24ec in fill_buffer ()
    at ../../third_party/ffmpeg/libavformat/aviobuf.c:599
#1  0x00007ffff7ad2dba in avio_read ()
    at ../../third_party/ffmpeg/libavformat/aviobuf.c:678
#2  0x00007ffff7ad6c6b in av_probe_input_buffer2 ()
    at ../../third_party/ffmpeg/libavformat/format.c:270
#3  0x00007ffff7ac4831 in avformat_open_input ()
    at ../../third_party/ffmpeg/libavformat/utils.c:425
#4  0x00005555581fdab7 in OpenContext ()
    at ../../media/filters/ffmpeg_glue.cc:110
#5  0x00005555581fd40e in Run () at ../../base/callback.h:96
#6  ReturnAsParamAdapter<bool> ()
    at ../../base/post_task_and_reply_with_result_internal.h:20
#7  0x00005555580aeeeb in Invoke<void (*)(base::OnceCallback<base::File ()>, base::File *), base::OnceCallback<base::File ()>, base::File *> ()
    at ../../base/bind_internal.h:402
#8  MakeItSo<void (*)(base::OnceCallback<base::File ()>, base::File *), base::OnceCallback<base::File ()>, base::File *> () at ../../base/bind_internal.h:547
#9  RunImpl<void (*)(base::OnceCallback<base::File ()>, base::File *), std::__1::tuple<base::OnceCallback<base::File ()>, base::File *>, 0, 1> ()
    at ../../base/bind_internal.h:621
#10 RunOnce () at ../../base/bind_internal.h:589
#11 0x0000555559a1691a in Run () at ../../base/callback.h:96

The ffmpeg does work all right as a component in debug build. The crash only happens for release build. If anyone has ideas who changes lead to this behavior under M68, it would be highly appreciated. 

Thanks a lot in advance.


Rest Regards,
Shanfeng Cheng

Torne (Richard Coles)

unread,
Aug 22, 2018, 3:28:52 PM8/22/18
to sfc...@gmail.com, chromium-dev
Possibly an ODR violation? The component build is, unfortunately, not guaranteed to be free of ODR violations - there are places where we accidentally include the same code into more than one component. This doesn't always cause an actual issue, so it may not be detected by our builders/testers, but if you build in an unsupported configuration (release component builds are not really supported/tested) then you might hit an issue that only applies in that configuration. This can be hard to debug :(

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/2018082213335279255424%40gmail.com.

sfc...@gmail.com

unread,
Aug 22, 2018, 3:35:45 PM8/22/18
to Torne (Richard Coles), chromium-dev
There are other weird issues as well. I have some places where I use dlopen and dlsym to call some API within ffmpeg library. While dlopen and dlsym returns valid function address, calling the actual function results in an immediate crash. This only started happening on m68. 

Torne (Richard Coles)

unread,
Aug 22, 2018, 3:42:05 PM8/22/18
to sfc...@gmail.com, chromium-dev
It's really hard to guess what might be wrong - this isn't a supported configuration and we don't know how you're even achieving it. You'll need to debug this on your end, probably.

Dale Curtis

unread,
Aug 22, 2018, 5:34:58 PM8/22/18
to to...@chromium.org, Shanfeng Cheng, Chromium-dev
+1, you're on your own here sorry. We're careful to only link ffmpeg in one place and no have no other dependencies. If you have code trying to use third_party/ffmpeg directly it should probably be instead linking against //media and including media/ffmpeg/ffmpeg_common.h.

Also If you have gn check enabled for //media (it should be enabled by default by 68 IIRC), it may help in diagnosing what's going wrong. 

- dale

Marshall Greenblatt

unread,
Aug 22, 2018, 5:35:17 PM8/22/18
to Shanfeng Cheng, Torne (Richard Coles), chromium-dev
On Wed, Aug 22, 2018 at 3:35 PM sfc...@gmail.com <sfc...@gmail.com> wrote:
There are other weird issues as well. I have some places where I use dlopen and dlsym to call some API within ffmpeg library. While dlopen and dlsym returns valid function address, calling the actual function results in an immediate crash. This only started happening on m68. 

Are you building with is_official_build=true? If so, it could be a cfi-icall violation due to https://crrev.com/a6889a090458a2653794c6e63387d6db743dc7f9 which is included with M68.
 
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/2018082214344739384528%40gmail.com.

sfc...@gmail.com

unread,
Aug 23, 2018, 1:26:46 AM8/23/18
to Marshall Greenblatt, Torne (Richard Coles), chromium-dev
Yes. That is exactly the problem. After disabling cif-icall, everything is back to normal. Thanks for pointing in the right direction. 
Reply all
Reply to author
Forward
0 new messages