New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 596252 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Jan 18
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 327115



Sign in to add a comment

Use BUILDFLAG in media

Project Member Reported by xhw...@chromium.org, Mar 19 2016

Issue description

Comment 1 by xhw...@chromium.org, Mar 22 2016

Labels: Hotlist-CodeHealth

Comment 2 by xhw...@chromium.org, Mar 24 2016

To clarify, this applies to both GN and GYP builds. But it might be easier to do this transition after GYP is deprecated (half work :))
Project Member

Comment 3 by bugdroid1@chromium.org, Mar 24 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2476ed2fc01e9d8a9603e8b3bb7e7bd311e26afa

commit 2476ed2fc01e9d8a9603e8b3bb7e7bd311e26afa
Author: xhwang <xhwang@chromium.org>
Date: Thu Mar 24 17:39:25 2016

media: Fix typo in USE_PROPRIETARY_CODECS check.

This is a good example why BUILDFLAG would be better. See  issue 596252 
for the bug to track using BUILDFLAG in media.

BUG= 596252 
TEST=Initdata parsing works now.

Review URL: https://codereview.chromium.org/1828153002

Cr-Commit-Position: refs/heads/master@{#383089}

[modify] https://crrev.com/2476ed2fc01e9d8a9603e8b3bb7e7bd311e26afa/components/cdm/browser/widevine_drm_delegate_android.cc

Blocking: 327115
As we switch mechanisms, it might be a good time to separate support for proprietary codecs from some of the containers that contain them (both currently controlled by USE_PROPRIETARY_CODECS). For example,  issue 327115 .
 Issue 605182  has been merged into this issue.
Cc: brettw@chromium.org
Most buildflags are simple mapping from gn args. However, mojo media does use something fancy, e.g. define macros based on the elements of a list:

https://cs.chromium.org/chromium/src/media/mojo/services/BUILD.gn?rcl=0&l=10

I don't see existing examples how to do this. 

brettw: Before I dive in and try do you have any idea on how to do this? Or are there any examples to follow? Thanks!
GN doesn't do easy inclusion-based tests. Can you describe the design?
It's described here:

https://cs.chromium.org/chromium/src/media/media_options.gni?rcl=0&l=98

For example, I can specify this gn arg:

mojo_media_services = [
  "cdm",
  "audio_decoder",
]

Today it'll define ENABLE_MOJO_CDM and ENABLE_MOJO_AUDIO_DECODER [1]. Note that I use foreach to get each element of the list, and then check each element to define the macro. I wonder whether I can do something similar with buildflags.

[1] https://cs.chromium.org/chromium/src/media/mojo/services/BUILD.gn?rcl=0&l=23
Project Member

Comment 9 by bugdroid1@chromium.org, Jan 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/59123b612a37738072b80870dfd18a7e8eaae241

commit 59123b612a37738072b80870dfd18a7e8eaae241
Author: xhwang <xhwang@chromium.org>
Date: Fri Jan 06 01:19:42 2017

media: Fix ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS check

Replace

 if (ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)

with

 if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS)

The former was working because some compilers predefine FOO to be 1 when
-DFOO is specified. For example:
https://gcc.gnu.org/onlinedocs/gcc/Preprocessor-Options.html

But I am not sure whether this is true for all compilers. Hence we
probably should not depend on it.

Long term, we should switch to use BUILDFLAG to avoid this.

TBR=mkwst@chromium.org
BUG= 596252 

Review-Url: https://codereview.chromium.org/2616703005
Cr-Commit-Position: refs/heads/master@{#441782}

[modify] https://crrev.com/59123b612a37738072b80870dfd18a7e8eaae241/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/59123b612a37738072b80870dfd18a7e8eaae241/content/shell/browser/shell_content_browser_client.cc

The build flags just need to end up with a list in the buildflag_header target. So any way you can generate that list will work, including something similar to the way you used to do it.
Cool, thanks! I'll give it a try.
Project Member

Comment 12 by bugdroid1@chromium.org, May 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9d5f354616dea455ea08345c96b67081275a865d

commit 9d5f354616dea455ea08345c96b67081275a865d
Author: xhwang <xhwang@chromium.org>
Date: Sat May 13 03:57:41 2017

media: Add mojo_media_config to media/gpu configs

Otherwise, macros like ENABLE_MOJO_MEDIA_IN_GPU_PROCESS are not defined.
We should switch to use BUILDFLAG to prevent this from happening, that
is tracked by  issue 596252 .

BUG= 596252 ,721935
TEST=Manually tested encrypted playback.
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2876123004
Cr-Commit-Position: refs/heads/master@{#471553}

[modify] https://crrev.com/9d5f354616dea455ea08345c96b67081275a865d/media/gpu/BUILD.gn

Project Member

Comment 13 by bugdroid1@chromium.org, May 20 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/db24d60f03a20d0efbe35a390def732c6105b403

commit db24d60f03a20d0efbe35a390def732c6105b403
Author: xhwang <xhwang@chromium.org>
Date: Sat May 20 06:32:24 2017

media: Convert mojo media defines to buildflags

BUG= 596252 
TEST=No functionality change
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2882813002
Cr-Commit-Position: refs/heads/master@{#473421}

[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/chrome/browser/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/chrome/browser/chrome_content_browser_client.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/chromecast/browser/cast_content_browser_client.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/browser/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/browser/browser_main_loop.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/browser/media/encrypted_media_browsertest.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/browser/media/media_interface_proxy.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/browser/renderer_host/render_process_host_browsertest.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/browser/service_manager/service_manager_context.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/browser/webrtc/webrtc_capture_from_element_browsertest.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/gpu/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/gpu/gpu_service_factory.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/gpu/gpu_service_factory.h
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/renderer/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/renderer/render_frame_impl.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/renderer/render_frame_impl.h
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/shell/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/shell/browser/shell_content_browser_client.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/shell/renderer/shell_content_renderer_client.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/shell/renderer/shell_content_renderer_client.h
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/utility/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/content/utility/utility_service_factory.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/gpu/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/gpu/android_video_decode_accelerator.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/mojo/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/mojo/clients/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/mojo/clients/mojo_cdm_factory.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/mojo/clients/mojo_decoder_factory.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/mojo/services/BUILD.gn
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/mojo/services/interface_factory_impl.cc
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/mojo/services/interface_factory_impl.h
[modify] https://crrev.com/db24d60f03a20d0efbe35a390def732c6105b403/media/mojo/services/media_service_unittest.cc

Labels: Hotlist-Fixit
We still have a few defines to be converted. I'll keep this bug open until those are fixed as well.

https://cs.chromium.org/search/?q=define+file:BUILD.gn+file:%5Esrc/media/+package:%5Echromium$&type=cs
Project Member

Comment 15 by bugdroid1@chromium.org, Jan 17 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/bcf523b9595b64c082fceade6f9900b9a8723cda

commit bcf523b9595b64c082fceade6f9900b9a8723cda
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Wed Jan 17 02:59:01 2018

Switch various media #defines to BUILDFLAGS.

Converts the following to buildflags:
- MEDIA_DISABLE_FFMPEG becomes ENABLE_FFMPEG, but keeps media_use_ffmpeg
as the GN variable due to external users.
- MEDIA_DISABLE_LIBVPX becomes ENABLE_LIBVPX, but keeps media_use_libvpx
as the GN variable due to external users.
- DISABLE_FFMPEG_VIDEO_DECODERS becomes ENABLE_FFMPEG_VIDEO_DECODERS and
the GN variable changes to enable_ffmpeg_video_decoders due to no
external users AFAIK.

Some incorrect usages of just MEDIA_DISABLE_FFMPEG to gate H264 support
and some less-efficient usages of !MEDIA_DISABLE_FFMPEG + !ANDROID are
replaced with the correct ENABLE_FFMPEG_VIDEO_DECODERS instead.

BUG= 596252 
TEST=compiles normally

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Iab4548feabab60d7fbed4144457f0be9f2e98f47
Reviewed-on: https://chromium-review.googlesource.com/865520
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Thomas Guilbert <tguilbert@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#529559}
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/chrome/browser/about_flags.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/chrome/services/media_gallery_util/BUILD.gn
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/chrome/services/media_gallery_util/media_metadata_parser.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/chrome/services/media_gallery_util/media_parser.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/content/browser/media/media_canplaytype_browsertest.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/content/public/common/BUILD.gn
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/content/public/common/feature_h264_with_openh264_ffmpeg.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/content/public/common/feature_h264_with_openh264_ffmpeg.h
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/content/renderer/media/audio_decoder.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/content/renderer/media/gpu/rtc_video_encoder_factory.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/content/renderer/pepper/video_decoder_shim.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/BUILD.gn
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/base/BUILD.gn
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/base/decode_capabilities.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/base/media.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/base/mime_util_internal.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/blink/webmediaplayer_impl.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/ffmpeg/ffmpeg_common.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/filters/BUILD.gn
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/filters/vpx_video_decoder.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/media_options.gni
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/renderers/BUILD.gn
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/renderers/default_renderer_factory.cc
[modify] https://crrev.com/bcf523b9595b64c082fceade6f9900b9a8723cda/media/test/pipeline_integration_test_base.cc

All the defines which wiggled their way outside of media/ are fixed, there are a couple media internal ones like USE_CRAS, USE_NEON, etc:

https://cs.chromium.org/chromium/src/media/BUILD.gn?l=47
Project Member

Comment 17 by sheriffbot@chromium.org, Jan 18 (5 days ago)

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 18 by dalecur...@chromium.org, Jan 18 (5 days ago)

Status: Fixed (was: Untriaged)
Summary: Use BUILDFLAG in media (was: Use BUILDFLAG in media.)
Marking as fixed, the remaining ones are internal only defines for audio code. They can be converted, but aren't entirely necessary.

Sign in to add a comment