[FFmpeg-devel] CONFIG_W64_DEMUXER and dead-code elimination
Bruce Dawson
brucedawson at google.com
Sat Apr 23 01:02:33 CEST 2016
I've noticed that when CONFIG_W64_DEMUXER is defined to zero that ffmpeg
compiles in a reference to ff_w64_guid_data but doesn't not link w64.o
(which defines that symbol).
This normally works because most optimizers discard the reference
to ff_w64_guid_data early enough to not cause a linker failure. However
this assumption means that /Od (debug, unoptimized) and /GL (Link Time Code
Generation - super optimized) builds with VC++ don't work.
The patch below is a simple code change to fix this specific issue:
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 7176cd6..8301748 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -654,9 +654,11 @@ smv_out:
if (wav->ignore_length)
left = INT_MAX;
if (left <= 0) {
+#if CONFIG_W64_DEMUXER
if (CONFIG_W64_DEMUXER && wav->w64)
left = find_guid(s->pb, ff_w64_guid_data) - 24;
else
+#endif
left = find_tag(wav, s->pb, MKTAG('d', 'a', 't', 'a'));
if (left < 0) {
wav->audio_eof = 1;
An alternate fix would be to update Makefile to always include w64.o when
wavdec.o is linked, like this:
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 51260f4..d290c9a 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -479,7 +479,7 @@ OBJS-$(CONFIG_VPLAYER_DEMUXER) +=
vplayerdec.o subtitles.o
OBJS-$(CONFIG_VQF_DEMUXER) += vqf.o
OBJS-$(CONFIG_W64_DEMUXER) += wavdec.o w64.o pcm.o
OBJS-$(CONFIG_W64_MUXER) += wavenc.o w64.o
-OBJS-$(CONFIG_WAV_DEMUXER) += wavdec.o pcm.o
+OBJS-$(CONFIG_WAV_DEMUXER) += wavdec.o w64.o pcm.o
OBJS-$(CONFIG_WAV_MUXER) += wavenc.o
OBJS-$(CONFIG_WC3_DEMUXER) += wc3movie.o
OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \
Any thoughts/preferences on this particular fix? I might be interested in
cleaning up all instances of this in order to allow usage of /Od and /GL in
Chromium builds of ffmpeg but I want to start small.
--
Bruce Dawson
More information about the ffmpeg-devel
mailing list