diff options
author | mostynb <mostynb@opera.com> | 2015-01-07 14:02:00 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-07 22:03:21 +0000 |
commit | 10406b9bcce7a8cb744a7ba118b11450444afb16 (patch) | |
tree | 40130fff310b575528fc8a68e6e593655b74f8c5 /media | |
parent | a759da6bd5af99f8d7c8596ddde0479a2c3480b1 (diff) | |
download | chromium_src-10406b9bcce7a8cb744a7ba118b11450444afb16.zip chromium_src-10406b9bcce7a8cb744a7ba118b11450444afb16.tar.gz chromium_src-10406b9bcce7a8cb744a7ba118b11450444afb16.tar.bz2 |
fix builds with vpx and/or ffmpeg disabled
If media_use_libvpx==0 then we should not include any libvpx headers.
And similarly for ffmpeg.
Followup to https://codereview.chromium.org/783003002
BUG=416570
Review URL: https://codereview.chromium.org/839763002
Cr-Commit-Position: refs/heads/master@{#310383}
Diffstat (limited to 'media')
-rw-r--r-- | media/BUILD.gn | 9 | ||||
-rw-r--r-- | media/filters/default_renderer_factory.cc | 13 | ||||
-rw-r--r-- | media/media.gyp | 11 | ||||
-rw-r--r-- | media/mojo/services/renderer_config_default.cc | 8 | ||||
-rw-r--r-- | media/test/pipeline_integration_test_base.cc | 14 |
5 files changed, 50 insertions, 5 deletions
diff --git a/media/BUILD.gn b/media/BUILD.gn index 4445c32..af7aa57 100644 --- a/media/BUILD.gn +++ b/media/BUILD.gn @@ -13,6 +13,12 @@ import("//media/media_options.gni") # NOT for exporting. config("media_config") { defines = [ "MEDIA_IMPLEMENTATION" ] + if (!media_use_libvpx) { + defines += [ "MEDIA_DISABLE_LIBVPX" ] + } + if (!media_use_ffmpeg) { + defines += [ "MEDIA_DISABLE_FFMPEG" ] + } if (cpu_arch == "arm" && arm_use_neon) { defines += [ "USE_NEON" ] } @@ -32,6 +38,9 @@ config("media_dependent_config") { if (!media_use_libvpx) { defines += [ "MEDIA_DISABLE_LIBVPX" ] } + if (!media_use_ffmpeg) { + defines += [ "MEDIA_DISABLE_FFMPEG" ] + } if (is_win) { ldflags = [ "/DELAYLOAD:mf.dll", diff --git a/media/filters/default_renderer_factory.cc b/media/filters/default_renderer_factory.cc index b9f95d4..b61c1d8 100644 --- a/media/filters/default_renderer_factory.cc +++ b/media/filters/default_renderer_factory.cc @@ -7,23 +7,29 @@ #include "base/bind.h" #include "base/single_thread_task_runner.h" #include "media/filters/audio_renderer_impl.h" +#if !defined(MEDIA_DISABLE_FFMPEG) #include "media/filters/ffmpeg_audio_decoder.h" #include "media/filters/ffmpeg_video_decoder.h" +#endif #include "media/filters/gpu_video_accelerator_factories.h" #include "media/filters/gpu_video_decoder.h" #include "media/filters/opus_audio_decoder.h" #include "media/filters/renderer_impl.h" #include "media/filters/video_renderer_impl.h" +#if !defined(MEDIA_DISABLE_LIBVPX) #include "media/filters/vpx_video_decoder.h" +#endif namespace media { +#if !defined(MEDIA_DISABLE_FFMPEG) // TODO(xhwang): We are abusing CreateMediaSourceErrorEvent() in a lot of places // that are not MediaSource related. Fix this in a separate CL. static void LogError(const scoped_refptr<MediaLog>& media_log, const std::string& error) { media_log->AddEvent(media_log->CreateMediaSourceErrorEvent(error)); } +#endif DefaultRendererFactory::DefaultRendererFactory( const scoped_refptr<MediaLog>& media_log, @@ -46,8 +52,11 @@ scoped_ptr<Renderer> DefaultRendererFactory::CreateRenderer( // Create our audio decoders and renderer. ScopedVector<AudioDecoder> audio_decoders; +#if !defined(MEDIA_DISABLE_FFMPEG) audio_decoders.push_back(new FFmpegAudioDecoder( media_task_runner, base::Bind(&LogError, media_log_))); +#endif + audio_decoders.push_back(new OpusAudioDecoder(media_task_runner)); scoped_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl( @@ -68,9 +77,11 @@ scoped_ptr<Renderer> DefaultRendererFactory::CreateRenderer( #if !defined(MEDIA_DISABLE_LIBVPX) video_decoders.push_back(new VpxVideoDecoder(media_task_runner)); -#endif // !defined(MEDIA_DISABLE_LIBVPX) +#endif +#if !defined(MEDIA_DISABLE_FFMPEG) video_decoders.push_back(new FFmpegVideoDecoder(media_task_runner)); +#endif scoped_ptr<VideoRenderer> video_renderer(new VideoRendererImpl( media_task_runner, video_decoders.Pass(), true, media_log_)); diff --git a/media/media.gyp b/media/media.gyp index 72263d7..afb6ec7 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -645,12 +645,23 @@ 'filters/in_memory_url_protocol.cc', 'filters/in_memory_url_protocol.h', ], + 'defines': [ + 'MEDIA_DISABLE_FFMPEG', + ], + 'direct_dependent_settings': { + 'defines': [ + 'MEDIA_DISABLE_FFMPEG', + ], + }, }], ['media_use_libvpx==1', { 'dependencies': [ '<(DEPTH)/third_party/libvpx/libvpx.gyp:libvpx', ], }, { # media_use_libvpx==0 + 'defines': [ + 'MEDIA_DISABLE_LIBVPX', + ], 'direct_dependent_settings': { 'defines': [ 'MEDIA_DISABLE_LIBVPX', diff --git a/media/mojo/services/renderer_config_default.cc b/media/mojo/services/renderer_config_default.cc index 76da6db..66464a9 100644 --- a/media/mojo/services/renderer_config_default.cc +++ b/media/mojo/services/renderer_config_default.cc @@ -12,7 +12,7 @@ #include "media/base/media.h" #include "media/filters/opus_audio_decoder.h" -#if !defined(OS_ANDROID) +#if !defined(MEDIA_DISABLE_FFMPEG) #include "media/filters/ffmpeg_audio_decoder.h" #include "media/filters/ffmpeg_video_decoder.h" #endif @@ -55,7 +55,7 @@ class DefaultRendererConfig : public PlatformRendererConfig { const LogCB& media_log_cb) override { ScopedVector<AudioDecoder> audio_decoders; -#if !defined(OS_ANDROID) +#if !defined(MEDIA_DISABLE_FFMPEG) audio_decoders.push_back( new FFmpegAudioDecoder(media_task_runner, media_log_cb)); audio_decoders.push_back(new OpusAudioDecoder(media_task_runner)); @@ -74,9 +74,9 @@ class DefaultRendererConfig : public PlatformRendererConfig { #if !defined(MEDIA_DISABLE_LIBVPX) video_decoders.push_back(new VpxVideoDecoder(media_task_runner)); -#endif // !defined(MEDIA_DISABLE_LIBVPX) +#endif -#if !defined(OS_ANDROID) +#if !defined(MEDIA_DISABLE_FFMPEG) video_decoders.push_back(new FFmpegVideoDecoder(media_task_runner)); #endif diff --git a/media/test/pipeline_integration_test_base.cc b/media/test/pipeline_integration_test_base.cc index 683a334..81cda84 100644 --- a/media/test/pipeline_integration_test_base.cc +++ b/media/test/pipeline_integration_test_base.cc @@ -11,13 +11,17 @@ #include "media/base/test_data_util.h" #include "media/filters/audio_renderer_impl.h" #include "media/filters/chunk_demuxer.h" +#if !defined(MEDIA_DISABLE_FFMPEG) #include "media/filters/ffmpeg_audio_decoder.h" #include "media/filters/ffmpeg_demuxer.h" #include "media/filters/ffmpeg_video_decoder.h" +#endif #include "media/filters/file_data_source.h" #include "media/filters/opus_audio_decoder.h" #include "media/filters/renderer_impl.h" +#if !defined(MEDIA_DISABLE_LIBVPX) #include "media/filters/vpx_video_decoder.h" +#endif using ::testing::_; using ::testing::AnyNumber; @@ -208,9 +212,12 @@ void PipelineIntegrationTestBase::CreateDemuxer(const std::string& filename) { Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb = base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, base::Unretained(this)); + +#if !defined(MEDIA_DISABLE_FFMPEG) demuxer_ = scoped_ptr<Demuxer>( new FFmpegDemuxer(message_loop_.message_loop_proxy(), data_source_.get(), encrypted_media_init_data_cb, new MediaLog())); +#endif } scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { @@ -219,8 +226,11 @@ scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { video_decoders.push_back( new VpxVideoDecoder(message_loop_.message_loop_proxy())); #endif // !defined(MEDIA_DISABLE_LIBVPX) + +#if !defined(MEDIA_DISABLE_FFMPEG) video_decoders.push_back( new FFmpegVideoDecoder(message_loop_.message_loop_proxy())); +#endif // Disable frame dropping if hashing is enabled. scoped_ptr<VideoRenderer> video_renderer( @@ -234,8 +244,12 @@ scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() { } ScopedVector<AudioDecoder> audio_decoders; + +#if !defined(MEDIA_DISABLE_FFMPEG) audio_decoders.push_back( new FFmpegAudioDecoder(message_loop_.message_loop_proxy(), LogCB())); +#endif + audio_decoders.push_back( new OpusAudioDecoder(message_loop_.message_loop_proxy())); |