summaryrefslogtreecommitdiff
path: root/chromium/media
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-11-28 16:14:41 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-12-13 15:19:41 +0000
commit61d9742824d54be5693191fe502325a909feca59 (patch)
treecbf28e779b11338fe52eb75b915684cd8955542c /chromium/media
parent45f9ded08bb7526984b24ccb5a5327aaf6821676 (diff)
downloadqtwebengine-chromium-61d9742824d54be5693191fe502325a909feca59.tar.gz
BASELINE: Update Chromium to 108.0.5359.70
Change-Id: I77334ff232b819600f275bd3cfe41fbaa3619230 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/445904 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/media')
-rw-r--r--chromium/media/BUILD.gn10
-rw-r--r--chromium/media/OWNERS1
-rw-r--r--chromium/media/PRESUBMIT.py2
-rwxr-xr-xchromium/media/PRESUBMIT_test.py2
-rw-r--r--chromium/media/audio/BUILD.gn31
-rw-r--r--chromium/media/audio/aecdump_recording_manager.cc125
-rw-r--r--chromium/media/audio/aecdump_recording_manager.h96
-rw-r--r--chromium/media/audio/aecdump_recording_manager_unittest.cc238
-rw-r--r--chromium/media/audio/agc_audio_stream.h2
-rw-r--r--chromium/media/audio/alive_checker.cc2
-rw-r--r--chromium/media/audio/alive_checker.h2
-rw-r--r--chromium/media/audio/alive_checker_unittest.cc2
-rw-r--r--chromium/media/audio/alsa/alsa_input.cc2
-rw-r--r--chromium/media/audio/alsa/alsa_input.h2
-rw-r--r--chromium/media/audio/alsa/alsa_output.cc2
-rw-r--r--chromium/media/audio/alsa/alsa_output.h2
-rw-r--r--chromium/media/audio/alsa/alsa_output_unittest.cc9
-rw-r--r--chromium/media/audio/alsa/alsa_util.cc2
-rw-r--r--chromium/media/audio/alsa/alsa_util.h2
-rw-r--r--chromium/media/audio/alsa/alsa_util_unittest.cc2
-rw-r--r--chromium/media/audio/alsa/alsa_wrapper.cc2
-rw-r--r--chromium/media/audio/alsa/alsa_wrapper.h2
-rw-r--r--chromium/media/audio/alsa/audio_manager_alsa.cc12
-rw-r--r--chromium/media/audio/alsa/audio_manager_alsa.h2
-rw-r--r--chromium/media/audio/alsa/mock_alsa_wrapper.cc2
-rw-r--r--chromium/media/audio/alsa/mock_alsa_wrapper.h2
-rw-r--r--chromium/media/audio/android/aaudio.sigs2
-rw-r--r--chromium/media/audio/android/aaudio_output.cc2
-rw-r--r--chromium/media/audio/android/aaudio_output.h2
-rw-r--r--chromium/media/audio/android/audio_android_unittest.cc4
-rw-r--r--chromium/media/audio/android/audio_manager_android.cc31
-rw-r--r--chromium/media/audio/android/audio_manager_android.h4
-rw-r--r--chromium/media/audio/android/audio_track_output_stream.cc3
-rw-r--r--chromium/media/audio/android/audio_track_output_stream.h2
-rw-r--r--chromium/media/audio/android/muteable_audio_output_stream.h2
-rw-r--r--chromium/media/audio/android/opensles_input.cc2
-rw-r--r--chromium/media/audio/android/opensles_input.h2
-rw-r--r--chromium/media/audio/android/opensles_output.cc2
-rw-r--r--chromium/media/audio/android/opensles_output.h2
-rw-r--r--chromium/media/audio/android/opensles_util.cc2
-rw-r--r--chromium/media/audio/android/opensles_util.h2
-rw-r--r--chromium/media/audio/android/opensles_wrapper.cc2
-rw-r--r--chromium/media/audio/audio_bus_pool.cc60
-rw-r--r--chromium/media/audio/audio_bus_pool.h76
-rw-r--r--chromium/media/audio/audio_bus_pool_unittest.cc120
-rw-r--r--chromium/media/audio/audio_debug_file_writer.cc173
-rw-r--r--chromium/media/audio/audio_debug_file_writer.h90
-rw-r--r--chromium/media/audio/audio_debug_file_writer_unittest.cc250
-rw-r--r--chromium/media/audio/audio_debug_recording_helper.cc101
-rw-r--r--chromium/media/audio/audio_debug_recording_helper.h49
-rw-r--r--chromium/media/audio/audio_debug_recording_helper_unittest.cc145
-rw-r--r--chromium/media/audio/audio_debug_recording_manager.cc26
-rw-r--r--chromium/media/audio/audio_debug_recording_manager.h17
-rw-r--r--chromium/media/audio/audio_debug_recording_manager_unittest.cc24
-rw-r--r--chromium/media/audio/audio_debug_recording_session.h2
-rw-r--r--chromium/media/audio/audio_debug_recording_test.cc2
-rw-r--r--chromium/media/audio/audio_debug_recording_test.h2
-rw-r--r--chromium/media/audio/audio_device_description.cc2
-rw-r--r--chromium/media/audio/audio_device_description.h2
-rw-r--r--chromium/media/audio/audio_device_info_accessor_for_tests.cc2
-rw-r--r--chromium/media/audio/audio_device_info_accessor_for_tests.h2
-rw-r--r--chromium/media/audio/audio_device_name.cc2
-rw-r--r--chromium/media/audio/audio_device_name.h2
-rw-r--r--chromium/media/audio/audio_device_thread.cc2
-rw-r--r--chromium/media/audio/audio_device_thread.h2
-rw-r--r--chromium/media/audio/audio_encoders_unittest.cc18
-rw-r--r--chromium/media/audio/audio_features.cc89
-rw-r--r--chromium/media/audio/audio_features.h34
-rw-r--r--chromium/media/audio/audio_input_delegate.cc2
-rw-r--r--chromium/media/audio/audio_input_delegate.h2
-rw-r--r--chromium/media/audio/audio_input_device.cc2
-rw-r--r--chromium/media/audio/audio_input_device.h2
-rw-r--r--chromium/media/audio/audio_input_device_unittest.cc6
-rw-r--r--chromium/media/audio/audio_input_ipc.cc2
-rw-r--r--chromium/media/audio/audio_input_ipc.h2
-rw-r--r--chromium/media/audio/audio_input_stream_data_interceptor.cc2
-rw-r--r--chromium/media/audio/audio_input_stream_data_interceptor.h2
-rw-r--r--chromium/media/audio/audio_input_stream_data_interceptor_unittest.cc2
-rw-r--r--chromium/media/audio/audio_input_unittest.cc2
-rw-r--r--chromium/media/audio/audio_io.cc2
-rw-r--r--chromium/media/audio/audio_io.h2
-rw-r--r--chromium/media/audio/audio_logging.h2
-rw-r--r--chromium/media/audio/audio_low_latency_input_output_unittest.cc8
-rw-r--r--chromium/media/audio/audio_manager.cc2
-rw-r--r--chromium/media/audio/audio_manager.h8
-rw-r--r--chromium/media/audio/audio_manager_base.cc56
-rw-r--r--chromium/media/audio/audio_manager_base.h11
-rw-r--r--chromium/media/audio/audio_manager_unittest.cc136
-rw-r--r--chromium/media/audio/audio_opus_encoder.cc14
-rw-r--r--chromium/media/audio/audio_opus_encoder.h2
-rw-r--r--chromium/media/audio/audio_output_delegate.cc2
-rw-r--r--chromium/media/audio/audio_output_delegate.h2
-rw-r--r--chromium/media/audio/audio_output_device.cc2
-rw-r--r--chromium/media/audio/audio_output_device.h2
-rw-r--r--chromium/media/audio/audio_output_device_thread_callback.cc2
-rw-r--r--chromium/media/audio/audio_output_device_thread_callback.h2
-rw-r--r--chromium/media/audio/audio_output_device_unittest.cc4
-rw-r--r--chromium/media/audio/audio_output_dispatcher.cc2
-rw-r--r--chromium/media/audio/audio_output_dispatcher.h2
-rw-r--r--chromium/media/audio/audio_output_dispatcher_impl.cc2
-rw-r--r--chromium/media/audio/audio_output_dispatcher_impl.h2
-rw-r--r--chromium/media/audio/audio_output_ipc.cc2
-rw-r--r--chromium/media/audio/audio_output_ipc.h2
-rw-r--r--chromium/media/audio/audio_output_proxy.cc2
-rw-r--r--chromium/media/audio/audio_output_proxy.h2
-rw-r--r--chromium/media/audio/audio_output_proxy_unittest.cc9
-rw-r--r--chromium/media/audio/audio_output_resampler.cc2
-rw-r--r--chromium/media/audio/audio_output_resampler.h2
-rw-r--r--chromium/media/audio/audio_output_stream_sink.cc2
-rw-r--r--chromium/media/audio/audio_output_stream_sink.h2
-rw-r--r--chromium/media/audio/audio_output_unittest.cc2
-rw-r--r--chromium/media/audio/audio_sink_parameters.cc2
-rw-r--r--chromium/media/audio/audio_sink_parameters.h2
-rw-r--r--chromium/media/audio/audio_source_parameters.cc2
-rw-r--r--chromium/media/audio/audio_source_parameters.h2
-rw-r--r--chromium/media/audio/audio_system.cc2
-rw-r--r--chromium/media/audio/audio_system.h2
-rw-r--r--chromium/media/audio/audio_system_helper.cc5
-rw-r--r--chromium/media/audio/audio_system_helper.h2
-rw-r--r--chromium/media/audio/audio_system_impl.cc3
-rw-r--r--chromium/media/audio/audio_system_impl.h2
-rw-r--r--chromium/media/audio/audio_system_impl_unittest.cc2
-rw-r--r--chromium/media/audio/audio_system_test_util.cc2
-rw-r--r--chromium/media/audio/audio_system_test_util.h26
-rw-r--r--chromium/media/audio/audio_thread.h2
-rw-r--r--chromium/media/audio/audio_thread_hang_monitor.cc2
-rw-r--r--chromium/media/audio/audio_thread_hang_monitor.h2
-rw-r--r--chromium/media/audio/audio_thread_hang_monitor_unittest.cc2
-rw-r--r--chromium/media/audio/audio_thread_impl.cc2
-rw-r--r--chromium/media/audio/audio_thread_impl.h2
-rw-r--r--chromium/media/audio/audio_unittest_util.cc2
-rw-r--r--chromium/media/audio/audio_unittest_util.h2
-rw-r--r--chromium/media/audio/clockless_audio_sink.cc2
-rw-r--r--chromium/media/audio/clockless_audio_sink.h2
-rw-r--r--chromium/media/audio/cras/audio_manager_chromeos.cc31
-rw-r--r--chromium/media/audio/cras/audio_manager_chromeos.h2
-rw-r--r--chromium/media/audio/cras/audio_manager_chromeos_unittest.cc6
-rw-r--r--chromium/media/audio/cras/audio_manager_cras.cc25
-rw-r--r--chromium/media/audio/cras/audio_manager_cras.h2
-rw-r--r--chromium/media/audio/cras/audio_manager_cras_base.cc24
-rw-r--r--chromium/media/audio/cras/audio_manager_cras_base.h16
-rw-r--r--chromium/media/audio/cras/audio_manager_cras_base_unittest.cc90
-rw-r--r--chromium/media/audio/cras/audio_manager_cras_unittest.cc2
-rw-r--r--chromium/media/audio/cras/cras_input.cc32
-rw-r--r--chromium/media/audio/cras/cras_input.h18
-rw-r--r--chromium/media/audio/cras/cras_input_unittest.cc64
-rw-r--r--chromium/media/audio/cras/cras_unified.cc2
-rw-r--r--chromium/media/audio/cras/cras_unified.h2
-rw-r--r--chromium/media/audio/cras/cras_unified_unittest.cc23
-rw-r--r--chromium/media/audio/cras/cras_util.cc2
-rw-r--r--chromium/media/audio/cras/cras_util.h2
-rw-r--r--chromium/media/audio/fake_audio_input_stream.cc2
-rw-r--r--chromium/media/audio/fake_audio_input_stream.h2
-rw-r--r--chromium/media/audio/fake_audio_log_factory.cc2
-rw-r--r--chromium/media/audio/fake_audio_log_factory.h2
-rw-r--r--chromium/media/audio/fake_audio_manager.cc14
-rw-r--r--chromium/media/audio/fake_audio_manager.h2
-rw-r--r--chromium/media/audio/fake_audio_output_stream.cc2
-rw-r--r--chromium/media/audio/fake_audio_output_stream.h2
-rw-r--r--chromium/media/audio/fuchsia/audio_input_stream_fuchsia.cc2
-rw-r--r--chromium/media/audio/fuchsia/audio_input_stream_fuchsia.h2
-rw-r--r--chromium/media/audio/fuchsia/audio_input_stream_fuchsia_test.cc38
-rw-r--r--chromium/media/audio/fuchsia/audio_manager_fuchsia.cc58
-rw-r--r--chromium/media/audio/fuchsia/audio_manager_fuchsia.h3
-rw-r--r--chromium/media/audio/fuchsia/audio_output_stream_fuchsia.cc49
-rw-r--r--chromium/media/audio/fuchsia/audio_output_stream_fuchsia.h6
-rw-r--r--chromium/media/audio/linux/audio_manager_linux.cc2
-rw-r--r--chromium/media/audio/mac/audio_auhal_mac.cc2
-rw-r--r--chromium/media/audio/mac/audio_auhal_mac.h2
-rw-r--r--chromium/media/audio/mac/audio_auhal_mac_unittest.cc2
-rw-r--r--chromium/media/audio/mac/audio_device_listener_mac.cc2
-rw-r--r--chromium/media/audio/mac/audio_device_listener_mac.h2
-rw-r--r--chromium/media/audio/mac/audio_device_listener_mac_unittest.cc4
-rw-r--r--chromium/media/audio/mac/audio_input_mac.cc2
-rw-r--r--chromium/media/audio/mac/audio_input_mac.h2
-rw-r--r--chromium/media/audio/mac/audio_low_latency_input_mac.cc2
-rw-r--r--chromium/media/audio/mac/audio_low_latency_input_mac.h2
-rw-r--r--chromium/media/audio/mac/audio_low_latency_input_mac_unittest.cc15
-rw-r--r--chromium/media/audio/mac/audio_manager_mac.cc24
-rw-r--r--chromium/media/audio/mac/audio_manager_mac.h2
-rw-r--r--chromium/media/audio/mac/core_audio_util_mac.cc5
-rw-r--r--chromium/media/audio/mac/core_audio_util_mac.h2
-rw-r--r--chromium/media/audio/mac/coreaudio_dispatch_override.cc2
-rw-r--r--chromium/media/audio/mac/coreaudio_dispatch_override.h2
-rw-r--r--chromium/media/audio/mac/scoped_audio_unit.cc2
-rw-r--r--chromium/media/audio/mac/scoped_audio_unit.h2
-rw-r--r--chromium/media/audio/mock_aecdump_recording_manager.cc17
-rw-r--r--chromium/media/audio/mock_aecdump_recording_manager.h34
-rw-r--r--chromium/media/audio/mock_audio_debug_recording_manager.cc6
-rw-r--r--chromium/media/audio/mock_audio_debug_recording_manager.h5
-rw-r--r--chromium/media/audio/mock_audio_manager.cc11
-rw-r--r--chromium/media/audio/mock_audio_manager.h5
-rw-r--r--chromium/media/audio/mock_audio_source_callback.cc2
-rw-r--r--chromium/media/audio/mock_audio_source_callback.h2
-rw-r--r--chromium/media/audio/null_audio_sink.cc2
-rw-r--r--chromium/media/audio/null_audio_sink.h2
-rw-r--r--chromium/media/audio/power_observer_helper.cc2
-rw-r--r--chromium/media/audio/power_observer_helper.h2
-rw-r--r--chromium/media/audio/power_observer_helper_unittest.cc2
-rw-r--r--chromium/media/audio/pulse/audio_manager_pulse.cc14
-rw-r--r--chromium/media/audio/pulse/audio_manager_pulse.h2
-rw-r--r--chromium/media/audio/pulse/pulse.sigs2
-rw-r--r--chromium/media/audio/pulse/pulse_input.cc2
-rw-r--r--chromium/media/audio/pulse/pulse_input.h2
-rw-r--r--chromium/media/audio/pulse/pulse_output.cc4
-rw-r--r--chromium/media/audio/pulse/pulse_output.h2
-rw-r--r--chromium/media/audio/pulse/pulse_util.cc2
-rw-r--r--chromium/media/audio/pulse/pulse_util.h2
-rw-r--r--chromium/media/audio/scoped_task_runner_observer.cc2
-rw-r--r--chromium/media/audio/scoped_task_runner_observer.h2
-rw-r--r--chromium/media/audio/simple_sources.cc4
-rw-r--r--chromium/media/audio/simple_sources.h2
-rw-r--r--chromium/media/audio/simple_sources_unittest.cc13
-rw-r--r--chromium/media/audio/system_glitch_reporter.cc2
-rw-r--r--chromium/media/audio/system_glitch_reporter.h2
-rw-r--r--chromium/media/audio/test_audio_thread.cc2
-rw-r--r--chromium/media/audio/test_audio_thread.h2
-rw-r--r--chromium/media/audio/test_data.h2
-rw-r--r--chromium/media/audio/wav_audio_handler.cc2
-rw-r--r--chromium/media/audio/wav_audio_handler.h2
-rw-r--r--chromium/media/audio/wav_audio_handler_fuzzer.cc2
-rw-r--r--chromium/media/audio/wav_audio_handler_unittest.cc2
-rw-r--r--chromium/media/audio/win/audio_device_listener_win.cc2
-rw-r--r--chromium/media/audio/win/audio_device_listener_win.h2
-rw-r--r--chromium/media/audio/win/audio_device_listener_win_unittest.cc2
-rw-r--r--chromium/media/audio/win/audio_edid_scan_win.cc185
-rw-r--r--chromium/media/audio/win/audio_edid_scan_win.h36
-rw-r--r--chromium/media/audio/win/audio_low_latency_input_win.cc22
-rw-r--r--chromium/media/audio/win/audio_low_latency_input_win.h2
-rw-r--r--chromium/media/audio/win/audio_low_latency_input_win_unittest.cc12
-rw-r--r--chromium/media/audio/win/audio_low_latency_output_win.cc50
-rw-r--r--chromium/media/audio/win/audio_low_latency_output_win.h5
-rw-r--r--chromium/media/audio/win/audio_low_latency_output_win_unittest.cc7
-rw-r--r--chromium/media/audio/win/audio_manager_win.cc103
-rw-r--r--chromium/media/audio/win/audio_manager_win.h16
-rw-r--r--chromium/media/audio/win/audio_output_win_unittest.cc40
-rw-r--r--chromium/media/audio/win/audio_session_event_listener_win.cc2
-rw-r--r--chromium/media/audio/win/audio_session_event_listener_win.h2
-rw-r--r--chromium/media/audio/win/audio_session_event_listener_win_unittest.cc2
-rw-r--r--chromium/media/audio/win/avrt_wrapper_win.cc2
-rw-r--r--chromium/media/audio/win/avrt_wrapper_win.h2
-rw-r--r--chromium/media/audio/win/core_audio_util_win.cc26
-rw-r--r--chromium/media/audio/win/core_audio_util_win.h2
-rw-r--r--chromium/media/audio/win/core_audio_util_win_unittest.cc2
-rw-r--r--chromium/media/audio/win/device_enumeration_win.cc2
-rw-r--r--chromium/media/audio/win/device_enumeration_win.h2
-rw-r--r--chromium/media/audio/win/device_enumeration_win_unittest.cc2
-rw-r--r--chromium/media/audio/win/volume_range_util.cc2
-rw-r--r--chromium/media/audio/win/volume_range_util.h2
-rw-r--r--chromium/media/audio/win/volume_range_util_unittest.cc2
-rw-r--r--chromium/media/audio/win/waveout_output_win.cc2
-rw-r--r--chromium/media/audio/win/waveout_output_win.h2
-rw-r--r--chromium/media/base/BUILD.gn8
-rw-r--r--chromium/media/base/android/BUILD.gn2
-rw-r--r--chromium/media/base/android/android_cdm_factory.cc2
-rw-r--r--chromium/media/base/android/android_cdm_factory.h2
-rw-r--r--chromium/media/base/android/android_overlay.cc2
-rw-r--r--chromium/media/base/android/android_overlay.h2
-rw-r--r--chromium/media/base/android/android_util.cc2
-rw-r--r--chromium/media/base/android/android_util.h2
-rw-r--r--chromium/media/base/android/extract_sps_and_pps.cc2
-rw-r--r--chromium/media/base/android/extract_sps_and_pps.h2
-rw-r--r--chromium/media/base/android/jni_hdr_metadata.cc2
-rw-r--r--chromium/media/base/android/jni_hdr_metadata.h2
-rw-r--r--chromium/media/base/android/media_codec_bridge.h2
-rw-r--r--chromium/media/base/android/media_codec_bridge_impl.cc2
-rw-r--r--chromium/media/base/android/media_codec_bridge_impl.h2
-rw-r--r--chromium/media/base/android/media_codec_bridge_impl_unittest.cc2
-rw-r--r--chromium/media/base/android/media_codec_direction.h2
-rw-r--r--chromium/media/base/android/media_codec_loop.cc2
-rw-r--r--chromium/media/base/android/media_codec_loop.h2
-rw-r--r--chromium/media/base/android/media_codec_loop_unittest.cc6
-rw-r--r--chromium/media/base/android/media_codec_util.cc62
-rw-r--r--chromium/media/base/android/media_codec_util.h7
-rw-r--r--chromium/media/base/android/media_codec_util_unittest.cc5
-rw-r--r--chromium/media/base/android/media_common_android.h2
-rw-r--r--chromium/media/base/android/media_crypto_context.h2
-rw-r--r--chromium/media/base/android/media_crypto_context_impl.cc2
-rw-r--r--chromium/media/base/android/media_crypto_context_impl.h2
-rw-r--r--chromium/media/base/android/media_drm_bridge.cc2
-rw-r--r--chromium/media/base/android/media_drm_bridge.h2
-rw-r--r--chromium/media/base/android/media_drm_bridge_client.cc2
-rw-r--r--chromium/media/base/android/media_drm_bridge_client.h2
-rw-r--r--chromium/media/base/android/media_drm_bridge_delegate.cc2
-rw-r--r--chromium/media/base/android/media_drm_bridge_delegate.h2
-rw-r--r--chromium/media/base/android/media_drm_bridge_factory.cc2
-rw-r--r--chromium/media/base/android/media_drm_bridge_factory.h2
-rw-r--r--chromium/media/base/android/media_drm_bridge_unittest.cc36
-rw-r--r--chromium/media/base/android/media_drm_storage_bridge.cc2
-rw-r--r--chromium/media/base/android/media_drm_storage_bridge.h2
-rw-r--r--chromium/media/base/android/media_player_bridge.cc2
-rw-r--r--chromium/media/base/android/media_player_bridge.h2
-rw-r--r--chromium/media/base/android/media_player_bridge_unittest.cc2
-rw-r--r--chromium/media/base/android/media_player_listener.cc2
-rw-r--r--chromium/media/base/android/media_player_listener.h2
-rw-r--r--chromium/media/base/android/media_resource_getter.cc2
-rw-r--r--chromium/media/base/android/media_resource_getter.h2
-rw-r--r--chromium/media/base/android/media_server_crash_listener.cc2
-rw-r--r--chromium/media/base/android/media_server_crash_listener.h2
-rw-r--r--chromium/media/base/android/media_service_throttler.cc2
-rw-r--r--chromium/media/base/android/media_service_throttler.h2
-rw-r--r--chromium/media/base/android/media_service_throttler_unittest.cc2
-rw-r--r--chromium/media/base/android/media_url_interceptor.h2
-rw-r--r--chromium/media/base/android/mock_android_overlay.cc2
-rw-r--r--chromium/media/base/android/mock_android_overlay.h2
-rw-r--r--chromium/media/base/android/mock_media_codec_bridge.cc2
-rw-r--r--chromium/media/base/android/mock_media_codec_bridge.h2
-rw-r--r--chromium/media/base/android/mock_media_crypto_context.cc2
-rw-r--r--chromium/media/base/android/mock_media_crypto_context.h2
-rw-r--r--chromium/media/base/android/stream_texture_wrapper.h2
-rw-r--r--chromium/media/base/android/test_destruction_observable.cc2
-rw-r--r--chromium/media/base/android/test_destruction_observable.h2
-rw-r--r--chromium/media/base/android_overlay_config.cc2
-rw-r--r--chromium/media/base/android_overlay_config.h2
-rw-r--r--chromium/media/base/android_overlay_mojo_factory.h2
-rw-r--r--chromium/media/base/async_destroy_video_decoder.h2
-rw-r--r--chromium/media/base/async_destroy_video_encoder.h2
-rw-r--r--chromium/media/base/audio_block_fifo.cc2
-rw-r--r--chromium/media/base/audio_block_fifo.h2
-rw-r--r--chromium/media/base/audio_block_fifo_unittest.cc2
-rw-r--r--chromium/media/base/audio_buffer.cc23
-rw-r--r--chromium/media/base/audio_buffer.h2
-rw-r--r--chromium/media/base/audio_buffer_converter.cc6
-rw-r--r--chromium/media/base/audio_buffer_converter.h2
-rw-r--r--chromium/media/base/audio_buffer_converter_unittest.cc17
-rw-r--r--chromium/media/base/audio_buffer_queue.cc2
-rw-r--r--chromium/media/base/audio_buffer_queue.h2
-rw-r--r--chromium/media/base/audio_buffer_queue_unittest.cc2
-rw-r--r--chromium/media/base/audio_buffer_unittest.cc65
-rw-r--r--chromium/media/base/audio_bus.cc3
-rw-r--r--chromium/media/base/audio_bus.h2
-rw-r--r--chromium/media/base/audio_bus_perftest.cc2
-rw-r--r--chromium/media/base/audio_bus_unittest.cc13
-rw-r--r--chromium/media/base/audio_capturer_source.h2
-rw-r--r--chromium/media/base/audio_codecs.cc2
-rw-r--r--chromium/media/base/audio_codecs.h2
-rw-r--r--chromium/media/base/audio_converter.cc10
-rw-r--r--chromium/media/base/audio_converter.h2
-rw-r--r--chromium/media/base/audio_converter_perftest.cc13
-rw-r--r--chromium/media/base/audio_converter_unittest.cc32
-rw-r--r--chromium/media/base/audio_decoder.cc2
-rw-r--r--chromium/media/base/audio_decoder.h2
-rw-r--r--chromium/media/base/audio_decoder_config.cc2
-rw-r--r--chromium/media/base/audio_decoder_config.h2
-rw-r--r--chromium/media/base/audio_discard_helper.cc2
-rw-r--r--chromium/media/base/audio_discard_helper.h2
-rw-r--r--chromium/media/base/audio_discard_helper_unittest.cc2
-rw-r--r--chromium/media/base/audio_encoder.cc2
-rw-r--r--chromium/media/base/audio_encoder.h2
-rw-r--r--chromium/media/base/audio_fifo.cc2
-rw-r--r--chromium/media/base/audio_fifo.h2
-rw-r--r--chromium/media/base/audio_fifo_unittest.cc2
-rw-r--r--chromium/media/base/audio_hash.cc2
-rw-r--r--chromium/media/base/audio_hash.h2
-rw-r--r--chromium/media/base/audio_hash_unittest.cc2
-rw-r--r--chromium/media/base/audio_latency.cc36
-rw-r--r--chromium/media/base/audio_latency.h2
-rw-r--r--chromium/media/base/audio_latency_unittest.cc10
-rw-r--r--chromium/media/base/audio_parameters.cc102
-rw-r--r--chromium/media/base/audio_parameters.h115
-rw-r--r--chromium/media/base/audio_parameters_unittest.cc148
-rw-r--r--chromium/media/base/audio_point.cc2
-rw-r--r--chromium/media/base/audio_point.h2
-rw-r--r--chromium/media/base/audio_point_unittest.cc2
-rw-r--r--chromium/media/base/audio_power_monitor.cc2
-rw-r--r--chromium/media/base/audio_power_monitor.h2
-rw-r--r--chromium/media/base/audio_power_monitor_unittest.cc2
-rw-r--r--chromium/media/base/audio_processing.cc2
-rw-r--r--chromium/media/base/audio_processing.h2
-rw-r--r--chromium/media/base/audio_processor_controls.h2
-rw-r--r--chromium/media/base/audio_pull_fifo.cc2
-rw-r--r--chromium/media/base/audio_pull_fifo.h2
-rw-r--r--chromium/media/base/audio_pull_fifo_unittest.cc2
-rw-r--r--chromium/media/base/audio_push_fifo.cc2
-rw-r--r--chromium/media/base/audio_push_fifo.h2
-rw-r--r--chromium/media/base/audio_push_fifo_unittest.cc2
-rw-r--r--chromium/media/base/audio_renderer.cc2
-rw-r--r--chromium/media/base/audio_renderer.h2
-rw-r--r--chromium/media/base/audio_renderer_mixer.cc2
-rw-r--r--chromium/media/base/audio_renderer_mixer.h2
-rw-r--r--chromium/media/base/audio_renderer_mixer_input.cc2
-rw-r--r--chromium/media/base/audio_renderer_mixer_input.h2
-rw-r--r--chromium/media/base/audio_renderer_mixer_input_unittest.cc7
-rw-r--r--chromium/media/base/audio_renderer_mixer_pool.h2
-rw-r--r--chromium/media/base/audio_renderer_mixer_unittest.cc14
-rw-r--r--chromium/media/base/audio_renderer_sink.h2
-rw-r--r--chromium/media/base/audio_sample_types.h2
-rw-r--r--chromium/media/base/audio_sample_types_unittest.cc2
-rw-r--r--chromium/media/base/audio_shifter.cc2
-rw-r--r--chromium/media/base/audio_shifter.h2
-rw-r--r--chromium/media/base/audio_shifter_unittest.cc2
-rw-r--r--chromium/media/base/audio_timestamp_helper.cc2
-rw-r--r--chromium/media/base/audio_timestamp_helper.h2
-rw-r--r--chromium/media/base/audio_timestamp_helper_unittest.cc2
-rw-r--r--chromium/media/base/bind_to_current_loop.h2
-rw-r--r--chromium/media/base/bit_reader.cc2
-rw-r--r--chromium/media/base/bit_reader.h2
-rw-r--r--chromium/media/base/bit_reader_core.cc2
-rw-r--r--chromium/media/base/bit_reader_core.h2
-rw-r--r--chromium/media/base/bit_reader_fuzzertest.cc2
-rw-r--r--chromium/media/base/bit_reader_unittest.cc2
-rw-r--r--chromium/media/base/bitrate.cc2
-rw-r--r--chromium/media/base/bitrate.h2
-rw-r--r--chromium/media/base/bitrate_unittest.cc2
-rw-r--r--chromium/media/base/bitstream_buffer.cc2
-rw-r--r--chromium/media/base/bitstream_buffer.h2
-rw-r--r--chromium/media/base/buffering_state.cc2
-rw-r--r--chromium/media/base/buffering_state.h2
-rw-r--r--chromium/media/base/byte_queue.cc2
-rw-r--r--chromium/media/base/byte_queue.h2
-rw-r--r--chromium/media/base/callback_holder.h2
-rw-r--r--chromium/media/base/callback_holder_unittest.cc2
-rw-r--r--chromium/media/base/callback_registry.h2
-rw-r--r--chromium/media/base/callback_registry_unittest.cc2
-rw-r--r--chromium/media/base/cdm_callback_promise.cc2
-rw-r--r--chromium/media/base/cdm_callback_promise.h2
-rw-r--r--chromium/media/base/cdm_config.cc2
-rw-r--r--chromium/media/base/cdm_config.h2
-rw-r--r--chromium/media/base/cdm_context.cc2
-rw-r--r--chromium/media/base/cdm_context.h2
-rw-r--r--chromium/media/base/cdm_factory.cc2
-rw-r--r--chromium/media/base/cdm_factory.h2
-rw-r--r--chromium/media/base/cdm_initialized_promise.cc2
-rw-r--r--chromium/media/base/cdm_initialized_promise.h2
-rw-r--r--chromium/media/base/cdm_key_information.cc2
-rw-r--r--chromium/media/base/cdm_key_information.h2
-rw-r--r--chromium/media/base/cdm_promise.cc2
-rw-r--r--chromium/media/base/cdm_promise.h2
-rw-r--r--chromium/media/base/cdm_promise_adapter.cc2
-rw-r--r--chromium/media/base/cdm_promise_adapter.h2
-rw-r--r--chromium/media/base/cdm_session_tracker.cc2
-rw-r--r--chromium/media/base/cdm_session_tracker.h2
-rw-r--r--chromium/media/base/channel_layout.cc2
-rw-r--r--chromium/media/base/channel_layout.h2
-rw-r--r--chromium/media/base/channel_mixer.cc2
-rw-r--r--chromium/media/base/channel_mixer.h2
-rw-r--r--chromium/media/base/channel_mixer_unittest.cc12
-rw-r--r--chromium/media/base/channel_mixing_matrix.cc12
-rw-r--r--chromium/media/base/channel_mixing_matrix.h2
-rw-r--r--chromium/media/base/channel_mixing_matrix_unittest.cc2
-rw-r--r--chromium/media/base/color_plane_layout.cc2
-rw-r--r--chromium/media/base/color_plane_layout.h2
-rw-r--r--chromium/media/base/container_names.cc2
-rw-r--r--chromium/media/base/container_names.h2
-rw-r--r--chromium/media/base/container_names_fuzzertest.cc2
-rw-r--r--chromium/media/base/container_names_unittest.cc2
-rw-r--r--chromium/media/base/content_decryption_module.cc2
-rw-r--r--chromium/media/base/content_decryption_module.h2
-rw-r--r--chromium/media/base/converting_audio_fifo.cc4
-rw-r--r--chromium/media/base/converting_audio_fifo.h2
-rw-r--r--chromium/media/base/converting_audio_fifo_unittest.cc7
-rw-r--r--chromium/media/base/crc_16.h2
-rw-r--r--chromium/media/base/crc_16_unittest.cc2
-rw-r--r--chromium/media/base/data_buffer.cc2
-rw-r--r--chromium/media/base/data_buffer.h2
-rw-r--r--chromium/media/base/data_buffer_unittest.cc2
-rw-r--r--chromium/media/base/data_source.cc2
-rw-r--r--chromium/media/base/data_source.h2
-rw-r--r--chromium/media/base/decoder.cc4
-rw-r--r--chromium/media/base/decoder.h5
-rw-r--r--chromium/media/base/decoder_buffer.cc2
-rw-r--r--chromium/media/base/decoder_buffer.h2
-rw-r--r--chromium/media/base/decoder_buffer_queue.cc2
-rw-r--r--chromium/media/base/decoder_buffer_queue.h2
-rw-r--r--chromium/media/base/decoder_buffer_queue_unittest.cc2
-rw-r--r--chromium/media/base/decoder_buffer_unittest.cc2
-rw-r--r--chromium/media/base/decoder_factory.cc7
-rw-r--r--chromium/media/base/decoder_factory.h9
-rw-r--r--chromium/media/base/decoder_status.cc2
-rw-r--r--chromium/media/base/decoder_status.h2
-rw-r--r--chromium/media/base/decrypt_config.cc2
-rw-r--r--chromium/media/base/decrypt_config.h2
-rw-r--r--chromium/media/base/decrypt_config_unittest.cc2
-rw-r--r--chromium/media/base/decryptor.cc2
-rw-r--r--chromium/media/base/decryptor.h2
-rw-r--r--chromium/media/base/demuxer.cc2
-rw-r--r--chromium/media/base/demuxer.h2
-rw-r--r--chromium/media/base/demuxer_memory_limit.h2
-rw-r--r--chromium/media/base/demuxer_memory_limit_android.cc2
-rw-r--r--chromium/media/base/demuxer_memory_limit_cast.cc2
-rw-r--r--chromium/media/base/demuxer_memory_limit_cast_unittest.cc2
-rw-r--r--chromium/media/base/demuxer_memory_limit_default.cc2
-rw-r--r--chromium/media/base/demuxer_memory_limit_low.cc2
-rw-r--r--chromium/media/base/demuxer_stream.cc2
-rw-r--r--chromium/media/base/demuxer_stream.h2
-rw-r--r--chromium/media/base/djb2.cc2
-rw-r--r--chromium/media/base/djb2.h2
-rw-r--r--chromium/media/base/djb2_unittest.cc2
-rw-r--r--chromium/media/base/eme_constants.h2
-rw-r--r--chromium/media/base/encoder_status.h2
-rw-r--r--chromium/media/base/encryption_pattern.cc2
-rw-r--r--chromium/media/base/encryption_pattern.h2
-rw-r--r--chromium/media/base/encryption_scheme.cc2
-rw-r--r--chromium/media/base/encryption_scheme.h2
-rw-r--r--chromium/media/base/fake_audio_render_callback.cc2
-rw-r--r--chromium/media/base/fake_audio_render_callback.h2
-rw-r--r--chromium/media/base/fake_audio_renderer_sink.cc4
-rw-r--r--chromium/media/base/fake_audio_renderer_sink.h2
-rw-r--r--chromium/media/base/fake_audio_worker.cc2
-rw-r--r--chromium/media/base/fake_audio_worker.h2
-rw-r--r--chromium/media/base/fake_audio_worker_unittest.cc12
-rw-r--r--chromium/media/base/fake_demuxer_stream.cc2
-rw-r--r--chromium/media/base/fake_demuxer_stream.h2
-rw-r--r--chromium/media/base/fake_demuxer_stream_unittest.cc2
-rw-r--r--chromium/media/base/fake_localized_strings.cc2
-rw-r--r--chromium/media/base/fake_localized_strings.h2
-rw-r--r--chromium/media/base/fake_single_thread_task_runner.cc2
-rw-r--r--chromium/media/base/fake_single_thread_task_runner.h2
-rw-r--r--chromium/media/base/fake_text_track_stream.cc2
-rw-r--r--chromium/media/base/fake_text_track_stream.h2
-rw-r--r--chromium/media/base/feedback_signal_accumulator.h2
-rw-r--r--chromium/media/base/feedback_signal_accumulator_unittest.cc2
-rw-r--r--chromium/media/base/flinging_controller.h2
-rw-r--r--chromium/media/base/format_utils.cc2
-rw-r--r--chromium/media/base/format_utils.h2
-rw-r--r--chromium/media/base/frame_rate_estimator.cc2
-rw-r--r--chromium/media/base/frame_rate_estimator.h2
-rw-r--r--chromium/media/base/frame_rate_estimator_unittest.cc2
-rw-r--r--chromium/media/base/ipc/BUILD.gn2
-rw-r--r--chromium/media/base/ipc/media_param_traits.cc17
-rw-r--r--chromium/media/base/ipc/media_param_traits.h2
-rw-r--r--chromium/media/base/ipc/media_param_traits_macros.h2
-rw-r--r--chromium/media/base/key_system_info.cc27
-rw-r--r--chromium/media/base/key_system_info.h (renamed from chromium/media/base/key_system_properties.h)17
-rw-r--r--chromium/media/base/key_system_names.cc2
-rw-r--r--chromium/media/base/key_system_names.h2
-rw-r--r--chromium/media/base/key_system_properties.cc28
-rw-r--r--chromium/media/base/key_systems.cc109
-rw-r--r--chromium/media/base/key_systems.h4
-rw-r--r--chromium/media/base/key_systems_unittest.cc35
-rw-r--r--chromium/media/base/limits.h2
-rw-r--r--chromium/media/base/localized_strings.cc2
-rw-r--r--chromium/media/base/localized_strings.h2
-rw-r--r--chromium/media/base/logging_override_if_enabled.h2
-rw-r--r--chromium/media/base/loopback_audio_converter.cc2
-rw-r--r--chromium/media/base/loopback_audio_converter.h2
-rw-r--r--chromium/media/base/mac/BUILD.gn2
-rw-r--r--chromium/media/base/mac/audio_latency_mac.cc2
-rw-r--r--chromium/media/base/mac/audio_latency_mac.h2
-rw-r--r--chromium/media/base/mac/color_space_util_mac.h8
-rw-r--r--chromium/media/base/mac/color_space_util_mac.mm63
-rw-r--r--chromium/media/base/mac/video_frame_mac.cc61
-rw-r--r--chromium/media/base/mac/video_frame_mac.h5
-rw-r--r--chromium/media/base/mac/video_frame_mac_unittests.cc10
-rw-r--r--chromium/media/base/mac/videotoolbox_helpers.cc2
-rw-r--r--chromium/media/base/mac/videotoolbox_helpers.h2
-rw-r--r--chromium/media/base/media.cc2
-rw-r--r--chromium/media/base/media.h2
-rw-r--r--chromium/media/base/media_client.cc2
-rw-r--r--chromium/media/base/media_client.h4
-rw-r--r--chromium/media/base/media_content_type.cc2
-rw-r--r--chromium/media/base/media_content_type.h2
-rw-r--r--chromium/media/base/media_controller.h2
-rw-r--r--chromium/media/base/media_drm_key_type.h2
-rw-r--r--chromium/media/base/media_drm_storage.cc2
-rw-r--r--chromium/media/base/media_drm_storage.h2
-rw-r--r--chromium/media/base/media_export.h2
-rw-r--r--chromium/media/base/media_log.cc19
-rw-r--r--chromium/media/base/media_log.h23
-rw-r--r--chromium/media/base/media_log_events.cc2
-rw-r--r--chromium/media/base/media_log_events.h2
-rw-r--r--chromium/media/base/media_log_message_levels.cc2
-rw-r--r--chromium/media/base/media_log_message_levels.h2
-rw-r--r--chromium/media/base/media_log_properties.cc2
-rw-r--r--chromium/media/base/media_log_properties.h2
-rw-r--r--chromium/media/base/media_log_record.h9
-rw-r--r--chromium/media/base/media_log_type_enforcement.h44
-rw-r--r--chromium/media/base/media_log_unittest.cc12
-rw-r--r--chromium/media/base/media_observer.cc2
-rw-r--r--chromium/media/base/media_observer.h5
-rw-r--r--chromium/media/base/media_permission.cc2
-rw-r--r--chromium/media/base/media_permission.h2
-rw-r--r--chromium/media/base/media_player_logging_id.cc21
-rw-r--r--chromium/media/base/media_player_logging_id.h20
-rw-r--r--chromium/media/base/media_resource.cc2
-rw-r--r--chromium/media/base/media_resource.h2
-rw-r--r--chromium/media/base/media_serializers.h100
-rw-r--r--chromium/media/base/media_serializers_base.h2
-rw-r--r--chromium/media/base/media_serializers_unittest.cc2
-rw-r--r--chromium/media/base/media_shmem_export.h2
-rw-r--r--chromium/media/base/media_status.cc2
-rw-r--r--chromium/media/base/media_status.h2
-rw-r--r--chromium/media/base/media_status_observer.h2
-rw-r--r--chromium/media/base/media_switches.cc707
-rw-r--r--chromium/media/base/media_switches.h281
-rw-r--r--chromium/media/base/media_track.cc2
-rw-r--r--chromium/media/base/media_track.h2
-rw-r--r--chromium/media/base/media_tracks.cc2
-rw-r--r--chromium/media/base/media_tracks.h2
-rw-r--r--chromium/media/base/media_types.cc2
-rw-r--r--chromium/media/base/media_types.h2
-rw-r--r--chromium/media/base/media_url_demuxer.cc2
-rw-r--r--chromium/media/base/media_url_demuxer.h2
-rw-r--r--chromium/media/base/media_url_demuxer_unittest.cc2
-rw-r--r--chromium/media/base/media_url_params.cc2
-rw-r--r--chromium/media/base/media_url_params.h2
-rw-r--r--chromium/media/base/media_util.cc4
-rw-r--r--chromium/media/base/media_util.h2
-rw-r--r--chromium/media/base/memory_dump_provider_proxy.cc2
-rw-r--r--chromium/media/base/memory_dump_provider_proxy.h2
-rw-r--r--chromium/media/base/mime_util.cc19
-rw-r--r--chromium/media/base/mime_util.h19
-rw-r--r--chromium/media/base/mime_util_internal.cc71
-rw-r--r--chromium/media/base/mime_util_internal.h41
-rw-r--r--chromium/media/base/mime_util_unittest.cc32
-rw-r--r--chromium/media/base/mock_audio_renderer_sink.cc4
-rw-r--r--chromium/media/base/mock_audio_renderer_sink.h2
-rw-r--r--chromium/media/base/mock_demuxer_host.cc2
-rw-r--r--chromium/media/base/mock_demuxer_host.h2
-rw-r--r--chromium/media/base/mock_filters.cc2
-rw-r--r--chromium/media/base/mock_filters.h37
-rw-r--r--chromium/media/base/mock_media_log.cc6
-rw-r--r--chromium/media/base/mock_media_log.h2
-rw-r--r--chromium/media/base/mock_video_renderer_sink.cc2
-rw-r--r--chromium/media/base/mock_video_renderer_sink.h2
-rw-r--r--chromium/media/base/moving_average.cc2
-rw-r--r--chromium/media/base/moving_average.h2
-rw-r--r--chromium/media/base/moving_average_unittest.cc2
-rw-r--r--chromium/media/base/multi_channel_resampler.cc2
-rw-r--r--chromium/media/base/multi_channel_resampler.h2
-rw-r--r--chromium/media/base/multi_channel_resampler_unittest.cc2
-rw-r--r--chromium/media/base/null_video_sink.cc2
-rw-r--r--chromium/media/base/null_video_sink.h2
-rw-r--r--chromium/media/base/null_video_sink_unittest.cc2
-rw-r--r--chromium/media/base/offloading_audio_encoder.cc2
-rw-r--r--chromium/media/base/offloading_audio_encoder.h2
-rw-r--r--chromium/media/base/offloading_audio_encoder_unittest.cc2
-rw-r--r--chromium/media/base/offloading_video_encoder.cc2
-rw-r--r--chromium/media/base/offloading_video_encoder.h2
-rw-r--r--chromium/media/base/offloading_video_encoder_unittest.cc2
-rw-r--r--chromium/media/base/output_device_info.cc2
-rw-r--r--chromium/media/base/output_device_info.h2
-rw-r--r--chromium/media/base/overlay_info.cc2
-rw-r--r--chromium/media/base/overlay_info.h2
-rw-r--r--chromium/media/base/pipeline.h2
-rw-r--r--chromium/media/base/pipeline_impl.cc2
-rw-r--r--chromium/media/base/pipeline_impl.h2
-rw-r--r--chromium/media/base/pipeline_impl_unittest.cc2
-rw-r--r--chromium/media/base/pipeline_metadata.cc2
-rw-r--r--chromium/media/base/pipeline_metadata.h2
-rw-r--r--chromium/media/base/pipeline_status.cc2
-rw-r--r--chromium/media/base/pipeline_status.h2
-rw-r--r--chromium/media/base/provision_fetcher.h2
-rw-r--r--chromium/media/base/ranges.cc2
-rw-r--r--chromium/media/base/ranges.h2
-rw-r--r--chromium/media/base/ranges_unittest.cc2
-rw-r--r--chromium/media/base/reentrancy_checker.cc2
-rw-r--r--chromium/media/base/reentrancy_checker.h2
-rw-r--r--chromium/media/base/reentrancy_checker_unittest.cc2
-rw-r--r--chromium/media/base/renderer.cc2
-rw-r--r--chromium/media/base/renderer.h2
-rw-r--r--chromium/media/base/renderer_client.cc2
-rw-r--r--chromium/media/base/renderer_client.h2
-rw-r--r--chromium/media/base/renderer_factory.cc2
-rw-r--r--chromium/media/base/renderer_factory.h2
-rw-r--r--chromium/media/base/renderer_factory_selector.cc2
-rw-r--r--chromium/media/base/renderer_factory_selector.h2
-rw-r--r--chromium/media/base/renderer_factory_selector_unittest.cc2
-rw-r--r--chromium/media/base/routing_token_callback.h2
-rw-r--r--chromium/media/base/run_all_perftests.cc2
-rw-r--r--chromium/media/base/sample_format.cc8
-rw-r--r--chromium/media/base/sample_format.h5
-rw-r--r--chromium/media/base/sample_rates.cc2
-rw-r--r--chromium/media/base/sample_rates.h2
-rw-r--r--chromium/media/base/scoped_async_trace.cc2
-rw-r--r--chromium/media/base/scoped_async_trace.h2
-rw-r--r--chromium/media/base/scopedfd_helper.cc2
-rw-r--r--chromium/media/base/scopedfd_helper.h2
-rw-r--r--chromium/media/base/seekable_buffer.cc2
-rw-r--r--chromium/media/base/seekable_buffer.h2
-rw-r--r--chromium/media/base/seekable_buffer_unittest.cc2
-rw-r--r--chromium/media/base/serial_runner.cc2
-rw-r--r--chromium/media/base/serial_runner.h2
-rw-r--r--chromium/media/base/serial_runner_unittest.cc2
-rw-r--r--chromium/media/base/silent_sink_suspender.cc2
-rw-r--r--chromium/media/base/silent_sink_suspender.h2
-rw-r--r--chromium/media/base/silent_sink_suspender_unittest.cc7
-rw-r--r--chromium/media/base/simple_sync_token_client.cc2
-rw-r--r--chromium/media/base/simple_sync_token_client.h2
-rw-r--r--chromium/media/base/simple_watch_timer.cc2
-rw-r--r--chromium/media/base/simple_watch_timer.h2
-rw-r--r--chromium/media/base/sinc_resampler.cc2
-rw-r--r--chromium/media/base/sinc_resampler.h2
-rw-r--r--chromium/media/base/sinc_resampler_perftest.cc2
-rw-r--r--chromium/media/base/sinc_resampler_unittest.cc2
-rw-r--r--chromium/media/base/speech_recognition_client.h2
-rw-r--r--chromium/media/base/status.cc2
-rw-r--r--chromium/media/base/status.h2
-rw-r--r--chromium/media/base/status_unittest.cc2
-rw-r--r--chromium/media/base/stream_parser.cc2
-rw-r--r--chromium/media/base/stream_parser.h19
-rw-r--r--chromium/media/base/stream_parser_buffer.cc2
-rw-r--r--chromium/media/base/stream_parser_buffer.h2
-rw-r--r--chromium/media/base/stream_parser_unittest.cc2
-rw-r--r--chromium/media/base/subsample_entry.cc2
-rw-r--r--chromium/media/base/subsample_entry.h2
-rw-r--r--chromium/media/base/subsample_entry_unittest.cc2
-rw-r--r--chromium/media/base/supported_types.cc38
-rw-r--r--chromium/media/base/supported_types.h7
-rw-r--r--chromium/media/base/supported_types_unittest.cc60
-rw-r--r--chromium/media/base/supported_video_decoder_config.cc2
-rw-r--r--chromium/media/base/supported_video_decoder_config.h2
-rw-r--r--chromium/media/base/supported_video_decoder_config_unittest.cc2
-rw-r--r--chromium/media/base/svc_scalability_mode.cc2
-rw-r--r--chromium/media/base/svc_scalability_mode.h2
-rw-r--r--chromium/media/base/test_data_util.cc9
-rw-r--r--chromium/media/base/test_data_util.h8
-rw-r--r--chromium/media/base/test_helpers.cc4
-rw-r--r--chromium/media/base/test_helpers.h2
-rw-r--r--chromium/media/base/test_random.h2
-rw-r--r--chromium/media/base/text_cue.cc2
-rw-r--r--chromium/media/base/text_cue.h2
-rw-r--r--chromium/media/base/text_ranges.cc2
-rw-r--r--chromium/media/base/text_ranges.h2
-rw-r--r--chromium/media/base/text_ranges_unittest.cc2
-rw-r--r--chromium/media/base/text_renderer.cc2
-rw-r--r--chromium/media/base/text_renderer.h2
-rw-r--r--chromium/media/base/text_renderer_unittest.cc2
-rw-r--r--chromium/media/base/text_track.h2
-rw-r--r--chromium/media/base/text_track_config.cc2
-rw-r--r--chromium/media/base/text_track_config.h2
-rw-r--r--chromium/media/base/time_delta_interpolator.cc2
-rw-r--r--chromium/media/base/time_delta_interpolator.h2
-rw-r--r--chromium/media/base/time_delta_interpolator_unittest.cc2
-rw-r--r--chromium/media/base/time_source.h2
-rw-r--r--chromium/media/base/timestamp_constants.h2
-rw-r--r--chromium/media/base/tuneable.cc2
-rw-r--r--chromium/media/base/tuneable.h2
-rw-r--r--chromium/media/base/tuneable_unittest.cc2
-rw-r--r--chromium/media/base/use_after_free_checker.h2
-rw-r--r--chromium/media/base/user_input_monitor.cc2
-rw-r--r--chromium/media/base/user_input_monitor.h2
-rw-r--r--chromium/media/base/user_input_monitor_linux.cc2
-rw-r--r--chromium/media/base/user_input_monitor_mac.cc2
-rw-r--r--chromium/media/base/user_input_monitor_unittest.cc2
-rw-r--r--chromium/media/base/user_input_monitor_win.cc2
-rw-r--r--chromium/media/base/vector_math.cc226
-rw-r--r--chromium/media/base/vector_math.h2
-rw-r--r--chromium/media/base/vector_math_perftest.cc90
-rw-r--r--chromium/media/base/vector_math_testing.h15
-rw-r--r--chromium/media/base/vector_math_unittest.cc34
-rw-r--r--chromium/media/base/video_aspect_ratio.cc2
-rw-r--r--chromium/media/base/video_aspect_ratio.h2
-rw-r--r--chromium/media/base/video_aspect_ratio_unittest.cc2
-rw-r--r--chromium/media/base/video_bitrate_allocation.cc2
-rw-r--r--chromium/media/base/video_bitrate_allocation.h2
-rw-r--r--chromium/media/base/video_bitrate_allocation_unittest.cc2
-rw-r--r--chromium/media/base/video_codecs.cc64
-rw-r--r--chromium/media/base/video_codecs.h27
-rw-r--r--chromium/media/base/video_codecs_unittest.cc17
-rw-r--r--chromium/media/base/video_color_space.cc2
-rw-r--r--chromium/media/base/video_color_space.h2
-rw-r--r--chromium/media/base/video_color_space_unittest.cc2
-rw-r--r--chromium/media/base/video_decoder.cc2
-rw-r--r--chromium/media/base/video_decoder.h6
-rw-r--r--chromium/media/base/video_decoder_config.cc2
-rw-r--r--chromium/media/base/video_decoder_config.h2
-rw-r--r--chromium/media/base/video_decoder_config_unittest.cc2
-rw-r--r--chromium/media/base/video_encoder.cc2
-rw-r--r--chromium/media/base/video_encoder.h2
-rw-r--r--chromium/media/base/video_facing.h2
-rw-r--r--chromium/media/base/video_frame.cc56
-rw-r--r--chromium/media/base/video_frame.h56
-rw-r--r--chromium/media/base/video_frame_layout.cc2
-rw-r--r--chromium/media/base/video_frame_layout.h2
-rw-r--r--chromium/media/base/video_frame_layout_unittest.cc2
-rw-r--r--chromium/media/base/video_frame_metadata.cc8
-rw-r--r--chromium/media/base/video_frame_metadata.h5
-rw-r--r--chromium/media/base/video_frame_pool.cc2
-rw-r--r--chromium/media/base/video_frame_pool.h2
-rw-r--r--chromium/media/base/video_frame_pool_unittest.cc4
-rw-r--r--chromium/media/base/video_frame_unittest.cc55
-rw-r--r--chromium/media/base/video_renderer.cc2
-rw-r--r--chromium/media/base/video_renderer.h2
-rw-r--r--chromium/media/base/video_renderer_sink.h2
-rw-r--r--chromium/media/base/video_thumbnail_decoder.cc2
-rw-r--r--chromium/media/base/video_thumbnail_decoder.h2
-rw-r--r--chromium/media/base/video_thumbnail_decoder_unittest.cc2
-rw-r--r--chromium/media/base/video_transformation.cc2
-rw-r--r--chromium/media/base/video_transformation.h2
-rw-r--r--chromium/media/base/video_transformation_unittest.cc2
-rw-r--r--chromium/media/base/video_types.cc47
-rw-r--r--chromium/media/base/video_types.h5
-rw-r--r--chromium/media/base/video_types_unittest.cc2
-rw-r--r--chromium/media/base/video_util.cc127
-rw-r--r--chromium/media/base/video_util.h6
-rw-r--r--chromium/media/base/video_util_unittest.cc10
-rw-r--r--chromium/media/base/wait_and_replace_sync_token_client.cc2
-rw-r--r--chromium/media/base/wait_and_replace_sync_token_client.h2
-rw-r--r--chromium/media/base/waiting.h2
-rw-r--r--chromium/media/base/wall_clock_time_source.cc2
-rw-r--r--chromium/media/base/wall_clock_time_source.h2
-rw-r--r--chromium/media/base/wall_clock_time_source_unittest.cc2
-rw-r--r--chromium/media/base/watch_time_keys.cc2
-rw-r--r--chromium/media/base/watch_time_keys.h2
-rw-r--r--chromium/media/base/webvtt_util.h2
-rw-r--r--chromium/media/base/win/BUILD.gn2
-rw-r--r--chromium/media/base/win/d3d11_mocks.cc2
-rw-r--r--chromium/media/base/win/d3d11_mocks.h2
-rw-r--r--chromium/media/base/win/dcomp_texture_wrapper.h2
-rw-r--r--chromium/media/base/win/dxgi_device_manager.cc2
-rw-r--r--chromium/media/base/win/dxgi_device_manager.h2
-rw-r--r--chromium/media/base/win/dxgi_device_scope_handle_unittest.cc2
-rw-r--r--chromium/media/base/win/hresults.h10
-rw-r--r--chromium/media/base/win/media_foundation_cdm_proxy.h2
-rw-r--r--chromium/media/base/win/mf_feature_checks.cc2
-rw-r--r--chromium/media/base/win/mf_feature_checks.h2
-rw-r--r--chromium/media/base/win/mf_helpers.cc2
-rw-r--r--chromium/media/base/win/mf_helpers.h2
-rw-r--r--chromium/media/base/win/mf_initializer.cc2
-rw-r--r--chromium/media/base/win/mf_initializer.h2
-rw-r--r--chromium/media/base/win/mf_mocks.cc2
-rw-r--r--chromium/media/base/win/mf_mocks.h2
-rw-r--r--chromium/media/base/win/mf_util_export.h2
-rw-r--r--chromium/media/base/win/overlay_state_observer_subscription.h2
-rw-r--r--chromium/media/base/win/test_utils.h2
-rw-r--r--chromium/media/capabilities/BUILD.gn2
-rw-r--r--chromium/media/capabilities/bucket_utility.cc2
-rw-r--r--chromium/media/capabilities/bucket_utility.h2
-rw-r--r--chromium/media/capabilities/in_memory_video_decode_stats_db_impl.cc2
-rw-r--r--chromium/media/capabilities/in_memory_video_decode_stats_db_impl.h2
-rw-r--r--chromium/media/capabilities/in_memory_video_decode_stats_db_unittest.cc2
-rw-r--r--chromium/media/capabilities/learning_helper.cc2
-rw-r--r--chromium/media/capabilities/learning_helper.h2
-rw-r--r--chromium/media/capabilities/pending_operations.cc2
-rw-r--r--chromium/media/capabilities/pending_operations.h2
-rw-r--r--chromium/media/capabilities/pending_operations_unittest.cc2
-rw-r--r--chromium/media/capabilities/video_decode_stats.proto2
-rw-r--r--chromium/media/capabilities/video_decode_stats_db.cc2
-rw-r--r--chromium/media/capabilities/video_decode_stats_db.h2
-rw-r--r--chromium/media/capabilities/video_decode_stats_db_impl.cc2
-rw-r--r--chromium/media/capabilities/video_decode_stats_db_impl.h2
-rw-r--r--chromium/media/capabilities/video_decode_stats_db_impl_unittest.cc2
-rw-r--r--chromium/media/capabilities/video_decode_stats_db_provider.cc2
-rw-r--r--chromium/media/capabilities/video_decode_stats_db_provider.h2
-rw-r--r--chromium/media/capabilities/video_decode_stats_db_unittest.cc2
-rw-r--r--chromium/media/capabilities/webrtc_video_stats.proto2
-rw-r--r--chromium/media/capabilities/webrtc_video_stats_db.cc2
-rw-r--r--chromium/media/capabilities/webrtc_video_stats_db.h2
-rw-r--r--chromium/media/capabilities/webrtc_video_stats_db_impl.cc2
-rw-r--r--chromium/media/capabilities/webrtc_video_stats_db_impl.h2
-rw-r--r--chromium/media/capabilities/webrtc_video_stats_db_impl_unittest.cc2
-rw-r--r--chromium/media/capabilities/webrtc_video_stats_db_provider.cc2
-rw-r--r--chromium/media/capabilities/webrtc_video_stats_db_provider.h2
-rw-r--r--chromium/media/capabilities/webrtc_video_stats_db_unittest.cc2
-rw-r--r--chromium/media/capture/BUILD.gn3
-rw-r--r--chromium/media/capture/capture_export.h2
-rw-r--r--chromium/media/capture/capture_switches.cc12
-rw-r--r--chromium/media/capture/capture_switches.h13
-rw-r--r--chromium/media/capture/content/android/BUILD.gn2
-rw-r--r--chromium/media/capture/content/android/screen_capture_machine_android.cc43
-rw-r--r--chromium/media/capture/content/android/screen_capture_machine_android.h2
-rw-r--r--chromium/media/capture/content/android/thread_safe_capture_oracle.cc2
-rw-r--r--chromium/media/capture/content/android/thread_safe_capture_oracle.h2
-rw-r--r--chromium/media/capture/content/animated_content_sampler.cc2
-rw-r--r--chromium/media/capture/content/animated_content_sampler.h2
-rw-r--r--chromium/media/capture/content/animated_content_sampler_unittest.cc2
-rw-r--r--chromium/media/capture/content/capture_resolution_chooser.cc2
-rw-r--r--chromium/media/capture/content/capture_resolution_chooser.h2
-rw-r--r--chromium/media/capture/content/capture_resolution_chooser_unittest.cc2
-rw-r--r--chromium/media/capture/content/screen_enumerator.h2
-rw-r--r--chromium/media/capture/content/smooth_event_sampler.cc2
-rw-r--r--chromium/media/capture/content/smooth_event_sampler.h2
-rw-r--r--chromium/media/capture/content/smooth_event_sampler_unittest.cc2
-rw-r--r--chromium/media/capture/content/video_capture_oracle.cc2
-rw-r--r--chromium/media/capture/content/video_capture_oracle.h2
-rw-r--r--chromium/media/capture/content/video_capture_oracle_unittest.cc2
-rw-r--r--chromium/media/capture/mojom/BUILD.gn2
-rw-r--r--chromium/media/capture/mojom/image_capture.mojom2
-rw-r--r--chromium/media/capture/mojom/image_capture_types.cc2
-rw-r--r--chromium/media/capture/mojom/image_capture_types.h2
-rw-r--r--chromium/media/capture/mojom/video_capture.mojom3
-rw-r--r--chromium/media/capture/mojom/video_capture_buffer.mojom10
-rw-r--r--chromium/media/capture/mojom/video_capture_types.mojom17
-rw-r--r--chromium/media/capture/mojom/video_capture_types_mojom_traits.cc17
-rw-r--r--chromium/media/capture/mojom/video_capture_types_mojom_traits.h2
-rw-r--r--chromium/media/capture/run_all_unittests.cc2
-rw-r--r--chromium/media/capture/video/android/BUILD.gn2
-rw-r--r--chromium/media/capture/video/android/photo_capabilities.cc2
-rw-r--r--chromium/media/capture/video/android/photo_capabilities.h2
-rw-r--r--chromium/media/capture/video/android/video_capture_device_android.cc18
-rw-r--r--chromium/media/capture/video/android/video_capture_device_android.h2
-rw-r--r--chromium/media/capture/video/android/video_capture_device_factory_android.cc2
-rw-r--r--chromium/media/capture/video/android/video_capture_device_factory_android.h2
-rw-r--r--chromium/media/capture/video/blob_utils.cc2
-rw-r--r--chromium/media/capture/video/blob_utils.h2
-rw-r--r--chromium/media/capture/video/chromeos/camera_3a_controller.cc9
-rw-r--r--chromium/media/capture/video/chromeos/camera_3a_controller.h2
-rw-r--r--chromium/media/capture/video/chromeos/camera_3a_controller_unittest.cc2
-rw-r--r--chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.cc2
-rw-r--r--chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.h2
-rw-r--r--chromium/media/capture/video/chromeos/camera_app_device_impl.cc2
-rw-r--r--chromium/media/capture/video/chromeos/camera_app_device_impl.h2
-rw-r--r--chromium/media/capture/video/chromeos/camera_app_device_provider_impl.cc2
-rw-r--r--chromium/media/capture/video/chromeos/camera_app_device_provider_impl.h3
-rw-r--r--chromium/media/capture/video/chromeos/camera_buffer_factory.cc2
-rw-r--r--chromium/media/capture/video/chromeos/camera_buffer_factory.h2
-rw-r--r--chromium/media/capture/video/chromeos/camera_device_context.cc2
-rw-r--r--chromium/media/capture/video/chromeos/camera_device_context.h2
-rw-r--r--chromium/media/capture/video/chromeos/camera_device_delegate.cc9
-rw-r--r--chromium/media/capture/video/chromeos/camera_device_delegate.h2
-rw-r--r--chromium/media/capture/video/chromeos/camera_device_delegate_unittest.cc4
-rw-r--r--chromium/media/capture/video/chromeos/camera_hal_delegate.cc6
-rw-r--r--chromium/media/capture/video/chromeos/camera_hal_delegate.h2
-rw-r--r--chromium/media/capture/video/chromeos/camera_hal_delegate_unittest.cc2
-rw-r--r--chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc32
-rw-r--r--chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.h3
-rw-r--r--chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc6
-rw-r--r--chromium/media/capture/video/chromeos/camera_metadata_utils.cc11
-rw-r--r--chromium/media/capture/video/chromeos/camera_metadata_utils.h2
-rw-r--r--chromium/media/capture/video/chromeos/camera_trace_utils.cc2
-rw-r--r--chromium/media/capture/video/chromeos/camera_trace_utils.h2
-rw-r--r--chromium/media/capture/video/chromeos/capture_metadata_dispatcher.h2
-rw-r--r--chromium/media/capture/video/chromeos/display_rotation_observer.cc2
-rw-r--r--chromium/media/capture/video/chromeos/display_rotation_observer.h2
-rw-r--r--chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.cc2
-rw-r--r--chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.h2
-rw-r--r--chromium/media/capture/video/chromeos/mock_camera_module.cc2
-rw-r--r--chromium/media/capture/video/chromeos/mock_camera_module.h4
-rw-r--r--chromium/media/capture/video/chromeos/mock_vendor_tag_ops.cc2
-rw-r--r--chromium/media/capture/video/chromeos/mock_vendor_tag_ops.h14
-rw-r--r--chromium/media/capture/video/chromeos/mock_video_capture_client.cc2
-rw-r--r--chromium/media/capture/video/chromeos/mock_video_capture_client.h4
-rw-r--r--chromium/media/capture/video/chromeos/mojom/BUILD.gn2
-rw-r--r--chromium/media/capture/video/chromeos/mojom/camera3.mojom2
-rw-r--r--chromium/media/capture/video/chromeos/mojom/camera_app.mojom2
-rw-r--r--chromium/media/capture/video/chromeos/mojom/camera_common.mojom2
-rw-r--r--chromium/media/capture/video/chromeos/mojom/camera_metadata.mojom2
-rw-r--r--chromium/media/capture/video/chromeos/mojom/camera_metadata_tags.mojom2
-rw-r--r--chromium/media/capture/video/chromeos/mojom/cros_camera_client.mojom2
-rw-r--r--chromium/media/capture/video/chromeos/mojom/cros_camera_service.mojom2
-rw-r--r--chromium/media/capture/video/chromeos/pixel_format_utils.cc2
-rw-r--r--chromium/media/capture/video/chromeos/pixel_format_utils.h2
-rw-r--r--chromium/media/capture/video/chromeos/public/BUILD.gn2
-rw-r--r--chromium/media/capture/video/chromeos/public/cros_features.cc2
-rw-r--r--chromium/media/capture/video/chromeos/public/cros_features.h2
-rw-r--r--chromium/media/capture/video/chromeos/request_builder.cc2
-rw-r--r--chromium/media/capture/video/chromeos/request_builder.h2
-rw-r--r--chromium/media/capture/video/chromeos/request_manager.cc2
-rw-r--r--chromium/media/capture/video/chromeos/request_manager.h2
-rw-r--r--chromium/media/capture/video/chromeos/request_manager_unittest.cc11
-rw-r--r--chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.cc2
-rw-r--r--chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.h2
-rw-r--r--chromium/media/capture/video/chromeos/stream_buffer_manager.cc71
-rw-r--r--chromium/media/capture/video/chromeos/stream_buffer_manager.h2
-rw-r--r--chromium/media/capture/video/chromeos/token_manager.cc7
-rw-r--r--chromium/media/capture/video/chromeos/token_manager.h2
-rw-r--r--chromium/media/capture/video/chromeos/token_manager_unittest.cc2
-rw-r--r--chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.cc2
-rw-r--r--chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.h2
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.cc2
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.h2
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.cc2
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.h2
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc2
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.h2
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_features_chromeos.cc10
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_features_chromeos.h8
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_jpeg_decoder.h2
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.cc46
-rw-r--r--chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.h4
-rw-r--r--chromium/media/capture/video/create_video_capture_device_factory.cc2
-rw-r--r--chromium/media/capture/video/create_video_capture_device_factory.h2
-rw-r--r--chromium/media/capture/video/fake_video_capture_device.cc2
-rw-r--r--chromium/media/capture/video/fake_video_capture_device.h2
-rw-r--r--chromium/media/capture/video/fake_video_capture_device_factory.cc2
-rw-r--r--chromium/media/capture/video/fake_video_capture_device_factory.h2
-rw-r--r--chromium/media/capture/video/fake_video_capture_device_unittest.cc2
-rw-r--r--chromium/media/capture/video/file_video_capture_device.cc2
-rw-r--r--chromium/media/capture/video/file_video_capture_device.h2
-rw-r--r--chromium/media/capture/video/file_video_capture_device_factory.cc2
-rw-r--r--chromium/media/capture/video/file_video_capture_device_factory.h2
-rw-r--r--chromium/media/capture/video/file_video_capture_device_unittest.cc2
-rw-r--r--chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc2
-rw-r--r--chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h2
-rw-r--r--chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia_test.cc4
-rw-r--r--chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.cc2
-rw-r--r--chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.h2
-rw-r--r--chromium/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc2
-rw-r--r--chromium/media/capture/video/gpu_memory_buffer_utils.cc2
-rw-r--r--chromium/media/capture/video/gpu_memory_buffer_utils.h2
-rw-r--r--chromium/media/capture/video/linux/fake_device_provider.cc17
-rw-r--r--chromium/media/capture/video/linux/fake_device_provider.h2
-rw-r--r--chromium/media/capture/video/linux/fake_v4l2_impl.cc9
-rw-r--r--chromium/media/capture/video/linux/fake_v4l2_impl.h2
-rw-r--r--chromium/media/capture/video/linux/scoped_v4l2_device_fd.cc2
-rw-r--r--chromium/media/capture/video/linux/scoped_v4l2_device_fd.h2
-rw-r--r--chromium/media/capture/video/linux/v4l2_capture_delegate.cc3
-rw-r--r--chromium/media/capture/video/linux/v4l2_capture_delegate.h2
-rw-r--r--chromium/media/capture/video/linux/v4l2_capture_delegate_unittest.cc2
-rw-r--r--chromium/media/capture/video/linux/v4l2_capture_device.h2
-rw-r--r--chromium/media/capture/video/linux/v4l2_capture_device_impl.cc2
-rw-r--r--chromium/media/capture/video/linux/v4l2_capture_device_impl.h2
-rw-r--r--chromium/media/capture/video/linux/video_capture_device_factory_linux.cc2
-rw-r--r--chromium/media/capture/video/linux/video_capture_device_factory_linux.h2
-rw-r--r--chromium/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc2
-rw-r--r--chromium/media/capture/video/linux/video_capture_device_linux.cc2
-rw-r--r--chromium/media/capture/video/linux/video_capture_device_linux.h2
-rw-r--r--chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.cc2
-rw-r--r--chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.h2
-rw-r--r--chromium/media/capture/video/mac/pixel_buffer_pool_mac.cc2
-rw-r--r--chromium/media/capture/video/mac/pixel_buffer_pool_mac.h2
-rw-r--r--chromium/media/capture/video/mac/pixel_buffer_pool_mac_unittest.mm2
-rw-r--r--chromium/media/capture/video/mac/pixel_buffer_transferer_mac.cc2
-rw-r--r--chromium/media/capture/video/mac/pixel_buffer_transferer_mac.h2
-rw-r--r--chromium/media/capture/video/mac/pixel_buffer_transferer_mac_unittest.mm2
-rw-r--r--chromium/media/capture/video/mac/sample_buffer_transformer_mac.cc2
-rw-r--r--chromium/media/capture/video/mac/sample_buffer_transformer_mac.h2
-rw-r--r--chromium/media/capture/video/mac/sample_buffer_transformer_mac_unittest.mm19
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.h4
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.mm12
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_avfoundation_mac_unittest.mm2
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.h2
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.mm2
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_decklink_mac.h2
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_decklink_mac.mm2
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_factory_mac.h2
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_factory_mac.mm13
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_factory_mac_unittest.mm2
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_mac.h2
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_mac.mm2
-rw-r--r--chromium/media/capture/video/mac/video_capture_device_mac_unittest.mm2
-rw-r--r--chromium/media/capture/video/mac/video_capture_metrics_mac.h2
-rw-r--r--chromium/media/capture/video/mac/video_capture_metrics_mac.mm2
-rw-r--r--chromium/media/capture/video/mac/video_capture_metrics_mac_unittest.mm2
-rw-r--r--chromium/media/capture/video/mock_device.cc2
-rw-r--r--chromium/media/capture/video/mock_device.h2
-rw-r--r--chromium/media/capture/video/mock_device_factory.cc2
-rw-r--r--chromium/media/capture/video/mock_device_factory.h2
-rw-r--r--chromium/media/capture/video/mock_gpu_memory_buffer_manager.cc2
-rw-r--r--chromium/media/capture/video/mock_gpu_memory_buffer_manager.h2
-rw-r--r--chromium/media/capture/video/mock_video_capture_device_client.cc2
-rw-r--r--chromium/media/capture/video/mock_video_capture_device_client.h2
-rw-r--r--chromium/media/capture/video/mock_video_frame_receiver.cc2
-rw-r--r--chromium/media/capture/video/mock_video_frame_receiver.h2
-rw-r--r--chromium/media/capture/video/scoped_buffer_pool_reservation.h2
-rw-r--r--chromium/media/capture/video/shared_memory_buffer_tracker.cc4
-rw-r--r--chromium/media/capture/video/shared_memory_buffer_tracker.h2
-rw-r--r--chromium/media/capture/video/video_capture_buffer_handle.cc2
-rw-r--r--chromium/media/capture/video/video_capture_buffer_handle.h2
-rw-r--r--chromium/media/capture/video/video_capture_buffer_pool.h5
-rw-r--r--chromium/media/capture/video/video_capture_buffer_pool_impl.cc35
-rw-r--r--chromium/media/capture/video/video_capture_buffer_pool_impl.h4
-rw-r--r--chromium/media/capture/video/video_capture_buffer_pool_util.cc2
-rw-r--r--chromium/media/capture/video/video_capture_buffer_pool_util.h2
-rw-r--r--chromium/media/capture/video/video_capture_buffer_tracker.cc2
-rw-r--r--chromium/media/capture/video/video_capture_buffer_tracker.h2
-rw-r--r--chromium/media/capture/video/video_capture_buffer_tracker_factory.h2
-rw-r--r--chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.cc2
-rw-r--r--chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.h2
-rw-r--r--chromium/media/capture/video/video_capture_device.cc8
-rw-r--r--chromium/media/capture/video/video_capture_device.h2
-rw-r--r--chromium/media/capture/video/video_capture_device_client.cc16
-rw-r--r--chromium/media/capture/video/video_capture_device_client.h2
-rw-r--r--chromium/media/capture/video/video_capture_device_client_unittest.cc2
-rw-r--r--chromium/media/capture/video/video_capture_device_descriptor.cc2
-rw-r--r--chromium/media/capture/video/video_capture_device_descriptor.h2
-rw-r--r--chromium/media/capture/video/video_capture_device_factory.cc4
-rw-r--r--chromium/media/capture/video/video_capture_device_factory.h2
-rw-r--r--chromium/media/capture/video/video_capture_device_info.cc2
-rw-r--r--chromium/media/capture/video/video_capture_device_info.h2
-rw-r--r--chromium/media/capture/video/video_capture_device_unittest.cc9
-rw-r--r--chromium/media/capture/video/video_capture_feedback.cc7
-rw-r--r--chromium/media/capture/video/video_capture_feedback.h2
-rw-r--r--chromium/media/capture/video/video_capture_metrics.cc2
-rw-r--r--chromium/media/capture/video/video_capture_metrics.h2
-rw-r--r--chromium/media/capture/video/video_capture_metrics_unittest.cc2
-rw-r--r--chromium/media/capture/video/video_capture_system.h2
-rw-r--r--chromium/media/capture/video/video_capture_system_impl.cc12
-rw-r--r--chromium/media/capture/video/video_capture_system_impl.h2
-rw-r--r--chromium/media/capture/video/video_frame_receiver.cc2
-rw-r--r--chromium/media/capture/video/video_frame_receiver.h2
-rw-r--r--chromium/media/capture/video/video_frame_receiver_on_task_runner.cc2
-rw-r--r--chromium/media/capture/video/video_frame_receiver_on_task_runner.h2
-rw-r--r--chromium/media/capture/video/win/capability_list_win.cc2
-rw-r--r--chromium/media/capture/video/win/capability_list_win.h2
-rw-r--r--chromium/media/capture/video/win/d3d_capture_test_utils.cc2
-rw-r--r--chromium/media/capture/video/win/d3d_capture_test_utils.h4
-rw-r--r--chromium/media/capture/video/win/filter_base_win.cc2
-rw-r--r--chromium/media/capture/video/win/filter_base_win.h2
-rw-r--r--chromium/media/capture/video/win/gpu_memory_buffer_tracker.cc2
-rw-r--r--chromium/media/capture/video/win/gpu_memory_buffer_tracker.h2
-rw-r--r--chromium/media/capture/video/win/gpu_memory_buffer_tracker_unittest.cc2
-rw-r--r--chromium/media/capture/video/win/metrics.cc2
-rw-r--r--chromium/media/capture/video/win/metrics.h2
-rw-r--r--chromium/media/capture/video/win/pin_base_win.cc14
-rw-r--r--chromium/media/capture/video/win/pin_base_win.h6
-rw-r--r--chromium/media/capture/video/win/sink_filter_observer_win.h2
-rw-r--r--chromium/media/capture/video/win/sink_filter_win.cc2
-rw-r--r--chromium/media/capture/video/win/sink_filter_win.h2
-rw-r--r--chromium/media/capture/video/win/sink_input_pin_win.cc2
-rw-r--r--chromium/media/capture/video/win/sink_input_pin_win.h2
-rw-r--r--chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.cc2
-rw-r--r--chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.h2
-rw-r--r--chromium/media/capture/video/win/video_capture_device_factory_win.cc15
-rw-r--r--chromium/media/capture/video/win/video_capture_device_factory_win.h2
-rw-r--r--chromium/media/capture/video/win/video_capture_device_factory_win_unittest.cc11
-rw-r--r--chromium/media/capture/video/win/video_capture_device_mf_win.cc6
-rw-r--r--chromium/media/capture/video/win/video_capture_device_mf_win.h2
-rw-r--r--chromium/media/capture/video/win/video_capture_device_mf_win_unittest.cc4
-rw-r--r--chromium/media/capture/video/win/video_capture_device_utils_win.cc2
-rw-r--r--chromium/media/capture/video/win/video_capture_device_utils_win.h2
-rw-r--r--chromium/media/capture/video/win/video_capture_device_win.cc45
-rw-r--r--chromium/media/capture/video/win/video_capture_device_win.h2
-rw-r--r--chromium/media/capture/video_capture_types.cc13
-rw-r--r--chromium/media/capture/video_capture_types.h14
-rw-r--r--chromium/media/capture/video_capture_types_unittest.cc2
-rw-r--r--chromium/media/cast/BUILD.gn12
-rw-r--r--chromium/media/cast/cast_callbacks.h2
-rw-r--r--chromium/media/cast/cast_config.cc62
-rw-r--r--chromium/media/cast/cast_config.h74
-rw-r--r--chromium/media/cast/cast_environment.cc2
-rw-r--r--chromium/media/cast/cast_environment.h2
-rw-r--r--chromium/media/cast/cast_sender.h2
-rw-r--r--chromium/media/cast/cast_sender_impl.cc2
-rw-r--r--chromium/media/cast/cast_sender_impl.h2
-rw-r--r--chromium/media/cast/common/clock_drift_smoother.cc2
-rw-r--r--chromium/media/cast/common/clock_drift_smoother.h2
-rw-r--r--chromium/media/cast/common/encoded_frame.cc6
-rw-r--r--chromium/media/cast/common/encoded_frame.h26
-rw-r--r--chromium/media/cast/common/expanded_value_base.h2
-rw-r--r--chromium/media/cast/common/expanded_value_base_unittest.cc2
-rw-r--r--chromium/media/cast/common/frame_id.h2
-rw-r--r--chromium/media/cast/common/mod_util.h2
-rw-r--r--chromium/media/cast/common/openscreen_conversion_helpers.cc122
-rw-r--r--chromium/media/cast/common/openscreen_conversion_helpers.h27
-rw-r--r--chromium/media/cast/common/openscreen_conversion_helpers_unittest.cc7
-rw-r--r--chromium/media/cast/common/rtp_time.h2
-rw-r--r--chromium/media/cast/common/sender_encoded_frame.cc2
-rw-r--r--chromium/media/cast/common/sender_encoded_frame.h2
-rw-r--r--chromium/media/cast/common/transport_encryption_handler.cc2
-rw-r--r--chromium/media/cast/common/transport_encryption_handler.h2
-rw-r--r--chromium/media/cast/common/video_frame_factory.h2
-rw-r--r--chromium/media/cast/constants.h2
-rw-r--r--chromium/media/cast/encoding/audio_encoder.cc25
-rw-r--r--chromium/media/cast/encoding/audio_encoder.h4
-rw-r--r--chromium/media/cast/encoding/audio_encoder_unittest.cc18
-rw-r--r--chromium/media/cast/encoding/av1_encoder.cc20
-rw-r--r--chromium/media/cast/encoding/av1_encoder.h2
-rw-r--r--chromium/media/cast/encoding/external_video_encoder.cc57
-rw-r--r--chromium/media/cast/encoding/external_video_encoder.h2
-rw-r--r--chromium/media/cast/encoding/external_video_encoder_unittest.cc15
-rw-r--r--chromium/media/cast/encoding/fake_software_video_encoder.cc13
-rw-r--r--chromium/media/cast/encoding/fake_software_video_encoder.h2
-rw-r--r--chromium/media/cast/encoding/h264_vt_encoder.cc11
-rw-r--r--chromium/media/cast/encoding/h264_vt_encoder.h2
-rw-r--r--chromium/media/cast/encoding/h264_vt_encoder_unittest.cc8
-rw-r--r--chromium/media/cast/encoding/size_adaptable_video_encoder_base.cc2
-rw-r--r--chromium/media/cast/encoding/size_adaptable_video_encoder_base.h2
-rw-r--r--chromium/media/cast/encoding/software_video_encoder.h2
-rw-r--r--chromium/media/cast/encoding/video_encoder.cc2
-rw-r--r--chromium/media/cast/encoding/video_encoder.h2
-rw-r--r--chromium/media/cast/encoding/video_encoder_impl.cc2
-rw-r--r--chromium/media/cast/encoding/video_encoder_impl.h2
-rw-r--r--chromium/media/cast/encoding/video_encoder_unittest.cc9
-rw-r--r--chromium/media/cast/encoding/vpx_encoder.cc25
-rw-r--r--chromium/media/cast/encoding/vpx_encoder.h2
-rw-r--r--chromium/media/cast/encoding/vpx_quantizer_parser.cc2
-rw-r--r--chromium/media/cast/encoding/vpx_quantizer_parser.h2
-rw-r--r--chromium/media/cast/encoding/vpx_quantizer_parser_unittest.cc6
-rw-r--r--chromium/media/cast/logging/encoding_event_subscriber.cc2
-rw-r--r--chromium/media/cast/logging/encoding_event_subscriber.h2
-rw-r--r--chromium/media/cast/logging/encoding_event_subscriber_unittest.cc2
-rw-r--r--chromium/media/cast/logging/log_event_dispatcher.cc11
-rw-r--r--chromium/media/cast/logging/log_event_dispatcher.h2
-rw-r--r--chromium/media/cast/logging/logging_defines.cc2
-rw-r--r--chromium/media/cast/logging/logging_defines.h2
-rw-r--r--chromium/media/cast/logging/proto/proto_utils.cc2
-rw-r--r--chromium/media/cast/logging/proto/proto_utils.h2
-rw-r--r--chromium/media/cast/logging/proto/raw_events.proto2
-rw-r--r--chromium/media/cast/logging/raw_event_subscriber.h2
-rw-r--r--chromium/media/cast/logging/raw_event_subscriber_bundle.cc2
-rw-r--r--chromium/media/cast/logging/raw_event_subscriber_bundle.h2
-rw-r--r--chromium/media/cast/logging/receiver_time_offset_estimator.h2
-rw-r--r--chromium/media/cast/logging/receiver_time_offset_estimator_impl.cc2
-rw-r--r--chromium/media/cast/logging/receiver_time_offset_estimator_impl.h2
-rw-r--r--chromium/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc2
-rw-r--r--chromium/media/cast/logging/simple_event_subscriber.cc2
-rw-r--r--chromium/media/cast/logging/simple_event_subscriber.h2
-rw-r--r--chromium/media/cast/logging/simple_event_subscriber_unittest.cc2
-rw-r--r--chromium/media/cast/logging/stats_event_subscriber.cc2
-rw-r--r--chromium/media/cast/logging/stats_event_subscriber.h2
-rw-r--r--chromium/media/cast/logging/stats_event_subscriber_unittest.cc2
-rw-r--r--chromium/media/cast/net/cast_transport.h2
-rw-r--r--chromium/media/cast/net/cast_transport_config.cc2
-rw-r--r--chromium/media/cast/net/cast_transport_config.h2
-rw-r--r--chromium/media/cast/net/cast_transport_defines.h2
-rw-r--r--chromium/media/cast/net/cast_transport_impl.cc2
-rw-r--r--chromium/media/cast/net/cast_transport_impl.h2
-rw-r--r--chromium/media/cast/net/cast_transport_impl_unittest.cc15
-rw-r--r--chromium/media/cast/net/pacing/paced_sender.cc6
-rw-r--r--chromium/media/cast/net/pacing/paced_sender.h2
-rw-r--r--chromium/media/cast/net/pacing/paced_sender_unittest.cc2
-rw-r--r--chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc2
-rw-r--r--chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h2
-rw-r--r--chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc2
-rw-r--r--chromium/media/cast/net/rtcp/receiver_rtcp_session.cc2
-rw-r--r--chromium/media/cast/net/rtcp/receiver_rtcp_session.h2
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_builder.cc4
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_builder.h4
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_builder_unittest.cc2
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_defines.cc2
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_defines.h2
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_session.h2
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_unittest.cc2
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_utility.cc2
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_utility.h2
-rw-r--r--chromium/media/cast/net/rtcp/rtcp_utility_unittest.cc2
-rw-r--r--chromium/media/cast/net/rtcp/sender_rtcp_session.cc2
-rw-r--r--chromium/media/cast/net/rtcp/sender_rtcp_session.h2
-rw-r--r--chromium/media/cast/net/rtp/packet_storage.cc2
-rw-r--r--chromium/media/cast/net/rtp/packet_storage.h2
-rw-r--r--chromium/media/cast/net/rtp/packet_storage_unittest.cc2
-rw-r--r--chromium/media/cast/net/rtp/rtp_defines.cc2
-rw-r--r--chromium/media/cast/net/rtp/rtp_defines.h2
-rw-r--r--chromium/media/cast/net/rtp/rtp_packetizer.cc11
-rw-r--r--chromium/media/cast/net/rtp/rtp_packetizer.h2
-rw-r--r--chromium/media/cast/net/rtp/rtp_packetizer_unittest.cc6
-rw-r--r--chromium/media/cast/net/rtp/rtp_parser.cc2
-rw-r--r--chromium/media/cast/net/rtp/rtp_parser.h2
-rw-r--r--chromium/media/cast/net/rtp/rtp_parser_unittest.cc2
-rw-r--r--chromium/media/cast/net/rtp/rtp_sender.cc2
-rw-r--r--chromium/media/cast/net/rtp/rtp_sender.h2
-rw-r--r--chromium/media/cast/net/transport_util.cc2
-rw-r--r--chromium/media/cast/net/transport_util.h2
-rw-r--r--chromium/media/cast/net/udp_packet_pipe.cc2
-rw-r--r--chromium/media/cast/net/udp_packet_pipe.h2
-rw-r--r--chromium/media/cast/net/udp_packet_pipe_unittest.cc2
-rw-r--r--chromium/media/cast/net/udp_transport_impl.cc2
-rw-r--r--chromium/media/cast/net/udp_transport_impl.h2
-rw-r--r--chromium/media/cast/net/udp_transport_interface.h2
-rw-r--r--chromium/media/cast/net/udp_transport_unittest.cc2
-rw-r--r--chromium/media/cast/sender/audio_sender.cc30
-rw-r--r--chromium/media/cast/sender/audio_sender.h5
-rw-r--r--chromium/media/cast/sender/audio_sender_unittest.cc2
-rw-r--r--chromium/media/cast/sender/congestion_control.cc2
-rw-r--r--chromium/media/cast/sender/congestion_control.h2
-rw-r--r--chromium/media/cast/sender/congestion_control_unittest.cc2
-rw-r--r--chromium/media/cast/sender/frame_sender.cc2
-rw-r--r--chromium/media/cast/sender/frame_sender.h17
-rw-r--r--chromium/media/cast/sender/frame_sender_impl.cc28
-rw-r--r--chromium/media/cast/sender/frame_sender_impl.h4
-rw-r--r--chromium/media/cast/sender/openscreen_frame_sender.cc116
-rw-r--r--chromium/media/cast/sender/openscreen_frame_sender.h37
-rw-r--r--chromium/media/cast/sender/performance_metrics_overlay.cc7
-rw-r--r--chromium/media/cast/sender/performance_metrics_overlay.h2
-rw-r--r--chromium/media/cast/sender/video_sender.cc56
-rw-r--r--chromium/media/cast/sender/video_sender.h10
-rw-r--r--chromium/media/cast/sender/video_sender_unittest.cc2
-rw-r--r--chromium/media/cast/test/proto/BUILD.gn2
-rw-r--r--chromium/media/cdm/BUILD.gn4
-rw-r--r--chromium/media/cdm/aes_cbc_crypto.cc2
-rw-r--r--chromium/media/cdm/aes_cbc_crypto.h2
-rw-r--r--chromium/media/cdm/aes_cbc_crypto_unittest.cc2
-rw-r--r--chromium/media/cdm/aes_decryptor.cc2
-rw-r--r--chromium/media/cdm/aes_decryptor.h2
-rw-r--r--chromium/media/cdm/aes_decryptor_unittest.cc2
-rw-r--r--chromium/media/cdm/cbcs_decryptor.cc2
-rw-r--r--chromium/media/cdm/cbcs_decryptor.h2
-rw-r--r--chromium/media/cdm/cbcs_decryptor_fuzzer.cc2
-rw-r--r--chromium/media/cdm/cbcs_decryptor_unittest.cc2
-rw-r--r--chromium/media/cdm/cdm_adapter.cc2
-rw-r--r--chromium/media/cdm/cdm_adapter.h2
-rw-r--r--chromium/media/cdm/cdm_adapter_factory.cc2
-rw-r--r--chromium/media/cdm/cdm_adapter_factory.h2
-rw-r--r--chromium/media/cdm/cdm_adapter_unittest.cc2
-rw-r--r--chromium/media/cdm/cdm_allocator.cc2
-rw-r--r--chromium/media/cdm/cdm_allocator.h2
-rw-r--r--chromium/media/cdm/cdm_auxiliary_helper.cc2
-rw-r--r--chromium/media/cdm/cdm_auxiliary_helper.h2
-rw-r--r--chromium/media/cdm/cdm_capability.cc2
-rw-r--r--chromium/media/cdm/cdm_capability.h2
-rw-r--r--chromium/media/cdm/cdm_context_ref_impl.cc2
-rw-r--r--chromium/media/cdm/cdm_context_ref_impl.h2
-rw-r--r--chromium/media/cdm/cdm_document_service.h2
-rw-r--r--chromium/media/cdm/cdm_helpers.cc2
-rw-r--r--chromium/media/cdm/cdm_helpers.h2
-rw-r--r--chromium/media/cdm/cdm_host_file.cc2
-rw-r--r--chromium/media/cdm/cdm_host_file.h2
-rw-r--r--chromium/media/cdm/cdm_host_files.cc2
-rw-r--r--chromium/media/cdm/cdm_host_files.h2
-rw-r--r--chromium/media/cdm/cdm_module.cc50
-rw-r--r--chromium/media/cdm/cdm_module.h2
-rw-r--r--chromium/media/cdm/cdm_paths.cc9
-rw-r--r--chromium/media/cdm/cdm_paths.h2
-rw-r--r--chromium/media/cdm/cdm_paths_unittest.cc4
-rw-r--r--chromium/media/cdm/cdm_type.h2
-rw-r--r--chromium/media/cdm/cdm_type_conversion.cc2
-rw-r--r--chromium/media/cdm/cdm_type_conversion.h2
-rw-r--r--chromium/media/cdm/cdm_wrapper.h2
-rw-r--r--chromium/media/cdm/cenc_decryptor.cc2
-rw-r--r--chromium/media/cdm/cenc_decryptor.h2
-rw-r--r--chromium/media/cdm/cenc_decryptor_fuzzer.cc2
-rw-r--r--chromium/media/cdm/cenc_decryptor_unittest.cc2
-rw-r--r--chromium/media/cdm/cenc_utils.cc2
-rw-r--r--chromium/media/cdm/cenc_utils.h2
-rw-r--r--chromium/media/cdm/cenc_utils_fuzzertest.cc2
-rw-r--r--chromium/media/cdm/cenc_utils_unittest.cc2
-rw-r--r--chromium/media/cdm/default_cdm_factory.cc2
-rw-r--r--chromium/media/cdm/default_cdm_factory.h2
-rw-r--r--chromium/media/cdm/external_clear_key_test_helper.cc9
-rw-r--r--chromium/media/cdm/external_clear_key_test_helper.h2
-rw-r--r--chromium/media/cdm/json_web_key.cc2
-rw-r--r--chromium/media/cdm/json_web_key.h2
-rw-r--r--chromium/media/cdm/json_web_key_fuzzer.cc2
-rw-r--r--chromium/media/cdm/json_web_key_unittest.cc2
-rw-r--r--chromium/media/cdm/library_cdm/BUILD.gn2
-rw-r--r--chromium/media/cdm/library_cdm/cdm_host_proxy.h2
-rw-r--r--chromium/media/cdm/library_cdm/cdm_host_proxy_impl.h2
-rw-r--r--chromium/media/cdm/library_cdm/cdm_paths.gni25
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/BUILD.gn18
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.cc2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.h2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.cc2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.h2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.h2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.cc2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.h2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.cc2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.h2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc2
-rw-r--r--chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.h2
-rw-r--r--chromium/media/cdm/library_cdm/mock_library_cdm.cc2
-rw-r--r--chromium/media/cdm/library_cdm/mock_library_cdm.h2
-rw-r--r--chromium/media/cdm/load_cdm_uma_helper.cc35
-rw-r--r--chromium/media/cdm/load_cdm_uma_helper.h40
-rw-r--r--chromium/media/cdm/media_foundation_cdm_data.cc2
-rw-r--r--chromium/media/cdm/media_foundation_cdm_data.h2
-rw-r--r--chromium/media/cdm/mock_helpers.cc2
-rw-r--r--chromium/media/cdm/mock_helpers.h2
-rw-r--r--chromium/media/cdm/output_protection.h2
-rw-r--r--chromium/media/cdm/simple_cdm_allocator.cc2
-rw-r--r--chromium/media/cdm/simple_cdm_allocator.h2
-rw-r--r--chromium/media/cdm/simple_cdm_allocator_unittest.cc2
-rw-r--r--chromium/media/cdm/simple_cdm_buffer.cc2
-rw-r--r--chromium/media/cdm/simple_cdm_buffer.h2
-rw-r--r--chromium/media/cdm/supported_audio_codecs.cc2
-rw-r--r--chromium/media/cdm/supported_audio_codecs.h2
-rw-r--r--chromium/media/cdm/supported_cdm_versions.cc2
-rw-r--r--chromium/media/cdm/supported_cdm_versions.h2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm.cc5
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm.h2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_factory.cc6
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_factory.h2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_factory_unittest.cc2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_module.cc44
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_module.h2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_session.cc2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_session.h2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_session_unittest.cc2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_unittest.cc2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_util.cc2
-rw-r--r--chromium/media/cdm/win/media_foundation_cdm_util.h2
-rw-r--r--chromium/media/device_monitors/BUILD.gn2
-rw-r--r--chromium/media/device_monitors/device_monitor_mac.h2
-rw-r--r--chromium/media/device_monitors/device_monitor_mac.mm12
-rw-r--r--chromium/media/device_monitors/device_monitor_udev.cc2
-rw-r--r--chromium/media/device_monitors/device_monitor_udev.h2
-rw-r--r--chromium/media/device_monitors/system_message_window_win.cc2
-rw-r--r--chromium/media/device_monitors/system_message_window_win.h2
-rw-r--r--chromium/media/device_monitors/system_message_window_win_unittest.cc2
-rw-r--r--chromium/media/ffmpeg/BUILD.gn2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_common.cc34
-rw-r--r--chromium/media/ffmpeg/ffmpeg_common.h2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_common_unittest.cc2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_decoding_loop.cc2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_decoding_loop.h2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_deleters.h2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_regression_tests.cc2
-rw-r--r--chromium/media/ffmpeg/scoped_av_packet.cc2
-rw-r--r--chromium/media/ffmpeg/scoped_av_packet.h2
-rw-r--r--chromium/media/ffmpeg/scoped_av_packet_unittest.cc2
-rw-r--r--chromium/media/filters/BUILD.gn19
-rw-r--r--chromium/media/filters/android/media_codec_audio_decoder.cc14
-rw-r--r--chromium/media/filters/android/media_codec_audio_decoder.h2
-rw-r--r--chromium/media/filters/android/video_frame_extractor.cc2
-rw-r--r--chromium/media/filters/android/video_frame_extractor.h2
-rw-r--r--chromium/media/filters/android/video_frame_extractor_unittest.cc2
-rw-r--r--chromium/media/filters/audio_clock.cc2
-rw-r--r--chromium/media/filters/audio_clock.h2
-rw-r--r--chromium/media/filters/audio_clock_unittest.cc2
-rw-r--r--chromium/media/filters/audio_decoder_stream_unittest.cc2
-rw-r--r--chromium/media/filters/audio_decoder_unittest.cc2
-rw-r--r--chromium/media/filters/audio_file_reader.cc2
-rw-r--r--chromium/media/filters/audio_file_reader.h2
-rw-r--r--chromium/media/filters/audio_file_reader_unittest.cc4
-rw-r--r--chromium/media/filters/audio_renderer_algorithm.cc2
-rw-r--r--chromium/media/filters/audio_renderer_algorithm.h2
-rw-r--r--chromium/media/filters/audio_renderer_algorithm_unittest.cc12
-rw-r--r--chromium/media/filters/audio_timestamp_validator.cc2
-rw-r--r--chromium/media/filters/audio_timestamp_validator.h2
-rw-r--r--chromium/media/filters/audio_timestamp_validator_unittest.cc2
-rw-r--r--chromium/media/filters/audio_video_metadata_extractor.cc2
-rw-r--r--chromium/media/filters/audio_video_metadata_extractor.h2
-rw-r--r--chromium/media/filters/audio_video_metadata_extractor_unittest.cc6
-rw-r--r--chromium/media/filters/blocking_url_protocol.cc2
-rw-r--r--chromium/media/filters/blocking_url_protocol.h2
-rw-r--r--chromium/media/filters/blocking_url_protocol_unittest.cc2
-rw-r--r--chromium/media/filters/chunk_demuxer.cc4
-rw-r--r--chromium/media/filters/chunk_demuxer.h4
-rw-r--r--chromium/media/filters/chunk_demuxer_unittest.cc6
-rw-r--r--chromium/media/filters/dav1d_video_decoder.cc2
-rw-r--r--chromium/media/filters/dav1d_video_decoder.h2
-rw-r--r--chromium/media/filters/dav1d_video_decoder_unittest.cc4
-rw-r--r--chromium/media/filters/decoder_selector.cc2
-rw-r--r--chromium/media/filters/decoder_selector.h2
-rw-r--r--chromium/media/filters/decoder_selector_unittest.cc2
-rw-r--r--chromium/media/filters/decoder_stream.cc2
-rw-r--r--chromium/media/filters/decoder_stream.h2
-rw-r--r--chromium/media/filters/decoder_stream_traits.cc2
-rw-r--r--chromium/media/filters/decoder_stream_traits.h2
-rw-r--r--chromium/media/filters/decrypting_audio_decoder.cc2
-rw-r--r--chromium/media/filters/decrypting_audio_decoder.h2
-rw-r--r--chromium/media/filters/decrypting_audio_decoder_unittest.cc2
-rw-r--r--chromium/media/filters/decrypting_demuxer_stream.cc2
-rw-r--r--chromium/media/filters/decrypting_demuxer_stream.h2
-rw-r--r--chromium/media/filters/decrypting_demuxer_stream_unittest.cc2
-rw-r--r--chromium/media/filters/decrypting_media_resource.cc2
-rw-r--r--chromium/media/filters/decrypting_media_resource.h2
-rw-r--r--chromium/media/filters/decrypting_media_resource_unittest.cc4
-rw-r--r--chromium/media/filters/decrypting_video_decoder.cc2
-rw-r--r--chromium/media/filters/decrypting_video_decoder.h2
-rw-r--r--chromium/media/filters/decrypting_video_decoder_unittest.cc2
-rw-r--r--chromium/media/filters/demuxer_perftest.cc2
-rw-r--r--chromium/media/filters/fake_video_decoder.cc2
-rw-r--r--chromium/media/filters/fake_video_decoder.h2
-rw-r--r--chromium/media/filters/fake_video_decoder_unittest.cc2
-rw-r--r--chromium/media/filters/ffmpeg_aac_bitstream_converter.cc2
-rw-r--r--chromium/media/filters/ffmpeg_aac_bitstream_converter.h2
-rw-r--r--chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc2
-rw-r--r--chromium/media/filters/ffmpeg_audio_decoder.cc4
-rw-r--r--chromium/media/filters/ffmpeg_audio_decoder.h2
-rw-r--r--chromium/media/filters/ffmpeg_bitstream_converter.h2
-rw-r--r--chromium/media/filters/ffmpeg_demuxer.cc2
-rw-r--r--chromium/media/filters/ffmpeg_demuxer.h2
-rw-r--r--chromium/media/filters/ffmpeg_demuxer_unittest.cc2
-rw-r--r--chromium/media/filters/ffmpeg_glue.cc2
-rw-r--r--chromium/media/filters/ffmpeg_glue.h2
-rw-r--r--chromium/media/filters/ffmpeg_glue_unittest.cc2
-rw-r--r--chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc2
-rw-r--r--chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h2
-rw-r--r--chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc2
-rw-r--r--chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc2
-rw-r--r--chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h2
-rw-r--r--chromium/media/filters/ffmpeg_video_decoder.cc4
-rw-r--r--chromium/media/filters/ffmpeg_video_decoder.h2
-rw-r--r--chromium/media/filters/ffmpeg_video_decoder_unittest.cc2
-rw-r--r--chromium/media/filters/file_data_source.cc2
-rw-r--r--chromium/media/filters/file_data_source.h2
-rw-r--r--chromium/media/filters/file_data_source_unittest.cc2
-rw-r--r--chromium/media/filters/frame_buffer_pool.cc8
-rw-r--r--chromium/media/filters/frame_buffer_pool.h2
-rw-r--r--chromium/media/filters/frame_buffer_pool_unittest.cc2
-rw-r--r--chromium/media/filters/frame_processor.cc2
-rw-r--r--chromium/media/filters/frame_processor.h2
-rw-r--r--chromium/media/filters/frame_processor_unittest.cc2
-rw-r--r--chromium/media/filters/gav1_video_decoder.cc8
-rw-r--r--chromium/media/filters/gav1_video_decoder.h2
-rw-r--r--chromium/media/filters/gav1_video_decoder_unittest.cc4
-rw-r--r--chromium/media/filters/h264_bitstream_buffer.cc2
-rw-r--r--chromium/media/filters/h264_bitstream_buffer.h2
-rw-r--r--chromium/media/filters/h264_bitstream_buffer_unittest.cc2
-rw-r--r--chromium/media/filters/h264_to_annex_b_bitstream_converter.cc2
-rw-r--r--chromium/media/filters/h264_to_annex_b_bitstream_converter.h2
-rw-r--r--chromium/media/filters/h264_to_annex_b_bitstream_converter_unittest.cc2
-rw-r--r--chromium/media/filters/h265_to_annex_b_bitstream_converter.cc295
-rw-r--r--chromium/media/filters/h265_to_annex_b_bitstream_converter.h156
-rw-r--r--chromium/media/filters/h265_to_annex_b_bitstream_converter_unittest.cc238
-rw-r--r--chromium/media/filters/in_memory_url_protocol.cc2
-rw-r--r--chromium/media/filters/in_memory_url_protocol.h2
-rw-r--r--chromium/media/filters/in_memory_url_protocol_unittest.cc2
-rw-r--r--chromium/media/filters/ivf_parser.cc2
-rw-r--r--chromium/media/filters/ivf_parser.h2
-rw-r--r--chromium/media/filters/ivf_parser_unittest.cc2
-rw-r--r--chromium/media/filters/mac/audio_toolbox_audio_decoder.cc2
-rw-r--r--chromium/media/filters/mac/audio_toolbox_audio_decoder.h2
-rw-r--r--chromium/media/filters/mac/audio_toolbox_audio_encoder.cc191
-rw-r--r--chromium/media/filters/mac/audio_toolbox_audio_encoder.h10
-rw-r--r--chromium/media/filters/media_file_checker.cc2
-rw-r--r--chromium/media/filters/media_file_checker.h2
-rw-r--r--chromium/media/filters/media_file_checker_unittest.cc2
-rw-r--r--chromium/media/filters/memory_data_source.cc2
-rw-r--r--chromium/media/filters/memory_data_source.h2
-rw-r--r--chromium/media/filters/memory_data_source_unittest.cc2
-rw-r--r--chromium/media/filters/offloading_video_decoder.cc6
-rw-r--r--chromium/media/filters/offloading_video_decoder.h2
-rw-r--r--chromium/media/filters/offloading_video_decoder_unittest.cc2
-rw-r--r--chromium/media/filters/passthrough_dts_audio_decoder.cc116
-rw-r--r--chromium/media/filters/passthrough_dts_audio_decoder.h70
-rw-r--r--chromium/media/filters/pipeline_controller.cc2
-rw-r--r--chromium/media/filters/pipeline_controller.h2
-rw-r--r--chromium/media/filters/pipeline_controller_unittest.cc2
-rw-r--r--chromium/media/filters/source_buffer_parse_warnings.h2
-rw-r--r--chromium/media/filters/source_buffer_range.cc2
-rw-r--r--chromium/media/filters/source_buffer_range.h2
-rw-r--r--chromium/media/filters/source_buffer_state.cc11
-rw-r--r--chromium/media/filters/source_buffer_state.h2
-rw-r--r--chromium/media/filters/source_buffer_state_unittest.cc2
-rw-r--r--chromium/media/filters/source_buffer_stream.cc13
-rw-r--r--chromium/media/filters/source_buffer_stream.h7
-rw-r--r--chromium/media/filters/source_buffer_stream_unittest.cc42
-rw-r--r--chromium/media/filters/stream_parser_factory.cc15
-rw-r--r--chromium/media/filters/stream_parser_factory.h7
-rw-r--r--chromium/media/filters/video_cadence_estimator.cc2
-rw-r--r--chromium/media/filters/video_cadence_estimator.h2
-rw-r--r--chromium/media/filters/video_cadence_estimator_unittest.cc2
-rw-r--r--chromium/media/filters/video_decoder_stream_unittest.cc2
-rw-r--r--chromium/media/filters/video_renderer_algorithm.cc2
-rw-r--r--chromium/media/filters/video_renderer_algorithm.h2
-rw-r--r--chromium/media/filters/video_renderer_algorithm_unittest.cc2
-rw-r--r--chromium/media/filters/vp9_bool_decoder.cc2
-rw-r--r--chromium/media/filters/vp9_bool_decoder.h2
-rw-r--r--chromium/media/filters/vp9_compressed_header_parser.cc2
-rw-r--r--chromium/media/filters/vp9_compressed_header_parser.h2
-rw-r--r--chromium/media/filters/vp9_parser.cc2
-rw-r--r--chromium/media/filters/vp9_parser.h2
-rw-r--r--chromium/media/filters/vp9_parser_encrypted_fuzzertest.cc2
-rw-r--r--chromium/media/filters/vp9_parser_fuzzertest.cc2
-rw-r--r--chromium/media/filters/vp9_parser_unittest.cc2
-rw-r--r--chromium/media/filters/vp9_raw_bits_reader.cc2
-rw-r--r--chromium/media/filters/vp9_raw_bits_reader.h2
-rw-r--r--chromium/media/filters/vp9_raw_bits_reader_unittest.cc2
-rw-r--r--chromium/media/filters/vp9_uncompressed_header_parser.cc2
-rw-r--r--chromium/media/filters/vp9_uncompressed_header_parser.h2
-rw-r--r--chromium/media/filters/vp9_uncompressed_header_parser_unittest.cc2
-rw-r--r--chromium/media/filters/vpx_video_decoder.cc24
-rw-r--r--chromium/media/filters/vpx_video_decoder.h2
-rw-r--r--chromium/media/filters/vpx_video_decoder_fuzzertest.cc2
-rw-r--r--chromium/media/filters/vpx_video_decoder_unittest.cc6
-rw-r--r--chromium/media/filters/win/media_foundation_audio_decoder.cc37
-rw-r--r--chromium/media/filters/win/media_foundation_audio_decoder.h2
-rw-r--r--chromium/media/filters/win/media_foundation_utils.cc7
-rw-r--r--chromium/media/filters/win/media_foundation_utils.h2
-rw-r--r--chromium/media/filters/wsola_internals.cc2
-rw-r--r--chromium/media/filters/wsola_internals.h2
-rw-r--r--chromium/media/formats/BUILD.gn24
-rw-r--r--chromium/media/formats/ac3/ac3_util.cc2
-rw-r--r--chromium/media/formats/ac3/ac3_util.h2
-rw-r--r--chromium/media/formats/ac3/ac3_util_unittest.cc2
-rw-r--r--chromium/media/formats/common/offset_byte_queue.cc2
-rw-r--r--chromium/media/formats/common/offset_byte_queue.h2
-rw-r--r--chromium/media/formats/common/offset_byte_queue_unittest.cc2
-rw-r--r--chromium/media/formats/common/opus_constants.cc2
-rw-r--r--chromium/media/formats/common/opus_constants.h2
-rw-r--r--chromium/media/formats/common/stream_parser_test_base.cc2
-rw-r--r--chromium/media/formats/common/stream_parser_test_base.h2
-rw-r--r--chromium/media/formats/dts/dts_stream_parser.cc2
-rw-r--r--chromium/media/formats/dts/dts_stream_parser.h2
-rw-r--r--chromium/media/formats/dts/dts_util.cc71
-rw-r--r--chromium/media/formats/dts/dts_util.h13
-rw-r--r--chromium/media/formats/dts/dts_util_fuzzer.cc18
-rw-r--r--chromium/media/formats/dts/dts_util_unittest.cc41
-rw-r--r--chromium/media/formats/hls/attribute_list_fuzzer.cc2
-rw-r--r--chromium/media/formats/hls/common_playlist_unittest.cc2
-rw-r--r--chromium/media/formats/hls/items.cc2
-rw-r--r--chromium/media/formats/hls/items.h2
-rw-r--r--chromium/media/formats/hls/items_fuzzer.cc2
-rw-r--r--chromium/media/formats/hls/items_unittest.cc2
-rw-r--r--chromium/media/formats/hls/media_playlist.cc13
-rw-r--r--chromium/media/formats/hls/media_playlist.h15
-rw-r--r--chromium/media/formats/hls/media_playlist_fuzzer.cc8
-rw-r--r--chromium/media/formats/hls/media_playlist_test_builder.cc2
-rw-r--r--chromium/media/formats/hls/media_playlist_test_builder.h2
-rw-r--r--chromium/media/formats/hls/media_playlist_unittest.cc22
-rw-r--r--chromium/media/formats/hls/media_segment.cc2
-rw-r--r--chromium/media/formats/hls/media_segment.h2
-rw-r--r--chromium/media/formats/hls/multivariant_playlist.cc24
-rw-r--r--chromium/media/formats/hls/multivariant_playlist.h23
-rw-r--r--chromium/media/formats/hls/multivariant_playlist_fuzzer.cc2
-rw-r--r--chromium/media/formats/hls/multivariant_playlist_test_builder.cc2
-rw-r--r--chromium/media/formats/hls/multivariant_playlist_test_builder.h7
-rw-r--r--chromium/media/formats/hls/multivariant_playlist_unittest.cc7
-rw-r--r--chromium/media/formats/hls/parse_status.cc2
-rw-r--r--chromium/media/formats/hls/parse_status.h2
-rw-r--r--chromium/media/formats/hls/playlist.cc4
-rw-r--r--chromium/media/formats/hls/playlist.h11
-rw-r--r--chromium/media/formats/hls/playlist_common.cc2
-rw-r--r--chromium/media/formats/hls/playlist_common.h2
-rw-r--r--chromium/media/formats/hls/playlist_test_builder.h8
-rw-r--r--chromium/media/formats/hls/playlist_unittest.cc2
-rw-r--r--chromium/media/formats/hls/source_string.cc2
-rw-r--r--chromium/media/formats/hls/source_string.h22
-rw-r--r--chromium/media/formats/hls/tag_name.cc2
-rw-r--r--chromium/media/formats/hls/tag_name.h2
-rw-r--r--chromium/media/formats/hls/tags.cc33
-rw-r--r--chromium/media/formats/hls/tags.h14
-rw-r--r--chromium/media/formats/hls/tags_unittest.cc33
-rw-r--r--chromium/media/formats/hls/test_util.h2
-rw-r--r--chromium/media/formats/hls/types.cc2
-rw-r--r--chromium/media/formats/hls/types.h2
-rw-r--r--chromium/media/formats/hls/types_unittest.cc2
-rw-r--r--chromium/media/formats/hls/variable_dictionary.cc2
-rw-r--r--chromium/media/formats/hls/variable_dictionary.h2
-rw-r--r--chromium/media/formats/hls/variable_dictionary_unittest.cc2
-rw-r--r--chromium/media/formats/hls/variant_stream.cc7
-rw-r--r--chromium/media/formats/hls/variant_stream.h14
-rw-r--r--chromium/media/formats/mp2t/descriptors.cc2
-rw-r--r--chromium/media/formats/mp2t/descriptors.h2
-rw-r--r--chromium/media/formats/mp2t/es_adapter_video.cc2
-rw-r--r--chromium/media/formats/mp2t/es_adapter_video.h2
-rw-r--r--chromium/media/formats/mp2t/es_adapter_video_unittest.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser.h2
-rw-r--r--chromium/media/formats/mp2t/es_parser_adts.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_adts.h2
-rw-r--r--chromium/media/formats/mp2t/es_parser_adts_fuzzer.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_adts_unittest.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_h264.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_h264.h2
-rw-r--r--chromium/media/formats/mp2t/es_parser_h264_fuzzer.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_h264_unittest.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_mpeg1audio.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_mpeg1audio.h2
-rw-r--r--chromium/media/formats/mp2t/es_parser_mpeg1audio_fuzzer.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_test_base.cc2
-rw-r--r--chromium/media/formats/mp2t/es_parser_test_base.h2
-rw-r--r--chromium/media/formats/mp2t/mp2t_common.h2
-rw-r--r--chromium/media/formats/mp2t/mp2t_stream_parser.cc22
-rw-r--r--chromium/media/formats/mp2t/mp2t_stream_parser.h12
-rw-r--r--chromium/media/formats/mp2t/mp2t_stream_parser_unittest.cc2
-rw-r--r--chromium/media/formats/mp2t/timestamp_unroller.cc2
-rw-r--r--chromium/media/formats/mp2t/timestamp_unroller.h2
-rw-r--r--chromium/media/formats/mp2t/timestamp_unroller_unittest.cc2
-rw-r--r--chromium/media/formats/mp2t/ts_packet.cc2
-rw-r--r--chromium/media/formats/mp2t/ts_packet.h2
-rw-r--r--chromium/media/formats/mp2t/ts_section.h2
-rw-r--r--chromium/media/formats/mp2t/ts_section_cat.cc2
-rw-r--r--chromium/media/formats/mp2t/ts_section_cat.h2
-rw-r--r--chromium/media/formats/mp2t/ts_section_cets_ecm.cc2
-rw-r--r--chromium/media/formats/mp2t/ts_section_cets_ecm.h2
-rw-r--r--chromium/media/formats/mp2t/ts_section_cets_pssh.cc2
-rw-r--r--chromium/media/formats/mp2t/ts_section_cets_pssh.h2
-rw-r--r--chromium/media/formats/mp2t/ts_section_pat.cc2
-rw-r--r--chromium/media/formats/mp2t/ts_section_pat.h2
-rw-r--r--chromium/media/formats/mp2t/ts_section_pes.cc2
-rw-r--r--chromium/media/formats/mp2t/ts_section_pes.h2
-rw-r--r--chromium/media/formats/mp2t/ts_section_pmt.cc2
-rw-r--r--chromium/media/formats/mp2t/ts_section_pmt.h2
-rw-r--r--chromium/media/formats/mp2t/ts_section_psi.cc2
-rw-r--r--chromium/media/formats/mp2t/ts_section_psi.h2
-rw-r--r--chromium/media/formats/mp4/aac.cc2
-rw-r--r--chromium/media/formats/mp4/aac.h2
-rw-r--r--chromium/media/formats/mp4/aac_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/avc.cc2
-rw-r--r--chromium/media/formats/mp4/avc.h2
-rw-r--r--chromium/media/formats/mp4/avc_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/bitstream_converter.cc2
-rw-r--r--chromium/media/formats/mp4/bitstream_converter.h2
-rw-r--r--chromium/media/formats/mp4/box_definitions.cc57
-rw-r--r--chromium/media/formats/mp4/box_definitions.h17
-rw-r--r--chromium/media/formats/mp4/box_reader.cc2
-rw-r--r--chromium/media/formats/mp4/box_reader.h2
-rw-r--r--chromium/media/formats/mp4/box_reader_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/dolby_vision.cc2
-rw-r--r--chromium/media/formats/mp4/dolby_vision.h2
-rw-r--r--chromium/media/formats/mp4/dolby_vision_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/dts.cc2
-rw-r--r--chromium/media/formats/mp4/dts.h2
-rw-r--r--chromium/media/formats/mp4/dts_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/dtsx.cc2
-rw-r--r--chromium/media/formats/mp4/dtsx.h2
-rw-r--r--chromium/media/formats/mp4/dtsx_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/es_descriptor.cc2
-rw-r--r--chromium/media/formats/mp4/es_descriptor.h2
-rw-r--r--chromium/media/formats/mp4/es_descriptor_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/fourccs.h7
-rw-r--r--chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.cc2
-rw-r--r--chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.h2
-rw-r--r--chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_fuzztest.cc2
-rw-r--r--chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/hevc.cc180
-rw-r--r--chromium/media/formats/mp4/hevc.h10
-rw-r--r--chromium/media/formats/mp4/hevc_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/mp4_avcc_parser_fuzzer.cc2
-rw-r--r--chromium/media/formats/mp4/mp4_box_reader_fuzzer.cc2
-rw-r--r--chromium/media/formats/mp4/mp4_status.h2
-rw-r--r--chromium/media/formats/mp4/mp4_stream_parser.cc92
-rw-r--r--chromium/media/formats/mp4/mp4_stream_parser.h18
-rw-r--r--chromium/media/formats/mp4/mp4_stream_parser_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/nalu_test_helper.cc2
-rw-r--r--chromium/media/formats/mp4/nalu_test_helper.h2
-rw-r--r--chromium/media/formats/mp4/parse_result.h2
-rw-r--r--chromium/media/formats/mp4/rcheck.h2
-rw-r--r--chromium/media/formats/mp4/sample_to_group_iterator.cc2
-rw-r--r--chromium/media/formats/mp4/sample_to_group_iterator.h2
-rw-r--r--chromium/media/formats/mp4/sample_to_group_iterator_unittest.cc2
-rw-r--r--chromium/media/formats/mp4/track_run_iterator.cc2
-rw-r--r--chromium/media/formats/mp4/track_run_iterator.h2
-rw-r--r--chromium/media/formats/mp4/track_run_iterator_unittest.cc2
-rw-r--r--chromium/media/formats/mpeg/adts_constants.cc2
-rw-r--r--chromium/media/formats/mpeg/adts_constants.h2
-rw-r--r--chromium/media/formats/mpeg/adts_stream_parser.cc2
-rw-r--r--chromium/media/formats/mpeg/adts_stream_parser.h2
-rw-r--r--chromium/media/formats/mpeg/adts_stream_parser_unittest.cc2
-rw-r--r--chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc2
-rw-r--r--chromium/media/formats/mpeg/mpeg1_audio_stream_parser.h2
-rw-r--r--chromium/media/formats/mpeg/mpeg1_audio_stream_parser_unittest.cc2
-rw-r--r--chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.cc20
-rw-r--r--chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.h12
-rw-r--r--chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.cc20
-rw-r--r--chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.h12
-rw-r--r--chromium/media/formats/webm/cluster_builder.cc2
-rw-r--r--chromium/media/formats/webm/cluster_builder.h2
-rw-r--r--chromium/media/formats/webm/opus_packet_builder.cc2
-rw-r--r--chromium/media/formats/webm/opus_packet_builder.h2
-rw-r--r--chromium/media/formats/webm/tracks_builder.cc2
-rw-r--r--chromium/media/formats/webm/tracks_builder.h2
-rw-r--r--chromium/media/formats/webm/webm_audio_client.cc2
-rw-r--r--chromium/media/formats/webm/webm_audio_client.h2
-rw-r--r--chromium/media/formats/webm/webm_cluster_parser.cc2
-rw-r--r--chromium/media/formats/webm/webm_cluster_parser.h2
-rw-r--r--chromium/media/formats/webm/webm_cluster_parser_unittest.cc2
-rw-r--r--chromium/media/formats/webm/webm_colour_parser.cc2
-rw-r--r--chromium/media/formats/webm/webm_colour_parser.h2
-rw-r--r--chromium/media/formats/webm/webm_constants.cc2
-rw-r--r--chromium/media/formats/webm/webm_constants.h2
-rw-r--r--chromium/media/formats/webm/webm_content_encodings.cc2
-rw-r--r--chromium/media/formats/webm/webm_content_encodings.h2
-rw-r--r--chromium/media/formats/webm/webm_content_encodings_client.cc2
-rw-r--r--chromium/media/formats/webm/webm_content_encodings_client.h2
-rw-r--r--chromium/media/formats/webm/webm_content_encodings_client_unittest.cc2
-rw-r--r--chromium/media/formats/webm/webm_crypto_helpers.cc2
-rw-r--r--chromium/media/formats/webm/webm_crypto_helpers.h2
-rw-r--r--chromium/media/formats/webm/webm_crypto_helpers_unittest.cc2
-rw-r--r--chromium/media/formats/webm/webm_info_parser.cc2
-rw-r--r--chromium/media/formats/webm/webm_info_parser.h2
-rw-r--r--chromium/media/formats/webm/webm_parser.cc2
-rw-r--r--chromium/media/formats/webm/webm_parser.h2
-rw-r--r--chromium/media/formats/webm/webm_parser_unittest.cc2
-rw-r--r--chromium/media/formats/webm/webm_projection_parser.cc2
-rw-r--r--chromium/media/formats/webm/webm_projection_parser.h2
-rw-r--r--chromium/media/formats/webm/webm_projection_parser_unittest.cc2
-rw-r--r--chromium/media/formats/webm/webm_stream_parser.cc24
-rw-r--r--chromium/media/formats/webm/webm_stream_parser.h12
-rw-r--r--chromium/media/formats/webm/webm_stream_parser_unittest.cc2
-rw-r--r--chromium/media/formats/webm/webm_tracks_parser.cc2
-rw-r--r--chromium/media/formats/webm/webm_tracks_parser.h2
-rw-r--r--chromium/media/formats/webm/webm_tracks_parser_unittest.cc2
-rw-r--r--chromium/media/formats/webm/webm_video_client.cc2
-rw-r--r--chromium/media/formats/webm/webm_video_client.h2
-rw-r--r--chromium/media/formats/webm/webm_video_client_unittest.cc2
-rw-r--r--chromium/media/formats/webm/webm_webvtt_parser.cc2
-rw-r--r--chromium/media/formats/webm/webm_webvtt_parser.h2
-rw-r--r--chromium/media/formats/webm/webm_webvtt_parser_unittest.cc2
-rw-r--r--chromium/media/fuchsia/audio/BUILD.gn2
-rw-r--r--chromium/media/fuchsia/audio/fake_audio_capturer.cc5
-rw-r--r--chromium/media/fuchsia/audio/fake_audio_capturer.h2
-rw-r--r--chromium/media/fuchsia/audio/fake_audio_consumer.cc2
-rw-r--r--chromium/media/fuchsia/audio/fake_audio_consumer.h2
-rw-r--r--chromium/media/fuchsia/audio/fake_audio_device_enumerator.cc2
-rw-r--r--chromium/media/fuchsia/audio/fake_audio_device_enumerator.h2
-rw-r--r--chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.cc2
-rw-r--r--chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.h2
-rw-r--r--chromium/media/fuchsia/camera/BUILD.gn2
-rw-r--r--chromium/media/fuchsia/camera/fake_fuchsia_camera.cc2
-rw-r--r--chromium/media/fuchsia/camera/fake_fuchsia_camera.h2
-rw-r--r--chromium/media/fuchsia/cdm/BUILD.gn2
-rw-r--r--chromium/media/fuchsia/cdm/client/BUILD.gn2
-rw-r--r--chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.cc2
-rw-r--r--chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.h2
-rw-r--r--chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.cc2
-rw-r--r--chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.h2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_cdm.cc2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_cdm.h2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_cdm_context.h2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_cdm_factory.cc2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_cdm_factory.h2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_cdm_provider.h2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_decryptor.cc2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_decryptor.h2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.cc2
-rw-r--r--chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.h2
-rw-r--r--chromium/media/fuchsia/cdm/service/BUILD.gn2
-rw-r--r--chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.cc2
-rw-r--r--chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.h2
-rw-r--r--chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager_unittest.cc2
-rw-r--r--chromium/media/fuchsia/cdm/service/mock_provision_fetcher.cc2
-rw-r--r--chromium/media/fuchsia/cdm/service/mock_provision_fetcher.h4
-rw-r--r--chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.cc2
-rw-r--r--chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.h2
-rw-r--r--chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl_unittest.cc2
-rw-r--r--chromium/media/fuchsia/common/BUILD.gn2
-rw-r--r--chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.cc2
-rw-r--r--chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.h2
-rw-r--r--chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.cc2
-rw-r--r--chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.h2
-rw-r--r--chromium/media/fuchsia/common/stream_processor_helper.cc2
-rw-r--r--chromium/media/fuchsia/common/stream_processor_helper.h2
-rw-r--r--chromium/media/fuchsia/common/sysmem_buffer_stream.h2
-rw-r--r--chromium/media/fuchsia/common/sysmem_client.cc2
-rw-r--r--chromium/media/fuchsia/common/sysmem_client.h2
-rw-r--r--chromium/media/fuchsia/common/vmo_buffer.cc2
-rw-r--r--chromium/media/fuchsia/common/vmo_buffer.h2
-rw-r--r--chromium/media/fuchsia/common/vmo_buffer_writer_queue.cc2
-rw-r--r--chromium/media/fuchsia/common/vmo_buffer_writer_queue.h2
-rw-r--r--chromium/media/fuchsia/mojom/BUILD.gn2
-rw-r--r--chromium/media/fuchsia/mojom/fuchsia_media_resource_provider.mojom16
-rw-r--r--chromium/media/fuchsia/mojom/fuchsia_media_resource_provider_mojom_traits.h2
-rw-r--r--chromium/media/fuchsia/test_support.shard.test-cml2
-rw-r--r--chromium/media/fuchsia/video/BUILD.gn3
-rw-r--r--chromium/media/fuchsia/video/fuchsia_decoder_factory.cc23
-rw-r--r--chromium/media/fuchsia/video/fuchsia_decoder_factory.h28
-rw-r--r--chromium/media/fuchsia/video/fuchsia_video_decoder.cc192
-rw-r--r--chromium/media/fuchsia/video/fuchsia_video_decoder.h22
-rw-r--r--chromium/media/fuchsia/video/fuchsia_video_decoder_unittest.cc27
-rw-r--r--chromium/media/gpu/BUILD.gn3
-rw-r--r--chromium/media/gpu/OWNERS1
-rw-r--r--chromium/media/gpu/accelerated_video_decoder.h2
-rw-r--r--chromium/media/gpu/android/android_video_encode_accelerator.cc2
-rw-r--r--chromium/media/gpu/android/android_video_encode_accelerator.h2
-rw-r--r--chromium/media/gpu/android/android_video_surface_chooser.cc2
-rw-r--r--chromium/media/gpu/android/android_video_surface_chooser.h2
-rw-r--r--chromium/media/gpu/android/android_video_surface_chooser_impl.cc2
-rw-r--r--chromium/media/gpu/android/android_video_surface_chooser_impl.h2
-rw-r--r--chromium/media/gpu/android/android_video_surface_chooser_impl_unittest.cc2
-rw-r--r--chromium/media/gpu/android/codec_allocator.cc8
-rw-r--r--chromium/media/gpu/android/codec_allocator.h2
-rw-r--r--chromium/media/gpu/android/codec_allocator_unittest.cc2
-rw-r--r--chromium/media/gpu/android/codec_buffer_wait_coordinator.cc2
-rw-r--r--chromium/media/gpu/android/codec_buffer_wait_coordinator.h2
-rw-r--r--chromium/media/gpu/android/codec_image.cc19
-rw-r--r--chromium/media/gpu/android/codec_image.h8
-rw-r--r--chromium/media/gpu/android/codec_image_group.cc2
-rw-r--r--chromium/media/gpu/android/codec_image_group.h2
-rw-r--r--chromium/media/gpu/android/codec_image_group_unittest.cc2
-rw-r--r--chromium/media/gpu/android/codec_image_unittest.cc2
-rw-r--r--chromium/media/gpu/android/codec_output_buffer_renderer.cc2
-rw-r--r--chromium/media/gpu/android/codec_output_buffer_renderer.h12
-rw-r--r--chromium/media/gpu/android/codec_surface_bundle.cc2
-rw-r--r--chromium/media/gpu/android/codec_surface_bundle.h2
-rw-r--r--chromium/media/gpu/android/codec_wrapper.cc2
-rw-r--r--chromium/media/gpu/android/codec_wrapper.h2
-rw-r--r--chromium/media/gpu/android/codec_wrapper_unittest.cc2
-rw-r--r--chromium/media/gpu/android/device_info.cc2
-rw-r--r--chromium/media/gpu/android/device_info.h2
-rw-r--r--chromium/media/gpu/android/direct_shared_image_video_provider.cc12
-rw-r--r--chromium/media/gpu/android/direct_shared_image_video_provider.h2
-rw-r--r--chromium/media/gpu/android/fake_codec_allocator.cc2
-rw-r--r--chromium/media/gpu/android/fake_codec_allocator.h2
-rw-r--r--chromium/media/gpu/android/frame_info_helper.cc2
-rw-r--r--chromium/media/gpu/android/frame_info_helper.h2
-rw-r--r--chromium/media/gpu/android/frame_info_helper_unittest.cc2
-rw-r--r--chromium/media/gpu/android/maybe_render_early_manager.cc10
-rw-r--r--chromium/media/gpu/android/maybe_render_early_manager.h2
-rw-r--r--chromium/media/gpu/android/maybe_render_early_manager_unittest.cc2
-rw-r--r--chromium/media/gpu/android/media_codec_video_decoder.cc32
-rw-r--r--chromium/media/gpu/android/media_codec_video_decoder.h2
-rw-r--r--chromium/media/gpu/android/media_codec_video_decoder_unittest.cc2
-rw-r--r--chromium/media/gpu/android/mediacodec.sigs2
-rw-r--r--chromium/media/gpu/android/mock_android_video_surface_chooser.cc2
-rw-r--r--chromium/media/gpu/android/mock_android_video_surface_chooser.h2
-rw-r--r--chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.cc2
-rw-r--r--chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.h4
-rw-r--r--chromium/media/gpu/android/mock_codec_image.cc2
-rw-r--r--chromium/media/gpu/android/mock_codec_image.h2
-rw-r--r--chromium/media/gpu/android/mock_device_info.cc2
-rw-r--r--chromium/media/gpu/android/mock_device_info.h2
-rw-r--r--chromium/media/gpu/android/mock_promotion_hint_aggregator.cc2
-rw-r--r--chromium/media/gpu/android/mock_promotion_hint_aggregator.h2
-rw-r--r--chromium/media/gpu/android/mock_shared_image_video_provider.cc2
-rw-r--r--chromium/media/gpu/android/mock_shared_image_video_provider.h6
-rw-r--r--chromium/media/gpu/android/ndk_constants.cc2
-rw-r--r--chromium/media/gpu/android/ndk_video_encode_accelerator.cc7
-rw-r--r--chromium/media/gpu/android/ndk_video_encode_accelerator.h2
-rw-r--r--chromium/media/gpu/android/ndk_video_encode_accelerator_tests.cc40
-rw-r--r--chromium/media/gpu/android/pooled_shared_image_video_provider.cc2
-rw-r--r--chromium/media/gpu/android/pooled_shared_image_video_provider.h2
-rw-r--r--chromium/media/gpu/android/pooled_shared_image_video_provider_unittest.cc2
-rw-r--r--chromium/media/gpu/android/promotion_hint_aggregator.h2
-rw-r--r--chromium/media/gpu/android/promotion_hint_aggregator_impl.cc2
-rw-r--r--chromium/media/gpu/android/promotion_hint_aggregator_impl.h2
-rw-r--r--chromium/media/gpu/android/promotion_hint_aggregator_impl_unittest.cc2
-rw-r--r--chromium/media/gpu/android/shared_image_video_provider.cc2
-rw-r--r--chromium/media/gpu/android/shared_image_video_provider.h2
-rw-r--r--chromium/media/gpu/android/surface_chooser_helper.cc2
-rw-r--r--chromium/media/gpu/android/surface_chooser_helper.h2
-rw-r--r--chromium/media/gpu/android/surface_chooser_helper_unittest.cc2
-rw-r--r--chromium/media/gpu/android/texture_pool_unittest.cc2
-rw-r--r--chromium/media/gpu/android/video_frame_factory.h2
-rw-r--r--chromium/media/gpu/android/video_frame_factory_impl.cc3
-rw-r--r--chromium/media/gpu/android/video_frame_factory_impl.h2
-rw-r--r--chromium/media/gpu/android/video_frame_factory_impl_unittest.cc2
-rw-r--r--chromium/media/gpu/args.gni5
-rw-r--r--chromium/media/gpu/av1_decoder.cc2
-rw-r--r--chromium/media/gpu/av1_decoder.h4
-rw-r--r--chromium/media/gpu/av1_decoder_fuzzertest.cc2
-rw-r--r--chromium/media/gpu/av1_decoder_unittest.cc13
-rw-r--r--chromium/media/gpu/av1_picture.cc2
-rw-r--r--chromium/media/gpu/av1_picture.h3
-rw-r--r--chromium/media/gpu/buffer_validation.cc2
-rw-r--r--chromium/media/gpu/buffer_validation.h2
-rw-r--r--chromium/media/gpu/buffer_validation_unittest.cc2
-rw-r--r--chromium/media/gpu/chromeos/BUILD.gn2
-rw-r--r--chromium/media/gpu/chromeos/chromeos_status.h2
-rw-r--r--chromium/media/gpu/chromeos/decoder_buffer_transcryptor.cc2
-rw-r--r--chromium/media/gpu/chromeos/decoder_buffer_transcryptor.h2
-rw-r--r--chromium/media/gpu/chromeos/dmabuf_video_frame_pool.cc2
-rw-r--r--chromium/media/gpu/chromeos/dmabuf_video_frame_pool.h2
-rw-r--r--chromium/media/gpu/chromeos/fourcc.cc2
-rw-r--r--chromium/media/gpu/chromeos/fourcc.h2
-rw-r--r--chromium/media/gpu/chromeos/fourcc_unittests.cc2
-rw-r--r--chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.cc7
-rw-r--r--chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.h2
-rw-r--r--chromium/media/gpu/chromeos/gl_image_processor_backend.cc65
-rw-r--r--chromium/media/gpu/chromeos/gl_image_processor_backend.h2
-rw-r--r--chromium/media/gpu/chromeos/gpu_buffer_layout.cc2
-rw-r--r--chromium/media/gpu/chromeos/gpu_buffer_layout.h2
-rw-r--r--chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.cc2
-rw-r--r--chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.h2
-rw-r--r--chromium/media/gpu/chromeos/image_processor.cc2
-rw-r--r--chromium/media/gpu/chromeos/image_processor.h2
-rw-r--r--chromium/media/gpu/chromeos/image_processor_backend.cc2
-rw-r--r--chromium/media/gpu/chromeos/image_processor_backend.h2
-rw-r--r--chromium/media/gpu/chromeos/image_processor_factory.cc2
-rw-r--r--chromium/media/gpu/chromeos/image_processor_factory.h2
-rw-r--r--chromium/media/gpu/chromeos/image_processor_test.cc2
-rw-r--r--chromium/media/gpu/chromeos/image_processor_with_pool.cc2
-rw-r--r--chromium/media/gpu/chromeos/image_processor_with_pool.h2
-rw-r--r--chromium/media/gpu/chromeos/libyuv_image_processor_backend.cc80
-rw-r--r--chromium/media/gpu/chromeos/libyuv_image_processor_backend.h2
-rw-r--r--chromium/media/gpu/chromeos/mailbox_video_frame_converter.cc5
-rw-r--r--chromium/media/gpu/chromeos/mailbox_video_frame_converter.h2
-rw-r--r--chromium/media/gpu/chromeos/mailbox_video_frame_converter_unittest.cc2
-rw-r--r--chromium/media/gpu/chromeos/oop_video_decoder.cc16
-rw-r--r--chromium/media/gpu/chromeos/oop_video_decoder.h2
-rw-r--r--chromium/media/gpu/chromeos/platform_video_frame_pool.cc2
-rw-r--r--chromium/media/gpu/chromeos/platform_video_frame_pool.h2
-rw-r--r--chromium/media/gpu/chromeos/platform_video_frame_pool_unittest.cc2
-rw-r--r--chromium/media/gpu/chromeos/platform_video_frame_utils.cc2
-rw-r--r--chromium/media/gpu/chromeos/platform_video_frame_utils.h2
-rw-r--r--chromium/media/gpu/chromeos/platform_video_frame_utils_unittest.cc2
-rw-r--r--chromium/media/gpu/chromeos/vd_video_decode_accelerator.cc15
-rw-r--r--chromium/media/gpu/chromeos/vd_video_decode_accelerator.h11
-rw-r--r--chromium/media/gpu/chromeos/vda_video_frame_pool.cc2
-rw-r--r--chromium/media/gpu/chromeos/vda_video_frame_pool.h2
-rw-r--r--chromium/media/gpu/chromeos/video_decoder_pipeline.cc54
-rw-r--r--chromium/media/gpu/chromeos/video_decoder_pipeline.h14
-rw-r--r--chromium/media/gpu/chromeos/video_decoder_pipeline_unittest.cc50
-rw-r--r--chromium/media/gpu/chromeos/video_frame_converter.cc2
-rw-r--r--chromium/media/gpu/chromeos/video_frame_converter.h2
-rw-r--r--chromium/media/gpu/codec_picture.cc2
-rw-r--r--chromium/media/gpu/codec_picture.h2
-rw-r--r--chromium/media/gpu/command_buffer_helper.cc15
-rw-r--r--chromium/media/gpu/command_buffer_helper.h7
-rw-r--r--chromium/media/gpu/decode_surface_handler.h2
-rw-r--r--chromium/media/gpu/gles2_decoder_helper.cc8
-rw-r--r--chromium/media/gpu/gles2_decoder_helper.h6
-rw-r--r--chromium/media/gpu/gpu_video_accelerator_util.cc2
-rw-r--r--chromium/media/gpu/gpu_video_accelerator_util.h2
-rw-r--r--chromium/media/gpu/gpu_video_decode_accelerator_factory.cc12
-rw-r--r--chromium/media/gpu/gpu_video_decode_accelerator_factory.h4
-rw-r--r--chromium/media/gpu/gpu_video_decode_accelerator_helpers.cc2
-rw-r--r--chromium/media/gpu/gpu_video_decode_accelerator_helpers.h2
-rw-r--r--chromium/media/gpu/gpu_video_encode_accelerator_factory.cc47
-rw-r--r--chromium/media/gpu/gpu_video_encode_accelerator_factory.h7
-rw-r--r--chromium/media/gpu/gpu_video_encode_accelerator_helpers.cc2
-rw-r--r--chromium/media/gpu/gpu_video_encode_accelerator_helpers.h2
-rw-r--r--chromium/media/gpu/h264_decoder.cc47
-rw-r--r--chromium/media/gpu/h264_decoder.h8
-rw-r--r--chromium/media/gpu/h264_decoder_unittest.cc2
-rw-r--r--chromium/media/gpu/h264_dpb.cc2
-rw-r--r--chromium/media/gpu/h264_dpb.h2
-rw-r--r--chromium/media/gpu/h265_decoder.cc2
-rw-r--r--chromium/media/gpu/h265_decoder.h2
-rw-r--r--chromium/media/gpu/h265_decoder_fuzzertest.cc2
-rw-r--r--chromium/media/gpu/h265_decoder_unittest.cc2
-rw-r--r--chromium/media/gpu/h265_dpb.cc2
-rw-r--r--chromium/media/gpu/h265_dpb.h2
-rw-r--r--chromium/media/gpu/ipc/client/BUILD.gn2
-rw-r--r--chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc2
-rw-r--r--chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.h2
-rw-r--r--chromium/media/gpu/ipc/common/BUILD.gn2
-rw-r--r--chromium/media/gpu/ipc/common/media_param_traits.cc2
-rw-r--r--chromium/media/gpu/ipc/common/media_param_traits.h2
-rw-r--r--chromium/media/gpu/ipc/common/media_param_traits_macros.h2
-rw-r--r--chromium/media/gpu/ipc/service/BUILD.gn2
-rw-r--r--chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.cc2
-rw-r--r--chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.h2
-rw-r--r--chromium/media/gpu/ipc/service/media_gpu_channel.cc2
-rw-r--r--chromium/media/gpu/ipc/service/media_gpu_channel.h2
-rw-r--r--chromium/media/gpu/ipc/service/media_gpu_channel_manager.cc2
-rw-r--r--chromium/media/gpu/ipc/service/media_gpu_channel_manager.h2
-rw-r--r--chromium/media/gpu/ipc/service/picture_buffer_manager.cc141
-rw-r--r--chromium/media/gpu/ipc/service/picture_buffer_manager.h28
-rw-r--r--chromium/media/gpu/ipc/service/picture_buffer_manager_unittest.cc16
-rw-r--r--chromium/media/gpu/ipc/service/vda_video_decoder.cc118
-rw-r--r--chromium/media/gpu/ipc/service/vda_video_decoder.h34
-rw-r--r--chromium/media/gpu/ipc/service/vda_video_decoder_unittest.cc8
-rw-r--r--chromium/media/gpu/mac/BUILD.gn2
-rw-r--r--chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.cc2
-rw-r--r--chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.h2
-rw-r--r--chromium/media/gpu/mac/vp9_super_frame_bitstream_filter_unittest.cc2
-rw-r--r--chromium/media/gpu/mac/vt_config_util.h2
-rw-r--r--chromium/media/gpu/mac/vt_config_util.mm12
-rw-r--r--chromium/media/gpu/mac/vt_config_util_unittest.cc2
-rw-r--r--chromium/media/gpu/mac/vt_video_decode_accelerator_mac.cc314
-rw-r--r--chromium/media/gpu/mac/vt_video_decode_accelerator_mac.h18
-rw-r--r--chromium/media/gpu/mac/vt_video_encode_accelerator_mac.cc112
-rw-r--r--chromium/media/gpu/mac/vt_video_encode_accelerator_mac.h10
-rw-r--r--chromium/media/gpu/macros.h2
-rw-r--r--chromium/media/gpu/media_gpu_export.h2
-rw-r--r--chromium/media/gpu/sandbox/BUILD.gn2
-rw-r--r--chromium/media/gpu/sandbox/OWNERS2
-rw-r--r--chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc15
-rw-r--r--chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h2
-rw-r--r--chromium/media/gpu/test/BUILD.gn3
-rw-r--r--chromium/media/gpu/v4l2/BUILD.gn26
-rw-r--r--chromium/media/gpu/v4l2/aml_v4l2_device.cc2
-rw-r--r--chromium/media/gpu/v4l2/aml_v4l2_device.h2
-rw-r--r--chromium/media/gpu/v4l2/buffer_affinity_tracker.cc2
-rw-r--r--chromium/media/gpu/v4l2/buffer_affinity_tracker.h2
-rw-r--r--chromium/media/gpu/v4l2/generic_v4l2_device.cc62
-rw-r--r--chromium/media/gpu/v4l2/generic_v4l2_device.h4
-rw-r--r--chromium/media/gpu/v4l2/v4l2.sig2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_decode_surface.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_decode_surface.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_decode_surface_handler.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_device.cc41
-rw-r--r--chromium/media/gpu/v4l2/v4l2_device.h94
-rw-r--r--chromium/media/gpu/v4l2/v4l2_device_poller.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_device_poller.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_device_unittest.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_framerate_control.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_framerate_control.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_image_processor_backend.cc53
-rw-r--r--chromium/media/gpu/v4l2/v4l2_image_processor_backend.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.cc13
-rw-r--r--chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc4
-rw-r--r--chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc20
-rw-r--r--chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_stateful_workaround.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_stateful_workaround.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_stateful_workaround_unittest.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_status.h5
-rw-r--r--chromium/media/gpu/v4l2/v4l2_utils.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_utils.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_vda_helpers.cc14
-rw-r--r--chromium/media/gpu/v4l2/v4l2_vda_helpers.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc15
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder.cc48
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_backend.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_backend.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc13
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_av1.cc622
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_av1.h48
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.cc2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.h2
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.cc90
-rw-r--r--chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.h2
-rw-r--r--chromium/media/gpu/vaapi/BUILD.gn2
-rw-r--r--chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.cc59
-rw-r--r--chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.h3
-rw-r--r--chromium/media/gpu/vaapi/fuzzers/jpeg_decoder/BUILD.gn2
-rw-r--r--chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.cc2
-rw-r--r--chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.h2
-rw-r--r--chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc2
-rw-r--r--chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h2
-rw-r--r--chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate_unittest.cc2
-rw-r--r--chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.cc2
-rw-r--r--chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.h2
-rw-r--r--chromium/media/gpu/vaapi/test_utils.cc2
-rw-r--r--chromium/media/gpu/vaapi/test_utils.h2
-rw-r--r--chromium/media/gpu/vaapi/va.sigs2
-rw-r--r--chromium/media/gpu/vaapi/va_drm.sigs2
-rw-r--r--chromium/media/gpu/vaapi/va_prot.sigs2
-rw-r--r--chromium/media/gpu/vaapi/va_surface.cc2
-rw-r--r--chromium/media/gpu/vaapi/va_surface.h2
-rw-r--r--chromium/media/gpu/vaapi/va_x11.sigs2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_common.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_common.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_image_decoder.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_image_decoder.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_image_processor_backend.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_image_processor_backend.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_jpeg_decoder.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_jpeg_decoder.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_jpeg_decoder_unittest.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_jpeg_encoder.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_jpeg_encoder.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_factory.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_factory.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_tfp.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_picture_tfp.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_status.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_unittest.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_utils.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_utils.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_utils_unittest.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_decoder.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_decoder.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.cc44
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_encode_accelerator_unittest.cc15
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_webp_decoder.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_webp_decoder.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_webp_decoder_unittest.cc2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_wrapper.cc28
-rw-r--r--chromium/media/gpu/vaapi/vaapi_wrapper.h2
-rw-r--r--chromium/media/gpu/vaapi/vaapi_wrapper_unittest.cc2
-rw-r--r--chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.cc2
-rw-r--r--chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.h2
-rw-r--r--chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.cc19
-rw-r--r--chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.h2
-rw-r--r--chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.cc2
-rw-r--r--chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.h2
-rw-r--r--chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.cc2
-rw-r--r--chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.h2
-rw-r--r--chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate_unittest.cc2
-rw-r--r--chromium/media/gpu/video_decode_accelerator_perf_tests.cc6
-rw-r--r--chromium/media/gpu/video_decode_accelerator_tests.cc6
-rw-r--r--chromium/media/gpu/video_encode_accelerator_perf_tests.cc4
-rw-r--r--chromium/media/gpu/video_encode_accelerator_tests.cc4
-rw-r--r--chromium/media/gpu/video_frame_mapper.h2
-rw-r--r--chromium/media/gpu/video_frame_mapper_factory.cc2
-rw-r--r--chromium/media/gpu/video_frame_mapper_factory.h2
-rw-r--r--chromium/media/gpu/video_rate_control.cc2
-rw-r--r--chromium/media/gpu/video_rate_control.h2
-rw-r--r--chromium/media/gpu/vp8_decoder.cc2
-rw-r--r--chromium/media/gpu/vp8_decoder.h2
-rw-r--r--chromium/media/gpu/vp8_decoder_unittest.cc2
-rw-r--r--chromium/media/gpu/vp8_picture.cc2
-rw-r--r--chromium/media/gpu/vp8_picture.h2
-rw-r--r--chromium/media/gpu/vp8_reference_frame_vector.cc2
-rw-r--r--chromium/media/gpu/vp8_reference_frame_vector.h2
-rw-r--r--chromium/media/gpu/vp9_decoder.cc2
-rw-r--r--chromium/media/gpu/vp9_decoder.h2
-rw-r--r--chromium/media/gpu/vp9_picture.cc2
-rw-r--r--chromium/media/gpu/vp9_picture.h2
-rw-r--r--chromium/media/gpu/vp9_reference_frame_vector.cc2
-rw-r--r--chromium/media/gpu/vp9_reference_frame_vector.h2
-rw-r--r--chromium/media/gpu/vp9_svc_layers.cc2
-rw-r--r--chromium/media/gpu/vp9_svc_layers.h2
-rw-r--r--chromium/media/gpu/vp9_svc_layers_unittest.cc2
-rw-r--r--chromium/media/gpu/windows/av1_guids.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_av1_accelerator.cc21
-rw-r--r--chromium/media/gpu/windows/d3d11_av1_accelerator.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_com_defs.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_copying_texture_wrapper.cc15
-rw-r--r--chromium/media/gpu/windows/d3d11_copying_texture_wrapper.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_copying_texture_wrapper_unittest.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_decoder_configurator.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_decoder_configurator.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_decoder_configurator_unittest.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_h264_accelerator.cc3
-rw-r--r--chromium/media/gpu/windows/d3d11_h264_accelerator.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_h265_accelerator.cc7
-rw-r--r--chromium/media/gpu/windows/d3d11_h265_accelerator.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_picture_buffer.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_picture_buffer.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_picture_buffer_unittest.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_status.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_texture_selector.cc23
-rw-r--r--chromium/media/gpu/windows/d3d11_texture_selector.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_texture_selector_unittest.cc4
-rw-r--r--chromium/media/gpu/windows/d3d11_texture_wrapper.cc4
-rw-r--r--chromium/media/gpu/windows/d3d11_texture_wrapper.h3
-rw-r--r--chromium/media/gpu/windows/d3d11_texture_wrapper_unittest.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_context_wrapper.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_context_wrapper.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_decoder.cc19
-rw-r--r--chromium/media/gpu/windows/d3d11_video_decoder.h8
-rw-r--r--chromium/media/gpu/windows/d3d11_video_decoder_client.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_decoder_impl.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_decoder_impl.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_decoder_unittest.cc8
-rw-r--r--chromium/media/gpu/windows/d3d11_video_device_format_support.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_device_format_support.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_device_format_support_unittest.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_processor_proxy.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_processor_proxy.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_video_processor_proxy_unittest.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_vp9_accelerator.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_vp9_accelerator.h2
-rw-r--r--chromium/media/gpu/windows/d3d11_vp9_picture.cc2
-rw-r--r--chromium/media/gpu/windows/d3d11_vp9_picture.h2
-rw-r--r--chromium/media/gpu/windows/dxva_picture_buffer_win.cc2
-rw-r--r--chromium/media/gpu/windows/dxva_picture_buffer_win.h2
-rw-r--r--chromium/media/gpu/windows/dxva_video_decode_accelerator_win.cc8
-rw-r--r--chromium/media/gpu/windows/dxva_video_decode_accelerator_win.h2
-rw-r--r--chromium/media/gpu/windows/init_guid.cc2
-rw-r--r--chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc262
-rw-r--r--chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.h14
-rw-r--r--chromium/media/gpu/windows/mf_audio_encoder.cc16
-rw-r--r--chromium/media/gpu/windows/mf_audio_encoder.h2
-rw-r--r--chromium/media/gpu/windows/output_with_release_mailbox_cb.h2
-rw-r--r--chromium/media/gpu/windows/supported_profile_helpers.cc2
-rw-r--r--chromium/media/gpu/windows/supported_profile_helpers.h2
-rw-r--r--chromium/media/gpu/windows/supported_profile_helpers_unittest.cc13
-rw-r--r--chromium/media/learning/BUILD.gn2
-rw-r--r--chromium/media/learning/common/BUILD.gn2
-rw-r--r--chromium/media/learning/common/feature_dictionary.cc2
-rw-r--r--chromium/media/learning/common/feature_dictionary.h2
-rw-r--r--chromium/media/learning/common/feature_dictionary_unittest.cc2
-rw-r--r--chromium/media/learning/common/feature_library.cc2
-rw-r--r--chromium/media/learning/common/feature_library.h2
-rw-r--r--chromium/media/learning/common/labelled_example.cc2
-rw-r--r--chromium/media/learning/common/labelled_example.h2
-rw-r--r--chromium/media/learning/common/labelled_example_unittest.cc2
-rw-r--r--chromium/media/learning/common/learning_session.cc2
-rw-r--r--chromium/media/learning/common/learning_session.h2
-rw-r--r--chromium/media/learning/common/learning_task.cc2
-rw-r--r--chromium/media/learning/common/learning_task.h2
-rw-r--r--chromium/media/learning/common/learning_task_controller.h2
-rw-r--r--chromium/media/learning/common/media_learning_tasks.cc2
-rw-r--r--chromium/media/learning/common/media_learning_tasks.h2
-rw-r--r--chromium/media/learning/common/media_learning_tasks_unittest.cc2
-rw-r--r--chromium/media/learning/common/target_histogram.cc2
-rw-r--r--chromium/media/learning/common/target_histogram.h2
-rw-r--r--chromium/media/learning/common/target_histogram_unittest.cc3
-rw-r--r--chromium/media/learning/common/value.cc2
-rw-r--r--chromium/media/learning/common/value.h2
-rw-r--r--chromium/media/learning/common/value_unittest.cc2
-rw-r--r--chromium/media/learning/impl/BUILD.gn2
-rw-r--r--chromium/media/learning/impl/distribution_reporter.cc2
-rw-r--r--chromium/media/learning/impl/distribution_reporter.h2
-rw-r--r--chromium/media/learning/impl/distribution_reporter_unittest.cc2
-rw-r--r--chromium/media/learning/impl/extra_trees_trainer.cc2
-rw-r--r--chromium/media/learning/impl/extra_trees_trainer.h2
-rw-r--r--chromium/media/learning/impl/extra_trees_trainer_unittest.cc2
-rw-r--r--chromium/media/learning/impl/feature_provider.cc2
-rw-r--r--chromium/media/learning/impl/feature_provider.h2
-rw-r--r--chromium/media/learning/impl/fisher_iris_dataset.cc2
-rw-r--r--chromium/media/learning/impl/fisher_iris_dataset.h2
-rw-r--r--chromium/media/learning/impl/learning_fuzzertest.cc2
-rw-r--r--chromium/media/learning/impl/learning_session_impl.cc2
-rw-r--r--chromium/media/learning/impl/learning_session_impl.h2
-rw-r--r--chromium/media/learning/impl/learning_session_impl_unittest.cc2
-rw-r--r--chromium/media/learning/impl/learning_task_controller_helper.cc2
-rw-r--r--chromium/media/learning/impl/learning_task_controller_helper.h2
-rw-r--r--chromium/media/learning/impl/learning_task_controller_helper_unittest.cc2
-rw-r--r--chromium/media/learning/impl/learning_task_controller_impl.cc2
-rw-r--r--chromium/media/learning/impl/learning_task_controller_impl.h2
-rw-r--r--chromium/media/learning/impl/learning_task_controller_impl_unittest.cc2
-rw-r--r--chromium/media/learning/impl/lookup_table_trainer.cc2
-rw-r--r--chromium/media/learning/impl/lookup_table_trainer.h2
-rw-r--r--chromium/media/learning/impl/lookup_table_trainer_unittest.cc2
-rw-r--r--chromium/media/learning/impl/model.h2
-rw-r--r--chromium/media/learning/impl/one_hot.cc2
-rw-r--r--chromium/media/learning/impl/one_hot.h2
-rw-r--r--chromium/media/learning/impl/one_hot_unittest.cc2
-rw-r--r--chromium/media/learning/impl/random_number_generator.cc2
-rw-r--r--chromium/media/learning/impl/random_number_generator.h2
-rw-r--r--chromium/media/learning/impl/random_number_generator_unittest.cc2
-rw-r--r--chromium/media/learning/impl/random_tree_trainer.cc2
-rw-r--r--chromium/media/learning/impl/random_tree_trainer.h2
-rw-r--r--chromium/media/learning/impl/random_tree_trainer_unittest.cc2
-rw-r--r--chromium/media/learning/impl/test_random_number_generator.cc2
-rw-r--r--chromium/media/learning/impl/test_random_number_generator.h2
-rw-r--r--chromium/media/learning/impl/training_algorithm.h2
-rw-r--r--chromium/media/learning/impl/voting_ensemble.cc2
-rw-r--r--chromium/media/learning/impl/voting_ensemble.h2
-rw-r--r--chromium/media/learning/mojo/BUILD.gn2
-rw-r--r--chromium/media/learning/mojo/mojo_learning_task_controller_service.cc2
-rw-r--r--chromium/media/learning/mojo/mojo_learning_task_controller_service.h2
-rw-r--r--chromium/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc2
-rw-r--r--chromium/media/learning/mojo/public/cpp/BUILD.gn2
-rw-r--r--chromium/media/learning/mojo/public/cpp/learning_mojom_traits.cc2
-rw-r--r--chromium/media/learning/mojo/public/cpp/learning_mojom_traits.h2
-rw-r--r--chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.cc2
-rw-r--r--chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.h2
-rw-r--r--chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc2
-rw-r--r--chromium/media/learning/mojo/public/mojom/BUILD.gn2
-rw-r--r--chromium/media/learning/mojo/public/mojom/learning_task_controller.mojom2
-rw-r--r--chromium/media/learning/mojo/public/mojom/learning_types.mojom2
-rw-r--r--chromium/media/media_options.gni6
-rw-r--r--chromium/media/midi/BUILD.gn2
-rw-r--r--chromium/media/midi/OWNERS1
-rw-r--r--chromium/media/midi/java/src/org/chromium/midi/MidiDeviceAndroid.java6
-rw-r--r--chromium/media/midi/java/src/org/chromium/midi/MidiInputPortAndroid.java6
-rw-r--r--chromium/media/midi/java/src/org/chromium/midi/MidiManagerAndroid.java6
-rw-r--r--chromium/media/midi/java/src/org/chromium/midi/MidiOutputPortAndroid.java6
-rw-r--r--chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceAndroid.java2
-rw-r--r--chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceFactoryAndroid.java2
-rw-r--r--chromium/media/midi/message_util.cc2
-rw-r--r--chromium/media/midi/message_util.h2
-rw-r--r--chromium/media/midi/message_util_unittest.cc2
-rw-r--r--chromium/media/midi/midi_device_android.cc2
-rw-r--r--chromium/media/midi/midi_device_android.h2
-rw-r--r--chromium/media/midi/midi_export.h2
-rw-r--r--chromium/media/midi/midi_input_port_android.cc2
-rw-r--r--chromium/media/midi/midi_input_port_android.h2
-rw-r--r--chromium/media/midi/midi_manager.cc2
-rw-r--r--chromium/media/midi/midi_manager.h2
-rw-r--r--chromium/media/midi/midi_manager_alsa.cc42
-rw-r--r--chromium/media/midi/midi_manager_alsa.h2
-rw-r--r--chromium/media/midi/midi_manager_alsa_unittest.cc2
-rw-r--r--chromium/media/midi/midi_manager_android.cc7
-rw-r--r--chromium/media/midi/midi_manager_android.h2
-rw-r--r--chromium/media/midi/midi_manager_mac.cc11
-rw-r--r--chromium/media/midi/midi_manager_mac.h2
-rw-r--r--chromium/media/midi/midi_manager_mac_unittest.cc2
-rw-r--r--chromium/media/midi/midi_manager_unittest.cc2
-rw-r--r--chromium/media/midi/midi_manager_usb.cc2
-rw-r--r--chromium/media/midi/midi_manager_usb.h2
-rw-r--r--chromium/media/midi/midi_manager_usb_unittest.cc2
-rw-r--r--chromium/media/midi/midi_manager_win.cc25
-rw-r--r--chromium/media/midi/midi_manager_win.h6
-rw-r--r--chromium/media/midi/midi_manager_winrt.cc2
-rw-r--r--chromium/media/midi/midi_manager_winrt.h2
-rw-r--r--chromium/media/midi/midi_message_queue.cc2
-rw-r--r--chromium/media/midi/midi_message_queue.h2
-rw-r--r--chromium/media/midi/midi_message_queue_fuzzer.cc2
-rw-r--r--chromium/media/midi/midi_message_queue_unittest.cc2
-rw-r--r--chromium/media/midi/midi_output_port_android.cc2
-rw-r--r--chromium/media/midi/midi_output_port_android.h2
-rw-r--r--chromium/media/midi/midi_service.cc2
-rw-r--r--chromium/media/midi/midi_service.h2
-rw-r--r--chromium/media/midi/midi_service.mojom2
-rw-r--r--chromium/media/midi/midi_switches.cc7
-rw-r--r--chromium/media/midi/midi_switches.h4
-rw-r--r--chromium/media/midi/midi_webmidi_data_validator_fuzzer.cc2
-rw-r--r--chromium/media/midi/task_service.cc2
-rw-r--r--chromium/media/midi/task_service.h2
-rw-r--r--chromium/media/midi/task_service_unittest.cc2
-rw-r--r--chromium/media/midi/usb_midi_descriptor_parser.cc21
-rw-r--r--chromium/media/midi/usb_midi_descriptor_parser.h3
-rw-r--r--chromium/media/midi/usb_midi_descriptor_parser_fuzzer.cc2
-rw-r--r--chromium/media/midi/usb_midi_descriptor_parser_unittest.cc2
-rw-r--r--chromium/media/midi/usb_midi_device.h2
-rw-r--r--chromium/media/midi/usb_midi_device_android.cc2
-rw-r--r--chromium/media/midi/usb_midi_device_android.h2
-rw-r--r--chromium/media/midi/usb_midi_device_factory_android.cc2
-rw-r--r--chromium/media/midi/usb_midi_device_factory_android.h2
-rw-r--r--chromium/media/midi/usb_midi_export.h2
-rw-r--r--chromium/media/midi/usb_midi_input_stream.cc2
-rw-r--r--chromium/media/midi/usb_midi_input_stream.h2
-rw-r--r--chromium/media/midi/usb_midi_input_stream_unittest.cc2
-rw-r--r--chromium/media/midi/usb_midi_jack.h2
-rw-r--r--chromium/media/midi/usb_midi_output_stream.cc2
-rw-r--r--chromium/media/midi/usb_midi_output_stream.h2
-rw-r--r--chromium/media/midi/usb_midi_output_stream_unittest.cc2
-rw-r--r--chromium/media/mojo/BUILD.gn9
-rw-r--r--chromium/media/mojo/README.md12
-rw-r--r--chromium/media/mojo/clients/BUILD.gn19
-rw-r--r--chromium/media/mojo/clients/mojo_android_overlay.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_android_overlay.h2
-rw-r--r--chromium/media/mojo/clients/mojo_android_overlay_unittest.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_audio_decoder.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_audio_decoder.h2
-rw-r--r--chromium/media/mojo/clients/mojo_audio_decoder_unittest.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_audio_encoder.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_audio_encoder.h2
-rw-r--r--chromium/media/mojo/clients/mojo_audio_encoder_unittest.cc15
-rw-r--r--chromium/media/mojo/clients/mojo_cdm.cc8
-rw-r--r--chromium/media/mojo/clients/mojo_cdm.h2
-rw-r--r--chromium/media/mojo/clients/mojo_cdm_factory.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_cdm_factory.h2
-rw-r--r--chromium/media/mojo/clients/mojo_cdm_unittest.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_decoder_factory.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_decoder_factory.h2
-rw-r--r--chromium/media/mojo/clients/mojo_decryptor.cc3
-rw-r--r--chromium/media/mojo/clients/mojo_decryptor.h2
-rw-r--r--chromium/media/mojo/clients/mojo_decryptor_unittest.cc23
-rw-r--r--chromium/media/mojo/clients/mojo_demuxer_stream_impl.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_demuxer_stream_impl.h2
-rw-r--r--chromium/media/mojo/clients/mojo_media_log_service.cc7
-rw-r--r--chromium/media/mojo/clients/mojo_media_log_service.h2
-rw-r--r--chromium/media/mojo/clients/mojo_renderer.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_renderer.h2
-rw-r--r--chromium/media/mojo/clients/mojo_renderer_factory.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_renderer_factory.h2
-rw-r--r--chromium/media/mojo/clients/mojo_renderer_unittest.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_renderer_wrapper.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_renderer_wrapper.h2
-rw-r--r--chromium/media/mojo/clients/mojo_video_decoder.cc2
-rw-r--r--chromium/media/mojo/clients/mojo_video_decoder.h2
-rw-r--r--chromium/media/mojo/clients/mojo_video_encode_accelerator.cc36
-rw-r--r--chromium/media/mojo/clients/mojo_video_encode_accelerator.h2
-rw-r--r--chromium/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc18
-rw-r--r--chromium/media/mojo/clients/win/media_foundation_renderer_client.cc32
-rw-r--r--chromium/media/mojo/clients/win/media_foundation_renderer_client.h8
-rw-r--r--chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.cc2
-rw-r--r--chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.h2
-rw-r--r--chromium/media/mojo/common/BUILD.gn20
-rw-r--r--chromium/media/mojo/common/audio_data_s16_converter.cc2
-rw-r--r--chromium/media/mojo/common/audio_data_s16_converter.h2
-rw-r--r--chromium/media/mojo/common/input_error_code_converter.cc2
-rw-r--r--chromium/media/mojo/common/input_error_code_converter.h2
-rw-r--r--chromium/media/mojo/common/media_type_converters.cc2
-rw-r--r--chromium/media/mojo/common/media_type_converters.h2
-rw-r--r--chromium/media/mojo/common/media_type_converters_unittest.cc2
-rw-r--r--chromium/media/mojo/common/mojo_data_pipe_read_write.cc2
-rw-r--r--chromium/media/mojo/common/mojo_data_pipe_read_write.h2
-rw-r--r--chromium/media/mojo/common/mojo_data_pipe_read_write_unittest.cc2
-rw-r--r--chromium/media/mojo/common/mojo_decoder_buffer_converter.cc2
-rw-r--r--chromium/media/mojo/common/mojo_decoder_buffer_converter.h2
-rw-r--r--chromium/media/mojo/common/mojo_decoder_buffer_converter_unittest.cc2
-rw-r--r--chromium/media/mojo/common/mojo_pipe_read_write_util.cc2
-rw-r--r--chromium/media/mojo/common/mojo_pipe_read_write_util.h2
-rw-r--r--chromium/media/mojo/common/mojo_shared_buffer_video_frame.cc288
-rw-r--r--chromium/media/mojo/common/mojo_shared_buffer_video_frame.h109
-rw-r--r--chromium/media/mojo/common/mojo_shared_buffer_video_frame_unittest.cc356
-rw-r--r--chromium/media/mojo/mojom/BUILD.gn7
-rw-r--r--chromium/media/mojo/mojom/android_overlay.mojom2
-rw-r--r--chromium/media/mojo/mojom/audio_data.mojom2
-rw-r--r--chromium/media/mojo/mojom/audio_data_pipe.mojom2
-rw-r--r--chromium/media/mojo/mojom/audio_decoder.mojom2
-rw-r--r--chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/audio_decoder_config_mojom_traits_unittest.cc2
-rw-r--r--chromium/media/mojo/mojom/audio_encoder.mojom2
-rw-r--r--chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/audio_input_stream.mojom2
-rw-r--r--chromium/media/mojo/mojom/audio_logging.mojom2
-rw-r--r--chromium/media/mojo/mojom/audio_output_stream.mojom3
-rw-r--r--chromium/media/mojo/mojom/audio_parameters.mojom2
-rw-r--r--chromium/media/mojo/mojom/audio_processing.mojom2
-rw-r--r--chromium/media/mojo/mojom/audio_processing_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/audio_processing_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/audio_processing_mojom_traits_unittest.cc2
-rw-r--r--chromium/media/mojo/mojom/audio_stream_factory.mojom2
-rw-r--r--chromium/media/mojo/mojom/capture_handle.mojom2
-rw-r--r--chromium/media/mojo/mojom/cast_application_media_info_manager.mojom2
-rw-r--r--chromium/media/mojo/mojom/cdm_capability_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/cdm_capability_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/cdm_document_service.mojom2
-rw-r--r--chromium/media/mojo/mojom/cdm_key_information_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/cdm_key_information_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/cdm_key_information_mojom_traits_unittest.cc2
-rw-r--r--chromium/media/mojo/mojom/cdm_service.mojom2
-rw-r--r--chromium/media/mojo/mojom/cdm_storage.mojom12
-rw-r--r--chromium/media/mojo/mojom/content_decryption_module.mojom3
-rw-r--r--chromium/media/mojo/mojom/dcomp_surface_registry.mojom2
-rw-r--r--chromium/media/mojo/mojom/decryptor.mojom2
-rw-r--r--chromium/media/mojo/mojom/demuxer_stream.mojom2
-rw-r--r--chromium/media/mojo/mojom/display_media_information.mojom8
-rw-r--r--chromium/media/mojo/mojom/encoded_audio_buffer_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/encoded_audio_buffer_traits.h2
-rw-r--r--chromium/media/mojo/mojom/encryption_pattern.mojom2
-rw-r--r--chromium/media/mojo/mojom/encryption_pattern_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/encryption_pattern_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/frame_interface_factory.mojom18
-rw-r--r--chromium/media/mojo/mojom/gpu_accelerated_video_decoder.mojom2
-rw-r--r--chromium/media/mojo/mojom/interface_factory.mojom2
-rw-r--r--chromium/media/mojo/mojom/key_system_support.mojom2
-rw-r--r--chromium/media/mojo/mojom/media_drm_storage.mojom2
-rw-r--r--chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/media_foundation_rendering_mode_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/media_foundation_service.mojom16
-rw-r--r--chromium/media/mojo/mojom/media_log.mojom2
-rw-r--r--chromium/media/mojo/mojom/media_metrics_provider.mojom3
-rw-r--r--chromium/media/mojo/mojom/media_player.mojom6
-rw-r--r--chromium/media/mojo/mojom/media_service.mojom2
-rw-r--r--chromium/media/mojo/mojom/media_types.mojom10
-rw-r--r--chromium/media/mojo/mojom/media_types_enum_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/output_protection.mojom2
-rw-r--r--chromium/media/mojo/mojom/pipeline_status_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/playback_events_recorder.mojom2
-rw-r--r--chromium/media/mojo/mojom/provision_fetcher.mojom2
-rw-r--r--chromium/media/mojo/mojom/remoting.mojom2
-rw-r--r--chromium/media/mojo/mojom/remoting_common.mojom2
-rw-r--r--chromium/media/mojo/mojom/renderer.mojom2
-rw-r--r--chromium/media/mojo/mojom/renderer_extensions.mojom8
-rw-r--r--chromium/media/mojo/mojom/speech_recognition.mojom25
-rw-r--r--chromium/media/mojo/mojom/speech_recognition_result.cc2
-rw-r--r--chromium/media/mojo/mojom/speech_recognition_result.h2
-rw-r--r--chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/speech_recognition_result_mojom_traits_unittest.cc2
-rw-r--r--chromium/media/mojo/mojom/speech_recognition_service.mojom3
-rw-r--r--chromium/media/mojo/mojom/stable/BUILD.gn2
-rw-r--r--chromium/media/mojo/mojom/stable/native_pixmap_handle.mojom2
-rw-r--r--chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/stable/stable_video_decoder.mojom2
-rw-r--r--chromium/media/mojo/mojom/stable/stable_video_decoder_types.mojom4
-rw-r--r--chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc10
-rw-r--r--chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h4
-rw-r--r--chromium/media/mojo/mojom/status_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/status_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/traits_test_service.mojom2
-rw-r--r--chromium/media/mojo/mojom/video_color_space_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/video_decode_perf_history.mojom3
-rw-r--r--chromium/media/mojo/mojom/video_decode_stats_recorder.mojom3
-rw-r--r--chromium/media/mojo/mojom/video_decoder.mojom2
-rw-r--r--chromium/media/mojo/mojom/video_decoder_config_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/video_decoder_config_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/video_decoder_config_mojom_traits_unittest.cc2
-rw-r--r--chromium/media/mojo/mojom/video_encode_accelerator.mojom2
-rw-r--r--chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits_unittest.cc2
-rw-r--r--chromium/media/mojo/mojom/video_encoder_info.mojom2
-rw-r--r--chromium/media/mojo/mojom/video_encoder_info_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/video_encoder_info_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/video_frame_metadata_mojom_traits_unittest.cc2
-rw-r--r--chromium/media/mojo/mojom/video_frame_mojom_traits.cc148
-rw-r--r--chromium/media/mojo/mojom/video_frame_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/video_frame_mojom_traits_unittest.cc80
-rw-r--r--chromium/media/mojo/mojom/video_transformation_mojom_traits.cc2
-rw-r--r--chromium/media/mojo/mojom/video_transformation_mojom_traits.h2
-rw-r--r--chromium/media/mojo/mojom/watch_time_recorder.mojom2
-rw-r--r--chromium/media/mojo/mojom/webrtc_video_perf.mojom2
-rw-r--r--chromium/media/mojo/services/BUILD.gn10
-rw-r--r--chromium/media/mojo/services/android_mojo_media_client.cc2
-rw-r--r--chromium/media/mojo/services/android_mojo_media_client.h2
-rw-r--r--chromium/media/mojo/services/android_mojo_util.cc2
-rw-r--r--chromium/media/mojo/services/android_mojo_util.h2
-rw-r--r--chromium/media/mojo/services/cdm_service.cc2
-rw-r--r--chromium/media/mojo/services/cdm_service.h2
-rw-r--r--chromium/media/mojo/services/cdm_service_broker.cc2
-rw-r--r--chromium/media/mojo/services/cdm_service_broker.h2
-rw-r--r--chromium/media/mojo/services/cdm_service_broker_unittest.cc2
-rw-r--r--chromium/media/mojo/services/cdm_service_unittest.cc2
-rw-r--r--chromium/media/mojo/services/deferred_destroy_unique_receiver_set.h2
-rw-r--r--chromium/media/mojo/services/deferred_destroy_unique_receiver_set_unittest.cc2
-rw-r--r--chromium/media/mojo/services/gpu_mojo_media_client.cc2
-rw-r--r--chromium/media/mojo/services/gpu_mojo_media_client.h2
-rw-r--r--chromium/media/mojo/services/gpu_mojo_media_client_android.cc2
-rw-r--r--chromium/media/mojo/services/gpu_mojo_media_client_cros.cc69
-rw-r--r--chromium/media/mojo/services/gpu_mojo_media_client_mac.cc5
-rw-r--r--chromium/media/mojo/services/gpu_mojo_media_client_stubs.cc2
-rw-r--r--chromium/media/mojo/services/gpu_mojo_media_client_win.cc19
-rw-r--r--chromium/media/mojo/services/interface_factory_impl.cc12
-rw-r--r--chromium/media/mojo/services/interface_factory_impl.h2
-rw-r--r--chromium/media/mojo/services/media_foundation_gpu_info_monitor.cc32
-rw-r--r--chromium/media/mojo/services/media_foundation_gpu_info_monitor.h44
-rw-r--r--chromium/media/mojo/services/media_foundation_mojo_media_client.cc14
-rw-r--r--chromium/media/mojo/services/media_foundation_mojo_media_client.h2
-rw-r--r--chromium/media/mojo/services/media_foundation_renderer_wrapper.cc27
-rw-r--r--chromium/media/mojo/services/media_foundation_renderer_wrapper.h16
-rw-r--r--chromium/media/mojo/services/media_foundation_service.cc6
-rw-r--r--chromium/media/mojo/services/media_foundation_service.h3
-rw-r--r--chromium/media/mojo/services/media_foundation_service_broker.cc20
-rw-r--r--chromium/media/mojo/services/media_foundation_service_broker.h15
-rw-r--r--chromium/media/mojo/services/media_metrics_provider.cc21
-rw-r--r--chromium/media/mojo/services/media_metrics_provider.h2
-rw-r--r--chromium/media/mojo/services/media_metrics_provider_unittest.cc2
-rw-r--r--chromium/media/mojo/services/media_mojo_export.h2
-rw-r--r--chromium/media/mojo/services/media_resource_shim.cc2
-rw-r--r--chromium/media/mojo/services/media_resource_shim.h2
-rw-r--r--chromium/media/mojo/services/media_service.cc2
-rw-r--r--chromium/media/mojo/services/media_service.h2
-rw-r--r--chromium/media/mojo/services/media_service_factory.cc2
-rw-r--r--chromium/media/mojo/services/media_service_factory.h2
-rw-r--r--chromium/media/mojo/services/media_service_unittest.cc2
-rw-r--r--chromium/media/mojo/services/mojo_audio_decoder_service.cc6
-rw-r--r--chromium/media/mojo/services/mojo_audio_decoder_service.h2
-rw-r--r--chromium/media/mojo/services/mojo_audio_encoder_service.cc2
-rw-r--r--chromium/media/mojo/services/mojo_audio_encoder_service.h2
-rw-r--r--chromium/media/mojo/services/mojo_audio_input_stream.cc2
-rw-r--r--chromium/media/mojo/services/mojo_audio_input_stream.h2
-rw-r--r--chromium/media/mojo/services/mojo_audio_input_stream_unittest.cc2
-rw-r--r--chromium/media/mojo/services/mojo_audio_output_stream.cc2
-rw-r--r--chromium/media/mojo/services/mojo_audio_output_stream.h2
-rw-r--r--chromium/media/mojo/services/mojo_audio_output_stream_provider.cc2
-rw-r--r--chromium/media/mojo/services/mojo_audio_output_stream_provider.h2
-rw-r--r--chromium/media/mojo/services/mojo_audio_output_stream_provider_unittest.cc2
-rw-r--r--chromium/media/mojo/services/mojo_audio_output_stream_unittest.cc2
-rw-r--r--chromium/media/mojo/services/mojo_cdm_allocator.cc146
-rw-r--r--chromium/media/mojo/services/mojo_cdm_allocator.h18
-rw-r--r--chromium/media/mojo/services/mojo_cdm_allocator_unittest.cc11
-rw-r--r--chromium/media/mojo/services/mojo_cdm_file_io.cc5
-rw-r--r--chromium/media/mojo/services/mojo_cdm_file_io.h2
-rw-r--r--chromium/media/mojo/services/mojo_cdm_file_io_unittest.cc2
-rw-r--r--chromium/media/mojo/services/mojo_cdm_helper.cc2
-rw-r--r--chromium/media/mojo/services/mojo_cdm_helper.h2
-rw-r--r--chromium/media/mojo/services/mojo_cdm_helper_unittest.cc5
-rw-r--r--chromium/media/mojo/services/mojo_cdm_promise.cc2
-rw-r--r--chromium/media/mojo/services/mojo_cdm_promise.h2
-rw-r--r--chromium/media/mojo/services/mojo_cdm_service.cc6
-rw-r--r--chromium/media/mojo/services/mojo_cdm_service.h2
-rw-r--r--chromium/media/mojo/services/mojo_cdm_service_context.cc2
-rw-r--r--chromium/media/mojo/services/mojo_cdm_service_context.h2
-rw-r--r--chromium/media/mojo/services/mojo_decryptor_service.cc7
-rw-r--r--chromium/media/mojo/services/mojo_decryptor_service.h2
-rw-r--r--chromium/media/mojo/services/mojo_demuxer_stream_adapter.cc2
-rw-r--r--chromium/media/mojo/services/mojo_demuxer_stream_adapter.h2
-rw-r--r--chromium/media/mojo/services/mojo_media_client.cc2
-rw-r--r--chromium/media/mojo/services/mojo_media_client.h2
-rw-r--r--chromium/media/mojo/services/mojo_media_drm_storage.cc2
-rw-r--r--chromium/media/mojo/services/mojo_media_drm_storage.h2
-rw-r--r--chromium/media/mojo/services/mojo_media_log.cc2
-rw-r--r--chromium/media/mojo/services/mojo_media_log.h2
-rw-r--r--chromium/media/mojo/services/mojo_provision_fetcher.cc2
-rw-r--r--chromium/media/mojo/services/mojo_provision_fetcher.h2
-rw-r--r--chromium/media/mojo/services/mojo_renderer_service.cc2
-rw-r--r--chromium/media/mojo/services/mojo_renderer_service.h2
-rw-r--r--chromium/media/mojo/services/mojo_video_decoder_service.cc10
-rw-r--r--chromium/media/mojo/services/mojo_video_decoder_service.h2
-rw-r--r--chromium/media/mojo/services/mojo_video_encode_accelerator_provider.cc2
-rw-r--r--chromium/media/mojo/services/mojo_video_encode_accelerator_provider.h2
-rw-r--r--chromium/media/mojo/services/mojo_video_encode_accelerator_service.cc2
-rw-r--r--chromium/media/mojo/services/mojo_video_encode_accelerator_service.h2
-rw-r--r--chromium/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc2
-rw-r--r--chromium/media/mojo/services/playback_events_recorder.cc2
-rw-r--r--chromium/media/mojo/services/playback_events_recorder.h2
-rw-r--r--chromium/media/mojo/services/playback_events_recorder_test.cc2
-rw-r--r--chromium/media/mojo/services/stable_video_decoder_factory_service.cc90
-rw-r--r--chromium/media/mojo/services/stable_video_decoder_factory_service.h2
-rw-r--r--chromium/media/mojo/services/stable_video_decoder_service.cc2
-rw-r--r--chromium/media/mojo/services/stable_video_decoder_service.h2
-rw-r--r--chromium/media/mojo/services/stable_video_decoder_service_unittest.cc6
-rw-r--r--chromium/media/mojo/services/test_helpers.cc2
-rw-r--r--chromium/media/mojo/services/test_helpers.h2
-rw-r--r--chromium/media/mojo/services/test_mojo_media_client.cc8
-rw-r--r--chromium/media/mojo/services/test_mojo_media_client.h2
-rw-r--r--chromium/media/mojo/services/video_decode_perf_history.cc2
-rw-r--r--chromium/media/mojo/services/video_decode_perf_history.h2
-rw-r--r--chromium/media/mojo/services/video_decode_perf_history_unittest.cc2
-rw-r--r--chromium/media/mojo/services/video_decode_stats_recorder.cc2
-rw-r--r--chromium/media/mojo/services/video_decode_stats_recorder.h2
-rw-r--r--chromium/media/mojo/services/video_decode_stats_recorder_unittest.cc2
-rw-r--r--chromium/media/mojo/services/watch_time_recorder.cc15
-rw-r--r--chromium/media/mojo/services/watch_time_recorder.h2
-rw-r--r--chromium/media/mojo/services/watch_time_recorder_unittest.cc18
-rw-r--r--chromium/media/mojo/services/webrtc_video_perf_history.cc2
-rw-r--r--chromium/media/mojo/services/webrtc_video_perf_history.h2
-rw-r--r--chromium/media/mojo/services/webrtc_video_perf_history_unittest.cc2
-rw-r--r--chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.cc2
-rw-r--r--chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.proto2
-rw-r--r--chromium/media/mojo/services/webrtc_video_perf_recorder.cc2
-rw-r--r--chromium/media/mojo/services/webrtc_video_perf_recorder.h2
-rw-r--r--chromium/media/mojo/services/webrtc_video_perf_recorder_unittest.cc2
-rw-r--r--chromium/media/mojo/test/BUILD.gn2
-rw-r--r--chromium/media/muxers/BUILD.gn2
-rw-r--r--chromium/media/muxers/file_webm_muxer_delegate.cc2
-rw-r--r--chromium/media/muxers/file_webm_muxer_delegate.h2
-rw-r--r--chromium/media/muxers/live_webm_muxer_delegate.cc2
-rw-r--r--chromium/media/muxers/live_webm_muxer_delegate.h2
-rw-r--r--chromium/media/muxers/webm_muxer.cc2
-rw-r--r--chromium/media/muxers/webm_muxer.h2
-rw-r--r--chromium/media/muxers/webm_muxer_fuzzertest.cc8
-rw-r--r--chromium/media/muxers/webm_muxer_unittest.cc14
-rw-r--r--chromium/media/parsers/BUILD.gn2
-rw-r--r--chromium/media/parsers/jpeg_parser.cc2
-rw-r--r--chromium/media/parsers/jpeg_parser.h2
-rw-r--r--chromium/media/parsers/jpeg_parser_picture_fuzzertest.cc2
-rw-r--r--chromium/media/parsers/jpeg_parser_unittest.cc2
-rw-r--r--chromium/media/parsers/media_parsers_export.h2
-rw-r--r--chromium/media/parsers/vp8_bool_decoder.cc2
-rw-r--r--chromium/media/parsers/vp8_bool_decoder.h2
-rw-r--r--chromium/media/parsers/vp8_bool_decoder_unittest.cc2
-rw-r--r--chromium/media/parsers/vp8_parser.cc2
-rw-r--r--chromium/media/parsers/vp8_parser.h2
-rw-r--r--chromium/media/parsers/vp8_parser_fuzzertest.cc2
-rw-r--r--chromium/media/parsers/vp8_parser_unittest.cc2
-rw-r--r--chromium/media/parsers/webp_parser.cc2
-rw-r--r--chromium/media/parsers/webp_parser.h2
-rw-r--r--chromium/media/parsers/webp_parser_fuzzertest.cc2
-rw-r--r--chromium/media/parsers/webp_parser_unittest.cc2
-rw-r--r--chromium/media/remoting/BUILD.gn23
-rw-r--r--chromium/media/remoting/OWNERS1
-rw-r--r--chromium/media/remoting/courier_renderer.cc61
-rw-r--r--chromium/media/remoting/courier_renderer.h8
-rw-r--r--chromium/media/remoting/courier_renderer_factory.cc2
-rw-r--r--chromium/media/remoting/courier_renderer_factory.h2
-rw-r--r--chromium/media/remoting/courier_renderer_unittest.cc2
-rw-r--r--chromium/media/remoting/demuxer_stream_adapter.cc59
-rw-r--r--chromium/media/remoting/demuxer_stream_adapter.h8
-rw-r--r--chromium/media/remoting/demuxer_stream_adapter_unittest.cc2
-rw-r--r--chromium/media/remoting/device_capability_checker.cc47
-rw-r--r--chromium/media/remoting/device_capability_checker.h29
-rw-r--r--chromium/media/remoting/device_capability_checker_unittest.cc38
-rw-r--r--chromium/media/remoting/end2end_test_renderer.cc2
-rw-r--r--chromium/media/remoting/end2end_test_renderer.h2
-rw-r--r--chromium/media/remoting/fake_media_resource.cc2
-rw-r--r--chromium/media/remoting/fake_media_resource.h2
-rw-r--r--chromium/media/remoting/fake_remoter.cc2
-rw-r--r--chromium/media/remoting/fake_remoter.h2
-rw-r--r--chromium/media/remoting/integration_test.cc2
-rw-r--r--chromium/media/remoting/metrics.cc2
-rw-r--r--chromium/media/remoting/metrics.h2
-rw-r--r--chromium/media/remoting/metrics_unittest.cc2
-rw-r--r--chromium/media/remoting/mock_receiver_controller.cc2
-rw-r--r--chromium/media/remoting/mock_receiver_controller.h3
-rw-r--r--chromium/media/remoting/receiver.cc2
-rw-r--r--chromium/media/remoting/receiver.h2
-rw-r--r--chromium/media/remoting/receiver_controller.cc2
-rw-r--r--chromium/media/remoting/receiver_controller.h2
-rw-r--r--chromium/media/remoting/receiver_unittest.cc2
-rw-r--r--chromium/media/remoting/remoting_constants.h2
-rw-r--r--chromium/media/remoting/remoting_renderer_factory.cc2
-rw-r--r--chromium/media/remoting/remoting_renderer_factory.h2
-rw-r--r--chromium/media/remoting/renderer_controller.cc24
-rw-r--r--chromium/media/remoting/renderer_controller.h3
-rw-r--r--chromium/media/remoting/renderer_controller_unittest.cc20
-rw-r--r--chromium/media/remoting/stream_provider.cc2
-rw-r--r--chromium/media/remoting/stream_provider.h2
-rw-r--r--chromium/media/remoting/stream_provider_unittest.cc2
-rw-r--r--chromium/media/remoting/test_utils.cc2
-rw-r--r--chromium/media/remoting/test_utils.h2
-rw-r--r--chromium/media/remoting/triggers.h7
-rw-r--r--chromium/media/renderers/BUILD.gn2
-rw-r--r--chromium/media/renderers/audio_renderer_impl.cc54
-rw-r--r--chromium/media/renderers/audio_renderer_impl.h5
-rw-r--r--chromium/media/renderers/audio_renderer_impl_unittest.cc55
-rw-r--r--chromium/media/renderers/decrypting_renderer.cc2
-rw-r--r--chromium/media/renderers/decrypting_renderer.h2
-rw-r--r--chromium/media/renderers/decrypting_renderer_factory.cc2
-rw-r--r--chromium/media/renderers/decrypting_renderer_factory.h2
-rw-r--r--chromium/media/renderers/decrypting_renderer_unittest.cc2
-rw-r--r--chromium/media/renderers/default_decoder_factory.cc59
-rw-r--r--chromium/media/renderers/default_decoder_factory.h3
-rw-r--r--chromium/media/renderers/default_renderer_factory.cc18
-rw-r--r--chromium/media/renderers/default_renderer_factory.h10
-rw-r--r--chromium/media/renderers/paint_canvas_video_renderer.cc70
-rw-r--r--chromium/media/renderers/paint_canvas_video_renderer.h2
-rw-r--r--chromium/media/renderers/paint_canvas_video_renderer_unittest.cc21
-rw-r--r--chromium/media/renderers/remote_playback_client_wrapper.h2
-rw-r--r--chromium/media/renderers/renderer_impl.cc2
-rw-r--r--chromium/media/renderers/renderer_impl.h2
-rw-r--r--chromium/media/renderers/renderer_impl_unittest.cc2
-rw-r--r--chromium/media/renderers/shared_image_video_frame_test_utils.cc77
-rw-r--r--chromium/media/renderers/shared_image_video_frame_test_utils.h2
-rw-r--r--chromium/media/renderers/video_frame_rgba_to_yuva_converter.cc2
-rw-r--r--chromium/media/renderers/video_frame_rgba_to_yuva_converter.h2
-rw-r--r--chromium/media/renderers/video_frame_yuv_converter.cc37
-rw-r--r--chromium/media/renderers/video_frame_yuv_converter.h7
-rw-r--r--chromium/media/renderers/video_frame_yuv_mailboxes_holder.cc12
-rw-r--r--chromium/media/renderers/video_frame_yuv_mailboxes_holder.h10
-rw-r--r--chromium/media/renderers/video_overlay_factory.cc2
-rw-r--r--chromium/media/renderers/video_overlay_factory.h2
-rw-r--r--chromium/media/renderers/video_renderer_impl.cc12
-rw-r--r--chromium/media/renderers/video_renderer_impl.h7
-rw-r--r--chromium/media/renderers/video_renderer_impl_unittest.cc7
-rw-r--r--chromium/media/renderers/video_resource_updater.cc184
-rw-r--r--chromium/media/renderers/video_resource_updater.h3
-rw-r--r--chromium/media/renderers/video_resource_updater_unittest.cc143
-rw-r--r--chromium/media/renderers/win/media_engine_extension.cc2
-rw-r--r--chromium/media/renderers/win/media_engine_extension.h2
-rw-r--r--chromium/media/renderers/win/media_engine_notify_impl.cc2
-rw-r--r--chromium/media/renderers/win/media_engine_notify_impl.h2
-rw-r--r--chromium/media/renderers/win/media_foundation_audio_stream.cc2
-rw-r--r--chromium/media/renderers/win/media_foundation_audio_stream.h2
-rw-r--r--chromium/media/renderers/win/media_foundation_protection_manager.cc5
-rw-r--r--chromium/media/renderers/win/media_foundation_protection_manager.h2
-rw-r--r--chromium/media/renderers/win/media_foundation_renderer.cc31
-rw-r--r--chromium/media/renderers/win/media_foundation_renderer.h6
-rw-r--r--chromium/media/renderers/win/media_foundation_renderer_extension.h6
-rw-r--r--chromium/media/renderers/win/media_foundation_renderer_integration_test.cc2
-rw-r--r--chromium/media/renderers/win/media_foundation_renderer_unittest.cc4
-rw-r--r--chromium/media/renderers/win/media_foundation_rendering_mode.cc2
-rw-r--r--chromium/media/renderers/win/media_foundation_rendering_mode.h2
-rw-r--r--chromium/media/renderers/win/media_foundation_source_wrapper.cc2
-rw-r--r--chromium/media/renderers/win/media_foundation_source_wrapper.h2
-rw-r--r--chromium/media/renderers/win/media_foundation_stream_wrapper.cc2
-rw-r--r--chromium/media/renderers/win/media_foundation_stream_wrapper.h2
-rw-r--r--chromium/media/renderers/win/media_foundation_texture_pool.cc2
-rw-r--r--chromium/media/renderers/win/media_foundation_texture_pool.h2
-rw-r--r--chromium/media/renderers/win/media_foundation_texture_pool_unittest.cc2
-rw-r--r--chromium/media/renderers/win/media_foundation_video_stream.cc2
-rw-r--r--chromium/media/renderers/win/media_foundation_video_stream.h2
-rw-r--r--chromium/media/test/BUILD.gn2
-rw-r--r--chromium/media/video/BUILD.gn2
-rw-r--r--chromium/media/video/av1_video_encoder.cc19
-rw-r--r--chromium/media/video/av1_video_encoder.h2
-rw-r--r--chromium/media/video/fake_gpu_memory_buffer.cc2
-rw-r--r--chromium/media/video/fake_gpu_memory_buffer.h2
-rw-r--r--chromium/media/video/fake_video_encode_accelerator.cc2
-rw-r--r--chromium/media/video/fake_video_encode_accelerator.h2
-rw-r--r--chromium/media/video/gpu_memory_buffer_video_frame_pool.cc125
-rw-r--r--chromium/media/video/gpu_memory_buffer_video_frame_pool.h11
-rw-r--r--chromium/media/video/gpu_memory_buffer_video_frame_pool_unittest.cc28
-rw-r--r--chromium/media/video/gpu_video_accelerator_factories.cc2
-rw-r--r--chromium/media/video/gpu_video_accelerator_factories.h5
-rw-r--r--chromium/media/video/h264_bit_reader.cc5
-rw-r--r--chromium/media/video/h264_bit_reader.h4
-rw-r--r--chromium/media/video/h264_bit_reader_unittest.cc2
-rw-r--r--chromium/media/video/h264_level_limits.cc2
-rw-r--r--chromium/media/video/h264_level_limits.h2
-rw-r--r--chromium/media/video/h264_parser.cc2
-rw-r--r--chromium/media/video/h264_parser.h2
-rw-r--r--chromium/media/video/h264_parser_fuzzertest.cc2
-rw-r--r--chromium/media/video/h264_parser_unittest.cc2
-rw-r--r--chromium/media/video/h264_poc.cc2
-rw-r--r--chromium/media/video/h264_poc.h2
-rw-r--r--chromium/media/video/h264_poc_unittest.cc2
-rw-r--r--chromium/media/video/h265_nalu_parser.cc2
-rw-r--r--chromium/media/video/h265_nalu_parser.h2
-rw-r--r--chromium/media/video/h265_nalu_parser_unittest.cc2
-rw-r--r--chromium/media/video/h265_parser.cc99
-rw-r--r--chromium/media/video/h265_parser.h58
-rw-r--r--chromium/media/video/h265_parser_fuzzertest.cc6
-rw-r--r--chromium/media/video/h265_parser_unittest.cc46
-rw-r--r--chromium/media/video/h265_poc.cc2
-rw-r--r--chromium/media/video/h265_poc.h2
-rw-r--r--chromium/media/video/h265_poc_unittest.cc8
-rw-r--r--chromium/media/video/half_float_maker.cc2
-rw-r--r--chromium/media/video/half_float_maker.h2
-rw-r--r--chromium/media/video/half_float_maker_unittest.cc2
-rw-r--r--chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.cc2
-rw-r--r--chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.h2
-rw-r--r--chromium/media/video/mock_gpu_video_accelerator_factories.cc2
-rw-r--r--chromium/media/video/mock_gpu_video_accelerator_factories.h3
-rw-r--r--chromium/media/video/mock_video_decode_accelerator.cc2
-rw-r--r--chromium/media/video/mock_video_decode_accelerator.h2
-rw-r--r--chromium/media/video/mock_video_encode_accelerator.cc2
-rw-r--r--chromium/media/video/mock_video_encode_accelerator.h2
-rw-r--r--chromium/media/video/openh264_video_encoder.cc8
-rw-r--r--chromium/media/video/openh264_video_encoder.h2
-rw-r--r--chromium/media/video/picture.cc2
-rw-r--r--chromium/media/video/picture.h2
-rw-r--r--chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc17
-rw-r--r--chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.h2
-rw-r--r--chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc2
-rw-r--r--chromium/media/video/software_video_encoder_test.cc36
-rw-r--r--chromium/media/video/supported_video_decoder_config_unittest.cc2
-rw-r--r--chromium/media/video/trace_util.cc2
-rw-r--r--chromium/media/video/trace_util.h2
-rw-r--r--chromium/media/video/video_decode_accelerator.cc2
-rw-r--r--chromium/media/video/video_decode_accelerator.h2
-rw-r--r--chromium/media/video/video_encode_accelerator.cc14
-rw-r--r--chromium/media/video/video_encode_accelerator.h10
-rw-r--r--chromium/media/video/video_encode_accelerator_adapter.cc223
-rw-r--r--chromium/media/video/video_encode_accelerator_adapter.h9
-rw-r--r--chromium/media/video/video_encode_accelerator_adapter_test.cc154
-rw-r--r--chromium/media/video/video_encoder_fallback.cc2
-rw-r--r--chromium/media/video/video_encoder_fallback.h2
-rw-r--r--chromium/media/video/video_encoder_fallback_test.cc2
-rw-r--r--chromium/media/video/video_encoder_info.cc2
-rw-r--r--chromium/media/video/video_encoder_info.h2
-rw-r--r--chromium/media/video/vpx_video_encoder.cc2
-rw-r--r--chromium/media/video/vpx_video_encoder.h2
-rw-r--r--chromium/media/webrtc/BUILD.gn2
-rw-r--r--chromium/media/webrtc/audio_delay_stats_reporter.cc2
-rw-r--r--chromium/media/webrtc/audio_delay_stats_reporter.h2
-rw-r--r--chromium/media/webrtc/audio_processor.cc70
-rw-r--r--chromium/media/webrtc/audio_processor.h12
-rw-r--r--chromium/media/webrtc/audio_processor_test.cc38
-rw-r--r--chromium/media/webrtc/constants.h2
-rw-r--r--chromium/media/webrtc/helpers.cc2
-rw-r--r--chromium/media/webrtc/helpers.h2
-rw-r--r--chromium/media/webrtc/helpers_unittests.cc2
-rw-r--r--chromium/media/webrtc/webrtc_features.cc24
-rw-r--r--chromium/media/webrtc/webrtc_features.h13
2879 files changed, 14595 insertions, 9185 deletions
diff --git a/chromium/media/BUILD.gn b/chromium/media/BUILD.gn
index bc8882384ae..9272cfb5cc0 100644
--- a/chromium/media/BUILD.gn
+++ b/chromium/media/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -219,17 +219,20 @@ test("media_unittests") {
"//media/fuchsia/video:unittests",
]
- use_cfv1 = false
-
# PaintCanvasVideoRendererWithGLTest.* uses SwiftShader, which generates
# machine code.
test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml"
additional_manifest_fragments = [
"//build/config/fuchsia/test/audio_output.shard.test-cml",
+ "//build/config/fuchsia/test/mark_vmo_executable.shard.test-cml",
"//build/config/fuchsia/test/platform_video_codecs.shard.test-cml",
"//third_party/fuchsia-sdk/sdk/pkg/vulkan/client.shard.cml",
]
+
+ if (enable_library_cdms) {
+ excluded_files = [ "lib.unstripped/libclearkeycdm.so" ]
+ }
}
if (enable_media_remoting) {
@@ -289,7 +292,6 @@ test("audio_unittests") {
}
if (is_fuchsia) {
- use_cfv1 = false
additional_manifest_fragments =
[ "//build/config/fuchsia/test/audio_output.shard.test-cml" ]
}
diff --git a/chromium/media/OWNERS b/chromium/media/OWNERS
index 59bcf8b258a..99606b91354 100644
--- a/chromium/media/OWNERS
+++ b/chromium/media/OWNERS
@@ -10,7 +10,6 @@
set noparent
cassew@chromium.org
-chcunningham@chromium.org
dalecurtis@chromium.org
eugene@chromium.org
jrummell@chromium.org
diff --git a/chromium/media/PRESUBMIT.py b/chromium/media/PRESUBMIT.py
index 7e5ba9cb577..f13b78d5a47 100644
--- a/chromium/media/PRESUBMIT.py
+++ b/chromium/media/PRESUBMIT.py
@@ -1,4 +1,4 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
+# Copyright 2013 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/PRESUBMIT_test.py b/chromium/media/PRESUBMIT_test.py
index 80eabff7808..6b403b747af 100755
--- a/chromium/media/PRESUBMIT_test.py
+++ b/chromium/media/PRESUBMIT_test.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
diff --git a/chromium/media/audio/BUILD.gn b/chromium/media/audio/BUILD.gn
index d872796dee0..cfec184939e 100644
--- a/chromium/media/audio/BUILD.gn
+++ b/chromium/media/audio/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -52,9 +52,13 @@ source_set("audio") {
"//media/base/android",
]
sources = [
+ "aecdump_recording_manager.cc",
+ "aecdump_recording_manager.h",
"agc_audio_stream.h",
"alive_checker.cc",
"alive_checker.h",
+ "audio_bus_pool.cc",
+ "audio_bus_pool.h",
"audio_debug_file_writer.cc",
"audio_debug_file_writer.h",
"audio_debug_recording_helper.cc",
@@ -208,6 +212,13 @@ source_set("audio") {
"win/waveout_output_win.h",
]
+ if (enable_platform_dts_audio) {
+ sources += [
+ "win/audio_edid_scan_win.cc",
+ "win/audio_edid_scan_win.h",
+ ]
+ }
+
deps += [ "//media/base/win:media_foundation_util" ]
libs += [
@@ -358,6 +369,8 @@ static_library("test_support") {
"audio_system_test_util.h",
"audio_unittest_util.cc",
"audio_unittest_util.h",
+ "mock_aecdump_recording_manager.cc",
+ "mock_aecdump_recording_manager.h",
"mock_audio_debug_recording_manager.cc",
"mock_audio_debug_recording_manager.h",
"mock_audio_manager.cc",
@@ -394,7 +407,9 @@ static_library("test_support") {
source_set("unit_tests") {
testonly = true
sources = [
+ "aecdump_recording_manager_unittest.cc",
"alive_checker_unittest.cc",
+ "audio_bus_pool_unittest.cc",
"audio_debug_file_writer_unittest.cc",
"audio_debug_recording_helper_unittest.cc",
"audio_debug_recording_manager_unittest.cc",
@@ -455,11 +470,7 @@ source_set("unit_tests") {
]
if (use_cras) {
- sources += [
- "cras/audio_manager_chromeos_unittest.cc",
- "cras/cras_input_unittest.cc",
- "cras/cras_unified_unittest.cc",
- ]
+ sources += [ "cras/audio_manager_chromeos_unittest.cc" ]
}
}
@@ -467,6 +478,14 @@ source_set("unit_tests") {
sources += [ "cras/audio_manager_cras_unittest.cc" ]
}
+ if (use_cras) {
+ sources += [
+ "cras/audio_manager_cras_base_unittest.cc",
+ "cras/cras_input_unittest.cc",
+ "cras/cras_unified_unittest.cc",
+ ]
+ }
+
if (is_win) {
sources += [
"win/audio_device_listener_win_unittest.cc",
diff --git a/chromium/media/audio/aecdump_recording_manager.cc b/chromium/media/audio/aecdump_recording_manager.cc
new file mode 100644
index 00000000000..8c4fb1754cf
--- /dev/null
+++ b/chromium/media/audio/aecdump_recording_manager.cc
@@ -0,0 +1,125 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/audio/aecdump_recording_manager.h"
+
+#include "base/bind.h"
+#include "base/task/single_thread_task_runner.h"
+#include "base/task/thread_pool.h"
+#include "media/audio/audio_manager.h"
+
+namespace media {
+namespace {
+void CloseFileWithoutBlocking(base::File file) {
+ // Post as a low-priority task to a thread pool to avoid blocking the
+ // current thread.
+ base::ThreadPool::PostTask(
+ FROM_HERE, {base::TaskPriority::LOWEST, base::MayBlock()},
+ base::BindOnce([](base::File) {}, std::move(file)));
+}
+} // namespace
+
+AecdumpRecordingManager::AecdumpRecordingManager(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ : task_runner_(std::move(task_runner)) {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+}
+
+AecdumpRecordingManager::~AecdumpRecordingManager() {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK_EQ(aecdump_recording_sources_.size(), 0u);
+ DCHECK(!IsDebugRecordingEnabled());
+}
+
+void AecdumpRecordingManager::EnableDebugRecording(
+ CreateFileCallback create_file_callback) {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK(create_file_callback);
+ DCHECK(!create_file_callback_);
+ create_file_callback_ = std::move(create_file_callback);
+
+ for (const auto& it : aecdump_recording_sources_) {
+ AecdumpRecordingSource* source = it.first;
+ uint32_t id = it.second;
+ create_file_callback_.Run(
+ id, /*reply_callback=*/base::BindOnce(
+ &StartRecordingIfValidPointer, weak_factory_.GetWeakPtr(), source));
+ }
+}
+
+void AecdumpRecordingManager::StartRecording(AecdumpRecordingSource* source,
+ base::File file) {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK(IsDebugRecordingEnabled());
+
+ if (aecdump_recording_sources_.find(source) !=
+ aecdump_recording_sources_.end()) {
+ source->StartAecdump(std::move(file));
+ return;
+ }
+
+ // The source is deregistered and we are responsible for closing the file.
+ CloseFileWithoutBlocking(std::move(file));
+}
+
+void AecdumpRecordingManager::DisableDebugRecording() {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK(create_file_callback_);
+ for (const auto& it : aecdump_recording_sources_) {
+ AecdumpRecordingSource* source = it.first;
+ source->StopAecdump();
+ }
+ create_file_callback_.Reset();
+
+ // By invalidating weak pointers, we cancel any recordings in the process of
+ // being started (file creation).
+ weak_factory_.InvalidateWeakPtrs();
+}
+
+void AecdumpRecordingManager::RegisterAecdumpSource(
+ AecdumpRecordingSource* source) {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK(aecdump_recording_sources_.find(source) ==
+ aecdump_recording_sources_.end());
+
+ const uint32_t id = recording_id_counter_++;
+
+ if (IsDebugRecordingEnabled()) {
+ create_file_callback_.Run(id, /*reply_callback=*/base::BindOnce(
+ &AecdumpRecordingManager::StartRecording,
+ weak_factory_.GetWeakPtr(), source));
+ }
+ aecdump_recording_sources_[source] = id;
+}
+
+void AecdumpRecordingManager::DeregisterAecdumpSource(
+ AecdumpRecordingSource* source) {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK(aecdump_recording_sources_.find(source) !=
+ aecdump_recording_sources_.end());
+
+ if (IsDebugRecordingEnabled()) {
+ source->StopAecdump();
+ }
+ aecdump_recording_sources_.erase(source);
+}
+
+bool AecdumpRecordingManager::IsDebugRecordingEnabled() const {
+ DCHECK(task_runner_->BelongsToCurrentThread());
+ return !create_file_callback_.is_null();
+}
+
+// static
+void AecdumpRecordingManager::StartRecordingIfValidPointer(
+ base::WeakPtr<AecdumpRecordingManager> manager,
+ AecdumpRecordingSource* source,
+ base::File file) {
+ if (manager) {
+ manager->StartRecording(source, std::move(file));
+ return;
+ }
+ // Recording has been stopped and we are responsible for closing the file.
+ CloseFileWithoutBlocking(std::move(file));
+}
+} // namespace media
diff --git a/chromium/media/audio/aecdump_recording_manager.h b/chromium/media/audio/aecdump_recording_manager.h
new file mode 100644
index 00000000000..8a7b1034a9e
--- /dev/null
+++ b/chromium/media/audio/aecdump_recording_manager.h
@@ -0,0 +1,96 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_AECDUMP_RECORDING_MANAGER_H_
+#define MEDIA_AUDIO_AECDUMP_RECORDING_MANAGER_H_
+
+#include <map>
+
+#include "base/callback.h"
+#include "base/files/file.h"
+#include "base/memory/weak_ptr.h"
+#include "media/base/media_export.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace media {
+
+class AecdumpRecordingSource {
+ public:
+ // Starts recording an aecdump to |aecdump_file|. If a recording is already
+ // ongoing, then that recording is stopped and and a new recording is started
+ // to |aecdump_file|.
+ virtual void StartAecdump(base::File aecdump_file) = 0;
+
+ // Stops recording an aecdump and closes the file. Does nothing if no
+ // recording is ongoing.
+ virtual void StopAecdump() = 0;
+};
+
+// Manages diagnostic audio processing recordings (so-called aecdumps).
+// Aecdump recording sources implement the AecdumpRecordingSource interface and
+// register/deregister with the AecdumpRecordingManager.
+// All operations, including creation and destruction, must happen on the same
+// thread as the |task_runner| provided in the constructor.
+class MEDIA_EXPORT AecdumpRecordingManager
+ : public base::SupportsWeakPtr<AecdumpRecordingManager> {
+ public:
+ using CreateFileCallback = base::RepeatingCallback<
+ void(uint32_t id, base::OnceCallback<void(base::File)> reply_callback)>;
+
+ explicit AecdumpRecordingManager(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+
+ AecdumpRecordingManager(const AecdumpRecordingManager&) = delete;
+ AecdumpRecordingManager& operator=(const AecdumpRecordingManager&) = delete;
+
+ virtual ~AecdumpRecordingManager();
+
+ // Starts and stops aecdump recording. Overridden by tests.
+ virtual void EnableDebugRecording(CreateFileCallback create_file_callback);
+ virtual void DisableDebugRecording();
+
+ // Registers an aecdump recording source. Overridden by tests.
+ virtual void RegisterAecdumpSource(AecdumpRecordingSource* source);
+ // Registers an aecdump recording source. If aecdump recording is currently
+ // enabled, then StopAecdump will be called on the source. Overridden by
+ // tests.
+ virtual void DeregisterAecdumpSource(AecdumpRecordingSource* source);
+
+ private:
+ // Forwards to StartRecording() if |manager| is valid, otherwise closes |file|
+ // without blocking the thread.
+ static void StartRecordingIfValidPointer(
+ base::WeakPtr<AecdumpRecordingManager> manager,
+ AecdumpRecordingSource* source,
+ base::File file);
+
+ // Used as callback for |create_file_callback_|, to ensure the recording
+ // source has not been deregistered during file creation.
+ void StartRecording(AecdumpRecordingSource* source, base::File file);
+
+ bool IsDebugRecordingEnabled() const;
+
+ // Counter for recording source IDs.
+ uint32_t recording_id_counter_ = 1;
+
+ // The task runner this class lives on. Also used for file creation callbacks.
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+
+ // Recorders, one per source. Maps pointer to source id.
+ std::map<AecdumpRecordingSource*, uint32_t> aecdump_recording_sources_;
+
+ // Callback for creating aecdump files. When this is not null, debug
+ // recording is enabled.
+ CreateFileCallback create_file_callback_;
+
+ // For managing debug recording cycles.
+ base::WeakPtrFactory<AecdumpRecordingManager> weak_factory_{this};
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_AECDUMP_RECORDING_MANAGER_H_
diff --git a/chromium/media/audio/aecdump_recording_manager_unittest.cc b/chromium/media/audio/aecdump_recording_manager_unittest.cc
new file mode 100644
index 00000000000..87bb29fd65f
--- /dev/null
+++ b/chromium/media/audio/aecdump_recording_manager_unittest.cc
@@ -0,0 +1,238 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/audio/aecdump_recording_manager.h"
+
+#include "base/bind.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/files/scoped_temp_dir.h"
+#include "base/test/task_environment.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using testing::_;
+using testing::InSequence;
+using testing::NiceMock;
+using testing::Sequence;
+
+namespace media {
+namespace {
+
+class MockAecdumpRecordingSource : public AecdumpRecordingSource {
+ public:
+ MOCK_METHOD1(StartAecdump, void(base::File));
+ MOCK_METHOD0(StopAecdump, void());
+};
+
+class AecdumpRecordingManagerTest : public ::testing::Test {
+ public:
+ AecdumpRecordingManagerTest()
+ : manager_(std::make_unique<AecdumpRecordingManager>(
+ task_environment_.GetMainThreadTaskRunner())),
+ create_file_callback_(base::BindRepeating(
+ &AecdumpRecordingManagerTest::AsyncCreateFileCallback,
+ base::Unretained(this))) {}
+
+ void SetUp() override { ASSERT_TRUE(temp_directory_.CreateUniqueTempDir()); }
+
+ protected:
+ // Simulates async file creation by posting the reply to the main thread.
+ void AsyncCreateFileCallback(
+ uint32_t /*id*/,
+ base::OnceCallback<void(base::File)> reply_callback) {
+ base::FilePath temp_file_path;
+ base::File file = base::CreateAndOpenTemporaryFileInDir(
+ temp_directory_.GetPath(), &temp_file_path);
+ ASSERT_TRUE(file.IsValid());
+ task_environment_.GetMainThreadTaskRunner()->PostTask(
+ FROM_HERE, base::BindOnce(std::move(reply_callback), std::move(file)));
+ }
+
+ base::test::TaskEnvironment task_environment_;
+ std::unique_ptr<AecdumpRecordingManager> manager_;
+ AecdumpRecordingManager::CreateFileCallback create_file_callback_;
+ base::ScopedTempDir temp_directory_;
+};
+
+TEST_F(AecdumpRecordingManagerTest, EnableDisableDoesNotCrash) {
+ manager_->EnableDebugRecording(create_file_callback_);
+ manager_->DisableDebugRecording();
+}
+
+TEST_F(AecdumpRecordingManagerTest,
+ EnableDisableWithOneSourceStartsStopsSource) {
+ MockAecdumpRecordingSource mock_source;
+ InSequence s;
+ EXPECT_CALL(mock_source, StartAecdump(_)).Times(1);
+ EXPECT_CALL(mock_source, StopAecdump()).Times(1);
+
+ manager_->RegisterAecdumpSource(&mock_source);
+
+ manager_->EnableDebugRecording(create_file_callback_);
+ base::RunLoop().RunUntilIdle();
+
+ manager_->DisableDebugRecording();
+
+ manager_->DeregisterAecdumpSource(&mock_source);
+}
+
+TEST_F(AecdumpRecordingManagerTest,
+ EnableDisableWithTwoSourcesStartsStopsSources) {
+ MockAecdumpRecordingSource mock_source_a;
+ MockAecdumpRecordingSource mock_source_b;
+ Sequence s1;
+ Sequence s2;
+ EXPECT_CALL(mock_source_a, StartAecdump(_)).Times(1).InSequence(s1);
+ EXPECT_CALL(mock_source_a, StopAecdump()).Times(1).InSequence(s1);
+ EXPECT_CALL(mock_source_b, StartAecdump(_)).Times(1).InSequence(s2);
+ EXPECT_CALL(mock_source_b, StopAecdump()).Times(1).InSequence(s2);
+
+ manager_->RegisterAecdumpSource(&mock_source_a);
+ manager_->RegisterAecdumpSource(&mock_source_b);
+
+ manager_->EnableDebugRecording(create_file_callback_);
+ base::RunLoop().RunUntilIdle();
+
+ manager_->DisableDebugRecording();
+
+ manager_->DeregisterAecdumpSource(&mock_source_a);
+ manager_->DeregisterAecdumpSource(&mock_source_b);
+}
+
+TEST_F(AecdumpRecordingManagerTest,
+ RegisterDeregisterSourceBeforeEnableDisableDoesNotStartStopSource) {
+ MockAecdumpRecordingSource mock_source;
+ EXPECT_CALL(mock_source, StartAecdump(_)).Times(0);
+ EXPECT_CALL(mock_source, StopAecdump()).Times(0);
+
+ manager_->RegisterAecdumpSource(&mock_source);
+ manager_->DeregisterAecdumpSource(&mock_source);
+
+ // Enabling debug recordings should not trigger any calls to the recording
+ // source.
+ manager_->EnableDebugRecording(create_file_callback_);
+ base::RunLoop().RunUntilIdle();
+ manager_->DisableDebugRecording();
+}
+
+TEST_F(AecdumpRecordingManagerTest,
+ RegisterDeregisterSourceAfterEnableDisableDoesNotStartStopSource) {
+ MockAecdumpRecordingSource mock_source;
+ EXPECT_CALL(mock_source, StartAecdump(_)).Times(0);
+ EXPECT_CALL(mock_source, StopAecdump()).Times(0);
+
+ // Enabling debug recordings should not trigger any calls to the recording
+ // source.
+ manager_->EnableDebugRecording(create_file_callback_);
+ manager_->DisableDebugRecording();
+
+ manager_->RegisterAecdumpSource(&mock_source);
+ base::RunLoop().RunUntilIdle();
+ manager_->DeregisterAecdumpSource(&mock_source);
+}
+
+TEST_F(AecdumpRecordingManagerTest,
+ RegisterDeregisterSourceDuringRecordingStartsStopsSource) {
+ InSequence s;
+ MockAecdumpRecordingSource mock_source;
+ EXPECT_CALL(mock_source, StartAecdump(_)).Times(1);
+ EXPECT_CALL(mock_source, StopAecdump()).Times(1);
+
+ manager_->EnableDebugRecording(create_file_callback_);
+
+ manager_->RegisterAecdumpSource(&mock_source);
+ base::RunLoop().RunUntilIdle();
+
+ manager_->DeregisterAecdumpSource(&mock_source);
+ ::testing::Mock::VerifyAndClearExpectations(&mock_source);
+
+ manager_->DisableDebugRecording();
+}
+
+TEST_F(AecdumpRecordingManagerTest,
+ DeregisterSourceBeforeFileCreationCallbackDoesNotStartSource) {
+ NiceMock<MockAecdumpRecordingSource> mock_source;
+ EXPECT_CALL(mock_source, StartAecdump(_)).Times(0);
+
+ manager_->RegisterAecdumpSource(&mock_source);
+
+ // Enabling debug recordings schedules a StartAecdump() call to the recording
+ // source.
+ manager_->EnableDebugRecording(create_file_callback_);
+
+ // Deregister the source before StartAecdump() can be called.
+ manager_->DeregisterAecdumpSource(&mock_source);
+
+ // Run the file creation callback. Aecdumps should not be started.
+ base::RunLoop().RunUntilIdle();
+
+ manager_->DisableDebugRecording();
+}
+
+TEST_F(AecdumpRecordingManagerTest,
+ StopRecordingBeforeFileCreationCallbackDoesNotStartSource) {
+ NiceMock<MockAecdumpRecordingSource> mock_source;
+ EXPECT_CALL(mock_source, StartAecdump(_)).Times(0);
+
+ manager_->RegisterAecdumpSource(&mock_source);
+
+ // Enabling debug recordings schedules a StartAecdump() call to the recording
+ // source.
+ manager_->EnableDebugRecording(create_file_callback_);
+
+ // Stop aecdump recording before StartAecdump() can be called.
+ manager_->DisableDebugRecording();
+
+ // Run the file creation callback. Aecdumps should not be started.
+ base::RunLoop().RunUntilIdle();
+
+ // Clean up.
+ manager_->DeregisterAecdumpSource(&mock_source);
+}
+
+TEST_F(AecdumpRecordingManagerTest,
+ RestartRecordingBeforeFileCreationCallbackDoesNotStartSourceTwice) {
+ NiceMock<MockAecdumpRecordingSource> mock_source;
+ EXPECT_CALL(mock_source, StartAecdump(_)).Times(1);
+
+ manager_->RegisterAecdumpSource(&mock_source);
+
+ // Enabling debug recordings schedules a StartAecdump() call to the recording
+ // source.
+ manager_->EnableDebugRecording(create_file_callback_);
+
+ // Restart aecdump recording before StartAecdump() can be called.
+ manager_->DisableDebugRecording();
+ manager_->EnableDebugRecording(create_file_callback_);
+
+ // Run the file creation callback. The first file created should be discarded,
+ // we expect only one StartAecdump() call.
+ base::RunLoop().RunUntilIdle();
+
+ // Clean up.
+ manager_->DeregisterAecdumpSource(&mock_source);
+ manager_->DisableDebugRecording();
+}
+
+TEST_F(AecdumpRecordingManagerTest,
+ DestroyManagerBeforeFileCreationCallbackDoesNotCrash) {
+ NiceMock<MockAecdumpRecordingSource> mock_source;
+ manager_->RegisterAecdumpSource(&mock_source);
+
+ // Enabling debug recordings schedules a StartAecdump() call to the recording
+ // source.
+ manager_->EnableDebugRecording(create_file_callback_);
+
+ // Destroy the AecdumpRecordingManager before StartAecdump() can be called.
+ manager_->DeregisterAecdumpSource(&mock_source);
+ manager_->DisableDebugRecording();
+ manager_.reset();
+
+ // Run the file creation callback. Aecdumps should not be started.
+ base::RunLoop().RunUntilIdle();
+}
+
+} // namespace
+} // namespace media
diff --git a/chromium/media/audio/agc_audio_stream.h b/chromium/media/audio/agc_audio_stream.h
index a14a9817077..bf1daea8a3e 100644
--- a/chromium/media/audio/agc_audio_stream.h
+++ b/chromium/media/audio/agc_audio_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alive_checker.cc b/chromium/media/audio/alive_checker.cc
index 8ca4e936c37..aede67fd4af 100644
--- a/chromium/media/audio/alive_checker.cc
+++ b/chromium/media/audio/alive_checker.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alive_checker.h b/chromium/media/audio/alive_checker.h
index b95c9fecba7..818fe7e8fcc 100644
--- a/chromium/media/audio/alive_checker.h
+++ b/chromium/media/audio/alive_checker.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alive_checker_unittest.cc b/chromium/media/audio/alive_checker_unittest.cc
index 556d3da3b24..567198e267f 100644
--- a/chromium/media/audio/alive_checker_unittest.cc
+++ b/chromium/media/audio/alive_checker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alsa/alsa_input.cc b/chromium/media/audio/alsa/alsa_input.cc
index 1698c0c3411..ad334630141 100644
--- a/chromium/media/audio/alsa/alsa_input.cc
+++ b/chromium/media/audio/alsa/alsa_input.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alsa/alsa_input.h b/chromium/media/audio/alsa/alsa_input.h
index 591c4ce564c..c24a48c0c80 100644
--- a/chromium/media/audio/alsa/alsa_input.h
+++ b/chromium/media/audio/alsa/alsa_input.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alsa/alsa_output.cc b/chromium/media/audio/alsa/alsa_output.cc
index 46fe698f63b..ba9134bccee 100644
--- a/chromium/media/audio/alsa/alsa_output.cc
+++ b/chromium/media/audio/alsa/alsa_output.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/alsa/alsa_output.h b/chromium/media/audio/alsa/alsa_output.h
index c674c5c506c..c2ecac8151b 100644
--- a/chromium/media/audio/alsa/alsa_output.h
+++ b/chromium/media/audio/alsa/alsa_output.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/alsa/alsa_output_unittest.cc b/chromium/media/audio/alsa/alsa_output_unittest.cc
index 3560767d361..90d2eb02c0c 100644
--- a/chromium/media/audio/alsa/alsa_output_unittest.cc
+++ b/chromium/media/audio/alsa/alsa_output_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,6 +20,7 @@
#include "media/audio/mock_audio_source_callback.h"
#include "media/audio/test_audio_thread.h"
#include "media/base/audio_timestamp_helper.h"
+#include "media/base/channel_layout.h"
#include "media/base/data_buffer.h"
#include "media/base/seekable_buffer.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -94,8 +95,10 @@ class AlsaPcmOutputStreamTest : public testing::Test {
AlsaPcmOutputStream* CreateStream(ChannelLayout layout,
int32_t samples_per_packet) {
- AudioParameters params(kTestFormat, layout, kTestSampleRate,
- samples_per_packet);
+ AudioParameters params(
+ kTestFormat,
+ ChannelLayoutConfig(layout, ChannelLayoutToChannelCount(layout)),
+ kTestSampleRate, samples_per_packet);
return new AlsaPcmOutputStream(kTestDeviceName,
params,
&mock_alsa_wrapper_,
diff --git a/chromium/media/audio/alsa/alsa_util.cc b/chromium/media/audio/alsa/alsa_util.cc
index 84b4133507f..821a750f4ea 100644
--- a/chromium/media/audio/alsa/alsa_util.cc
+++ b/chromium/media/audio/alsa/alsa_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alsa/alsa_util.h b/chromium/media/audio/alsa/alsa_util.h
index 47b5d1b6594..a3855a4f781 100644
--- a/chromium/media/audio/alsa/alsa_util.h
+++ b/chromium/media/audio/alsa/alsa_util.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alsa/alsa_util_unittest.cc b/chromium/media/audio/alsa/alsa_util_unittest.cc
index 343730dc07b..da6bfc85789 100644
--- a/chromium/media/audio/alsa/alsa_util_unittest.cc
+++ b/chromium/media/audio/alsa/alsa_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alsa/alsa_wrapper.cc b/chromium/media/audio/alsa/alsa_wrapper.cc
index 83493271cbd..abcaa88a634 100644
--- a/chromium/media/audio/alsa/alsa_wrapper.cc
+++ b/chromium/media/audio/alsa/alsa_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alsa/alsa_wrapper.h b/chromium/media/audio/alsa/alsa_wrapper.h
index 29653beede9..94a401f93fb 100644
--- a/chromium/media/audio/alsa/alsa_wrapper.h
+++ b/chromium/media/audio/alsa/alsa_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/alsa/audio_manager_alsa.cc b/chromium/media/audio/alsa/audio_manager_alsa.cc
index 19d69a0197c..af69ccd4c82 100644
--- a/chromium/media/audio/alsa/audio_manager_alsa.cc
+++ b/chromium/media/audio/alsa/audio_manager_alsa.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -73,7 +73,7 @@ AudioParameters AudioManagerAlsa::GetInputStreamParameters(
static const int kDefaultInputBufferSize = 1024;
return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, kDefaultSampleRate,
+ ChannelLayoutConfig::Stereo(), kDefaultSampleRate,
kDefaultInputBufferSize);
}
@@ -272,7 +272,7 @@ AudioParameters AudioManagerAlsa::GetPreferredOutputStreamParameters(
// TODO(tommi): Support |output_device_id|.
DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!";
static const int kDefaultOutputBufferSize = 2048;
- ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
+ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Stereo();
int sample_rate = kDefaultSampleRate;
int buffer_size = kDefaultOutputBufferSize;
if (input_params.IsValid()) {
@@ -282,7 +282,7 @@ AudioParameters AudioManagerAlsa::GetPreferredOutputStreamParameters(
// TODO(dalecurtis): This should include bits per channel and channel layout
// eventually.
sample_rate = input_params.sample_rate();
- channel_layout = input_params.channel_layout();
+ channel_layout_config = input_params.channel_layout_config();
buffer_size = std::min(input_params.frames_per_buffer(), buffer_size);
}
@@ -290,8 +290,8 @@ AudioParameters AudioManagerAlsa::GetPreferredOutputStreamParameters(
if (user_buffer_size)
buffer_size = user_buffer_size;
- return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
- sample_rate, buffer_size);
+ return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ channel_layout_config, sample_rate, buffer_size);
}
AudioOutputStream* AudioManagerAlsa::MakeOutputStream(
diff --git a/chromium/media/audio/alsa/audio_manager_alsa.h b/chromium/media/audio/alsa/audio_manager_alsa.h
index f6897b41705..04cd9cc1c34 100644
--- a/chromium/media/audio/alsa/audio_manager_alsa.h
+++ b/chromium/media/audio/alsa/audio_manager_alsa.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alsa/mock_alsa_wrapper.cc b/chromium/media/audio/alsa/mock_alsa_wrapper.cc
index fdb9573a85a..f6332f5fa5b 100644
--- a/chromium/media/audio/alsa/mock_alsa_wrapper.cc
+++ b/chromium/media/audio/alsa/mock_alsa_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/alsa/mock_alsa_wrapper.h b/chromium/media/audio/alsa/mock_alsa_wrapper.h
index 827a17137bd..4f2c948750e 100644
--- a/chromium/media/audio/alsa/mock_alsa_wrapper.h
+++ b/chromium/media/audio/alsa/mock_alsa_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/aaudio.sigs b/chromium/media/audio/android/aaudio.sigs
index 1d89b56d675..7e64d58ebf6 100644
--- a/chromium/media/audio/android/aaudio.sigs
+++ b/chromium/media/audio/android/aaudio.sigs
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/aaudio_output.cc b/chromium/media/audio/android/aaudio_output.cc
index 261bb6b0c4a..3210e423ab5 100644
--- a/chromium/media/audio/android/aaudio_output.cc
+++ b/chromium/media/audio/android/aaudio_output.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/aaudio_output.h b/chromium/media/audio/android/aaudio_output.h
index 261c0920a00..0ed311de1af 100644
--- a/chromium/media/audio/android/aaudio_output.h
+++ b/chromium/media/audio/android/aaudio_output.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/audio_android_unittest.cc b/chromium/media/audio/android/audio_android_unittest.cc
index 0e5434da59f..1e8dde8abfb 100644
--- a/chromium/media/audio/android/audio_android_unittest.cc
+++ b/chromium/media/audio/android/audio_android_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -827,7 +827,7 @@ TEST_F(AudioAndroidOutputTest,
DISABLED_StartOutputStreamCallbacksNonDefaultParameters) {
GetDefaultOutputStreamParametersOnAudioThread();
AudioParameters params(audio_output_parameters().format(),
- CHANNEL_LAYOUT_MONO,
+ ChannelLayoutConfig::Mono(),
audio_output_parameters().sample_rate(),
audio_output_parameters().sample_rate() / 100);
StartOutputStreamCallbacks(params);
diff --git a/chromium/media/audio/android/audio_manager_android.cc b/chromium/media/audio/android/audio_manager_android.cc
index 1547f62de50..b2f3d2bc6c1 100644
--- a/chromium/media/audio/android/audio_manager_android.cc
+++ b/chromium/media/audio/android/audio_manager_android.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -172,7 +172,7 @@ AudioParameters AudioManagerAndroid::GetInputStreamParameters(
// resources. Using mono also avoids a driver issue seen on Samsung
// Galaxy S3 and S4 devices. See http://crbug.com/256851 for details.
JNIEnv* env = AttachCurrentThread();
- ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO;
+ constexpr ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO;
int buffer_size = Java_AudioManagerAndroid_getMinInputFrameSize(
env, GetNativeOutputSampleRate(),
ChannelLayoutToChannelCount(channel_layout));
@@ -186,7 +186,8 @@ AudioParameters AudioManagerAndroid::GetInputStreamParameters(
if (user_buffer_size)
buffer_size = user_buffer_size;
- AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::FromLayout<channel_layout>(),
GetNativeOutputSampleRate(), buffer_size);
params.set_effects(effects);
DVLOG(1) << params.AsHumanReadableString();
@@ -365,7 +366,7 @@ AudioParameters AudioManagerAndroid::GetPreferredOutputStreamParameters(
// TODO(tommi): Support |output_device_id|.
DCHECK(GetTaskRunner()->BelongsToCurrentThread());
DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!";
- ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
+ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Stereo();
int sample_rate = GetNativeOutputSampleRate();
int buffer_size = GetOptimalOutputFrameSize(sample_rate, 2);
if (input_params.IsValid()) {
@@ -375,7 +376,7 @@ AudioParameters AudioManagerAndroid::GetPreferredOutputStreamParameters(
// AudioManager APIs for GetOptimalOutputFrameSize() don't support channel
// layouts greater than stereo unless low latency audio is supported.
if (input_params.channels() <= 2 || IsAudioLowLatencySupported())
- channel_layout = input_params.channel_layout();
+ channel_layout_config = input_params.channel_layout_config();
// For high latency playback on supported platforms, pass through the
// requested buffer size; this provides significant power savings (~25%) and
@@ -384,8 +385,8 @@ AudioParameters AudioManagerAndroid::GetPreferredOutputStreamParameters(
input_params.latency_tag() == AudioLatency::LATENCY_PLAYBACK) {
buffer_size = input_params.frames_per_buffer();
} else {
- buffer_size = GetOptimalOutputFrameSize(
- sample_rate, ChannelLayoutToChannelCount(channel_layout));
+ buffer_size = GetOptimalOutputFrameSize(sample_rate,
+ channel_layout_config.channels());
}
}
@@ -396,11 +397,11 @@ AudioParameters AudioManagerAndroid::GetPreferredOutputStreamParameters(
// Check if device supports additional audio encodings.
if (IsAudioSinkConnected()) {
return GetAudioFormatsSupportedBySinkDevice(
- output_device_id, channel_layout, sample_rate, buffer_size);
+ output_device_id, channel_layout_config, sample_rate, buffer_size);
}
- return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
- sample_rate, buffer_size);
+ return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ channel_layout_config, sample_rate, buffer_size);
}
bool AudioManagerAndroid::HasNoAudioInputStreams() {
@@ -482,16 +483,18 @@ int AudioManagerAndroid::GetSinkAudioEncodingFormats() {
// AudioParameters structure.
AudioParameters AudioManagerAndroid::GetAudioFormatsSupportedBySinkDevice(
const std::string& output_device_id,
- ChannelLayout channel_layout,
+ const ChannelLayoutConfig& channel_layout_config,
int sample_rate,
int buffer_size) {
int formats = GetSinkAudioEncodingFormats();
DVLOG(1) << __func__ << ": IsAudioSinkConnected()==true, output_device_id="
<< output_device_id << ", Supported Encodings=" << formats;
- return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
- sample_rate, buffer_size,
- AudioParameters::HardwareCapabilities(formats));
+ return AudioParameters(
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout_config,
+ sample_rate, buffer_size,
+ AudioParameters::HardwareCapabilities(formats,
+ /*require_encapsulation=*/false));
}
void AudioManagerAndroid::DoSetMuteOnAudioThread(bool muted) {
diff --git a/chromium/media/audio/android/audio_manager_android.h b/chromium/media/audio/android/audio_manager_android.h
index 5c97aff3f7b..5beddd6e675 100644
--- a/chromium/media/audio/android/audio_manager_android.h
+++ b/chromium/media/audio/android/audio_manager_android.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -112,7 +112,7 @@ class MEDIA_EXPORT AudioManagerAndroid : public AudioManagerBase {
int GetOptimalOutputFrameSize(int sample_rate, int channels);
AudioParameters GetAudioFormatsSupportedBySinkDevice(
const std::string& output_device_id,
- ChannelLayout channel_layout,
+ const ChannelLayoutConfig& channel_layout_config,
int sample_rate,
int buffer_size);
diff --git a/chromium/media/audio/android/audio_track_output_stream.cc b/chromium/media/audio/android/audio_track_output_stream.cc
index 0b7b11b94cf..21897c24f04 100644
--- a/chromium/media/audio/android/audio_track_output_stream.cc
+++ b/chromium/media/audio/android/audio_track_output_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -64,6 +64,7 @@ bool AudioTrackOutputStream::Open() {
format = kEncodingDts;
break;
case AudioParameters::AUDIO_BITSTREAM_DTS_HD:
+ case AudioParameters::AUDIO_BITSTREAM_DTS_HD_MA:
format = kEncodingDtshd;
break;
case AudioParameters::AUDIO_BITSTREAM_IEC61937:
diff --git a/chromium/media/audio/android/audio_track_output_stream.h b/chromium/media/audio/android/audio_track_output_stream.h
index 3936b7d5d5e..74a6fb74db2 100644
--- a/chromium/media/audio/android/audio_track_output_stream.h
+++ b/chromium/media/audio/android/audio_track_output_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/muteable_audio_output_stream.h b/chromium/media/audio/android/muteable_audio_output_stream.h
index db4f6b19cb5..b31d2865754 100644
--- a/chromium/media/audio/android/muteable_audio_output_stream.h
+++ b/chromium/media/audio/android/muteable_audio_output_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/opensles_input.cc b/chromium/media/audio/android/opensles_input.cc
index 800ac877b2c..dbe950b1a7c 100644
--- a/chromium/media/audio/android/opensles_input.cc
+++ b/chromium/media/audio/android/opensles_input.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/opensles_input.h b/chromium/media/audio/android/opensles_input.h
index ddad9837d49..f3d63569dc1 100644
--- a/chromium/media/audio/android/opensles_input.h
+++ b/chromium/media/audio/android/opensles_input.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/opensles_output.cc b/chromium/media/audio/android/opensles_output.cc
index 1218e4b26a6..d7c9f4f13a5 100644
--- a/chromium/media/audio/android/opensles_output.cc
+++ b/chromium/media/audio/android/opensles_output.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/opensles_output.h b/chromium/media/audio/android/opensles_output.h
index c7b927397ef..865911d9523 100644
--- a/chromium/media/audio/android/opensles_output.h
+++ b/chromium/media/audio/android/opensles_output.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/opensles_util.cc b/chromium/media/audio/android/opensles_util.cc
index 128a3bd20d2..aee6bd89839 100644
--- a/chromium/media/audio/android/opensles_util.cc
+++ b/chromium/media/audio/android/opensles_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/opensles_util.h b/chromium/media/audio/android/opensles_util.h
index 2e8d27055bf..37fdf94d406 100644
--- a/chromium/media/audio/android/opensles_util.h
+++ b/chromium/media/audio/android/opensles_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/android/opensles_wrapper.cc b/chromium/media/audio/android/opensles_wrapper.cc
index ca0385555d6..41746ffd712 100644
--- a/chromium/media/audio/android/opensles_wrapper.cc
+++ b/chromium/media/audio/android/opensles_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_bus_pool.cc b/chromium/media/audio/audio_bus_pool.cc
new file mode 100644
index 00000000000..6cbf3a5c57e
--- /dev/null
+++ b/chromium/media/audio/audio_bus_pool.cc
@@ -0,0 +1,60 @@
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/audio/audio_bus_pool.h"
+#include <memory>
+#include "base/check_op.h"
+#include "base/functional/bind.h"
+#include "base/synchronization/lock.h"
+#include "media/base/audio_bus.h"
+#include "media/base/audio_parameters.h"
+
+namespace media {
+
+AudioBusPoolImpl::AudioBusPoolImpl(const AudioParameters& params,
+ size_t preallocated,
+ size_t max_capacity)
+ : AudioBusPoolImpl(params,
+ preallocated,
+ max_capacity,
+ base::BindRepeating(
+ static_cast<std::unique_ptr<AudioBus> (*)(
+ const AudioParameters&)>(&AudioBus::Create))) {}
+
+AudioBusPoolImpl::~AudioBusPoolImpl() = default;
+
+std::unique_ptr<AudioBus> AudioBusPoolImpl::GetAudioBus() {
+ base::AutoLock auto_lock(lock_);
+ if (!audio_buses_.empty()) {
+ std::unique_ptr<AudioBus> bus = std::move(audio_buses_.top());
+ audio_buses_.pop();
+ return bus;
+ }
+ return create_audio_bus_.Run(params_);
+}
+
+void AudioBusPoolImpl::InsertAudioBus(std::unique_ptr<AudioBus> audio_bus) {
+ CHECK_EQ(audio_bus->channels(), params_.channels());
+ CHECK_EQ(audio_bus->frames(), params_.frames_per_buffer());
+
+ base::AutoLock auto_lock(lock_);
+ if (audio_buses_.size() < max_capacity_) {
+ audio_buses_.push(std::move(audio_bus));
+ }
+}
+
+AudioBusPoolImpl::AudioBusPoolImpl(const AudioParameters& params,
+ size_t preallocated,
+ size_t max_capacity,
+ CreateAudioBusCallback create_audio_bus)
+ : params_(params),
+ max_capacity_(max_capacity),
+ create_audio_bus_(std::move(create_audio_bus)) {
+ DCHECK_GE(max_capacity, preallocated);
+ while (preallocated-- > 0) {
+ audio_buses_.push(create_audio_bus_.Run(params_));
+ }
+}
+
+} // namespace media
diff --git a/chromium/media/audio/audio_bus_pool.h b/chromium/media/audio/audio_bus_pool.h
new file mode 100644
index 00000000000..2439329db8d
--- /dev/null
+++ b/chromium/media/audio/audio_bus_pool.h
@@ -0,0 +1,76 @@
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_AUDIO_BUS_POOL_H_
+#define MEDIA_AUDIO_AUDIO_BUS_POOL_H_
+
+#include <memory>
+#include <stack>
+
+#include "base/files/file.h"
+#include "base/functional/callback_forward.h"
+#include "base/gtest_prod_util.h"
+#include "base/synchronization/lock.h"
+#include "media/base/audio_bus.h"
+#include "media/base/audio_parameters.h"
+#include "media/base/media_export.h"
+
+namespace media {
+
+// Thread-safe interface for reusing AudioBuses.
+class MEDIA_EXPORT AudioBusPool {
+ public:
+ virtual ~AudioBusPool() = default;
+
+ // If there is an AudioBus in the pool, return it. Otherwise, allocate and
+ // return a new AudioBus with the correct number of frames and channels.
+ virtual std::unique_ptr<AudioBus> GetAudioBus() = 0;
+
+ // Inserts an AudioBus to the pool, allowing it to be reused with
+ // GetAudioBus. |audio_bus| needs to have the same number of frames and
+ // channels as was specified when creating the AudioBusPool, or the call will
+ // crash.
+ virtual void InsertAudioBus(std::unique_ptr<AudioBus> audio_bus) = 0;
+};
+
+class MEDIA_EXPORT AudioBusPoolImpl final : public AudioBusPool {
+ public:
+ AudioBusPoolImpl(const AudioParameters& params,
+ size_t preallocated,
+ size_t max_capacity);
+
+ AudioBusPoolImpl(const AudioBusPool&) = delete;
+ AudioBusPoolImpl& operator=(const AudioBusPool&) = delete;
+ ~AudioBusPoolImpl() override;
+
+ std::unique_ptr<AudioBus> GetAudioBus() override;
+
+ void InsertAudioBus(std::unique_ptr<AudioBus> audio_bus) override;
+
+ private:
+ friend class AudioBusPoolTest;
+
+ using CreateAudioBusCallback =
+ base::RepeatingCallback<std::unique_ptr<AudioBus>(
+ const AudioParameters&)>;
+
+ AudioBusPoolImpl(const AudioParameters& params,
+ size_t preallocated,
+ size_t max_capacity,
+ CreateAudioBusCallback create_audio_bus);
+
+ const AudioParameters params_;
+
+ const size_t max_capacity_;
+
+ CreateAudioBusCallback create_audio_bus_;
+
+ std::stack<std::unique_ptr<AudioBus>> audio_buses_ GUARDED_BY(lock_);
+
+ base::Lock lock_;
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_AUDIO_BUS_POOL_H_
diff --git a/chromium/media/audio/audio_bus_pool_unittest.cc b/chromium/media/audio/audio_bus_pool_unittest.cc
new file mode 100644
index 00000000000..e015d9bd89d
--- /dev/null
+++ b/chromium/media/audio/audio_bus_pool_unittest.cc
@@ -0,0 +1,120 @@
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/audio/audio_bus_pool.h"
+#include <memory>
+#include <utility>
+
+#include "base/check_op.h"
+#include "base/functional/bind.h"
+#include "base/memory/scoped_refptr.h"
+#include "base/test/bind.h"
+#include "media/audio/audio_io.h"
+#include "media/base/audio_bus.h"
+#include "media/base/audio_parameters.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media {
+
+// The test fixture.
+class AudioBusPoolTest : public ::testing::Test {
+ public:
+ AudioBusPoolTest()
+ : params_(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(),
+ 1000,
+ 100) {}
+
+ AudioBusPoolTest(const AudioBusPoolTest&) = delete;
+ AudioBusPoolTest& operator=(const AudioBusPoolTest&) = delete;
+
+ ~AudioBusPoolTest() override = default;
+
+ MOCK_METHOD0(OnCreateAudioBus, void());
+
+ // Creates an AudioBusPoolImpl and makes OnCreateAudioBus track when it
+ // creates AudioBuses.
+ void CreateAndTrackAudioBusPool(size_t preallocated, size_t max_capacity) {
+ audio_bus_pool_.reset(new AudioBusPoolImpl(
+ params_, preallocated, max_capacity,
+ base::BindLambdaForTesting([&](const AudioParameters& params) {
+ EXPECT_TRUE(params.Equals(params_));
+ OnCreateAudioBus();
+ return AudioBus::Create(params);
+ })));
+ }
+
+ protected:
+ const AudioParameters params_;
+
+ std::unique_ptr<AudioBusPool> audio_bus_pool_;
+};
+
+TEST_F(AudioBusPoolTest, PublicConstructor) {
+ // The other tests use a specialized callback to create AudioBuses which also
+ // tracks when it's called. We need to check that the default callback also
+ // creates correct AudioBuses.
+ audio_bus_pool_ = std::make_unique<AudioBusPoolImpl>(params_, 0, 10);
+ std::unique_ptr<AudioBus> audio_bus = audio_bus_pool_->GetAudioBus();
+ EXPECT_EQ(audio_bus->channels(), params_.channels());
+ EXPECT_EQ(audio_bus->frames(), params_.frames_per_buffer());
+}
+
+TEST_F(AudioBusPoolTest, ReuseAudioBusesInLifoOrder) {
+ CreateAndTrackAudioBusPool(0, 10);
+ EXPECT_CALL(*this, OnCreateAudioBus()).Times(0);
+
+ std::unique_ptr<AudioBus> audio_bus_1 = AudioBus::Create(params_);
+ std::unique_ptr<AudioBus> audio_bus_2 = AudioBus::Create(params_);
+ audio_bus_1->channel(0)[0] = 123;
+ audio_bus_2->channel(0)[0] = 456;
+ audio_bus_pool_->InsertAudioBus(std::move(audio_bus_1));
+ audio_bus_pool_->InsertAudioBus(std::move(audio_bus_2));
+
+ EXPECT_EQ(456, audio_bus_pool_->GetAudioBus()->channel(0)[0]);
+ EXPECT_EQ(123, audio_bus_pool_->GetAudioBus()->channel(0)[0]);
+}
+
+TEST_F(AudioBusPoolTest, Preallocate) {
+ // Expect to create 5 AudioBuses while preallocating.
+ EXPECT_CALL(*this, OnCreateAudioBus()).Times(5);
+ CreateAndTrackAudioBusPool(5, 10);
+
+ // Expect not to have to create any new AudioBuses the first 5 times.
+ EXPECT_CALL(*this, OnCreateAudioBus()).Times(0);
+ for (int i = 0; i < 5; i++) {
+ audio_bus_pool_->GetAudioBus();
+ }
+
+ // Now the pool has run out of AudioBuses and we expect it to create a new
+ // one.
+ EXPECT_CALL(*this, OnCreateAudioBus());
+ audio_bus_pool_->GetAudioBus();
+}
+
+TEST_F(AudioBusPoolTest, MaxCapacity) {
+ const int kMaxCapacity = 10;
+ CreateAndTrackAudioBusPool(0, kMaxCapacity);
+
+ // Insert 15 AudioBuses, but the max capacity is only 10.
+ for (int i = 0; i < 15; i++) {
+ audio_bus_pool_->InsertAudioBus(AudioBus::Create(params_));
+ }
+
+ // Expect not to have to create any new AudioBuses during the first 10 calls
+ // to GetAudioBus.
+ EXPECT_CALL(*this, OnCreateAudioBus()).Times(0);
+ for (int i = 0; i < 10; i++) {
+ audio_bus_pool_->GetAudioBus();
+ }
+
+ // Despite having called InsertAudioBus 15 times above, since the max capacity
+ // is only 10, we should now have run out of stored AudioBuses. We therefore
+ // expect that we will have to create a new AudioBus when we call GetAudioBus.
+ EXPECT_CALL(*this, OnCreateAudioBus());
+ audio_bus_pool_->GetAudioBus();
+}
+
+} // namespace media
diff --git a/chromium/media/audio/audio_debug_file_writer.cc b/chromium/media/audio/audio_debug_file_writer.cc
index ee8ffd569c3..823f3839a13 100644
--- a/chromium/media/audio/audio_debug_file_writer.cc
+++ b/chromium/media/audio/audio_debug_file_writer.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,13 +7,17 @@
#include <stdint.h>
#include <array>
#include <limits>
+#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
+#include "base/sequence_checker.h"
#include "base/sys_byteorder.h"
+#include "base/task/sequenced_task_runner.h"
+#include "media/audio/audio_bus_pool.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_sample_types.h"
@@ -136,82 +140,53 @@ void WriteWavHeader(WavHeaderBuffer* buf,
} // namespace
-// Manages the debug recording file and writes to it. Can be created on any
-// thread. All the operations must be executed on a thread that has IO
-// permissions.
-class AudioDebugFileWriter::AudioFileWriter {
- public:
- static AudioFileWriterUniquePtr Create(
- base::File file,
- const AudioParameters& params,
- scoped_refptr<base::SequencedTaskRunner> task_runner);
-
- ~AudioFileWriter();
-
- // Write data from |data| to file.
- void Write(const AudioBus* data);
-
- private:
- explicit AudioFileWriter(const AudioParameters& params);
-
- // Write wave header to file. Called on the |task_runner_| twice: on
- // construction
- // of AudioFileWriter size of the wave data is unknown, so the header is
- // written with zero sizes; then on destruction it is re-written with the
- // actual size info accumulated throughout the object lifetime.
- void WriteHeader();
-
- void StartRecording(base::File file);
-
- // The file to write to.
- base::File file_;
-
- // Number of written samples.
- uint64_t samples_;
-
- // Audio parameters required to build wave header. Number of channels and
- // sample rate are used.
- const AudioParameters params_;
-
- // Intermediate buffer to be written to file. Interleaved 16 bit audio data.
- std::unique_ptr<int16_t[]> interleaved_data_;
- int interleaved_data_size_;
+AudioDebugFileWriter::~AudioDebugFileWriter() {
+ DCHECK(task_runner_->RunsTasksInCurrentSequence());
+ if (file_.IsValid())
+ WriteHeader();
+}
- SEQUENCE_CHECKER(sequence_checker_);
-};
+void AudioDebugFileWriter::Write(const AudioBus& data) {
+ std::unique_ptr<AudioBus> data_copy = audio_bus_pool_->GetAudioBus();
+ DCHECK(data_copy);
+ data.CopyTo(data_copy.get());
+ task_runner_->PostTask(
+ FROM_HERE, base::BindOnce(&AudioDebugFileWriter::DoWrite, weak_this_,
+ std::move(data_copy)));
+}
-// static
-AudioDebugFileWriter::AudioFileWriterUniquePtr
-AudioDebugFileWriter::AudioFileWriter::Create(
- base::File file,
+AudioDebugFileWriter::Ptr AudioDebugFileWriter::Create(
const AudioParameters& params,
- scoped_refptr<base::SequencedTaskRunner> task_runner) {
- AudioFileWriterUniquePtr file_writer(new AudioFileWriter(params),
- base::OnTaskRunnerDeleter(task_runner));
-
- // base::Unretained is safe, because destructor is called on
- // |task_runner|.
- task_runner->PostTask(
- FROM_HERE,
- base::BindOnce(&AudioFileWriter::StartRecording,
- base::Unretained(file_writer.get()), std::move(file)));
- return file_writer;
+ base::File file) {
+ return Create(params, std::move(file),
+ std::make_unique<AudioBusPoolImpl>(
+ params, kPreallocatedAudioBuses, kMaxCachedAudioBuses));
}
-AudioDebugFileWriter::AudioFileWriter::AudioFileWriter(
- const AudioParameters& params)
- : samples_(0), params_(params), interleaved_data_size_(0) {
- DETACH_FROM_SEQUENCE(sequence_checker_);
+AudioDebugFileWriter::AudioDebugFileWriter(
+ const AudioParameters& params,
+ base::File file,
+ std::unique_ptr<AudioBusPool> audio_bus_pool)
+ : params_(params),
+ file_(std::move(file)),
+ audio_bus_pool_(std::move(audio_bus_pool)) {
+ weak_this_ = weak_factory_.GetWeakPtr();
}
-AudioDebugFileWriter::AudioFileWriter::~AudioFileWriter() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (file_.IsValid())
- WriteHeader();
+AudioDebugFileWriter::Ptr AudioDebugFileWriter::Create(
+ const AudioParameters& params,
+ base::File file,
+ std::unique_ptr<AudioBusPool> audio_bus_pool) {
+ AudioDebugFileWriter* writer = new AudioDebugFileWriter(
+ params, std::move(file), std::move(audio_bus_pool));
+ writer->task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(&AudioDebugFileWriter::WriteHeader, writer->weak_this_));
+ return Ptr(writer, base::OnTaskRunnerDeleter(writer->task_runner_));
}
-void AudioDebugFileWriter::AudioFileWriter::Write(const AudioBus* data) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+void AudioDebugFileWriter::DoWrite(std::unique_ptr<AudioBus> data) {
+ DCHECK(task_runner_->RunsTasksInCurrentSequence());
DCHECK_EQ(params_.channels(), data->channels());
if (!file_.IsValid())
return;
@@ -235,10 +210,13 @@ void AudioDebugFileWriter::AudioFileWriter::Write(const AudioBus* data) {
file_.WriteAtCurrentPos(reinterpret_cast<char*>(interleaved_data_.get()),
data_size * sizeof(interleaved_data_[0]));
+
+ // Cache the AudioBus for later use.
+ audio_bus_pool_->InsertAudioBus(std::move(data));
}
-void AudioDebugFileWriter::AudioFileWriter::WriteHeader() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+void AudioDebugFileWriter::WriteHeader() {
+ DCHECK(task_runner_->RunsTasksInCurrentSequence());
if (!file_.IsValid())
return;
WavHeaderBuffer buf;
@@ -250,59 +228,4 @@ void AudioDebugFileWriter::AudioFileWriter::WriteHeader() {
file_.Seek(base::File::FROM_BEGIN, kWavHeaderSize);
}
-void AudioDebugFileWriter::AudioFileWriter::StartRecording(base::File file) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- DCHECK(!file_.IsValid());
-
- file_ = std::move(file);
- WriteHeader();
-}
-
-AudioDebugFileWriter::AudioDebugFileWriter(const AudioParameters& params)
- : params_(params),
- file_writer_(nullptr, base::OnTaskRunnerDeleter(nullptr)) {
- DETACH_FROM_SEQUENCE(client_sequence_checker_);
-}
-
-AudioDebugFileWriter::~AudioDebugFileWriter() {
- // |file_writer_| will be deleted on |task_runner_|.
-}
-
-void AudioDebugFileWriter::Start(base::File file) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
- DCHECK(!file_writer_);
- file_writer_ =
- AudioFileWriter::Create(std::move(file), params_, file_task_runner_);
-}
-
-void AudioDebugFileWriter::Stop() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
- // |file_writer_| is deleted on FILE thread.
- file_writer_.reset();
- DETACH_FROM_SEQUENCE(client_sequence_checker_);
-}
-
-void AudioDebugFileWriter::Write(std::unique_ptr<AudioBus> data) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
- if (!file_writer_)
- return;
-
- // base::Unretained for |file_writer_| is safe, see the destructor.
- file_task_runner_->PostTask(
- FROM_HERE,
- // Callback takes ownership of |data|:
- base::BindOnce(&AudioFileWriter::Write,
- base::Unretained(file_writer_.get()),
- base::Owned(data.release())));
-}
-
-bool AudioDebugFileWriter::WillWrite() {
- // Note that if this is called from any place other than
- // |client_sequence_checker_| then there is a data race here, but it's fine,
- // because Write() will check for |file_writer_|. So, we are not very precise
- // here, but it's fine: we can afford missing some data or scheduling some
- // no-op writes.
- return !!file_writer_;
-}
-
} // namespace media
diff --git a/chromium/media/audio/audio_debug_file_writer.h b/chromium/media/audio/audio_debug_file_writer.h
index aa535ac779b..d24376c2fdd 100644
--- a/chromium/media/audio/audio_debug_file_writer.h
+++ b/chromium/media/audio/audio_debug_file_writer.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include "base/files/file.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
@@ -21,56 +22,79 @@ namespace media {
class AudioBus;
-// Writes audio data to a 16 bit PCM WAVE file used for debugging purposes. All
-// operations are non-blocking.
-// Functions are virtual for the purpose of test mocking.
+class AudioBusPool;
+
+// Writes audio data to a 16 bit PCM WAVE file used for debugging purposes.
+// Functions are virtual for the purpose of test mocking. This class can be
+// created and used anywhere, but must be destroyed using the
+// OnTaskRunnerDeleter provided by Create(). It starts writing on Create(), and
+// stops writing on destruction.
class MEDIA_EXPORT AudioDebugFileWriter {
public:
- // Number of channels and sample rate are used from |params|, the other
- // parameters are ignored. The number of channels in the data passed to
- // Write() must match |params|.
- explicit AudioDebugFileWriter(const AudioParameters& params);
-
AudioDebugFileWriter(const AudioDebugFileWriter&) = delete;
AudioDebugFileWriter& operator=(const AudioDebugFileWriter&) = delete;
virtual ~AudioDebugFileWriter();
- // Must be called before calling Write() for the first time after creation or
- // Stop() call. Can be called on any sequence; Write() and Stop() must be
- // called on the same sequence as Start().
- virtual void Start(base::File file);
-
- // Must be called to finish recording. Each call to Start() requires a call to
- // Stop(). Will be automatically called on destruction.
- virtual void Stop();
-
// Write |data| to file.
- virtual void Write(std::unique_ptr<AudioBus> data);
+ virtual void Write(const AudioBus& data);
- // Returns true if Write() call scheduled at this point will most likely write
- // data to the file, and false if it most likely will be a no-op. The result
- // may be ambigulous if Start() or Stop() is executed at the moment. Can be
- // called from any sequence.
- virtual bool WillWrite();
+ using Ptr = std::unique_ptr<AudioDebugFileWriter, base::OnTaskRunnerDeleter>;
+
+ // Number of channels and sample rate are used from |params|, the other
+ // parameters are ignored. The number of channels in the data passed to
+ // Write() must match |params|. Write() must be called on the sequence that
+ // task_runner belongs to.
+ static Ptr Create(const AudioParameters& params, base::File file);
protected:
- const AudioParameters params_;
+ // Protected for testing.
+ AudioDebugFileWriter(const AudioParameters& params,
+ base::File file,
+ std::unique_ptr<AudioBusPool> audio_bus_pool);
- private:
- class AudioFileWriter;
+ // Create with a custom AudioBusPool.
+ static Ptr Create(const AudioParameters& params,
+ base::File file,
+ std::unique_ptr<AudioBusPool> audio_bus_pool);
- using AudioFileWriterUniquePtr =
- std::unique_ptr<AudioFileWriter, base::OnTaskRunnerDeleter>;
+ const AudioParameters params_;
- // The task runner to do file output operations on.
- const scoped_refptr<base::SequencedTaskRunner> file_task_runner_ =
+ const scoped_refptr<base::SequencedTaskRunner> task_runner_ =
base::ThreadPool::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
- AudioFileWriterUniquePtr file_writer_;
- SEQUENCE_CHECKER(client_sequence_checker_);
+ private:
+ // Write wave header to file. Called twice: on Create() the size of the wave
+ // data is unknown, so the header is written with zero sizes; then on
+ // destruction it is re-written with the actual size info accumulated
+ // throughout the object lifetime.
+ void WriteHeader();
+
+ void DoWrite(std::unique_ptr<AudioBus> data);
+
+ // The file to write to.
+ base::File file_;
+
+ // Number of written samples.
+ uint64_t samples_ = 0;
+
+ // Intermediate buffer to be written to file. Interleaved 16 bit audio data.
+ std::unique_ptr<int16_t[]> interleaved_data_;
+ int interleaved_data_size_ = 0;
+
+ // Stores AudioBuses to be reused.
+ const std::unique_ptr<AudioBusPool> audio_bus_pool_;
+
+ // The number of AudioBuses that should be preallocated on creation.
+ static constexpr size_t kPreallocatedAudioBuses = 100;
+
+ // The maximum number of AudioBuses we should cache at once.
+ static constexpr size_t kMaxCachedAudioBuses = 500;
+
+ base::WeakPtr<AudioDebugFileWriter> weak_this_;
+ base::WeakPtrFactory<AudioDebugFileWriter> weak_factory_{this};
};
} // namespace media
diff --git a/chromium/media/audio/audio_debug_file_writer_unittest.cc b/chromium/media/audio/audio_debug_file_writer_unittest.cc
index 3ca19fb4a12..3d7b0208813 100644
--- a/chromium/media/audio/audio_debug_file_writer_unittest.cc
+++ b/chromium/media/audio/audio_debug_file_writer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,12 +15,16 @@
#include "base/sys_byteorder.h"
#include "base/test/task_environment.h"
#include "base/threading/thread.h"
+#include "media/audio/audio_bus_pool.h"
#include "media/audio/audio_debug_file_writer.h"
#include "media/base/audio_bus.h"
+#include "media/base/audio_parameters.h"
#include "media/base/audio_sample_types.h"
#include "media/base/test_helpers.h"
#include "testing/gtest/include/gtest/gtest.h"
+using testing::_;
+
namespace media {
namespace {
@@ -43,10 +47,56 @@ base::File OpenFile(const base::FilePath& file_path) {
return base::File(file_path, base::File::FLAG_OPEN | base::File::FLAG_WRITE);
}
+// Serves only to expose the protected Create method of AudioDebugFileWriter.
+class AudioDebugFileWriterUnderTest : public AudioDebugFileWriter {
+ public:
+ // Should not be instantiated
+ AudioDebugFileWriterUnderTest() = delete;
+
+ static Ptr Create(const AudioParameters& params,
+ base::File file,
+ std::unique_ptr<AudioBusPool> audio_bus_pool) {
+ return AudioDebugFileWriter::Create(params, std::move(file),
+ std::move(audio_bus_pool));
+ }
+};
+
+class MockAudioBusPool : public AudioBusPool {
+ public:
+ explicit MockAudioBusPool(const AudioParameters& params) : params_(params) {}
+
+ MockAudioBusPool(const MockAudioBusPool&) = delete;
+ MockAudioBusPool& operator=(const MockAudioBusPool&) = delete;
+ ~MockAudioBusPool() override = default;
+
+ std::unique_ptr<AudioBus> GetAudioBus() override {
+ if (audio_bus_to_return_) {
+ return std::move(audio_bus_to_return_);
+ }
+ return AudioBus::Create(params_);
+ }
+
+ MOCK_METHOD1(OnInsertAudioBus, void(AudioBus*));
+
+ void InsertAudioBus(std::unique_ptr<AudioBus> audio_bus) override {
+ OnInsertAudioBus(audio_bus.get());
+ }
+
+ void SetNextAudioBus(std::unique_ptr<AudioBus> audio_bus) {
+ audio_bus_to_return_ = std::move(audio_bus);
+ }
+
+ private:
+ const AudioParameters params_;
+
+ std::unique_ptr<AudioBus> audio_bus_to_return_;
+};
+
} // namespace
// <channel layout, sample rate, frames per buffer, number of buffer writes
-typedef std::tuple<ChannelLayout, int, int, int> AudioDebugFileWriterTestData;
+typedef std::tuple<ChannelLayoutConfig, int, int, int>
+ AudioDebugFileWriterTestData;
class AudioDebugFileWriterTest
: public testing::TestWithParam<AudioDebugFileWriterTestData> {
@@ -55,6 +105,7 @@ class AudioDebugFileWriterTest
base::test::TaskEnvironment::ThreadPoolExecutionMode execution_mode)
: task_environment_(base::test::TaskEnvironment::MainThreadType::DEFAULT,
execution_mode),
+ debug_writer_(nullptr, base::OnTaskRunnerDeleter(nullptr)),
params_(AudioParameters::Format::AUDIO_PCM_LINEAR,
std::get<0>(GetParam()),
std::get<1>(GetParam()),
@@ -169,7 +220,10 @@ class AudioDebugFileWriterTest
}
}
- void DoDebugRecording() {
+ void DoDebugRecording(bool expect_buses_returned_to_pool = true) {
+ EXPECT_CALL(*mock_audio_bus_pool_, OnInsertAudioBus(_))
+ .Times(expect_buses_returned_to_pool ? writes_ : 0);
+
for (int i = 0; i < writes_; ++i) {
std::unique_ptr<AudioBus> bus =
AudioBus::Create(params_.channels(), params_.frames_per_buffer());
@@ -179,32 +233,15 @@ class AudioDebugFileWriterTest
i * params_.channels() * params_.frames_per_buffer(),
params_.frames_per_buffer());
- debug_writer_->Write(std::move(bus));
+ debug_writer_->Write(*bus);
}
}
- void RecordAndVerifyOnce() {
- base::FilePath file_path;
- ASSERT_TRUE(base::CreateTemporaryFile(&file_path));
- base::File file = OpenFile(file_path);
- ASSERT_TRUE(file.IsValid());
-
- debug_writer_->Start(std::move(file));
-
- DoDebugRecording();
-
- debug_writer_->Stop();
-
- task_environment_.RunUntilIdle();
-
- VerifyRecording(file_path);
-
- if (::testing::Test::HasFailure()) {
- LOG(ERROR) << "Test failed; keeping recording(s) at ["
- << file_path.value().c_str() << "].";
- } else {
- ASSERT_TRUE(base::DeleteFile(file_path));
- }
+ void CreateDebugWriter(base::File file) {
+ auto audio_bus_pool = std::make_unique<MockAudioBusPool>(params_);
+ mock_audio_bus_pool_ = audio_bus_pool.get();
+ debug_writer_ = AudioDebugFileWriterUnderTest::Create(
+ params_, std::move(file), std::move(audio_bus_pool));
}
protected:
@@ -212,7 +249,10 @@ class AudioDebugFileWriterTest
base::test::TaskEnvironment task_environment_;
// Writer under test.
- std::unique_ptr<AudioDebugFileWriter> debug_writer_;
+ AudioDebugFileWriter::Ptr debug_writer_;
+
+ // Pointer to the AudioBusPool of the most recently created writer.
+ MockAudioBusPool* mock_audio_bus_pool_;
// AudioBus parameters.
AudioParameters params_;
@@ -237,25 +277,64 @@ class AudioDebugFileWriterSingleThreadTest : public AudioDebugFileWriterTest {
};
TEST_P(AudioDebugFileWriterTest, WaveRecordingTest) {
- debug_writer_ = std::make_unique<AudioDebugFileWriter>(params_);
- RecordAndVerifyOnce();
+ base::FilePath file_path;
+ ASSERT_TRUE(base::CreateTemporaryFile(&file_path));
+ base::File file = OpenFile(file_path);
+ ASSERT_TRUE(file.IsValid());
+
+ CreateDebugWriter(std::move(file));
+
+ DoDebugRecording();
+
+ debug_writer_.reset();
+ task_environment_.RunUntilIdle();
+
+ VerifyRecording(file_path);
+
+ if (::testing::Test::HasFailure()) {
+ LOG(ERROR) << "Test failed; keeping recording(s) at ["
+ << file_path.value().c_str() << "].";
+ } else {
+ ASSERT_TRUE(base::DeleteFile(file_path));
+ }
+}
+
+TEST_P(AudioDebugFileWriterBehavioralTest, ShouldReuseAudioBusesWithPool) {
+ base::FilePath file_path;
+ ASSERT_TRUE(base::CreateTemporaryFile(&file_path));
+ base::File file = OpenFile(file_path);
+ ASSERT_TRUE(file.IsValid());
+
+ CreateDebugWriter(std::move(file));
+
+ // Set a specific audio bus to be returned by the pool.
+ std::unique_ptr<AudioBus> reference_audio_bus = AudioBus::Create(params_);
+ AudioBus* reference_audio_bus_ptr = reference_audio_bus.get();
+ mock_audio_bus_pool_->SetNextAudioBus(std::move(reference_audio_bus));
+
+ // Expect that same audio bus to be returned to the pool.
+ EXPECT_CALL(*mock_audio_bus_pool_, OnInsertAudioBus(reference_audio_bus_ptr));
+
+ std::unique_ptr<AudioBus> bus = AudioBus::Create(params_);
+ bus->FromInterleaved<media::SignedInt16SampleTypeTraits>(
+ source_interleaved_.get(), params_.frames_per_buffer());
+
+ debug_writer_->Write(*bus);
+ task_environment_.RunUntilIdle();
}
TEST_P(AudioDebugFileWriterSingleThreadTest,
DeletedBeforeRecordingFinishedOnFileThread) {
- debug_writer_ = std::make_unique<AudioDebugFileWriter>(params_);
-
base::FilePath file_path;
ASSERT_TRUE(base::CreateTemporaryFile(&file_path));
base::File file = OpenFile(file_path);
ASSERT_TRUE(file.IsValid());
- debug_writer_->Start(std::move(file));
+ CreateDebugWriter(std::move(file));
DoDebugRecording();
debug_writer_.reset();
-
task_environment_.RunUntilIdle();
VerifyRecording(file_path);
@@ -269,31 +348,53 @@ TEST_P(AudioDebugFileWriterSingleThreadTest,
}
TEST_P(AudioDebugFileWriterBehavioralTest, StartWithInvalidFile) {
- debug_writer_ = std::make_unique<AudioDebugFileWriter>(params_);
base::File file; // Invalid file, recording should not crash
- debug_writer_->Start(std::move(file));
- DoDebugRecording();
+ CreateDebugWriter(std::move(file));
+
+ DoDebugRecording(/*expect_buses_returned_to_pool = */ false);
+ task_environment_.RunUntilIdle();
}
TEST_P(AudioDebugFileWriterBehavioralTest, StartStopStartStop) {
- debug_writer_ = std::make_unique<AudioDebugFileWriter>(params_);
- RecordAndVerifyOnce();
- RecordAndVerifyOnce();
-}
+ base::FilePath file_path1;
+ ASSERT_TRUE(base::CreateTemporaryFile(&file_path1));
+ base::File file1 = OpenFile(file_path1);
+ ASSERT_TRUE(file1.IsValid());
+
+ base::FilePath file_path2;
+ ASSERT_TRUE(base::CreateTemporaryFile(&file_path2));
+ base::File file2 = OpenFile(file_path2);
+ ASSERT_TRUE(file2.IsValid());
-TEST_P(AudioDebugFileWriterBehavioralTest, DestroyNotStarted) {
- debug_writer_ = std::make_unique<AudioDebugFileWriter>(params_);
+ CreateDebugWriter(std::move(file1));
+ DoDebugRecording();
+ CreateDebugWriter(std::move(file2));
+ DoDebugRecording();
debug_writer_.reset();
+ task_environment_.RunUntilIdle();
+
+ VerifyRecording(file_path1);
+ VerifyRecording(file_path2);
+
+ if (::testing::Test::HasFailure()) {
+ LOG(ERROR) << "Test failed; keeping recording(s) at ["
+ << file_path1.value().c_str() << ", "
+ << file_path2.value().c_str() << "].";
+ } else {
+ ASSERT_TRUE(base::DeleteFile(file_path1));
+ ASSERT_TRUE(base::DeleteFile(file_path2));
+ }
}
TEST_P(AudioDebugFileWriterBehavioralTest, DestroyStarted) {
- debug_writer_ = std::make_unique<AudioDebugFileWriter>(params_);
base::FilePath file_path;
ASSERT_TRUE(base::CreateTemporaryFile(&file_path));
base::File file = OpenFile(file_path);
ASSERT_TRUE(file.IsValid());
- debug_writer_->Start(std::move(file));
+ CreateDebugWriter(std::move(file));
+
debug_writer_.reset();
+ task_environment_.RunUntilIdle();
}
INSTANTIATE_TEST_SUITE_P(
@@ -302,53 +403,34 @@ INSTANTIATE_TEST_SUITE_P(
// Using 10ms frames per buffer everywhere.
testing::Values(
// No writes.
- std::make_tuple(ChannelLayout::CHANNEL_LAYOUT_MONO,
- 44100,
- 44100 / 100,
- 0),
+ std::make_tuple(ChannelLayoutConfig::Mono(), 44100, 44100 / 100, 0),
// 1 write of mono.
- std::make_tuple(ChannelLayout::CHANNEL_LAYOUT_MONO,
- 44100,
- 44100 / 100,
- 1),
+ std::make_tuple(ChannelLayoutConfig::Mono(), 44100, 44100 / 100, 1),
// 1 second of mono.
- std::make_tuple(ChannelLayout::CHANNEL_LAYOUT_MONO,
- 44100,
- 44100 / 100,
- 100),
+ std::make_tuple(ChannelLayoutConfig::Mono(), 44100, 44100 / 100, 100),
// 1 second of mono, higher rate.
- std::make_tuple(ChannelLayout::CHANNEL_LAYOUT_MONO,
- 48000,
- 48000 / 100,
- 100),
+ std::make_tuple(ChannelLayoutConfig::Mono(), 48000, 48000 / 100, 100),
// 1 second of stereo.
- std::make_tuple(ChannelLayout::CHANNEL_LAYOUT_STEREO,
- 44100,
- 44100 / 100,
- 100),
+ std::make_tuple(ChannelLayoutConfig::Stereo(), 44100, 44100 / 100, 100),
// 15 seconds of stereo, higher rate.
- std::make_tuple(ChannelLayout::CHANNEL_LAYOUT_STEREO,
+ std::make_tuple(ChannelLayoutConfig::Stereo(),
48000,
48000 / 100,
1500)));
-INSTANTIATE_TEST_SUITE_P(AudioDebugFileWriterBehavioralTest,
- AudioDebugFileWriterBehavioralTest,
- // Using 10ms frames per buffer everywhere.
- testing::Values(
- // No writes.
- std::make_tuple(ChannelLayout::CHANNEL_LAYOUT_MONO,
- 44100,
- 44100 / 100,
- 100)));
-
-INSTANTIATE_TEST_SUITE_P(AudioDebugFileWriterSingleThreadTest,
- AudioDebugFileWriterSingleThreadTest,
- // Using 10ms frames per buffer everywhere.
- testing::Values(
- // No writes.
- std::make_tuple(ChannelLayout::CHANNEL_LAYOUT_MONO,
- 44100,
- 44100 / 100,
- 100)));
+INSTANTIATE_TEST_SUITE_P(
+ AudioDebugFileWriterBehavioralTest,
+ AudioDebugFileWriterBehavioralTest,
+ // Using 10ms frames per buffer everywhere.
+ testing::Values(
+ // No writes.
+ std::make_tuple(ChannelLayoutConfig::Mono(), 44100, 44100 / 100, 100)));
+
+INSTANTIATE_TEST_SUITE_P(
+ AudioDebugFileWriterSingleThreadTest,
+ AudioDebugFileWriterSingleThreadTest,
+ // Using 10ms frames per buffer everywhere.
+ testing::Values(
+ // No writes.
+ std::make_tuple(ChannelLayoutConfig::Mono(), 44100, 44100 / 100, 100)));
} // namespace media
diff --git a/chromium/media/audio/audio_debug_recording_helper.cc b/chromium/media/audio/audio_debug_recording_helper.cc
index 24d55f9c5b9..5a284ef0801 100644
--- a/chromium/media/audio/audio_debug_recording_helper.cc
+++ b/chromium/media/audio/audio_debug_recording_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,7 +11,9 @@
#include "base/files/file.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
-#include "base/task/single_thread_task_runner.h"
+#include "base/sequence_checker.h"
+#include "base/synchronization/lock.h"
+#include "base/task/bind_post_task.h"
#include "media/audio/audio_debug_file_writer.h"
#include "media/base/audio_bus.h"
@@ -19,14 +21,15 @@ namespace media {
AudioDebugRecordingHelper::AudioDebugRecordingHelper(
const AudioParameters& params,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
base::OnceClosure on_destruction_closure)
: params_(params),
- recording_enabled_(0),
- task_runner_(std::move(task_runner)),
- on_destruction_closure_(std::move(on_destruction_closure)) {}
+ file_writer_(nullptr, base::OnTaskRunnerDeleter(nullptr)),
+ on_destruction_closure_(std::move(on_destruction_closure)) {
+ DETACH_FROM_SEQUENCE(sequence_checker_);
+}
AudioDebugRecordingHelper::~AudioDebugRecordingHelper() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (on_destruction_closure_)
std::move(on_destruction_closure_).Run();
}
@@ -35,10 +38,8 @@ void AudioDebugRecordingHelper::EnableDebugRecording(
AudioDebugRecordingStreamType stream_type,
uint32_t id,
CreateWavFileCallback create_file_callback) {
- DCHECK(task_runner_->BelongsToCurrentThread());
- DCHECK(!debug_writer_);
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- debug_writer_ = CreateAudioDebugFileWriter(params_);
std::move(create_file_callback)
.Run(stream_type, id,
base::BindOnce(&AudioDebugRecordingHelper::StartDebugRecordingToFile,
@@ -46,73 +47,47 @@ void AudioDebugRecordingHelper::EnableDebugRecording(
}
void AudioDebugRecordingHelper::StartDebugRecordingToFile(base::File file) {
- DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (!file.IsValid()) {
- PLOG(ERROR) << "Invalid debug recording file, error="
- << file.error_details();
- debug_writer_.reset();
- return;
- }
+ {
+ base::AutoLock auto_lock(file_writer_lock_);
- debug_writer_->Start(std::move(file));
+ if (!file.IsValid()) {
+ PLOG(ERROR) << "Invalid debug recording file, error="
+ << file.error_details();
+ file_writer_.reset();
+ return;
+ }
- base::subtle::NoBarrier_Store(&recording_enabled_, 1);
+ file_writer_ = CreateAudioDebugFileWriter(params_, std::move(file));
+ }
}
void AudioDebugRecordingHelper::DisableDebugRecording() {
- DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- base::subtle::NoBarrier_Store(&recording_enabled_, 0);
-
- if (debug_writer_) {
- debug_writer_->Stop();
- debug_writer_.reset();
+ {
+ base::AutoLock auto_lock(file_writer_lock_);
+ if (file_writer_) {
+ file_writer_.reset();
+ }
}
}
void AudioDebugRecordingHelper::OnData(const AudioBus* source) {
- // Check if debug recording is enabled to avoid an unecessary copy and thread
- // jump if not. Recording can be disabled between the atomic Load() here and
- // DoWrite(), but it's fine with a single unnecessary copy+jump at disable
- // time. We use an atomic operation for accessing the flag on different
- // threads. No memory barrier is needed for the same reason; a race is no
- // problem at enable and disable time. Missing one buffer of data doesn't
- // matter.
- base::subtle::Atomic32 recording_enabled =
- base::subtle::NoBarrier_Load(&recording_enabled_);
- if (!recording_enabled)
- return;
-
- // TODO(tommi): This is costly. AudioBus heap allocs and we create a new one
- // for every callback. We could instead have a pool of bus objects that get
- // returned to us somehow.
- // We should also avoid calling PostTask here since the implementation of the
- // debug writer will basically do a PostTask straight away anyway. Might
- // require some modifications to AudioDebugFileWriter though since there are
- // some threading concerns there and AudioDebugFileWriter's lifetime
- // guarantees need to be longer than that of associated active audio streams.
- std::unique_ptr<AudioBus> audio_bus_copy =
- AudioBus::Create(source->channels(), source->frames());
- source->CopyTo(audio_bus_copy.get());
-
- task_runner_->PostTask(
- FROM_HERE,
- base::BindOnce(&AudioDebugRecordingHelper::DoWrite,
- weak_factory_.GetWeakPtr(), std::move(audio_bus_copy)));
-}
-
-void AudioDebugRecordingHelper::DoWrite(std::unique_ptr<media::AudioBus> data) {
- DCHECK(task_runner_->BelongsToCurrentThread());
-
- if (debug_writer_)
- debug_writer_->Write(std::move(data));
+ if (file_writer_lock_.Try()) {
+ if (file_writer_) {
+ file_writer_->Write(*source);
+ }
+ file_writer_lock_.Release();
+ }
}
-std::unique_ptr<AudioDebugFileWriter>
-AudioDebugRecordingHelper::CreateAudioDebugFileWriter(
- const AudioParameters& params) {
- return std::make_unique<AudioDebugFileWriter>(params);
+AudioDebugFileWriter::Ptr AudioDebugRecordingHelper::CreateAudioDebugFileWriter(
+ const AudioParameters& params,
+ base::File file) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ return AudioDebugFileWriter::Create(params, std::move(file));
}
} // namespace media
diff --git a/chromium/media/audio/audio_debug_recording_helper.h b/chromium/media/audio/audio_debug_recording_helper.h
index 86d2ed7b368..2283a95aecc 100644
--- a/chromium/media/audio/audio_debug_recording_helper.h
+++ b/chromium/media/audio/audio_debug_recording_helper.h
@@ -1,16 +1,15 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_AUDIO_AUDIO_DEBUG_RECORDING_HELPER_H_
#define MEDIA_AUDIO_AUDIO_DEBUG_RECORDING_HELPER_H_
-#include <memory>
-
#include "base/atomicops.h"
#include "base/callback.h"
#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
+#include "base/thread_annotations.h"
#include "base/threading/thread_checker.h"
#include "media/audio/audio_debug_file_writer.h"
#include "media/base/audio_parameters.h"
@@ -18,7 +17,6 @@
namespace base {
class File;
-class SingleThreadTaskRunner;
}
namespace media {
@@ -39,16 +37,9 @@ class AudioDebugRecorder {
};
// A helper class for those who want to use AudioDebugFileWriter. It handles
-// copying AudioBus data, thread jump (OnData() can be called on any
-// thread), and creating and deleting the AudioDebugFileWriter at enable and
-// disable. All functions except OnData() must be called on the thread
-// |task_runner| belongs to.
-// TODO(grunell): When input debug recording is moved to AudioManager, it should
-// be possible to merge this class into AudioDebugFileWriter. One thread jump
-// could be skipped then. Currently we have
-// soundcard thread -> control thread -> file thread,
-// and with the merge we should be able to do
-// soundcard thread -> file thread.
+// copying AudioBus data, thread jump (OnData() can be called on any thread),
+// and creating and deleting the AudioDebugFileWriter at enable and disable. All
+// public methods except OnData() must be called on the same sequence.
class MEDIA_EXPORT AudioDebugRecordingHelper : public AudioDebugRecorder {
public:
using CreateWavFileCallback = base::OnceCallback<void(
@@ -56,10 +47,8 @@ class MEDIA_EXPORT AudioDebugRecordingHelper : public AudioDebugRecorder {
uint32_t id,
base::OnceCallback<void(base::File)> reply_callback)>;
- AudioDebugRecordingHelper(
- const AudioParameters& params,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- base::OnceClosure on_destruction_closure);
+ AudioDebugRecordingHelper(const AudioParameters& params,
+ base::OnceClosure on_destruction_closure);
AudioDebugRecordingHelper(const AudioDebugRecordingHelper&) = delete;
AudioDebugRecordingHelper& operator=(const AudioDebugRecordingHelper&) =
@@ -67,13 +56,12 @@ class MEDIA_EXPORT AudioDebugRecordingHelper : public AudioDebugRecorder {
~AudioDebugRecordingHelper() override;
- // Enable debug recording. Creates |debug_writer_| and runs
- // |create_file_callback| to create debug recording file.
+ // Enable debug recording. Runs |create_file_callback| synchronously to create
+ // the debug recording file.
virtual void EnableDebugRecording(AudioDebugRecordingStreamType stream_type,
uint32_t id,
CreateWavFileCallback create_file_callback);
- // Disable debug recording. Destroys |debug_writer_|.
virtual void DisableDebugRecording();
// AudioDebugRecorder implementation. Can be called on any thread.
@@ -83,30 +71,27 @@ class MEDIA_EXPORT AudioDebugRecordingHelper : public AudioDebugRecorder {
FRIEND_TEST_ALL_PREFIXES(AudioDebugRecordingHelperTest, EnableDisable);
FRIEND_TEST_ALL_PREFIXES(AudioDebugRecordingHelperTest, OnData);
- // Writes debug data to |debug_writer_|.
- void DoWrite(std::unique_ptr<media::AudioBus> data);
-
// Creates an AudioDebugFileWriter. Overridden by test.
- virtual std::unique_ptr<AudioDebugFileWriter> CreateAudioDebugFileWriter(
- const AudioParameters& params);
+ virtual AudioDebugFileWriter::Ptr CreateAudioDebugFileWriter(
+ const AudioParameters& params,
+ base::File file);
// Passed to |create_file_callback| in EnableDebugRecording, to be called
// after debug recording file was created.
void StartDebugRecordingToFile(base::File file);
const AudioParameters params_;
- std::unique_ptr<AudioDebugFileWriter> debug_writer_;
- // Used as a flag to indicate if recording is enabled, accessed on different
- // threads.
- base::subtle::Atomic32 recording_enabled_;
+ // Locks access to the |file_writer_|.
+ base::Lock file_writer_lock_;
- // The task runner for accessing |debug_writer_|.
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ AudioDebugFileWriter::Ptr file_writer_ GUARDED_BY(file_writer_lock_);
// Runs in destructor if set.
base::OnceClosure on_destruction_closure_;
+ SEQUENCE_CHECKER(sequence_checker_);
+
base::WeakPtrFactory<AudioDebugRecordingHelper> weak_factory_{this};
};
diff --git a/chromium/media/audio/audio_debug_recording_helper_unittest.cc b/chromium/media/audio/audio_debug_recording_helper_unittest.cc
index c5b4d434ac2..cea821a36ba 100644
--- a/chromium/media/audio/audio_debug_recording_helper_unittest.cc
+++ b/chromium/media/audio/audio_debug_recording_helper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,14 +10,20 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/check_op.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/functional/callback_forward.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
+#include "base/synchronization/lock.h"
+#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
+#include "base/test/bind.h"
#include "base/test/task_environment.h"
+#include "media/audio/audio_bus_pool.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_sample_types.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -38,36 +44,31 @@ const base::FilePath::CharType kFileName[] =
// Mock class for the audio file writer that the helper wraps.
class MockAudioDebugFileWriter : public AudioDebugFileWriter {
public:
- explicit MockAudioDebugFileWriter(const AudioParameters& params)
- : AudioDebugFileWriter(params), reference_data_(nullptr) {}
+ explicit MockAudioDebugFileWriter(const AudioParameters& params,
+ base::File file)
+ : AudioDebugFileWriter(params, std::move(file), nullptr),
+ reference_data_(nullptr) {}
MockAudioDebugFileWriter(const MockAudioDebugFileWriter&) = delete;
MockAudioDebugFileWriter& operator=(const MockAudioDebugFileWriter&) = delete;
- ~MockAudioDebugFileWriter() override = default;
+ MOCK_METHOD0(DestructorCalled, void());
+ ~MockAudioDebugFileWriter() override { DestructorCalled(); }
- MOCK_METHOD1(DoStart, void(bool));
- void Start(base::File file) override { DoStart(file.IsValid()); }
- MOCK_METHOD0(Stop, void());
-
- // Functions with move-only types as arguments can't be mocked directly, so
- // we pass on to DoWrite(). Also, we can verify the data this way.
- MOCK_METHOD1(DoWrite, void(AudioBus*));
- void Write(std::unique_ptr<AudioBus> data) override {
+ MOCK_METHOD1(DoWrite, void(const AudioBus&));
+ void Write(const AudioBus& data) override {
CHECK(reference_data_);
- EXPECT_EQ(reference_data_->channels(), data->channels());
- EXPECT_EQ(reference_data_->frames(), data->frames());
- for (int i = 0; i < data->channels(); ++i) {
- float* data_ptr = data->channel(i);
+ EXPECT_EQ(reference_data_->channels(), data.channels());
+ EXPECT_EQ(reference_data_->frames(), data.frames());
+ for (int i = 0; i < data.channels(); ++i) {
+ const float* data_ptr = data.channel(i);
float* ref_data_ptr = reference_data_->channel(i);
- for (int j = 0; j < data->frames(); ++j, ++data_ptr, ++ref_data_ptr)
+ for (int j = 0; j < data.frames(); ++j, ++data_ptr, ++ref_data_ptr)
EXPECT_EQ(*ref_data_ptr, *data_ptr);
}
- DoWrite(data.get());
+ DoWrite(data);
}
- MOCK_METHOD0(WillWrite, bool());
-
// Set reference data to compare against. Must be called before Write() is
// called.
void SetReferenceData(AudioBus* reference_data) {
@@ -76,6 +77,10 @@ class MockAudioDebugFileWriter : public AudioDebugFileWriter {
reference_data_ = reference_data;
}
+ scoped_refptr<base::SequencedTaskRunner> GetTaskRunner() {
+ return task_runner_;
+ }
+
private:
raw_ptr<AudioBus> reference_data_;
};
@@ -84,13 +89,15 @@ class MockAudioDebugFileWriter : public AudioDebugFileWriter {
// function to create the above mock instead.
class AudioDebugRecordingHelperUnderTest : public AudioDebugRecordingHelper {
public:
+ using CreatedWriterCallback =
+ base::RepeatingCallback<void(MockAudioDebugFileWriter*)>;
+
AudioDebugRecordingHelperUnderTest(
const AudioParameters& params,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- base::OnceClosure on_destruction_closure)
- : AudioDebugRecordingHelper(params,
- std::move(task_runner),
- std::move(on_destruction_closure)) {}
+ base::OnceClosure on_destruction_closure,
+ CreatedWriterCallback created_writer_callback)
+ : AudioDebugRecordingHelper(params, std::move(on_destruction_closure)),
+ created_writer_callback_(std::move(created_writer_callback)) {}
AudioDebugRecordingHelperUnderTest(
const AudioDebugRecordingHelperUnderTest&) = delete;
@@ -100,19 +107,23 @@ class AudioDebugRecordingHelperUnderTest : public AudioDebugRecordingHelper {
~AudioDebugRecordingHelperUnderTest() override = default;
private:
- // Creates the mock writer. After the mock writer is returned, we always
- // expect Start() to be called on it by the helper.
- std::unique_ptr<AudioDebugFileWriter> CreateAudioDebugFileWriter(
- const AudioParameters& params) override {
- MockAudioDebugFileWriter* writer = new MockAudioDebugFileWriter(params);
- EXPECT_CALL(*writer, DoStart(true));
- return base::WrapUnique<AudioDebugFileWriter>(writer);
+ // Creates the mock writer.
+ AudioDebugFileWriter::Ptr CreateAudioDebugFileWriter(
+ const AudioParameters& params,
+ base::File file) override {
+ MockAudioDebugFileWriter* writer =
+ new MockAudioDebugFileWriter(params, std::move(file));
+ created_writer_callback_.Run(writer);
+ return AudioDebugFileWriter::Ptr(
+ writer, base::OnTaskRunnerDeleter(writer->GetTaskRunner()));
}
+
+ CreatedWriterCallback created_writer_callback_;
};
class AudioDebugRecordingHelperTest : public ::testing::Test {
public:
- AudioDebugRecordingHelperTest() {}
+ AudioDebugRecordingHelperTest() = default;
AudioDebugRecordingHelperTest(const AudioDebugRecordingHelperTest&) = delete;
AudioDebugRecordingHelperTest& operator=(
@@ -125,8 +136,11 @@ class AudioDebugRecordingHelperTest : public ::testing::Test {
const AudioParameters& params,
base::OnceClosure on_destruction_closure) {
return std::make_unique<AudioDebugRecordingHelperUnderTest>(
- params, task_environment_.GetMainThreadTaskRunner(),
- std::move(on_destruction_closure));
+ params, std::move(on_destruction_closure),
+ base::BindLambdaForTesting(
+ [&](MockAudioDebugFileWriter* mock_audio_file_writer) {
+ mock_audio_file_writer_ = mock_audio_file_writer;
+ }));
}
MOCK_METHOD0(OnAudioDebugRecordingHelperDestruction, void());
@@ -148,9 +162,16 @@ class AudioDebugRecordingHelperTest : public ::testing::Test {
// Run |reply_callback| with a valid file for expected
// MockAudioDebugFileWriter::Start mocked call to happen.
std::move(reply_callback).Run(std::move(debug_file));
- // File can be removed right away because MockAudioDebugFileWriter::Start is
- // called synchronously.
- ASSERT_TRUE(base::DeleteFile(path));
+ paths_.push_back(std::move(path));
+ }
+
+ void VerifyAndDeleteWavFiles(size_t expected_file_count) {
+ DCHECK_EQ(expected_file_count, paths_.size());
+ task_environment_.RunUntilIdle();
+ for (base::FilePath& path : paths_) {
+ ASSERT_TRUE(base::DeleteFile(path));
+ }
+ paths_.clear();
}
protected:
@@ -160,6 +181,12 @@ class AudioDebugRecordingHelperTest : public ::testing::Test {
// The test task environment.
base::test::TaskEnvironment task_environment_;
+
+ // Used for testing to access the file writer having to go through the
+ // internal |file_writer_lock_|.
+ MockAudioDebugFileWriter* mock_audio_file_writer_;
+
+ std::vector<base::FilePath> paths_;
};
// Creates a helper with an on destruction closure, and verifies that it's run.
@@ -172,6 +199,8 @@ TEST_F(AudioDebugRecordingHelperTest, TestDestructionClosure) {
base::Unretained(this)));
EXPECT_CALL(*this, OnAudioDebugRecordingHelperDestruction());
+
+ VerifyAndDeleteWavFiles(0);
}
// Verifies that disable can be called without being enabled.
@@ -181,6 +210,8 @@ TEST_F(AudioDebugRecordingHelperTest, OnlyDisable) {
CreateRecordingHelper(params, base::OnceClosure());
recording_helper->DisableDebugRecording();
+
+ VerifyAndDeleteWavFiles(0);
}
TEST_F(AudioDebugRecordingHelperTest, EnableDisable) {
@@ -192,19 +223,17 @@ TEST_F(AudioDebugRecordingHelperTest, EnableDisable) {
stream_type_, id_,
base::BindOnce(&AudioDebugRecordingHelperTest::CreateWavFile,
base::Unretained(this)));
- EXPECT_CALL(*static_cast<MockAudioDebugFileWriter*>(
- recording_helper->debug_writer_.get()),
- Stop());
+ EXPECT_CALL(*mock_audio_file_writer_, DestructorCalled());
recording_helper->DisableDebugRecording();
recording_helper->EnableDebugRecording(
stream_type_, id_,
base::BindOnce(&AudioDebugRecordingHelperTest::CreateWavFile,
base::Unretained(this)));
- EXPECT_CALL(*static_cast<MockAudioDebugFileWriter*>(
- recording_helper->debug_writer_.get()),
- Stop());
+ EXPECT_CALL(*mock_audio_file_writer_, DestructorCalled());
recording_helper->DisableDebugRecording();
+
+ VerifyAndDeleteWavFiles(2);
}
TEST_F(AudioDebugRecordingHelperTest, OnData) {
@@ -212,7 +241,7 @@ TEST_F(AudioDebugRecordingHelperTest, OnData) {
// AudioBus, the other parameters are ignored.
const int number_of_frames = 100;
const AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
- ChannelLayout::CHANNEL_LAYOUT_STEREO, 0,
+ ChannelLayoutConfig::Stereo(), 0,
number_of_frames);
// Setup some data.
@@ -235,16 +264,13 @@ TEST_F(AudioDebugRecordingHelperTest, OnData) {
stream_type_, id_,
base::BindOnce(&AudioDebugRecordingHelperTest::CreateWavFile,
base::Unretained(this)));
- MockAudioDebugFileWriter* mock_audio_file_writer =
- static_cast<MockAudioDebugFileWriter*>(
- recording_helper->debug_writer_.get());
- mock_audio_file_writer->SetReferenceData(audio_bus.get());
+ mock_audio_file_writer_->SetReferenceData(audio_bus.get());
- EXPECT_CALL(*mock_audio_file_writer, DoWrite(_));
+ EXPECT_CALL(*mock_audio_file_writer_, DoWrite(_));
recording_helper->OnData(audio_bus.get());
base::RunLoop().RunUntilIdle();
- EXPECT_CALL(*mock_audio_file_writer, Stop());
+ EXPECT_CALL(*mock_audio_file_writer_, DestructorCalled());
recording_helper->DisableDebugRecording();
// Make sure we clear the loop before enabling again.
@@ -257,26 +283,21 @@ TEST_F(AudioDebugRecordingHelperTest, OnData) {
stream_type_, id_,
base::BindOnce(&AudioDebugRecordingHelperTest::CreateWavFile,
base::Unretained(this)));
- mock_audio_file_writer = static_cast<MockAudioDebugFileWriter*>(
- recording_helper->debug_writer_.get());
- mock_audio_file_writer->SetReferenceData(audio_bus.get());
+ mock_audio_file_writer_->SetReferenceData(audio_bus.get());
- EXPECT_CALL(*mock_audio_file_writer, DoWrite(_)).Times(2);
+ EXPECT_CALL(*mock_audio_file_writer_, DoWrite(_)).Times(2);
recording_helper->OnData(audio_bus.get());
recording_helper->OnData(audio_bus.get());
base::RunLoop().RunUntilIdle();
- // This call should not yield a DoWrite() call on the mock, since the message
- // loop isn't run until after disabling. WillWrite() is expected since
- // recording is enabled.
- recording_helper->OnData(audio_bus.get());
-
- EXPECT_CALL(*mock_audio_file_writer, Stop());
+ EXPECT_CALL(*mock_audio_file_writer_, DestructorCalled());
recording_helper->DisableDebugRecording();
- // This call should not yield a DoWrite() call on the mock either.
+ // This call should not yield a DoWrite() call on the mock.
recording_helper->OnData(audio_bus.get());
base::RunLoop().RunUntilIdle();
+
+ VerifyAndDeleteWavFiles(2);
}
} // namespace media
diff --git a/chromium/media/audio/audio_debug_recording_manager.cc b/chromium/media/audio/audio_debug_recording_manager.cc
index 10ae1a47957..9292e2d9724 100644
--- a/chromium/media/audio/audio_debug_recording_manager.cc
+++ b/chromium/media/audio/audio_debug_recording_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,8 +8,7 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
-#include "base/task/single_thread_task_runner.h"
-#include "base/task/task_runner_util.h"
+#include "base/threading/thread_checker.h"
namespace media {
@@ -18,15 +17,15 @@ namespace {
uint32_t g_next_stream_id = 1;
}
-AudioDebugRecordingManager::AudioDebugRecordingManager(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner)
- : task_runner_(std::move(task_runner)) {}
+AudioDebugRecordingManager::AudioDebugRecordingManager() {
+ DETACH_FROM_SEQUENCE(sequence_checker_);
+}
AudioDebugRecordingManager::~AudioDebugRecordingManager() = default;
void AudioDebugRecordingManager::EnableDebugRecording(
CreateWavFileCallback create_file_callback) {
- DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!create_file_callback.is_null());
create_file_callback_ = std::move(create_file_callback);
@@ -40,7 +39,7 @@ void AudioDebugRecordingManager::EnableDebugRecording(
}
void AudioDebugRecordingManager::DisableDebugRecording() {
- DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!create_file_callback_.is_null());
for (const auto& it : debug_recording_helpers_) {
AudioDebugRecordingHelper* recording_helper = it.second.first;
@@ -53,7 +52,7 @@ std::unique_ptr<AudioDebugRecorder>
AudioDebugRecordingManager::RegisterDebugRecordingSource(
AudioDebugRecordingStreamType stream_type,
const AudioParameters& params) {
- DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const uint32_t id = g_next_stream_id++;
@@ -61,7 +60,7 @@ AudioDebugRecordingManager::RegisterDebugRecordingSource(
// returned recorder. But to not require this we use a weak pointer.
std::unique_ptr<AudioDebugRecordingHelper> recording_helper =
CreateAudioDebugRecordingHelper(
- params, task_runner_,
+ params,
base::BindOnce(
&AudioDebugRecordingManager::UnregisterDebugRecordingSource,
weak_factory_.GetWeakPtr(), id));
@@ -78,7 +77,7 @@ AudioDebugRecordingManager::RegisterDebugRecordingSource(
}
void AudioDebugRecordingManager::UnregisterDebugRecordingSource(uint32_t id) {
- DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
auto it = debug_recording_helpers_.find(id);
DCHECK(it != debug_recording_helpers_.end());
debug_recording_helpers_.erase(id);
@@ -87,14 +86,13 @@ void AudioDebugRecordingManager::UnregisterDebugRecordingSource(uint32_t id) {
std::unique_ptr<AudioDebugRecordingHelper>
AudioDebugRecordingManager::CreateAudioDebugRecordingHelper(
const AudioParameters& params,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
base::OnceClosure on_destruction_closure) {
return std::make_unique<AudioDebugRecordingHelper>(
- params, task_runner, std::move(on_destruction_closure));
+ params, std::move(on_destruction_closure));
}
bool AudioDebugRecordingManager::IsDebugRecordingEnabled() {
- DCHECK(task_runner_->BelongsToCurrentThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return !create_file_callback_.is_null();
}
diff --git a/chromium/media/audio/audio_debug_recording_manager.h b/chromium/media/audio/audio_debug_recording_manager.h
index 8c95c3c4694..8cf8a60194d 100644
--- a/chromium/media/audio/audio_debug_recording_manager.h
+++ b/chromium/media/audio/audio_debug_recording_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -59,8 +59,7 @@ class MEDIA_EXPORT AudioDebugRecordingManager {
uint32_t id,
base::OnceCallback<void(base::File)> reply_callback)>;
- AudioDebugRecordingManager(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+ AudioDebugRecordingManager();
AudioDebugRecordingManager(const AudioDebugRecordingManager&) = delete;
AudioDebugRecordingManager& operator=(const AudioDebugRecordingManager&) =
@@ -81,14 +80,8 @@ class MEDIA_EXPORT AudioDebugRecordingManager {
protected:
// Creates an AudioDebugRecordingHelper. Overridden by test.
virtual std::unique_ptr<AudioDebugRecordingHelper>
- CreateAudioDebugRecordingHelper(
- const AudioParameters& params,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- base::OnceClosure on_destruction_closure);
-
- // The task runner this class lives on. Also handed to
- // AudioDebugRecordingHelpers.
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ CreateAudioDebugRecordingHelper(const AudioParameters& params,
+ base::OnceClosure on_destruction_closure);
private:
FRIEND_TEST_ALL_PREFIXES(AudioDebugRecordingManagerTest,
@@ -115,6 +108,8 @@ class MEDIA_EXPORT AudioDebugRecordingManager {
// recording is enabled.
CreateWavFileCallback create_file_callback_;
+ SEQUENCE_CHECKER(sequence_checker_);
+
base::WeakPtrFactory<AudioDebugRecordingManager> weak_factory_{this};
};
diff --git a/chromium/media/audio/audio_debug_recording_manager_unittest.cc b/chromium/media/audio/audio_debug_recording_manager_unittest.cc
index 0fc61f00bd5..2afa4763792 100644
--- a/chromium/media/audio/audio_debug_recording_manager_unittest.cc
+++ b/chromium/media/audio/audio_debug_recording_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/callback.h"
-#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "media/audio/audio_debug_recording_helper.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -53,13 +52,9 @@ void CreateWavFile(AudioDebugRecordingStreamType stream_type,
// Mock class to verify enable and disable calls.
class MockAudioDebugRecordingHelper : public AudioDebugRecordingHelper {
public:
- MockAudioDebugRecordingHelper(
- const AudioParameters& params,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- base::OnceClosure on_destruction_closure)
- : AudioDebugRecordingHelper(params,
- std::move(task_runner),
- base::OnceClosure()),
+ MockAudioDebugRecordingHelper(const AudioParameters& params,
+ base::OnceClosure on_destruction_closure)
+ : AudioDebugRecordingHelper(params, base::OnceClosure()),
on_destruction_closure_in_mock_(std::move(on_destruction_closure)) {
if (g_expect_enable_after_create_helper)
EXPECT_CALL(*this, DoEnableDebugRecording(_, _));
@@ -95,9 +90,7 @@ class MockAudioDebugRecordingHelper : public AudioDebugRecordingHelper {
// function to create the above mock instead.
class AudioDebugRecordingManagerUnderTest : public AudioDebugRecordingManager {
public:
- AudioDebugRecordingManagerUnderTest(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner)
- : AudioDebugRecordingManager(std::move(task_runner)) {}
+ AudioDebugRecordingManagerUnderTest() = default;
AudioDebugRecordingManagerUnderTest(
const AudioDebugRecordingManagerUnderTest&) = delete;
@@ -109,19 +102,16 @@ class AudioDebugRecordingManagerUnderTest : public AudioDebugRecordingManager {
private:
std::unique_ptr<AudioDebugRecordingHelper> CreateAudioDebugRecordingHelper(
const AudioParameters& params,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
base::OnceClosure on_destruction_closure) override {
return std::make_unique<MockAudioDebugRecordingHelper>(
- params, std::move(task_runner),
- std::move(on_destruction_closure));
+ params, std::move(on_destruction_closure));
}
};
// The test fixture.
class AudioDebugRecordingManagerTest : public ::testing::Test {
public:
- AudioDebugRecordingManagerTest()
- : manager_(task_environment_.GetMainThreadTaskRunner()) {}
+ AudioDebugRecordingManagerTest() = default;
AudioDebugRecordingManagerTest(const AudioDebugRecordingManagerTest&) =
delete;
diff --git a/chromium/media/audio/audio_debug_recording_session.h b/chromium/media/audio/audio_debug_recording_session.h
index a3149b5348d..25145742faf 100644
--- a/chromium/media/audio/audio_debug_recording_session.h
+++ b/chromium/media/audio/audio_debug_recording_session.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_debug_recording_test.cc b/chromium/media/audio/audio_debug_recording_test.cc
index bc19e832ae1..31e5c8d69ad 100644
--- a/chromium/media/audio/audio_debug_recording_test.cc
+++ b/chromium/media/audio/audio_debug_recording_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_debug_recording_test.h b/chromium/media/audio/audio_debug_recording_test.h
index 48635771ae7..e0bb5ef6cac 100644
--- a/chromium/media/audio/audio_debug_recording_test.h
+++ b/chromium/media/audio/audio_debug_recording_test.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_device_description.cc b/chromium/media/audio/audio_device_description.cc
index a2d515b877c..a9cb921fc9c 100644
--- a/chromium/media/audio/audio_device_description.cc
+++ b/chromium/media/audio/audio_device_description.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_device_description.h b/chromium/media/audio/audio_device_description.h
index ccba18edbbb..23e8c0aff46 100644
--- a/chromium/media/audio/audio_device_description.h
+++ b/chromium/media/audio/audio_device_description.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_device_info_accessor_for_tests.cc b/chromium/media/audio/audio_device_info_accessor_for_tests.cc
index 4b3eb1fc63b..9841922773b 100644
--- a/chromium/media/audio/audio_device_info_accessor_for_tests.cc
+++ b/chromium/media/audio/audio_device_info_accessor_for_tests.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_device_info_accessor_for_tests.h b/chromium/media/audio/audio_device_info_accessor_for_tests.h
index d2d7055010c..fb1d8f1e417 100644
--- a/chromium/media/audio/audio_device_info_accessor_for_tests.h
+++ b/chromium/media/audio/audio_device_info_accessor_for_tests.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_device_name.cc b/chromium/media/audio/audio_device_name.cc
index c14ba73a9b7..23d147a172b 100644
--- a/chromium/media/audio/audio_device_name.cc
+++ b/chromium/media/audio/audio_device_name.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_device_name.h b/chromium/media/audio/audio_device_name.h
index a0ecfb5d7fe..c483b27865f 100644
--- a/chromium/media/audio/audio_device_name.h
+++ b/chromium/media/audio/audio_device_name.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_device_thread.cc b/chromium/media/audio/audio_device_thread.cc
index 899740e0ab3..70eb11033fa 100644
--- a/chromium/media/audio/audio_device_thread.cc
+++ b/chromium/media/audio/audio_device_thread.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_device_thread.h b/chromium/media/audio/audio_device_thread.h
index 390afbb740f..c613f2eb454 100644
--- a/chromium/media/audio/audio_device_thread.h
+++ b/chromium/media/audio/audio_device_thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_encoders_unittest.cc b/chromium/media/audio/audio_encoders_unittest.cc
index d6fc72161da..c17c5053728 100644
--- a/chromium/media/audio/audio_encoders_unittest.cc
+++ b/chromium/media/audio/audio_encoders_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -532,12 +532,24 @@ TEST_P(AudioEncodersTest, Timestamps) {
int num_frames =
AudioTimestampHelper::TimeToFrames(duration, options_.sample_rate);
- size_t expected_padding = GetExpectedPadding();
+ size_t total_frames = num_frames * kCount;
+
+#if HAS_AAC_ENCODER
+ if (options_.codec == AudioCodec::kAAC &&
+ total_frames % kAacFramesPerBuffer) {
+ // We send data in chunks of kAacFramesPerBuffer to the encoder, padding
+ // it with silence when flushing.
+ // Round `total_frames` up to the nearest multiple of kAacFramesPerBuffer.
+ int chunks = (total_frames / kAacFramesPerBuffer) + 1;
+ total_frames = chunks * kAacFramesPerBuffer;
+ }
+#endif
+
+ total_frames += GetExpectedPadding();
// The encoder will have multiple outputs per input if `num_frames` is
// larger than `frames_per_buffer_`, and fewer outputs per input if it is
// smaller.
- size_t total_frames = num_frames * kCount + expected_padding;
size_t expected_outputs = total_frames / frames_per_buffer_;
// Round up if the division truncated. This is because the encoder will pad
diff --git a/chromium/media/audio/audio_features.cc b/chromium/media/audio/audio_features.cc
index 3e60bf27e33..d6235fa515d 100644
--- a/chromium/media/audio/audio_features.cc
+++ b/chromium/media/audio/audio_features.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,62 +9,65 @@
namespace features {
-// When the audio service in a separate process, kill it when a hang is
-// detected. It will be restarted when needed.
-const base::Feature kAudioServiceOutOfProcessKillAtHang{
- "AudioServiceOutOfProcessKillAtHang",
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
- BUILDFLAG(IS_CHROMEOS)
- base::FEATURE_ENABLED_BY_DEFAULT
-#else
- base::FEATURE_DISABLED_BY_DEFAULT
-#endif
-};
-
// If enabled, base::DumpWithoutCrashing is called whenever an audio service
// hang is detected.
-const base::Feature kDumpOnAudioServiceHang{"DumpOnAudioServiceHang",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kDumpOnAudioServiceHang,
+ "DumpOnAudioServiceHang",
+ base::FEATURE_DISABLED_BY_DEFAULT);
#if BUILDFLAG(IS_ANDROID)
// Enables loading and using AAudio instead of OpenSLES on compatible devices,
// for audio output streams.
-const base::Feature kUseAAudioDriver{"UseAAudioDriver",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kUseAAudioDriver,
+ "UseAAudioDriver",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#endif
#if BUILDFLAG(IS_CHROMEOS)
-const base::Feature kCrOSSystemAEC{"CrOSSystemAECWithBoardTuningsAllowed",
- base::FEATURE_ENABLED_BY_DEFAULT};
-const base::Feature kCrOSSystemAECDeactivatedGroups{
- "CrOSSystemAECDeactivatedGroups", base::FEATURE_ENABLED_BY_DEFAULT};
-const base::Feature kCrOSEnforceSystemAecNsAgc{
- "CrOSEnforceSystemAecNsAgc", base::FEATURE_DISABLED_BY_DEFAULT};
-const base::Feature kCrOSEnforceSystemAecNs{"CrOSEnforceSystemAecNs",
- base::FEATURE_DISABLED_BY_DEFAULT};
-const base::Feature kCrOSEnforceSystemAecAgc{"CrOSEnforceSystemAecAgc",
- base::FEATURE_DISABLED_BY_DEFAULT};
-const base::Feature kCrOSEnforceSystemAec{"CrOSEnforceSystemAec",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kCrOSSystemAEC,
+ "CrOSSystemAECWithBoardTuningsAllowed",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+BASE_FEATURE(kCrOSSystemAECDeactivatedGroups,
+ "CrOSSystemAECDeactivatedGroups",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+BASE_FEATURE(kCrOSEnforceSystemAecNsAgc,
+ "CrOSEnforceSystemAecNsAgc",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+BASE_FEATURE(kCrOSEnforceSystemAecNs,
+ "CrOSEnforceSystemAecNs",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+BASE_FEATURE(kCrOSEnforceSystemAecAgc,
+ "CrOSEnforceSystemAecAgc",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+BASE_FEATURE(kCrOSEnforceSystemAec,
+ "CrOSEnforceSystemAec",
+ base::FEATURE_DISABLED_BY_DEFAULT);
-const base::Feature kCrOSDspBasedAecDeactivatedGroups{
- "CrOSDspBasedAecDeactivatedGroups", base::FEATURE_ENABLED_BY_DEFAULT};
-const base::Feature kCrOSDspBasedNsDeactivatedGroups{
- "CrOSDspBasedNsDeactivatedGroups", base::FEATURE_ENABLED_BY_DEFAULT};
-const base::Feature kCrOSDspBasedAgcDeactivatedGroups{
- "CrOSDspBasedAgcDeactivatedGroups", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kCrOSDspBasedAecDeactivatedGroups,
+ "CrOSDspBasedAecDeactivatedGroups",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+BASE_FEATURE(kCrOSDspBasedNsDeactivatedGroups,
+ "CrOSDspBasedNsDeactivatedGroups",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+BASE_FEATURE(kCrOSDspBasedAgcDeactivatedGroups,
+ "CrOSDspBasedAgcDeactivatedGroups",
+ base::FEATURE_ENABLED_BY_DEFAULT);
-const base::Feature kCrOSDspBasedAecAllowed{"CrOSDspBasedAecAllowed",
- base::FEATURE_ENABLED_BY_DEFAULT};
-const base::Feature kCrOSDspBasedNsAllowed{"CrOSDspBasedNsAllowed",
- base::FEATURE_ENABLED_BY_DEFAULT};
-const base::Feature kCrOSDspBasedAgcAllowed{"CrOSDspBasedAgcAllowed",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kCrOSDspBasedAecAllowed,
+ "CrOSDspBasedAecAllowed",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+BASE_FEATURE(kCrOSDspBasedNsAllowed,
+ "CrOSDspBasedNsAllowed",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+BASE_FEATURE(kCrOSDspBasedAgcAllowed,
+ "CrOSDspBasedAgcAllowed",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#endif
#if BUILDFLAG(IS_WIN)
-const base::Feature kAllowIAudioClient3{"AllowIAudioClient3",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kAllowIAudioClient3,
+ "AllowIAudioClient3",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#endif
} // namespace features
diff --git a/chromium/media/audio/audio_features.h b/chromium/media/audio/audio_features.h
index 17b96b0ae0d..dadc99614ad 100644
--- a/chromium/media/audio/audio_features.h
+++ b/chromium/media/audio/audio_features.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,30 +11,30 @@
namespace features {
-MEDIA_EXPORT extern const base::Feature kAudioServiceOutOfProcessKillAtHang;
-MEDIA_EXPORT extern const base::Feature kDumpOnAudioServiceHang;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kAudioServiceOutOfProcessKillAtHang);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kDumpOnAudioServiceHang);
#if BUILDFLAG(IS_ANDROID)
-MEDIA_EXPORT extern const base::Feature kUseAAudioDriver;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAAudioDriver);
#endif
#if BUILDFLAG(IS_CHROMEOS)
-MEDIA_EXPORT extern const base::Feature kCrOSSystemAEC;
-MEDIA_EXPORT extern const base::Feature kCrOSSystemAECDeactivatedGroups;
-MEDIA_EXPORT extern const base::Feature kCrOSEnforceSystemAecNsAgc;
-MEDIA_EXPORT extern const base::Feature kCrOSEnforceSystemAecNs;
-MEDIA_EXPORT extern const base::Feature kCrOSEnforceSystemAecAgc;
-MEDIA_EXPORT extern const base::Feature kCrOSEnforceSystemAec;
-MEDIA_EXPORT extern const base::Feature kCrOSDspBasedAecDeactivatedGroups;
-MEDIA_EXPORT extern const base::Feature kCrOSDspBasedNsDeactivatedGroups;
-MEDIA_EXPORT extern const base::Feature kCrOSDspBasedAgcDeactivatedGroups;
-MEDIA_EXPORT extern const base::Feature kCrOSDspBasedAecAllowed;
-MEDIA_EXPORT extern const base::Feature kCrOSDspBasedNsAllowed;
-MEDIA_EXPORT extern const base::Feature kCrOSDspBasedAgcAllowed;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSSystemAEC);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSSystemAECDeactivatedGroups);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSEnforceSystemAecNsAgc);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSEnforceSystemAecNs);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSEnforceSystemAecAgc);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSEnforceSystemAec);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSDspBasedAecDeactivatedGroups);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSDspBasedNsDeactivatedGroups);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSDspBasedAgcDeactivatedGroups);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSDspBasedAecAllowed);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSDspBasedNsAllowed);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCrOSDspBasedAgcAllowed);
#endif
#if BUILDFLAG(IS_WIN)
-MEDIA_EXPORT extern const base::Feature kAllowIAudioClient3;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kAllowIAudioClient3);
#endif
} // namespace features
diff --git a/chromium/media/audio/audio_input_delegate.cc b/chromium/media/audio/audio_input_delegate.cc
index 1310c00d27f..e6cd768993e 100644
--- a/chromium/media/audio/audio_input_delegate.cc
+++ b/chromium/media/audio/audio_input_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_input_delegate.h b/chromium/media/audio/audio_input_delegate.h
index babd1b48128..6b80ad1a893 100644
--- a/chromium/media/audio/audio_input_delegate.h
+++ b/chromium/media/audio/audio_input_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_input_device.cc b/chromium/media/audio/audio_input_device.cc
index 0b46627e329..cb8760bb52f 100644
--- a/chromium/media/audio/audio_input_device.cc
+++ b/chromium/media/audio/audio_input_device.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_input_device.h b/chromium/media/audio/audio_input_device.h
index 2cb581fd597..b298970ce7a 100644
--- a/chromium/media/audio/audio_input_device.h
+++ b/chromium/media/audio/audio_input_device.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_input_device_unittest.cc b/chromium/media/audio/audio_input_device_unittest.cc
index fe09a08b237..794db512747 100644
--- a/chromium/media/audio/audio_input_device_unittest.cc
+++ b/chromium/media/audio/audio_input_device_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -86,7 +86,7 @@ ACTION_P(ReportStateChange, device) {
// Verify that we get an OnCaptureError() callback if CreateStream fails.
TEST_P(AudioInputDeviceTest, FailToCreateStream) {
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, 48000, 480);
+ ChannelLayoutConfig::Stereo(), 48000, 480);
MockCaptureCallback callback;
MockAudioInputIPC* input_ipc = new MockAudioInputIPC();
@@ -105,7 +105,7 @@ TEST_P(AudioInputDeviceTest, FailToCreateStream) {
TEST_P(AudioInputDeviceTest, CreateStream) {
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, 48000, 480);
+ ChannelLayoutConfig::Stereo(), 48000, 480);
base::MappedReadOnlyRegion shared_memory;
CancelableSyncSocket browser_socket;
CancelableSyncSocket renderer_socket;
diff --git a/chromium/media/audio/audio_input_ipc.cc b/chromium/media/audio/audio_input_ipc.cc
index e18a9b8b4b5..cce1edb3bc2 100644
--- a/chromium/media/audio/audio_input_ipc.cc
+++ b/chromium/media/audio/audio_input_ipc.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_input_ipc.h b/chromium/media/audio/audio_input_ipc.h
index 28663a98ab5..091b4f3991e 100644
--- a/chromium/media/audio/audio_input_ipc.h
+++ b/chromium/media/audio/audio_input_ipc.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_input_stream_data_interceptor.cc b/chromium/media/audio/audio_input_stream_data_interceptor.cc
index 332b3aeaf79..6ef80aba9ea 100644
--- a/chromium/media/audio/audio_input_stream_data_interceptor.cc
+++ b/chromium/media/audio/audio_input_stream_data_interceptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_input_stream_data_interceptor.h b/chromium/media/audio/audio_input_stream_data_interceptor.h
index c6f9d7dcb24..2f28085af92 100644
--- a/chromium/media/audio/audio_input_stream_data_interceptor.h
+++ b/chromium/media/audio/audio_input_stream_data_interceptor.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_input_stream_data_interceptor_unittest.cc b/chromium/media/audio/audio_input_stream_data_interceptor_unittest.cc
index 3a2ec62f218..0125660f32e 100644
--- a/chromium/media/audio/audio_input_stream_data_interceptor_unittest.cc
+++ b/chromium/media/audio/audio_input_stream_data_interceptor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_input_unittest.cc b/chromium/media/audio/audio_input_unittest.cc
index 34a16e85609..5602d3de050 100644
--- a/chromium/media/audio/audio_input_unittest.cc
+++ b/chromium/media/audio/audio_input_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_io.cc b/chromium/media/audio/audio_io.cc
index 36f94b812d1..0f9a3079a97 100644
--- a/chromium/media/audio/audio_io.cc
+++ b/chromium/media/audio/audio_io.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_io.h b/chromium/media/audio/audio_io.h
index 09133b94fa9..23077877174 100644
--- a/chromium/media/audio/audio_io.h
+++ b/chromium/media/audio/audio_io.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_logging.h b/chromium/media/audio/audio_logging.h
index 764b8b2ba57..c6b1e101c63 100644
--- a/chromium/media/audio/audio_logging.h
+++ b/chromium/media/audio/audio_logging.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_low_latency_input_output_unittest.cc b/chromium/media/audio/audio_low_latency_input_output_unittest.cc
index 9f219dea545..7e02e2fb988 100644
--- a/chromium/media/audio/audio_low_latency_input_output_unittest.cc
+++ b/chromium/media/audio/audio_low_latency_input_output_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -326,8 +326,10 @@ class StreamWrapper {
private:
StreamType* CreateStream() {
StreamType* stream = StreamTraits::CreateStream(
- audio_manager_, AudioParameters(format_, channel_layout_, sample_rate_,
- samples_per_packet_));
+ audio_manager_,
+ AudioParameters(format_,
+ ChannelLayoutConfig(channel_layout_, channels()),
+ sample_rate_, samples_per_packet_));
EXPECT_TRUE(stream);
return stream;
}
diff --git a/chromium/media/audio/audio_manager.cc b/chromium/media/audio/audio_manager.cc
index e543c4f7fda..6305a9a0538 100644
--- a/chromium/media/audio/audio_manager.cc
+++ b/chromium/media/audio/audio_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_manager.h b/chromium/media/audio/audio_manager.h
index 708fd094871..30d590d44ce 100644
--- a/chromium/media/audio/audio_manager.h
+++ b/chromium/media/audio/audio_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -28,6 +28,7 @@ class AudioManagerPowerUser;
namespace media {
+class AecdumpRecordingManager;
class AudioDebugRecordingManager;
class AudioInputStream;
class AudioManager;
@@ -170,6 +171,11 @@ class MEDIA_EXPORT AudioManager {
// thread (GetTaskRunner()).
virtual AudioDebugRecordingManager* GetAudioDebugRecordingManager() = 0;
+ // Set aecdump recording manager. This can only be called on AudioManager's
+ // thread (GetTaskRunner()).
+ virtual void SetAecDumpRecordingManager(
+ base::WeakPtr<AecdumpRecordingManager> aecdump_recording_manager) = 0;
+
// Gets the name of the audio manager (e.g., Windows, Mac, PulseAudio).
virtual const char* GetName() = 0;
diff --git a/chromium/media/audio/audio_manager_base.cc b/chromium/media/audio/audio_manager_base.cc
index 7090de5b88d..c7e11c8907a 100644
--- a/chromium/media/audio/audio_manager_base.cc
+++ b/chromium/media/audio/audio_manager_base.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/observer_list.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
@@ -98,26 +99,6 @@ struct AudioManagerBase::DispatcherParams {
std::unique_ptr<AudioOutputDispatcher> dispatcher;
};
-class AudioManagerBase::CompareByParams {
- public:
- explicit CompareByParams(const DispatcherParams* dispatcher)
- : dispatcher_(dispatcher) {}
- bool operator()(
- const std::unique_ptr<DispatcherParams>& dispatcher_in) const {
- // We will reuse the existing dispatcher when:
- // 1) Unified IO is not used, input_params and output_params of the
- // existing dispatcher are the same as the requested dispatcher.
- // 2) Unified IO is used, input_params and output_params of the existing
- // dispatcher are the same as the request dispatcher.
- return (dispatcher_->input_params.Equals(dispatcher_in->input_params) &&
- dispatcher_->output_params.Equals(dispatcher_in->output_params) &&
- dispatcher_->output_device_id == dispatcher_in->output_device_id);
- }
-
- private:
- raw_ptr<const DispatcherParams> dispatcher_;
-};
-
AudioManagerBase::AudioManagerBase(std::unique_ptr<AudioThread> audio_thread,
AudioLogFactory* audio_log_factory)
: AudioManager(std::move(audio_thread)),
@@ -424,12 +405,21 @@ AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy(
NOTREACHED();
}
- std::unique_ptr<DispatcherParams> dispatcher_params =
- std::make_unique<DispatcherParams>(params, output_params,
- output_device_id);
-
- auto it = std::find_if(output_dispatchers_.begin(), output_dispatchers_.end(),
- CompareByParams(dispatcher_params.get()));
+ auto dispatcher_params = std::make_unique<DispatcherParams>(
+ params, output_params, output_device_id);
+
+ auto it = base::ranges::find_if(
+ output_dispatchers_,
+ [&](const std::unique_ptr<DispatcherParams>& dispatcher) {
+ // We will reuse the existing dispatcher when:
+ // 1) Unified IO is not used, input_params and output_params of the
+ // existing dispatcher are the same as the requested dispatcher.
+ // 2) Unified IO is used, input_params and output_params of the existing
+ // dispatcher are the same as the request dispatcher.
+ return params.Equals(dispatcher->input_params) &&
+ output_params.Equals(dispatcher->output_params) &&
+ output_device_id == dispatcher->output_device_id;
+ });
if (it != output_dispatchers_.end())
return (*it)->dispatcher->CreateStreamProxy();
@@ -620,13 +610,12 @@ void AudioManagerBase::InitializeDebugRecording() {
}
DCHECK(!debug_recording_manager_);
- debug_recording_manager_ = CreateAudioDebugRecordingManager(GetTaskRunner());
+ debug_recording_manager_ = CreateAudioDebugRecordingManager();
}
std::unique_ptr<AudioDebugRecordingManager>
-AudioManagerBase::CreateAudioDebugRecordingManager(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
- return std::make_unique<AudioDebugRecordingManager>(std::move(task_runner));
+AudioManagerBase::CreateAudioDebugRecordingManager() {
+ return std::make_unique<AudioDebugRecordingManager>();
}
AudioDebugRecordingManager* AudioManagerBase::GetAudioDebugRecordingManager() {
@@ -634,4 +623,9 @@ AudioDebugRecordingManager* AudioManagerBase::GetAudioDebugRecordingManager() {
return debug_recording_manager_.get();
}
+void AudioManagerBase::SetAecDumpRecordingManager(
+ base::WeakPtr<AecdumpRecordingManager>) {
+ // This is no-op by default.
+}
+
} // namespace media
diff --git a/chromium/media/audio/audio_manager_base.h b/chromium/media/audio/audio_manager_base.h
index 046aeef2691..ffa8637177f 100644
--- a/chromium/media/audio/audio_manager_base.h
+++ b/chromium/media/audio/audio_manager_base.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,6 +18,7 @@
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
+#include "media/audio/aecdump_recording_manager.h"
#include "media/audio/audio_debug_recording_manager.h"
#include "media/audio/audio_device_name.h"
#include "media/audio/audio_manager.h"
@@ -160,10 +161,12 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
std::string GetCommunicationsOutputDeviceID() override;
virtual std::unique_ptr<AudioDebugRecordingManager>
- CreateAudioDebugRecordingManager(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+ CreateAudioDebugRecordingManager();
AudioDebugRecordingManager* GetAudioDebugRecordingManager() final;
+ void SetAecDumpRecordingManager(base::WeakPtr<AecdumpRecordingManager>
+ aecdump_recording_manager) override;
+
// These functions assign group ids to devices based on their device ids. The
// default implementation is an attempt to do this based on
// GetAssociatedOutputDeviceID. They may be overridden by subclasses that want
@@ -181,8 +184,6 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
struct DispatcherParams;
typedef std::vector<std::unique_ptr<DispatcherParams>> AudioOutputDispatchers;
- class CompareByParams;
-
// AudioManager:
void InitializeDebugRecording() final;
diff --git a/chromium/media/audio/audio_manager_unittest.cc b/chromium/media/audio/audio_manager_unittest.cc
index 161ab95f7b5..86f0a01accd 100644
--- a/chromium/media/audio/audio_manager_unittest.cc
+++ b/chromium/media/audio/audio_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,6 +14,7 @@
#include "base/environment.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
+#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -129,18 +130,20 @@ const uint64_t kJabraMic2StableDeviceId = 90002;
const uint64_t kWebcamMicId = 40003;
const uint64_t kWebcamMicStableDeviceId = 90003;
-const AudioNode kInternalSpeaker(false,
- kInternalSpeakerId,
- true,
- kInternalSpeakerStableDeviceId,
- kInternalSpeakerStableDeviceId ^ 0xFF,
- "Internal Speaker",
- "INTERNAL_SPEAKER",
- "Speaker",
- false,
- 0,
- 2,
- 0);
+const AudioNode kInternalSpeaker(
+ false,
+ kInternalSpeakerId,
+ true,
+ kInternalSpeakerStableDeviceId,
+ kInternalSpeakerStableDeviceId ^ 0xFF,
+ "Internal Speaker",
+ "INTERNAL_SPEAKER",
+ "Speaker",
+ false,
+ 0,
+ 2,
+ 0,
+ 25); // output nodes should get a valid number (>0)
const AudioNode kInternalMic(true,
kInternalMicId,
@@ -153,33 +156,38 @@ const AudioNode kInternalMic(true,
false,
0,
1,
- 1); // EFFECT_TYPE_NOISE_CANCELLATION
-
-const AudioNode kJabraSpeaker1(false,
- kJabraSpeaker1Id,
- true,
- kJabraSpeaker1StableDeviceId,
- kJabraSpeaker1StableDeviceId ^ 0xFF,
- "Jabra Speaker",
- "USB",
- "Jabra Speaker 1",
- false,
- 0,
- 2, // expects CHANNEL_LAYOUT_STEREO
- 0);
-
-const AudioNode kJabraSpeaker2(false,
- kJabraSpeaker2Id,
- true,
- kJabraSpeaker2StableDeviceId,
- kJabraSpeaker2StableDeviceId ^ 0xFF,
- "Jabra Speaker",
- "USB",
- "Jabra Speaker 2",
- false,
- 0,
- 6, // expects CHANNEL_LAYOUT_5_1
- 0);
+ 1, // EFFECT_TYPE_NOISE_CANCELLATION
+ 0); // input nodes this value is invalid (0)
+
+const AudioNode kJabraSpeaker1(
+ false,
+ kJabraSpeaker1Id,
+ true,
+ kJabraSpeaker1StableDeviceId,
+ kJabraSpeaker1StableDeviceId ^ 0xFF,
+ "Jabra Speaker",
+ "USB",
+ "Jabra Speaker 1",
+ false,
+ 0,
+ 2, // expects CHANNEL_LAYOUT_STEREO
+ 0,
+ 25); // output nodes should get a valid number (>0)
+
+const AudioNode kJabraSpeaker2(
+ false,
+ kJabraSpeaker2Id,
+ true,
+ kJabraSpeaker2StableDeviceId,
+ kJabraSpeaker2StableDeviceId ^ 0xFF,
+ "Jabra Speaker",
+ "USB",
+ "Jabra Speaker 2",
+ false,
+ 0,
+ 6, // expects CHANNEL_LAYOUT_5_1
+ 0,
+ 25); // output nodes should get a valid number (>0)
const AudioNode kHDMIOutput(false,
kHDMIOutputId,
@@ -192,7 +200,8 @@ const AudioNode kHDMIOutput(false,
false,
0,
8, // expects CHANNEL_LAYOUT_7_1
- 0);
+ 0,
+ 25); // output nodes should get a valid number (>0)
const AudioNode kJabraMic1(true,
kJabraMic1Id,
@@ -205,7 +214,8 @@ const AudioNode kJabraMic1(true,
false,
0,
1,
- 0);
+ 0,
+ 0); // input nodes this value is invalid (0)
const AudioNode kJabraMic2(true,
kJabraMic2Id,
@@ -218,7 +228,8 @@ const AudioNode kJabraMic2(true,
false,
0,
1,
- 0);
+ 0,
+ 0); // input nodes this value is invalid (0)
const AudioNode kUSBCameraMic(true,
kWebcamMicId,
@@ -231,7 +242,8 @@ const AudioNode kUSBCameraMic(true,
false,
0,
1,
- 0);
+ 0,
+ 0); // input nodes this value is invalid (0)
#endif // defined(USE_CRAS)
const char kRealDefaultInputDeviceID[] = "input2";
@@ -272,7 +284,7 @@ class AudioManagerTest : public ::testing::Test {
public:
void HandleDefaultDeviceIDsTest() {
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, 48000, 2048);
+ ChannelLayoutConfig::Stereo(), 48000, 2048);
// Create a stream with the default device id "".
AudioOutputStream* stream =
@@ -334,7 +346,8 @@ class AudioManagerTest : public ::testing::Test {
}
AudioParameters GetPreferredOutputStreamParameters(
- ChannelLayout channel_layout, int32_t user_buffer_size = 0) {
+ const ChannelLayoutConfig& channel_layout_config,
+ int32_t user_buffer_size = 0) {
// Generated AudioParameters should follow the same rule as in
// AudioManagerCras::GetPreferredOutputStreamParameters().
int sample_rate = kDefaultSampleRate;
@@ -342,8 +355,8 @@ class AudioManagerTest : public ::testing::Test {
if (buffer_size == 0) // Not user-provided.
cras_audio_handler_->GetDefaultOutputBufferSize(&buffer_size);
return AudioParameters(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate,
- buffer_size,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout_config,
+ sample_rate, buffer_size,
AudioParameters::HardwareCapabilities(limits::kMinAudioBufferSize,
limits::kMaxAudioBufferSize));
}
@@ -438,11 +451,8 @@ class AudioManagerTest : public ::testing::Test {
// Helper method for (USE_CRAS) which returns |group_id| from |device_id|.
std::string getGroupID(const AudioDeviceDescriptions& device_descriptions,
const std::string device_id) {
- AudioDeviceDescriptions::const_iterator it =
- std::find_if(device_descriptions.begin(), device_descriptions.end(),
- [&device_id](const auto& audio_device_desc) {
- return audio_device_desc.unique_id == device_id;
- });
+ AudioDeviceDescriptions::const_iterator it = base::ranges::find(
+ device_descriptions, device_id, &AudioDeviceDescription::unique_id);
EXPECT_NE(it, device_descriptions.end());
return it->group_id;
@@ -579,18 +589,18 @@ TEST_F(AudioManagerTest, CheckOutputStreamParametersCras) {
// should be reflected to the specific output device.
params = device_info_accessor_->GetOutputStreamParameters(
base::NumberToString(kJabraSpeaker1Id));
- golden_params = GetPreferredOutputStreamParameters(
- ChannelLayout::CHANNEL_LAYOUT_STEREO);
+ golden_params =
+ GetPreferredOutputStreamParameters(ChannelLayoutConfig::Stereo());
EXPECT_TRUE(params.Equals(golden_params));
params = device_info_accessor_->GetOutputStreamParameters(
base::NumberToString(kJabraSpeaker2Id));
golden_params = GetPreferredOutputStreamParameters(
- ChannelLayout::CHANNEL_LAYOUT_5_1);
+ ChannelLayoutConfig::FromLayout<ChannelLayout::CHANNEL_LAYOUT_5_1>());
EXPECT_TRUE(params.Equals(golden_params));
params = device_info_accessor_->GetOutputStreamParameters(
base::NumberToString(kHDMIOutputId));
golden_params = GetPreferredOutputStreamParameters(
- ChannelLayout::CHANNEL_LAYOUT_7_1);
+ ChannelLayoutConfig::FromLayout<ChannelLayout::CHANNEL_LAYOUT_7_1>());
EXPECT_TRUE(params.Equals(golden_params));
// Set user-provided audio buffer size by command line, then check the buffer
@@ -608,26 +618,30 @@ TEST_F(AudioManagerTest, CheckOutputStreamParametersCras) {
params = device_info_accessor_->GetOutputStreamParameters(
AudioDeviceDescription::kDefaultDeviceId);
golden_params = GetPreferredOutputStreamParameters(
- ChannelLayout::CHANNEL_LAYOUT_STEREO, 2048);
+ ChannelLayoutConfig::FromLayout<ChannelLayout::CHANNEL_LAYOUT_STEREO>(),
+ 2048);
EXPECT_TRUE(params.Equals(golden_params));
SetActiveOutputNode(kJabraSpeaker2Id);
params = device_info_accessor_->GetOutputStreamParameters(
AudioDeviceDescription::kDefaultDeviceId);
golden_params = GetPreferredOutputStreamParameters(
- ChannelLayout::CHANNEL_LAYOUT_5_1, 2048);
+ ChannelLayoutConfig::FromLayout<ChannelLayout::CHANNEL_LAYOUT_5_1>(),
+ 2048);
EXPECT_TRUE(params.Equals(golden_params));
SetActiveOutputNode(kHDMIOutputId);
params = device_info_accessor_->GetOutputStreamParameters(
AudioDeviceDescription::kDefaultDeviceId);
golden_params = GetPreferredOutputStreamParameters(
- ChannelLayout::CHANNEL_LAYOUT_7_1, 2048);
+ ChannelLayoutConfig::FromLayout<ChannelLayout::CHANNEL_LAYOUT_7_1>(),
+ 2048);
EXPECT_TRUE(params.Equals(golden_params));
// Check non-default device again.
params = device_info_accessor_->GetOutputStreamParameters(
base::NumberToString(kJabraSpeaker1Id));
golden_params = GetPreferredOutputStreamParameters(
- ChannelLayout::CHANNEL_LAYOUT_STEREO, 2048);
+ ChannelLayoutConfig::FromLayout<ChannelLayout::CHANNEL_LAYOUT_STEREO>(),
+ 2048);
EXPECT_TRUE(params.Equals(golden_params));
}
diff --git a/chromium/media/audio/audio_opus_encoder.cc b/chromium/media/audio/audio_opus_encoder.cc
index eff6da899d7..235a2356b6f 100644
--- a/chromium/media/audio/audio_opus_encoder.cc
+++ b/chromium/media/audio/audio_opus_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -46,9 +46,8 @@ AudioParameters CreateInputParams(const AudioEncoder::Options& options) {
kOpusPreferredBufferDurationMs /
base::Time::kMillisecondsPerSecond;
AudioParameters result(media::AudioParameters::AUDIO_PCM_LINEAR,
- media::CHANNEL_LAYOUT_DISCRETE, options.sample_rate,
- frames_per_buffer);
- result.set_channels_for_discrete(options.channels);
+ {media::CHANNEL_LAYOUT_DISCRETE, options.channels},
+ options.sample_rate, frames_per_buffer);
return result;
}
@@ -68,9 +67,10 @@ AudioParameters CreateOpusCompatibleParams(const AudioParameters& params) {
const int frames_per_buffer = used_rate * kOpusPreferredBufferDurationMs /
base::Time::kMillisecondsPerSecond;
- AudioParameters result(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- GuessChannelLayout(std::min(params.channels(), 2)),
- used_rate, frames_per_buffer);
+ AudioParameters result(
+ AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::Guess(std::min(params.channels(), 2)), used_rate,
+ frames_per_buffer);
return result;
}
diff --git a/chromium/media/audio/audio_opus_encoder.h b/chromium/media/audio/audio_opus_encoder.h
index d439c5bde02..846a6618e91 100644
--- a/chromium/media/audio/audio_opus_encoder.h
+++ b/chromium/media/audio/audio_opus_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_delegate.cc b/chromium/media/audio/audio_output_delegate.cc
index 98e11e96173..c52f6d2129a 100644
--- a/chromium/media/audio/audio_output_delegate.cc
+++ b/chromium/media/audio/audio_output_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_delegate.h b/chromium/media/audio/audio_output_delegate.h
index 607f4f8aa70..28c2f9887ec 100644
--- a/chromium/media/audio/audio_output_delegate.h
+++ b/chromium/media/audio/audio_output_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_device.cc b/chromium/media/audio/audio_output_device.cc
index c1b8347018d..301bff6bd02 100644
--- a/chromium/media/audio/audio_output_device.cc
+++ b/chromium/media/audio/audio_output_device.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_device.h b/chromium/media/audio/audio_output_device.h
index a8bfc71ba20..6a72534df0a 100644
--- a/chromium/media/audio/audio_output_device.h
+++ b/chromium/media/audio/audio_output_device.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/audio_output_device_thread_callback.cc b/chromium/media/audio/audio_output_device_thread_callback.cc
index 6afce2f04bf..29109fcbaa1 100644
--- a/chromium/media/audio/audio_output_device_thread_callback.cc
+++ b/chromium/media/audio/audio_output_device_thread_callback.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_device_thread_callback.h b/chromium/media/audio/audio_output_device_thread_callback.h
index b98d8b56cde..8ea3f3923d0 100644
--- a/chromium/media/audio/audio_output_device_thread_callback.h
+++ b/chromium/media/audio/audio_output_device_thread_callback.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_device_unittest.cc b/chromium/media/audio/audio_output_device_unittest.cc
index 3474215935b..0e1136b1e17 100644
--- a/chromium/media/audio/audio_output_device_unittest.cc
+++ b/chromium/media/audio/audio_output_device_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -123,7 +123,7 @@ class AudioOutputDeviceTest : public testing::Test {
AudioOutputDeviceTest::AudioOutputDeviceTest()
: device_status_(OUTPUT_DEVICE_STATUS_ERROR_INTERNAL) {
default_audio_parameters_.Reset(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 48000, 1024);
+ ChannelLayoutConfig::Stereo(), 48000, 1024);
SetDevice(kDefaultDeviceId);
}
diff --git a/chromium/media/audio/audio_output_dispatcher.cc b/chromium/media/audio/audio_output_dispatcher.cc
index 3d4f391795b..97655cdcc86 100644
--- a/chromium/media/audio/audio_output_dispatcher.cc
+++ b/chromium/media/audio/audio_output_dispatcher.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_dispatcher.h b/chromium/media/audio/audio_output_dispatcher.h
index 063c95bdf44..50a8b0b916e 100644
--- a/chromium/media/audio/audio_output_dispatcher.h
+++ b/chromium/media/audio/audio_output_dispatcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_dispatcher_impl.cc b/chromium/media/audio/audio_output_dispatcher_impl.cc
index dd9279fd6d7..231f565fb7b 100644
--- a/chromium/media/audio/audio_output_dispatcher_impl.cc
+++ b/chromium/media/audio/audio_output_dispatcher_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_dispatcher_impl.h b/chromium/media/audio/audio_output_dispatcher_impl.h
index 09decca2de4..c793a226492 100644
--- a/chromium/media/audio/audio_output_dispatcher_impl.h
+++ b/chromium/media/audio/audio_output_dispatcher_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_ipc.cc b/chromium/media/audio/audio_output_ipc.cc
index eb07d30e55a..0782da5f20d 100644
--- a/chromium/media/audio/audio_output_ipc.cc
+++ b/chromium/media/audio/audio_output_ipc.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_ipc.h b/chromium/media/audio/audio_output_ipc.h
index 7fb9898e80b..1b77a77862c 100644
--- a/chromium/media/audio/audio_output_ipc.h
+++ b/chromium/media/audio/audio_output_ipc.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_proxy.cc b/chromium/media/audio/audio_output_proxy.cc
index d205d67091e..5f17fe6f804 100644
--- a/chromium/media/audio/audio_output_proxy.cc
+++ b/chromium/media/audio/audio_output_proxy.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_proxy.h b/chromium/media/audio/audio_output_proxy.h
index 13c7fc27152..118677fa54b 100644
--- a/chromium/media/audio/audio_output_proxy.h
+++ b/chromium/media/audio/audio_output_proxy.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_proxy_unittest.cc b/chromium/media/audio/audio_output_proxy_unittest.cc
index 58ff35441a3..ac25a224306 100644
--- a/chromium/media/audio/audio_output_proxy_unittest.cc
+++ b/chromium/media/audio/audio_output_proxy_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -173,7 +173,7 @@ class AudioOutputProxyTest : public testing::Test {
// FakeAudioOutputStream will keep the message loop busy indefinitely; i.e.,
// RunUntilIdle() will never terminate.
params_ = AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 8000, 2048);
+ ChannelLayoutConfig::Stereo(), 8000, 2048);
InitDispatcher(base::Milliseconds(kTestCloseDelayMs));
}
@@ -501,8 +501,9 @@ class AudioOutputResamplerTest : public AudioOutputProxyTest {
// Use a low sample rate and large buffer size when testing otherwise the
// FakeAudioOutputStream will keep the message loop busy indefinitely; i.e.,
// RunUntilIdle() will never terminate.
- resampler_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, 16000, 1024);
+ resampler_params_ =
+ AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::Stereo(), 16000, 1024);
resampler_ = std::make_unique<AudioOutputResampler>(
&manager(), params_, resampler_params_, std::string(), close_delay,
base::BindRepeating(&RegisterDebugRecording));
diff --git a/chromium/media/audio/audio_output_resampler.cc b/chromium/media/audio/audio_output_resampler.cc
index cd2c2baf209..fca550200fc 100644
--- a/chromium/media/audio/audio_output_resampler.cc
+++ b/chromium/media/audio/audio_output_resampler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_resampler.h b/chromium/media/audio/audio_output_resampler.h
index f9d9c3b21b6..96aab4a95a6 100644
--- a/chromium/media/audio/audio_output_resampler.h
+++ b/chromium/media/audio/audio_output_resampler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_stream_sink.cc b/chromium/media/audio/audio_output_stream_sink.cc
index 1dff40e1449..a8732537079 100644
--- a/chromium/media/audio/audio_output_stream_sink.cc
+++ b/chromium/media/audio/audio_output_stream_sink.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_stream_sink.h b/chromium/media/audio/audio_output_stream_sink.h
index 2589a264e4f..308033579c2 100644
--- a/chromium/media/audio/audio_output_stream_sink.h
+++ b/chromium/media/audio/audio_output_stream_sink.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_output_unittest.cc b/chromium/media/audio/audio_output_unittest.cc
index 19aa1f115a7..3de3f6e5c29 100644
--- a/chromium/media/audio/audio_output_unittest.cc
+++ b/chromium/media/audio/audio_output_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_sink_parameters.cc b/chromium/media/audio/audio_sink_parameters.cc
index 8287fa07779..52d9fc42115 100644
--- a/chromium/media/audio/audio_sink_parameters.cc
+++ b/chromium/media/audio/audio_sink_parameters.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_sink_parameters.h b/chromium/media/audio/audio_sink_parameters.h
index a96679bb3f4..51939d03012 100644
--- a/chromium/media/audio/audio_sink_parameters.h
+++ b/chromium/media/audio/audio_sink_parameters.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_source_parameters.cc b/chromium/media/audio/audio_source_parameters.cc
index 8585904ff81..92b10a459ad 100644
--- a/chromium/media/audio/audio_source_parameters.cc
+++ b/chromium/media/audio/audio_source_parameters.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_source_parameters.h b/chromium/media/audio/audio_source_parameters.h
index d0e36fed089..2be9b2e22f2 100644
--- a/chromium/media/audio/audio_source_parameters.h
+++ b/chromium/media/audio/audio_source_parameters.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_system.cc b/chromium/media/audio/audio_system.cc
index 81c58aa4a3a..132cbfbf27b 100644
--- a/chromium/media/audio/audio_system.cc
+++ b/chromium/media/audio/audio_system.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_system.h b/chromium/media/audio/audio_system.h
index 9701570bb73..07811594c15 100644
--- a/chromium/media/audio/audio_system.h
+++ b/chromium/media/audio/audio_system.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_system_helper.cc b/chromium/media/audio/audio_system_helper.cc
index f30c7172073..4ea32545c38 100644
--- a/chromium/media/audio/audio_system_helper.cc
+++ b/chromium/media/audio/audio_system_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,7 +22,8 @@ absl::optional<AudioParameters> TryToFixChannels(
// better to report a valid value if this is the only problem.
if (params.channels() > limits::kMaxChannels) {
DCHECK(params.channel_layout() == CHANNEL_LAYOUT_DISCRETE);
- params_copy.set_channels_for_discrete(limits::kMaxChannels);
+ params_copy.SetChannelLayoutConfig(CHANNEL_LAYOUT_DISCRETE,
+ limits::kMaxChannels);
}
return params_copy.IsValid() ? params_copy
diff --git a/chromium/media/audio/audio_system_helper.h b/chromium/media/audio/audio_system_helper.h
index d151859e0f4..35a0b6532b4 100644
--- a/chromium/media/audio/audio_system_helper.h
+++ b/chromium/media/audio/audio_system_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_system_impl.cc b/chromium/media/audio/audio_system_impl.cc
index ee04c3e6e5e..905b84808c5 100644
--- a/chromium/media/audio/audio_system_impl.cc
+++ b/chromium/media/audio/audio_system_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/task/single_thread_task_runner.h"
-#include "base/task/task_runner_util.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_manager.h"
#include "media/base/bind_to_current_loop.h"
diff --git a/chromium/media/audio/audio_system_impl.h b/chromium/media/audio/audio_system_impl.h
index b1cdfb4b40d..207b327beb1 100644
--- a/chromium/media/audio/audio_system_impl.h
+++ b/chromium/media/audio/audio_system_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_system_impl_unittest.cc b/chromium/media/audio/audio_system_impl_unittest.cc
index 8375d35908c..f77fe27af26 100644
--- a/chromium/media/audio/audio_system_impl_unittest.cc
+++ b/chromium/media/audio/audio_system_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_system_test_util.cc b/chromium/media/audio/audio_system_test_util.cc
index 7e31a7fff0b..afac0bb24ab 100644
--- a/chromium/media/audio/audio_system_test_util.cc
+++ b/chromium/media/audio/audio_system_test_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_system_test_util.h b/chromium/media/audio/audio_system_test_util.h
index 05fb3d63a5c..71ebca82992 100644
--- a/chromium/media/audio/audio_system_test_util.h
+++ b/chromium/media/audio/audio_system_test_util.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -105,18 +105,18 @@ class AudioSystemTestTemplate : public T {
void SetUp() override {
T::SetUp();
- input_params_ =
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- AudioParameters::kTelephoneSampleRate,
- AudioParameters::kTelephoneSampleRate / 10);
- output_params_ =
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- AudioParameters::kTelephoneSampleRate,
- AudioParameters::kTelephoneSampleRate / 20);
- default_output_params_ =
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- AudioParameters::kTelephoneSampleRate,
- AudioParameters::kTelephoneSampleRate / 30);
+ input_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(),
+ AudioParameters::kTelephoneSampleRate,
+ AudioParameters::kTelephoneSampleRate / 10);
+ output_params_ = AudioParameters(
+ AudioParameters::AUDIO_PCM_LINEAR, ChannelLayoutConfig::Mono(),
+ AudioParameters::kTelephoneSampleRate,
+ AudioParameters::kTelephoneSampleRate / 20);
+ default_output_params_ = AudioParameters(
+ AudioParameters::AUDIO_PCM_LINEAR, ChannelLayoutConfig::Mono(),
+ AudioParameters::kTelephoneSampleRate,
+ AudioParameters::kTelephoneSampleRate / 30);
audio_manager()->SetInputStreamParameters(input_params_);
audio_manager()->SetOutputStreamParameters(output_params_);
audio_manager()->SetDefaultOutputStreamParameters(default_output_params_);
diff --git a/chromium/media/audio/audio_thread.h b/chromium/media/audio/audio_thread.h
index b014b89cfad..4b16d656e18 100644
--- a/chromium/media/audio/audio_thread.h
+++ b/chromium/media/audio/audio_thread.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_thread_hang_monitor.cc b/chromium/media/audio/audio_thread_hang_monitor.cc
index c3c7b7efe50..70080838680 100644
--- a/chromium/media/audio/audio_thread_hang_monitor.cc
+++ b/chromium/media/audio/audio_thread_hang_monitor.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_thread_hang_monitor.h b/chromium/media/audio/audio_thread_hang_monitor.h
index 70f0db692bd..b6975ac2382 100644
--- a/chromium/media/audio/audio_thread_hang_monitor.h
+++ b/chromium/media/audio/audio_thread_hang_monitor.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_thread_hang_monitor_unittest.cc b/chromium/media/audio/audio_thread_hang_monitor_unittest.cc
index 345975f8aac..a55a2fbf9aa 100644
--- a/chromium/media/audio/audio_thread_hang_monitor_unittest.cc
+++ b/chromium/media/audio/audio_thread_hang_monitor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_thread_impl.cc b/chromium/media/audio/audio_thread_impl.cc
index 95a0afa5285..c8f9c5d2a4d 100644
--- a/chromium/media/audio/audio_thread_impl.cc
+++ b/chromium/media/audio/audio_thread_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_thread_impl.h b/chromium/media/audio/audio_thread_impl.h
index 340b2719d44..1fbbda61308 100644
--- a/chromium/media/audio/audio_thread_impl.h
+++ b/chromium/media/audio/audio_thread_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_unittest_util.cc b/chromium/media/audio/audio_unittest_util.cc
index 0ddf94ad35f..a5a24f1374d 100644
--- a/chromium/media/audio/audio_unittest_util.cc
+++ b/chromium/media/audio/audio_unittest_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/audio_unittest_util.h b/chromium/media/audio/audio_unittest_util.h
index 3bd0dfad676..530dbfe581e 100644
--- a/chromium/media/audio/audio_unittest_util.h
+++ b/chromium/media/audio/audio_unittest_util.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/clockless_audio_sink.cc b/chromium/media/audio/clockless_audio_sink.cc
index b30df2cf20d..1b121c0a31c 100644
--- a/chromium/media/audio/clockless_audio_sink.cc
+++ b/chromium/media/audio/clockless_audio_sink.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/clockless_audio_sink.h b/chromium/media/audio/clockless_audio_sink.h
index 0d0093cecb1..c865cff0ec6 100644
--- a/chromium/media/audio/clockless_audio_sink.h
+++ b/chromium/media/audio/clockless_audio_sink.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/cras/audio_manager_chromeos.cc b/chromium/media/audio/cras/audio_manager_chromeos.cc
index d3e1e96945c..fbe90b8f17b 100644
--- a/chromium/media/audio/cras/audio_manager_chromeos.cc
+++ b/chromium/media/audio/cras/audio_manager_chromeos.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,6 @@
#include <stddef.h>
-#include <algorithm>
#include <map>
#include <utility>
@@ -16,6 +15,7 @@
#include "base/environment.h"
#include "base/metrics/field_trial_params.h"
#include "base/nix/xdg_util.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/system/sys_info.h"
@@ -294,8 +294,8 @@ std::string AudioManagerChromeOS::GetAssociatedOutputDeviceID(
return "";
// Now search for an output device with the same device name.
- auto output_device_it = std::find_if(
- devices.begin(), devices.end(), [device_name](const AudioDevice& device) {
+ auto output_device_it =
+ base::ranges::find_if(devices, [device_name](const AudioDevice& device) {
return !device.is_input && device.device_name == device_name;
});
return output_device_it == devices.end()
@@ -385,11 +385,11 @@ AudioParameters AudioManagerChromeOS::GetPreferredOutputStreamParameters(
const AudioParameters& input_params) {
DCHECK(GetTaskRunner()->BelongsToCurrentThread());
- ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
+ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Stereo();
int sample_rate = kDefaultSampleRate;
int buffer_size = GetUserBufferSize();
if (input_params.IsValid()) {
- channel_layout = input_params.channel_layout();
+ channel_layout_config = input_params.channel_layout_config();
sample_rate = input_params.sample_rate();
if (!buffer_size) // Not user-provided.
buffer_size =
@@ -397,8 +397,8 @@ AudioParameters AudioManagerChromeOS::GetPreferredOutputStreamParameters(
std::max(static_cast<int>(limits::kMinAudioBufferSize),
input_params.frames_per_buffer()));
return AudioParameters(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate,
- buffer_size,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout_config,
+ sample_rate, buffer_size,
AudioParameters::HardwareCapabilities(limits::kMinAudioBufferSize,
limits::kMaxAudioBufferSize));
}
@@ -418,11 +418,12 @@ AudioParameters AudioManagerChromeOS::GetPreferredOutputStreamParameters(
GetAudioDevices(&devices);
const AudioDevice* device = GetDeviceFromId(devices, preferred_device_id);
if (device && device->is_input == false) {
- channel_layout =
- GuessChannelLayout(static_cast<int>(device->max_supported_channels));
+ channel_layout_config = ChannelLayoutConfig::Guess(
+ static_cast<int>(device->max_supported_channels));
// Fall-back to old fashion: always fixed to STEREO layout.
- if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) {
- channel_layout = CHANNEL_LAYOUT_STEREO;
+ if (channel_layout_config.channel_layout() ==
+ CHANNEL_LAYOUT_UNSUPPORTED) {
+ channel_layout_config = ChannelLayoutConfig::Stereo();
}
}
}
@@ -431,8 +432,8 @@ AudioParameters AudioManagerChromeOS::GetPreferredOutputStreamParameters(
buffer_size = GetDefaultOutputBufferSizePerBoard();
return AudioParameters(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate,
- buffer_size,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout_config,
+ sample_rate, buffer_size,
AudioParameters::HardwareCapabilities(limits::kMinAudioBufferSize,
limits::kMaxAudioBufferSize));
}
@@ -585,7 +586,7 @@ AudioParameters AudioManagerChromeOS::GetStreamParametersForSystem(
int user_buffer_size,
const AudioManagerChromeOS::SystemAudioProcessingInfo& system_apm_info) {
AudioParameters params(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, ChannelLayoutConfig::Stereo(),
kDefaultSampleRate, user_buffer_size,
AudioParameters::HardwareCapabilities(limits::kMinAudioBufferSize,
limits::kMaxAudioBufferSize));
diff --git a/chromium/media/audio/cras/audio_manager_chromeos.h b/chromium/media/audio/cras/audio_manager_chromeos.h
index bec0fdc05af..a9071871161 100644
--- a/chromium/media/audio/cras/audio_manager_chromeos.h
+++ b/chromium/media/audio/cras/audio_manager_chromeos.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/cras/audio_manager_chromeos_unittest.cc b/chromium/media/audio/cras/audio_manager_chromeos_unittest.cc
index 440f790e5fa..9a100bb8b1b 100644
--- a/chromium/media/audio/cras/audio_manager_chromeos_unittest.cc
+++ b/chromium/media/audio/cras/audio_manager_chromeos_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/audio/cras/audio_manager_chromeos.h"
@@ -274,8 +274,8 @@ class AllowedDspParameters
AudioManagerChromeOS::SystemAudioProcessingInfo system_apm_info_;
size_t user_buffer_size_ = kDefaultInputBufferSize;
- std::vector<base::Feature> enabled_features_;
- std::vector<base::Feature> disabled_features_;
+ std::vector<base::test::FeatureRef> enabled_features_;
+ std::vector<base::test::FeatureRef> disabled_features_;
bool aec_on_dsp_allowed_;
bool ns_on_dsp_allowed_;
bool agc_on_dsp_allowed_;
diff --git a/chromium/media/audio/cras/audio_manager_cras.cc b/chromium/media/audio/cras/audio_manager_cras.cc
index 4762e88f43b..b1717770a8d 100644
--- a/chromium/media/audio/cras/audio_manager_cras.cc
+++ b/chromium/media/audio/cras/audio_manager_cras.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -183,7 +183,7 @@ void RetrieveSystemEffectFeatures(bool& enforce_system_aec,
AudioParameters AudioManagerCras::GetStreamParametersForSystem(
int user_buffer_size) {
AudioParameters params(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, CHANNEL_LAYOUT_STEREO,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, ChannelLayoutConfig::Stereo(),
kDefaultSampleRate, user_buffer_size,
AudioParameters::HardwareCapabilities(limits::kMinAudioBufferSize,
limits::kMaxAudioBufferSize));
@@ -313,11 +313,11 @@ AudioParameters AudioManagerCras::GetPreferredOutputStreamParameters(
const std::string& output_device_id,
const AudioParameters& input_params) {
DCHECK(GetTaskRunner()->BelongsToCurrentThread());
- ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
+ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Stereo();
int sample_rate = kDefaultSampleRate;
int buffer_size = GetUserBufferSize();
if (input_params.IsValid()) {
- channel_layout = input_params.channel_layout();
+ channel_layout_config = input_params.channel_layout_config();
sample_rate = input_params.sample_rate();
if (!buffer_size) // Not user-provided.
buffer_size =
@@ -325,8 +325,8 @@ AudioParameters AudioManagerCras::GetPreferredOutputStreamParameters(
std::max(static_cast<int>(limits::kMinAudioBufferSize),
input_params.frames_per_buffer()));
return AudioParameters(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate,
- buffer_size,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout_config,
+ sample_rate, buffer_size,
AudioParameters::HardwareCapabilities(limits::kMinAudioBufferSize,
limits::kMaxAudioBufferSize));
}
@@ -344,11 +344,12 @@ AudioParameters AudioManagerCras::GetPreferredOutputStreamParameters(
for (const auto& device :
cras_util_->CrasGetAudioDevices(DeviceType::kOutput)) {
if (device.id == preferred_device_id) {
- channel_layout =
- GuessChannelLayout(static_cast<int>(device.max_supported_channels));
+ channel_layout_config = ChannelLayoutConfig::Guess(
+ static_cast<int>(device.max_supported_channels));
// Fall-back to old fashion: always fixed to STEREO layout.
- if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) {
- channel_layout = CHANNEL_LAYOUT_STEREO;
+ if (channel_layout_config.channel_layout() ==
+ CHANNEL_LAYOUT_UNSUPPORTED) {
+ channel_layout_config = ChannelLayoutConfig::Stereo();
}
break;
}
@@ -361,8 +362,8 @@ AudioParameters AudioManagerCras::GetPreferredOutputStreamParameters(
buffer_size = kDefaultOutputBufferSize;
return AudioParameters(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate,
- buffer_size,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout_config,
+ sample_rate, buffer_size,
AudioParameters::HardwareCapabilities(limits::kMinAudioBufferSize,
limits::kMaxAudioBufferSize));
}
diff --git a/chromium/media/audio/cras/audio_manager_cras.h b/chromium/media/audio/cras/audio_manager_cras.h
index db0426492ca..60317e985af 100644
--- a/chromium/media/audio/cras/audio_manager_cras.h
+++ b/chromium/media/audio/cras/audio_manager_cras.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/cras/audio_manager_cras_base.cc b/chromium/media/audio/cras/audio_manager_cras_base.cc
index b7eecf40279..dca0ed1d384 100644
--- a/chromium/media/audio/cras/audio_manager_cras_base.cc
+++ b/chromium/media/audio/cras/audio_manager_cras_base.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,6 +14,7 @@
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/environment.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial_params.h"
#include "base/nix/xdg_util.h"
#include "base/strings/string_number_conversions.h"
@@ -92,4 +93,25 @@ AudioInputStream* AudioManagerCrasBase::MakeInputStream(
return new CrasInputStream(params, this, device_id);
}
+void AudioManagerCrasBase::RegisterSystemAecDumpSource(
+ AecdumpRecordingSource* stream) {
+ DCHECK(GetTaskRunner()->BelongsToCurrentThread());
+ if (aecdump_recording_manager_)
+ aecdump_recording_manager_->RegisterAecdumpSource(stream);
+}
+
+void AudioManagerCrasBase::DeregisterSystemAecDumpSource(
+ AecdumpRecordingSource* stream) {
+ DCHECK(GetTaskRunner()->BelongsToCurrentThread());
+ if (aecdump_recording_manager_)
+ aecdump_recording_manager_->DeregisterAecdumpSource(stream);
+}
+
+void AudioManagerCrasBase::SetAecDumpRecordingManager(
+ base::WeakPtr<AecdumpRecordingManager> aecdump_recording_manager) {
+ DCHECK(GetTaskRunner()->BelongsToCurrentThread());
+ DCHECK(!aecdump_recording_manager_);
+ aecdump_recording_manager_ = aecdump_recording_manager;
+}
+
} // namespace media
diff --git a/chromium/media/audio/cras/audio_manager_cras_base.h b/chromium/media/audio/cras/audio_manager_cras_base.h
index 6c5d84599c1..b5633d2c8f6 100644
--- a/chromium/media/audio/cras/audio_manager_cras_base.h
+++ b/chromium/media/audio/cras/audio_manager_cras_base.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -54,6 +54,16 @@ class MEDIA_EXPORT AudioManagerCrasBase : public AudioManagerBase {
// Returns CRAS client type.
virtual enum CRAS_CLIENT_TYPE GetClientType() = 0;
+ // Registers a CrasInputStream as the source of system AEC dump.
+ virtual void RegisterSystemAecDumpSource(AecdumpRecordingSource* stream);
+
+ // Unregisters system AEC dump. Virtual to mock in unittest.
+ virtual void DeregisterSystemAecDumpSource(AecdumpRecordingSource* stream);
+
+ virtual void SetAecDumpRecordingManager(
+ base::WeakPtr<AecdumpRecordingManager> aecdump_recording_manager)
+ override;
+
protected:
// Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
AudioOutputStream* MakeOutputStream(const AudioParameters& params,
@@ -62,6 +72,10 @@ class MEDIA_EXPORT AudioManagerCrasBase : public AudioManagerBase {
// Called by MakeLinearInputStream and MakeLowLatencyInputStream.
AudioInputStream* MakeInputStream(const AudioParameters& params,
const std::string& device_id);
+
+ private:
+ // Manages starting / stopping of aecdump recording.
+ base::WeakPtr<AecdumpRecordingManager> aecdump_recording_manager_;
};
} // namespace media
diff --git a/chromium/media/audio/cras/audio_manager_cras_base_unittest.cc b/chromium/media/audio/cras/audio_manager_cras_base_unittest.cc
new file mode 100644
index 00000000000..c653d087c00
--- /dev/null
+++ b/chromium/media/audio/cras/audio_manager_cras_base_unittest.cc
@@ -0,0 +1,90 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/audio/cras/audio_manager_cras_base.h"
+
+#include "base/test/task_environment.h"
+#include "media/audio/fake_audio_log_factory.h"
+#include "media/audio/mock_aecdump_recording_manager.h"
+#include "media/audio/test_audio_thread.h"
+#include "media/base/audio_parameters.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using testing::_;
+using testing::StrictMock;
+
+namespace media {
+
+namespace {
+
+class MockAecdumpRecordingSource : public AecdumpRecordingSource {
+ public:
+ MOCK_METHOD1(StartAecdump, void(base::File));
+ MOCK_METHOD0(StopAecdump, void());
+};
+
+class MockAudioManagerCrasBase : public AudioManagerCrasBase {
+ public:
+ MockAudioManagerCrasBase()
+ : AudioManagerCrasBase(std::make_unique<TestAudioThread>(),
+ &fake_audio_log_factory_) {}
+
+ bool HasAudioOutputDevices() { return true; }
+ bool HasAudioInputDevices() { return true; }
+ AudioParameters GetPreferredOutputStreamParameters(
+ const std::string& output_device_id,
+ const AudioParameters& input_params) {
+ return AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(), 44100, 1000);
+ }
+ bool IsDefault(const std::string& device_id, bool is_input) override {
+ return true;
+ }
+ enum CRAS_CLIENT_TYPE GetClientType() { return CRAS_CLIENT_TYPE_LACROS; }
+
+ // We need to override this function in order to skip checking the number
+ // of active output streams. It is because the number of active streams
+ // is managed inside MakeAudioInputStream, and we don't use
+ // MakeAudioInputStream to create the stream in the tests.
+ void ReleaseInputStream(AudioInputStream* stream) override {
+ DCHECK(stream);
+ delete stream;
+ }
+
+ private:
+ FakeAudioLogFactory fake_audio_log_factory_;
+};
+
+class AudioManagerCrasBaseTest : public testing::Test {
+ protected:
+ AudioManagerCrasBaseTest() {
+ mock_manager_.reset(new StrictMock<MockAudioManagerCrasBase>());
+ base::RunLoop().RunUntilIdle();
+ }
+ ~AudioManagerCrasBaseTest() override { mock_manager_->Shutdown(); }
+
+ base::test::SingleThreadTaskEnvironment task_environment_;
+ std::unique_ptr<StrictMock<MockAudioManagerCrasBase>> mock_manager_ = NULL;
+};
+
+TEST_F(AudioManagerCrasBaseTest, SetAecDumpRecordingManager) {
+ MockAecdumpRecordingManager* mock_aecdump_recording_manager =
+ new MockAecdumpRecordingManager(mock_manager_->GetTaskRunner());
+ mock_manager_->SetAecDumpRecordingManager(
+ mock_aecdump_recording_manager->AsWeakPtr());
+
+ MockAecdumpRecordingSource* source = new MockAecdumpRecordingSource();
+
+ EXPECT_CALL(*mock_aecdump_recording_manager, RegisterAecdumpSource(_));
+ EXPECT_CALL(*mock_aecdump_recording_manager, DeregisterAecdumpSource(_));
+
+ mock_manager_->RegisterSystemAecDumpSource(source);
+ mock_manager_->DeregisterSystemAecDumpSource(source);
+
+ delete mock_aecdump_recording_manager;
+}
+
+} // namespace
+} // namespace media
diff --git a/chromium/media/audio/cras/audio_manager_cras_unittest.cc b/chromium/media/audio/cras/audio_manager_cras_unittest.cc
index 434eccfef45..f05ea5a31a5 100644
--- a/chromium/media/audio/cras/audio_manager_cras_unittest.cc
+++ b/chromium/media/audio/cras/audio_manager_cras_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/cras/cras_input.cc b/chromium/media/audio/cras/cras_input.cc
index 7ffca72d37c..1bf9866181a 100644
--- a/chromium/media/audio/cras/cras_input.cc
+++ b/chromium/media/audio/cras/cras_input.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include <algorithm>
+#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_number_conversions.h"
@@ -74,6 +75,9 @@ CrasInputStream::CrasInputStream(const AudioParameters& params,
mute_system_audio_(device_id ==
AudioDeviceDescription::kLoopbackWithMuteDeviceId),
mute_done_(false),
+#if DCHECK_IS_ON()
+ recording_enabled_(false),
+#endif
input_volume_(1.0f) {
DCHECK(audio_manager_);
audio_bus_ = AudioBus::Create(params_);
@@ -336,6 +340,8 @@ void CrasInputStream::Start(AudioInputCallback* callback) {
started_ = true;
+ audio_manager_->RegisterSystemAecDumpSource(this);
+
ReportStreamStartResult(StreamStartResult::kCallbackStartSuccess);
}
@@ -346,6 +352,8 @@ void CrasInputStream::Stop() {
if (!callback_ || !started_)
return;
+ audio_manager_->DeregisterSystemAecDumpSource(this);
+
if (mute_system_audio_ && mute_done_) {
libcras_client_set_system_mute(client_, 0);
mute_done_ = false;
@@ -464,4 +472,26 @@ void CrasInputStream::SetOutputDeviceForAec(
libcras_client_set_aec_ref(client_, stream_id_, echo_ref_id);
}
+void CrasInputStream::StartAecdump(base::File file) {
+ FILE* stream = base::FileToFILE(std::move(file), "w");
+ if (!client_)
+ return;
+#if DCHECK_IS_ON()
+ DCHECK(!recording_enabled_);
+ recording_enabled_ = true;
+#endif
+
+ libcras_client_set_aec_dump(client_, stream_id_, /*start=*/1, fileno(stream));
+}
+
+void CrasInputStream::StopAecdump() {
+ if (!client_)
+ return;
+#if DCHECK_IS_ON()
+ DCHECK(recording_enabled_);
+ recording_enabled_ = false;
+#endif
+ libcras_client_set_aec_dump(client_, stream_id_, /*start=*/0, /*fd=*/-1);
+}
+
} // namespace media
diff --git a/chromium/media/audio/cras/cras_input.h b/chromium/media/audio/cras/cras_input.h
index 994fef54c04..9f4c19599da 100644
--- a/chromium/media/audio/cras/cras_input.h
+++ b/chromium/media/audio/cras/cras_input.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,7 +13,9 @@
#include <string>
#include "base/compiler_specific.h"
+#include "media/audio/aecdump_recording_manager.h"
#include "media/audio/agc_audio_stream.h"
+#include "media/audio/audio_debug_recording_helper.h"
#include "media/audio/audio_io.h"
#include "media/base/audio_parameters.h"
#include "media/base/media_export.h"
@@ -25,7 +27,8 @@ class AudioManagerCrasBase;
// Provides an input stream for audio capture based on CRAS, the ChromeOS Audio
// Server. This object is not thread safe and all methods should be invoked in
// the thread that created the object.
-class MEDIA_EXPORT CrasInputStream : public AgcAudioStream<AudioInputStream> {
+class MEDIA_EXPORT CrasInputStream : public AgcAudioStream<AudioInputStream>,
+ public AecdumpRecordingSource {
public:
// The ctor takes all the usual parameters, plus |manager| which is the
// audio manager who is creating this object.
@@ -51,6 +54,10 @@ class MEDIA_EXPORT CrasInputStream : public AgcAudioStream<AudioInputStream> {
bool IsMuted() override;
void SetOutputDeviceForAec(const std::string& output_device_id) override;
+ // Implementation of AecdumpRecordingSource
+ void StartAecdump(base::File aecdump_file) override;
+ void StopAecdump() override;
+
private:
// Handles requests to get samples from the provided buffer. This will be
// called by the audio server when it has samples ready.
@@ -128,10 +135,17 @@ class MEDIA_EXPORT CrasInputStream : public AgcAudioStream<AudioInputStream> {
bool mute_system_audio_;
bool mute_done_;
+#if DCHECK_IS_ON()
+ // Flag to indicate if recording has been enabled or not.
+ bool recording_enabled_;
+#endif
+
// Value of input stream volume, between 0.0 - 1.0.
double input_volume_;
std::unique_ptr<AudioBus> audio_bus_;
+
+ base::WeakPtrFactory<CrasInputStream> weak_factory_{this};
};
} // namespace media
diff --git a/chromium/media/audio/cras/cras_input_unittest.cc b/chromium/media/audio/cras/cras_input_unittest.cc
index 76c4a8d70b6..72be910971d 100644
--- a/chromium/media/audio/cras/cras_input_unittest.cc
+++ b/chromium/media/audio/cras/cras_input_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,9 +16,10 @@
#include "chromeos/ash/components/audio/cras_audio_handler.h"
#include "chromeos/ash/components/dbus/audio/fake_cras_audio_client.h"
#include "media/audio/audio_device_description.h"
-#include "media/audio/cras/audio_manager_chromeos.h"
+#include "media/audio/cras/audio_manager_cras.h"
#include "media/audio/fake_audio_log_factory.h"
#include "media/audio/test_audio_thread.h"
+#include "media/base/audio_parameters.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -42,12 +43,29 @@ class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
MOCK_METHOD0(OnError, void());
};
-class MockAudioManagerCrasInput : public AudioManagerChromeOS {
+class MockAudioManagerCrasInput : public AudioManagerCrasBase {
public:
MockAudioManagerCrasInput()
- : AudioManagerChromeOS(std::make_unique<TestAudioThread>(),
+ : AudioManagerCrasBase(std::make_unique<TestAudioThread>(),
&fake_audio_log_factory_) {}
+ MOCK_METHOD1(RegisterSystemAecDumpSource, void(AecdumpRecordingSource*));
+
+ MOCK_METHOD1(DeregisterSystemAecDumpSource, void(AecdumpRecordingSource*));
+
+ bool HasAudioOutputDevices() { return true; }
+ bool HasAudioInputDevices() { return true; }
+ AudioParameters GetPreferredOutputStreamParameters(
+ const std::string& output_device_id,
+ const AudioParameters& input_params) {
+ return AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(), 44100, 1000);
+ }
+ bool IsDefault(const std::string& device_id, bool is_input) override {
+ return true;
+ }
+ enum CRAS_CLIENT_TYPE GetClientType() { return CRAS_CLIENT_TYPE_LACROS; }
+
// We need to override this function in order to skip checking the number
// of active output streams. It is because the number of active streams
// is managed inside MakeAudioInputStream, and we don't use
@@ -79,17 +97,17 @@ class CrasInputStreamTest : public testing::Test {
ash::CrasAudioClient::Shutdown();
}
- CrasInputStream* CreateStream(ChannelLayout layout) {
+ CrasInputStream* CreateStream(ChannelLayoutConfig layout) {
return CreateStream(layout, kTestFramesPerPacket);
}
- CrasInputStream* CreateStream(ChannelLayout layout,
+ CrasInputStream* CreateStream(ChannelLayoutConfig layout,
int32_t samples_per_packet) {
return CreateStream(layout, samples_per_packet,
AudioDeviceDescription::kDefaultDeviceId);
}
- CrasInputStream* CreateStream(ChannelLayout layout,
+ CrasInputStream* CreateStream(ChannelLayoutConfig layout,
int32_t samples_per_packet,
const std::string& device_id) {
AudioParameters params(kTestFormat,
@@ -104,6 +122,9 @@ class CrasInputStreamTest : public testing::Test {
CrasInputStream* test_stream = new CrasInputStream(
params, mock_manager_.get(), AudioDeviceDescription::kDefaultDeviceId);
+ EXPECT_CALL(*mock_manager_.get(), RegisterSystemAecDumpSource(_));
+ EXPECT_CALL(*mock_manager_.get(), DeregisterSystemAecDumpSource(_));
+
EXPECT_EQ(test_stream->Open(), AudioInputStream::OpenOutcome::kSuccess);
// Allow 8 frames variance for SRC in the callback. Different numbers of
@@ -136,7 +157,7 @@ class CrasInputStreamTest : public testing::Test {
};
const unsigned int CrasInputStreamTest::kTestCaptureDurationMs = 250;
-const ChannelLayout CrasInputStreamTest::kTestChannelLayout =
+constexpr ChannelLayout CrasInputStreamTest::kTestChannelLayout =
CHANNEL_LAYOUT_STEREO;
const AudioParameters::Format CrasInputStreamTest::kTestFormat =
AudioParameters::AUDIO_PCM_LINEAR;
@@ -144,22 +165,21 @@ const uint32_t CrasInputStreamTest::kTestFramesPerPacket = 1000;
const int CrasInputStreamTest::kTestSampleRate = 44100;
TEST_F(CrasInputStreamTest, OpenMono) {
- CrasInputStream* test_stream = CreateStream(CHANNEL_LAYOUT_MONO);
+ CrasInputStream* test_stream = CreateStream(ChannelLayoutConfig::Mono());
EXPECT_EQ(test_stream->Open(), AudioInputStream::OpenOutcome::kSuccess);
test_stream->Close();
}
TEST_F(CrasInputStreamTest, OpenStereo) {
- CrasInputStream* test_stream = CreateStream(CHANNEL_LAYOUT_STEREO);
+ CrasInputStream* test_stream = CreateStream(ChannelLayoutConfig::Stereo());
EXPECT_EQ(test_stream->Open(), AudioInputStream::OpenOutcome::kSuccess);
test_stream->Close();
}
TEST_F(CrasInputStreamTest, BadSampleRate) {
- AudioParameters bad_rate_params(kTestFormat,
- kTestChannelLayout,
- 0,
- kTestFramesPerPacket);
+ AudioParameters bad_rate_params(
+ kTestFormat, ChannelLayoutConfig::FromLayout<kTestChannelLayout>(), 0,
+ kTestFramesPerPacket);
CrasInputStream* test_stream =
new CrasInputStream(bad_rate_params, mock_manager_.get(),
AudioDeviceDescription::kDefaultDeviceId);
@@ -168,7 +188,7 @@ TEST_F(CrasInputStreamTest, BadSampleRate) {
}
TEST_F(CrasInputStreamTest, SetGetVolume) {
- CrasInputStream* test_stream = CreateStream(CHANNEL_LAYOUT_MONO);
+ CrasInputStream* test_stream = CreateStream(ChannelLayoutConfig::Mono());
EXPECT_EQ(test_stream->Open(), AudioInputStream::OpenOutcome::kSuccess);
double max_volume = test_stream->GetMaxVolume();
@@ -190,26 +210,22 @@ TEST_F(CrasInputStreamTest, CaptureFrames) {
for (unsigned int i = 0; i < ARRAY_SIZE(rates); i++) {
SCOPED_TRACE(testing::Message() << "Mono " << rates[i] << "Hz");
- AudioParameters params_mono(kTestFormat,
- CHANNEL_LAYOUT_MONO,
- rates[i],
- kTestFramesPerPacket);
+ AudioParameters params_mono(kTestFormat, ChannelLayoutConfig::Mono(),
+ rates[i], kTestFramesPerPacket);
CaptureSomeFrames(params_mono, kTestCaptureDurationMs);
}
for (unsigned int i = 0; i < ARRAY_SIZE(rates); i++) {
SCOPED_TRACE(testing::Message() << "Stereo " << rates[i] << "Hz");
- AudioParameters params_stereo(kTestFormat,
- CHANNEL_LAYOUT_STEREO,
- rates[i],
- kTestFramesPerPacket);
+ AudioParameters params_stereo(kTestFormat, ChannelLayoutConfig::Stereo(),
+ rates[i], kTestFramesPerPacket);
CaptureSomeFrames(params_stereo, kTestCaptureDurationMs);
}
}
TEST_F(CrasInputStreamTest, CaptureLoopback) {
CrasInputStream* test_stream =
- CreateStream(CHANNEL_LAYOUT_STEREO, kTestFramesPerPacket,
+ CreateStream(ChannelLayoutConfig::Stereo(), kTestFramesPerPacket,
AudioDeviceDescription::kLoopbackInputDeviceId);
EXPECT_EQ(test_stream->Open(), AudioInputStream::OpenOutcome::kSuccess);
test_stream->Close();
diff --git a/chromium/media/audio/cras/cras_unified.cc b/chromium/media/audio/cras/cras_unified.cc
index b0c4830e717..44139f9c44d 100644
--- a/chromium/media/audio/cras/cras_unified.cc
+++ b/chromium/media/audio/cras/cras_unified.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/cras/cras_unified.h b/chromium/media/audio/cras/cras_unified.h
index 6d74e6c1cff..4cd7d5b0608 100644
--- a/chromium/media/audio/cras/cras_unified.h
+++ b/chromium/media/audio/cras/cras_unified.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/cras/cras_unified_unittest.cc b/chromium/media/audio/cras/cras_unified_unittest.cc
index 5c2d257e9b7..f8b9619a677 100644
--- a/chromium/media/audio/cras/cras_unified_unittest.cc
+++ b/chromium/media/audio/cras/cras_unified_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -76,11 +76,11 @@ class CrasUnifiedStreamTest : public testing::Test {
ash::CrasAudioClient::Shutdown();
}
- CrasUnifiedStream* CreateStream(ChannelLayout layout) {
+ CrasUnifiedStream* CreateStream(ChannelLayoutConfig layout) {
return CreateStream(layout, kTestFramesPerPacket);
}
- CrasUnifiedStream* CreateStream(ChannelLayout layout,
+ CrasUnifiedStream* CreateStream(ChannelLayoutConfig layout,
int32_t samples_per_packet) {
AudioParameters params(kTestFormat, layout, kTestSampleRate,
samples_per_packet);
@@ -101,7 +101,7 @@ class CrasUnifiedStreamTest : public testing::Test {
std::unique_ptr<StrictMock<MockAudioManagerCras>> mock_manager_;
};
-const ChannelLayout CrasUnifiedStreamTest::kTestChannelLayout =
+constexpr ChannelLayout CrasUnifiedStreamTest::kTestChannelLayout =
CHANNEL_LAYOUT_STEREO;
const int CrasUnifiedStreamTest::kTestSampleRate =
AudioParameters::kAudioCDSampleRate;
@@ -110,23 +110,26 @@ const AudioParameters::Format CrasUnifiedStreamTest::kTestFormat =
const uint32_t CrasUnifiedStreamTest::kTestFramesPerPacket = 1000;
TEST_F(CrasUnifiedStreamTest, ConstructedState) {
- CrasUnifiedStream* test_stream = CreateStream(kTestChannelLayout);
+ CrasUnifiedStream* test_stream =
+ CreateStream(ChannelLayoutConfig::FromLayout<kTestChannelLayout>());
EXPECT_TRUE(test_stream->Open());
test_stream->Close();
// Should support mono.
- test_stream = CreateStream(CHANNEL_LAYOUT_MONO);
+ test_stream = CreateStream(ChannelLayoutConfig::Mono());
EXPECT_TRUE(test_stream->Open());
test_stream->Close();
// Should support multi-channel.
- test_stream = CreateStream(CHANNEL_LAYOUT_SURROUND);
+ test_stream =
+ CreateStream(ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_SURROUND>());
EXPECT_TRUE(test_stream->Open());
test_stream->Close();
// Bad sample rate.
- AudioParameters bad_rate_params(kTestFormat, kTestChannelLayout, 0,
- kTestFramesPerPacket);
+ AudioParameters bad_rate_params(
+ kTestFormat, ChannelLayoutConfig::FromLayout<kTestChannelLayout>(), 0,
+ kTestFramesPerPacket);
test_stream = new CrasUnifiedStream(bad_rate_params, mock_manager_.get(),
AudioDeviceDescription::kDefaultDeviceId);
EXPECT_FALSE(test_stream->Open());
@@ -134,7 +137,7 @@ TEST_F(CrasUnifiedStreamTest, ConstructedState) {
}
TEST_F(CrasUnifiedStreamTest, RenderFrames) {
- CrasUnifiedStream* test_stream = CreateStream(CHANNEL_LAYOUT_MONO);
+ CrasUnifiedStream* test_stream = CreateStream(ChannelLayoutConfig::Mono());
MockAudioSourceCallback mock_callback;
ASSERT_TRUE(test_stream->Open());
diff --git a/chromium/media/audio/cras/cras_util.cc b/chromium/media/audio/cras/cras_util.cc
index 9b1c7a8da93..ef825230f2a 100644
--- a/chromium/media/audio/cras/cras_util.cc
+++ b/chromium/media/audio/cras/cras_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/cras/cras_util.h b/chromium/media/audio/cras/cras_util.h
index 0031e9d173e..2c3db02ea64 100644
--- a/chromium/media/audio/cras/cras_util.h
+++ b/chromium/media/audio/cras/cras_util.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/fake_audio_input_stream.cc b/chromium/media/audio/fake_audio_input_stream.cc
index 4cc30150faf..dd7e144ea21 100644
--- a/chromium/media/audio/fake_audio_input_stream.cc
+++ b/chromium/media/audio/fake_audio_input_stream.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/fake_audio_input_stream.h b/chromium/media/audio/fake_audio_input_stream.h
index e204bfa78bf..d4245553d85 100644
--- a/chromium/media/audio/fake_audio_input_stream.h
+++ b/chromium/media/audio/fake_audio_input_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/fake_audio_log_factory.cc b/chromium/media/audio/fake_audio_log_factory.cc
index caf08f52e3f..2ac6d2e96ff 100644
--- a/chromium/media/audio/fake_audio_log_factory.cc
+++ b/chromium/media/audio/fake_audio_log_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/fake_audio_log_factory.h b/chromium/media/audio/fake_audio_log_factory.h
index 8d94e4298bc..f0ad4dcb9b7 100644
--- a/chromium/media/audio/fake_audio_log_factory.h
+++ b/chromium/media/audio/fake_audio_log_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/fake_audio_manager.cc b/chromium/media/audio/fake_audio_manager.cc
index cc6ea938ca0..f2059baa3d1 100644
--- a/chromium/media/audio/fake_audio_manager.cc
+++ b/chromium/media/audio/fake_audio_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,8 @@
#include <algorithm>
#include <utility>
+#include "media/base/audio_parameters.h"
+#include "media/base/channel_layout.h"
namespace media {
@@ -64,23 +66,23 @@ AudioParameters FakeAudioManager::GetPreferredOutputStreamParameters(
const AudioParameters& input_params) {
static const int kDefaultOutputBufferSize = 2048;
static const int kDefaultSampleRate = 48000;
- ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
+ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Stereo();
int sample_rate = kDefaultSampleRate;
int buffer_size = kDefaultOutputBufferSize;
if (input_params.IsValid()) {
sample_rate = input_params.sample_rate();
- channel_layout = input_params.channel_layout();
+ channel_layout_config = input_params.channel_layout_config();
buffer_size = std::min(input_params.frames_per_buffer(), buffer_size);
}
- return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
- sample_rate, buffer_size);
+ return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ channel_layout_config, sample_rate, buffer_size);
}
AudioParameters FakeAudioManager::GetInputStreamParameters(
const std::string& device_id) {
return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, kDefaultSampleRate,
+ ChannelLayoutConfig::Stereo(), kDefaultSampleRate,
kDefaultInputBufferSize);
}
diff --git a/chromium/media/audio/fake_audio_manager.h b/chromium/media/audio/fake_audio_manager.h
index 852740bc7a7..6d2274c74e2 100644
--- a/chromium/media/audio/fake_audio_manager.h
+++ b/chromium/media/audio/fake_audio_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/fake_audio_output_stream.cc b/chromium/media/audio/fake_audio_output_stream.cc
index e6ef8a7227d..d25513d8c24 100644
--- a/chromium/media/audio/fake_audio_output_stream.cc
+++ b/chromium/media/audio/fake_audio_output_stream.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/fake_audio_output_stream.h b/chromium/media/audio/fake_audio_output_stream.h
index bdbb05588eb..6582775bd84 100644
--- a/chromium/media/audio/fake_audio_output_stream.h
+++ b/chromium/media/audio/fake_audio_output_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/fuchsia/audio_input_stream_fuchsia.cc b/chromium/media/audio/fuchsia/audio_input_stream_fuchsia.cc
index 01b1c950997..8c136f51604 100644
--- a/chromium/media/audio/fuchsia/audio_input_stream_fuchsia.cc
+++ b/chromium/media/audio/fuchsia/audio_input_stream_fuchsia.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/fuchsia/audio_input_stream_fuchsia.h b/chromium/media/audio/fuchsia/audio_input_stream_fuchsia.h
index 23024d37d1c..47e5cb30ab3 100644
--- a/chromium/media/audio/fuchsia/audio_input_stream_fuchsia.h
+++ b/chromium/media/audio/fuchsia/audio_input_stream_fuchsia.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/fuchsia/audio_input_stream_fuchsia_test.cc b/chromium/media/audio/fuchsia/audio_input_stream_fuchsia_test.cc
index 5d552092891..60b5e2fc1d5 100644
--- a/chromium/media/audio/fuchsia/audio_input_stream_fuchsia_test.cc
+++ b/chromium/media/audio/fuchsia/audio_input_stream_fuchsia_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include "base/fuchsia/test_component_context_for_process.h"
#include "base/test/task_environment.h"
#include "media/audio/audio_device_description.h"
+#include "media/base/audio_parameters.h"
#include "media/base/channel_layout.h"
#include "media/fuchsia/audio/fake_audio_capturer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -69,14 +70,15 @@ class AudioInputStreamFuchsiaTest : public testing::Test {
base::RunLoop().RunUntilIdle();
}
- void InitializeCapturer(ChannelLayout layout) {
+ void InitializeCapturer(ChannelLayoutConfig channel_layout_config) {
base::TestComponentContextForProcess test_context;
FakeAudioCapturerFactory audio_capturer_factory(
test_context.additional_services());
input_stream_ = std::make_unique<AudioInputStreamFuchsia>(
/*manager=*/nullptr,
- AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, layout,
+ AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ channel_layout_config,
/*sample_rate=*/48000, kFramesPerPacket),
AudioDeviceDescription::kDefaultDeviceId);
@@ -94,12 +96,12 @@ class AudioInputStreamFuchsiaTest : public testing::Test {
ASSERT_FALSE(audio_capturer_factory.TakeCapturer());
}
- void TestCapture(ChannelLayout layout) {
- InitializeCapturer(layout);
+ void TestCapture(ChannelLayoutConfig channel_layout_config) {
+ InitializeCapturer(channel_layout_config);
input_stream_->Start(&callback_);
base::RunLoop().RunUntilIdle();
- size_t num_channels = ChannelLayoutToChannelCount(layout);
+ size_t num_channels = channel_layout_config.channels();
// Produce a packet.
std::vector<float> samples(kFramesPerPacket * num_channels);
@@ -133,14 +135,14 @@ class AudioInputStreamFuchsiaTest : public testing::Test {
TEST_F(AudioInputStreamFuchsiaTest, CreateAndDestroy) {}
TEST_F(AudioInputStreamFuchsiaTest, InitializeAndDestroy) {
- InitializeCapturer(CHANNEL_LAYOUT_MONO);
+ InitializeCapturer(ChannelLayoutConfig::Mono());
}
TEST_F(AudioInputStreamFuchsiaTest, InitializeAndStart) {
- const auto kLayout = CHANNEL_LAYOUT_MONO;
- const auto kNumChannels = ChannelLayoutToChannelCount(kLayout);
+ const auto kChannelLayoutConfig = ChannelLayoutConfig::Mono();
+ const auto kNumChannels = kChannelLayoutConfig.channels();
- InitializeCapturer(kLayout);
+ InitializeCapturer(kChannelLayoutConfig);
input_stream_->Start(&callback_);
base::RunLoop().RunUntilIdle();
@@ -152,10 +154,10 @@ TEST_F(AudioInputStreamFuchsiaTest, InitializeAndStart) {
}
TEST_F(AudioInputStreamFuchsiaTest, InitializeStereo) {
- const auto kLayout = CHANNEL_LAYOUT_STEREO;
- const auto kNumChannels = ChannelLayoutToChannelCount(kLayout);
+ const auto kChannelLayoutConfig = ChannelLayoutConfig::Stereo();
+ const auto kNumChannels = kChannelLayoutConfig.channels();
- InitializeCapturer(kLayout);
+ InitializeCapturer(kChannelLayoutConfig);
input_stream_->Start(&callback_);
base::RunLoop().RunUntilIdle();
@@ -165,7 +167,7 @@ TEST_F(AudioInputStreamFuchsiaTest, InitializeStereo) {
}
TEST_F(AudioInputStreamFuchsiaTest, StartAndStop) {
- InitializeCapturer(CHANNEL_LAYOUT_MONO);
+ InitializeCapturer(ChannelLayoutConfig::Stereo());
input_stream_->Start(&callback_);
base::RunLoop().RunUntilIdle();
@@ -176,15 +178,15 @@ TEST_F(AudioInputStreamFuchsiaTest, StartAndStop) {
}
TEST_F(AudioInputStreamFuchsiaTest, CaptureMono) {
- TestCapture(CHANNEL_LAYOUT_MONO);
+ TestCapture(ChannelLayoutConfig::Mono());
}
TEST_F(AudioInputStreamFuchsiaTest, CaptureStereo) {
- TestCapture(CHANNEL_LAYOUT_STEREO);
+ TestCapture(ChannelLayoutConfig::Stereo());
}
TEST_F(AudioInputStreamFuchsiaTest, CaptureTwoPackets) {
- InitializeCapturer(CHANNEL_LAYOUT_MONO);
+ InitializeCapturer(ChannelLayoutConfig::Mono());
input_stream_->Start(&callback_);
base::RunLoop().RunUntilIdle();
@@ -214,7 +216,7 @@ TEST_F(AudioInputStreamFuchsiaTest, CaptureTwoPackets) {
}
TEST_F(AudioInputStreamFuchsiaTest, CaptureAfterStop) {
- InitializeCapturer(CHANNEL_LAYOUT_MONO);
+ InitializeCapturer(ChannelLayoutConfig::Mono());
input_stream_->Start(&callback_);
base::RunLoop().RunUntilIdle();
input_stream_->Stop();
diff --git a/chromium/media/audio/fuchsia/audio_manager_fuchsia.cc b/chromium/media/audio/fuchsia/audio_manager_fuchsia.cc
index d52af7ab995..d0f9a051f31 100644
--- a/chromium/media/audio/fuchsia/audio_manager_fuchsia.cc
+++ b/chromium/media/audio/fuchsia/audio_manager_fuchsia.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,16 +10,22 @@
#include "base/callback.h"
#include "base/command_line.h"
+#include "base/containers/contains.h"
#include "base/fuchsia/fuchsia_logging.h"
#include "base/fuchsia/process_context.h"
#include "base/fuchsia/scheduler.h"
+#include "base/time/time.h"
#include "media/audio/fuchsia/audio_input_stream_fuchsia.h"
#include "media/audio/fuchsia/audio_output_stream_fuchsia.h"
+#include "media/base/audio_parameters.h"
#include "media/base/audio_timestamp_helper.h"
#include "media/base/media_switches.h"
namespace media {
+constexpr base::TimeDelta kMinBufferPeriod = base::kAudioSchedulingPeriod;
+constexpr base::TimeDelta kMaxBufferPeriod = base::Seconds(1);
+
AudioManagerFuchsia::AudioManagerFuchsia(
std::unique_ptr<AudioThread> audio_thread,
AudioLogFactory* audio_log_factory)
@@ -31,6 +37,16 @@ AudioManagerFuchsia::AudioManagerFuchsia(
AudioManagerFuchsia::~AudioManagerFuchsia() = default;
+void AudioManagerFuchsia::ShutdownOnAudioThread() {
+ DCHECK(GetTaskRunner()->BelongsToCurrentThread());
+
+ AudioManagerBase::ShutdownOnAudioThread();
+
+ // Teardown the AudioDeviceEnumerator channel before the audio
+ // thread, which it is bound to, stops.
+ enumerator_ = nullptr;
+}
+
bool AudioManagerFuchsia::HasAudioOutputDevices() {
return HasAudioDevice(false);
}
@@ -71,7 +87,8 @@ AudioParameters AudioManagerFuchsia::GetInputStreamParameters(
const size_t kPeriodSamples = AudioTimestampHelper::TimeToFrames(
base::kAudioSchedulingPeriod, kSampleRate);
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_MONO, kSampleRate, kPeriodSamples);
+ ChannelLayoutConfig::Mono(), kSampleRate,
+ kPeriodSamples);
// Some AudioCapturer implementations support echo cancellation, noise
// suppression and automatic gain control, but currently there is no way to
@@ -90,14 +107,36 @@ AudioParameters AudioManagerFuchsia::GetInputStreamParameters(
AudioParameters AudioManagerFuchsia::GetPreferredOutputStreamParameters(
const std::string& output_device_id,
const AudioParameters& input_params) {
+ if (input_params.IsValid()) {
+ AudioParameters params = input_params;
+
+ base::TimeDelta period = AudioTimestampHelper::FramesToTime(
+ input_params.frames_per_buffer(), input_params.sample_rate());
+
+ // Round period to a whole number of the CPU scheduling periods.
+ period = round(period / base::kAudioSchedulingPeriod) *
+ base::kAudioSchedulingPeriod;
+ period = std::min(kMaxBufferPeriod, std::max(period, kMinBufferPeriod));
+
+ params.set_frames_per_buffer(
+ AudioTimestampHelper::TimeToFrames(period, params.sample_rate()));
+
+ return params;
+ }
+
// TODO(crbug.com/852834): Fuchsia currently doesn't provide an API to get
// device configuration. Update this method when that functionality is
// implemented.
- const size_t kSampleRate = 48000;
- const size_t kPeriodFrames = AudioTimestampHelper::TimeToFrames(
- base::kAudioSchedulingPeriod, kSampleRate);
+ const int kSampleRate = 48000;
+ const int kMinPeriodFrames =
+ AudioTimestampHelper::TimeToFrames(kMinBufferPeriod, kSampleRate);
+ const int kMaxPeriodFrames =
+ AudioTimestampHelper::TimeToFrames(kMaxBufferPeriod, kSampleRate);
return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, kSampleRate, kPeriodFrames);
+ ChannelLayoutConfig::Stereo(), kSampleRate,
+ kMinPeriodFrames,
+ AudioParameters::HardwareCapabilities(
+ kMinPeriodFrames, kMaxPeriodFrames));
}
const char* AudioManagerFuchsia::GetName() {
@@ -215,10 +254,9 @@ void AudioManagerFuchsia::OnDeviceRemoved(uint64_t device_token) {
bool AudioManagerFuchsia::HasAudioDevice(bool is_input) {
DCHECK(GetTaskRunner()->BelongsToCurrentThread());
- return std::find_if(audio_devices_.begin(), audio_devices_.end(),
- [is_input](const auto& device) {
- return device.second.is_input == is_input;
- }) != audio_devices_.end();
+ return base::Contains(audio_devices_, is_input, [](const auto& device) {
+ return device.second.is_input;
+ });
}
void AudioManagerFuchsia::GetAudioDevices(AudioDeviceNames* device_names,
diff --git a/chromium/media/audio/fuchsia/audio_manager_fuchsia.h b/chromium/media/audio/fuchsia/audio_manager_fuchsia.h
index ed0274252b9..5b41b644c76 100644
--- a/chromium/media/audio/fuchsia/audio_manager_fuchsia.h
+++ b/chromium/media/audio/fuchsia/audio_manager_fuchsia.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,6 +24,7 @@ class AudioManagerFuchsia : public AudioManagerBase {
~AudioManagerFuchsia() override;
// Implementation of AudioManager.
+ void ShutdownOnAudioThread() override;
bool HasAudioOutputDevices() override;
bool HasAudioInputDevices() override;
void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
diff --git a/chromium/media/audio/fuchsia/audio_output_stream_fuchsia.cc b/chromium/media/audio/fuchsia/audio_output_stream_fuchsia.cc
index 3ec94836325..cc582a4ffdb 100644
--- a/chromium/media/audio/fuchsia/audio_output_stream_fuchsia.cc
+++ b/chromium/media/audio/fuchsia/audio_output_stream_fuchsia.cc
@@ -1,9 +1,10 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/audio/fuchsia/audio_output_stream_fuchsia.h"
+#include <fuchsia/media/cpp/fidl.h>
#include <lib/sys/cpp/component_context.h>
#include <zircon/syscalls.h>
@@ -22,13 +23,35 @@ namespace {
const uint32_t kBufferId = 0;
-fuchsia::media::AudioRenderUsage GetStreamUsage(
+absl::optional<fuchsia::media::AudioRenderUsage> GetStreamUsage(
const AudioParameters& parameters) {
- // TODO(crbug.com/1253010) In WebEngine: use `audio_renderer_usage` from the
- // `FrameMediaSettings` for the current web frame.
- if (parameters.latency_tag() == AudioLatency::LATENCY_RTC)
- return fuchsia::media::AudioRenderUsage::COMMUNICATION;
- return fuchsia::media::AudioRenderUsage::MEDIA;
+ int usage_flags = parameters.effects() &
+ (AudioParameters::FUCHSIA_RENDER_USAGE_BACKGROUND |
+ AudioParameters::FUCHSIA_RENDER_USAGE_MEDIA |
+ AudioParameters::FUCHSIA_RENDER_USAGE_INTERRUPTION |
+ AudioParameters::FUCHSIA_RENDER_USAGE_SYSTEM_AGENT |
+ AudioParameters::FUCHSIA_RENDER_USAGE_COMMUNICATION);
+ switch (usage_flags) {
+ case AudioParameters::FUCHSIA_RENDER_USAGE_BACKGROUND:
+ return fuchsia::media::AudioRenderUsage::BACKGROUND;
+ case AudioParameters::FUCHSIA_RENDER_USAGE_MEDIA:
+ return fuchsia::media::AudioRenderUsage::MEDIA;
+ case AudioParameters::FUCHSIA_RENDER_USAGE_INTERRUPTION:
+ return fuchsia::media::AudioRenderUsage::INTERRUPTION;
+ case AudioParameters::FUCHSIA_RENDER_USAGE_SYSTEM_AGENT:
+ return fuchsia::media::AudioRenderUsage::SYSTEM_AGENT;
+ case AudioParameters::FUCHSIA_RENDER_USAGE_COMMUNICATION:
+ return fuchsia::media::AudioRenderUsage::COMMUNICATION;
+ case 0:
+ // If the usage flags are not set then use COMMUNICATION for WebRTC and
+ // MEDIA for everything else.
+ if (parameters.latency_tag() == AudioLatency::LATENCY_RTC)
+ return fuchsia::media::AudioRenderUsage::COMMUNICATION;
+ return fuchsia::media::AudioRenderUsage::MEDIA;
+ default:
+ DLOG(FATAL) << "More than one FUCHSIA_RENDER_USAGE flag is set";
+ return absl::nullopt;
+ }
}
} // namespace
@@ -57,7 +80,10 @@ bool AudioOutputStreamFuchsia::Open() {
audio_renderer_.set_error_handler(
fit::bind_member(this, &AudioOutputStreamFuchsia::OnRendererError));
- audio_renderer_->SetUsage(GetStreamUsage(parameters_));
+ auto usage = GetStreamUsage(parameters_);
+ if (!usage)
+ return false;
+ audio_renderer_->SetUsage(usage.value());
// Inform the |audio_renderer_| of the format required by the caller.
fuchsia::media::AudioStreamType format;
@@ -285,14 +311,15 @@ void AudioOutputStreamFuchsia::PumpSamples() {
payload_buffer_pos_ =
(payload_buffer_pos_ + packet_size) % payload_buffer_.size();
- SchedulePumpSamples(now);
+ SchedulePumpSamples();
}
-void AudioOutputStreamFuchsia::SchedulePumpSamples(base::TimeTicks now) {
+void AudioOutputStreamFuchsia::SchedulePumpSamples() {
base::TimeTicks next_pump_time = GetCurrentStreamTime() -
min_lead_time_.value() -
parameters_.GetBufferDuration() / 2;
- timer_.Start(FROM_HERE, next_pump_time - now,
+
+ timer_.Start(FROM_HERE, next_pump_time,
base::BindOnce(&AudioOutputStreamFuchsia::PumpSamples,
base::Unretained(this)));
}
diff --git a/chromium/media/audio/fuchsia/audio_output_stream_fuchsia.h b/chromium/media/audio/fuchsia/audio_output_stream_fuchsia.h
index 2fdba87afb8..775675ab4be 100644
--- a/chromium/media/audio/fuchsia/audio_output_stream_fuchsia.h
+++ b/chromium/media/audio/fuchsia/audio_output_stream_fuchsia.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -67,7 +67,7 @@ class AudioOutputStreamFuchsia : public AudioOutputStream {
// Schedules |timer_| to call PumpSamples() when appropriate for the next
// packet.
- void SchedulePumpSamples(base::TimeTicks now);
+ void SchedulePumpSamples();
AudioManagerFuchsia* manager_;
AudioParameters parameters_;
@@ -99,7 +99,7 @@ class AudioOutputStreamFuchsia : public AudioOutputStream {
absl::optional<base::TimeDelta> min_lead_time_;
// Timer that's scheduled to call PumpSamples().
- base::OneShotTimer timer_;
+ base::DeadlineTimer timer_;
};
} // namespace media
diff --git a/chromium/media/audio/linux/audio_manager_linux.cc b/chromium/media/audio/linux/audio_manager_linux.cc
index ed7a3962624..749897baebe 100644
--- a/chromium/media/audio/linux/audio_manager_linux.cc
+++ b/chromium/media/audio/linux/audio_manager_linux.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/audio_auhal_mac.cc b/chromium/media/audio/mac/audio_auhal_mac.cc
index 01dfcd621e4..e345343b075 100644
--- a/chromium/media/audio/mac/audio_auhal_mac.cc
+++ b/chromium/media/audio/mac/audio_auhal_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/audio_auhal_mac.h b/chromium/media/audio/mac/audio_auhal_mac.h
index 24330f6aec0..5d1a51d4fab 100644
--- a/chromium/media/audio/mac/audio_auhal_mac.h
+++ b/chromium/media/audio/mac/audio_auhal_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/mac/audio_auhal_mac_unittest.cc b/chromium/media/audio/mac/audio_auhal_mac_unittest.cc
index 2f889ac4152..1fa433abb4b 100644
--- a/chromium/media/audio/mac/audio_auhal_mac_unittest.cc
+++ b/chromium/media/audio/mac/audio_auhal_mac_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/audio_device_listener_mac.cc b/chromium/media/audio/mac/audio_device_listener_mac.cc
index b7d84fd1d01..18fd2fcf181 100644
--- a/chromium/media/audio/mac/audio_device_listener_mac.cc
+++ b/chromium/media/audio/mac/audio_device_listener_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/audio_device_listener_mac.h b/chromium/media/audio/mac/audio_device_listener_mac.h
index 8da880aff84..bf1dfc3a6e5 100644
--- a/chromium/media/audio/mac/audio_device_listener_mac.h
+++ b/chromium/media/audio/mac/audio_device_listener_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/audio_device_listener_mac_unittest.cc b/chromium/media/audio/mac/audio_device_listener_mac_unittest.cc
index c13ac335eb3..71a0caa4815 100644
--- a/chromium/media/audio/mac/audio_device_listener_mac_unittest.cc
+++ b/chromium/media/audio/mac/audio_device_listener_mac_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -35,7 +35,7 @@ class AudioDeviceListenerMacTest : public testing::Test {
AudioDeviceListenerMacTest& operator=(const AudioDeviceListenerMacTest&) =
delete;
- virtual ~AudioDeviceListenerMacTest() {
+ ~AudioDeviceListenerMacTest() override {
// It's important to destroy the device listener from the message loop in
// order to ensure we don't end up with unbalanced TaskObserver calls.
task_environment_.GetMainThreadTaskRunner()->PostTask(
diff --git a/chromium/media/audio/mac/audio_input_mac.cc b/chromium/media/audio/mac/audio_input_mac.cc
index c125a4801c8..852a2b9cbd5 100644
--- a/chromium/media/audio/mac/audio_input_mac.cc
+++ b/chromium/media/audio/mac/audio_input_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/audio_input_mac.h b/chromium/media/audio/mac/audio_input_mac.h
index b6b08cc34ae..93f90bb7fdb 100644
--- a/chromium/media/audio/mac/audio_input_mac.h
+++ b/chromium/media/audio/mac/audio_input_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/audio_low_latency_input_mac.cc b/chromium/media/audio/mac/audio_low_latency_input_mac.cc
index de981fa288c..751b723388f 100644
--- a/chromium/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/chromium/media/audio/mac/audio_low_latency_input_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/audio/mac/audio_low_latency_input_mac.h"
diff --git a/chromium/media/audio/mac/audio_low_latency_input_mac.h b/chromium/media/audio/mac/audio_low_latency_input_mac.h
index dbd912e336d..38e4d6bc3f0 100644
--- a/chromium/media/audio/mac/audio_low_latency_input_mac.h
+++ b/chromium/media/audio/mac/audio_low_latency_input_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/mac/audio_low_latency_input_mac_unittest.cc b/chromium/media/audio/mac/audio_low_latency_input_mac_unittest.cc
index 9f31662515c..58d867608d7 100644
--- a/chromium/media/audio/mac/audio_low_latency_input_mac_unittest.cc
+++ b/chromium/media/audio/mac/audio_low_latency_input_mac_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -144,7 +144,7 @@ class MacAudioInputTest : public testing::Test {
int samples_per_packet = fs / 100;
AudioInputStream* ais = audio_manager_->MakeAudioInputStream(
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, fs, samples_per_packet),
+ ChannelLayoutConfig::Stereo(), fs, samples_per_packet),
AudioDeviceDescription::kDefaultDeviceId,
base::BindRepeating(&MacAudioInputTest::OnLogMessage,
base::Unretained(this)));
@@ -154,12 +154,13 @@ class MacAudioInputTest : public testing::Test {
// Convenience method which creates an AudioInputStream object with a
// specified channel layout.
- AudioInputStream* CreateAudioInputStream(ChannelLayout channel_layout) {
+ AudioInputStream* CreateAudioInputStream(
+ ChannelLayoutConfig channel_layout_config) {
int fs = static_cast<int>(AUAudioInputStream::HardwareSampleRate());
int samples_per_packet = fs / 100;
AudioInputStream* ais = audio_manager_->MakeAudioInputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
- fs, samples_per_packet),
+ AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ channel_layout_config, fs, samples_per_packet),
AudioDeviceDescription::kDefaultDeviceId,
base::BindRepeating(&MacAudioInputTest::OnLogMessage,
base::Unretained(this)));
@@ -217,7 +218,7 @@ TEST_F(MacAudioInputTest, AUAudioInputStreamVerifyMonoRecording) {
int count = 0;
// Create an audio input stream which records in mono.
- AudioInputStream* ais = CreateAudioInputStream(CHANNEL_LAYOUT_MONO);
+ AudioInputStream* ais = CreateAudioInputStream(ChannelLayoutConfig::Mono());
EXPECT_EQ(ais->Open(), AudioInputStream::OpenOutcome::kSuccess);
MockAudioInputCallback sink;
@@ -246,7 +247,7 @@ TEST_F(MacAudioInputTest, AUAudioInputStreamVerifyStereoRecording) {
int count = 0;
// Create an audio input stream which records in stereo.
- AudioInputStream* ais = CreateAudioInputStream(CHANNEL_LAYOUT_STEREO);
+ AudioInputStream* ais = CreateAudioInputStream(ChannelLayoutConfig::Stereo());
EXPECT_EQ(ais->Open(), AudioInputStream::OpenOutcome::kSuccess);
MockAudioInputCallback sink;
diff --git a/chromium/media/audio/mac/audio_manager_mac.cc b/chromium/media/audio/mac/audio_manager_mac.cc
index eb0aff29b2f..f2e38845218 100644
--- a/chromium/media/audio/mac/audio_manager_mac.cc
+++ b/chromium/media/audio/mac/audio_manager_mac.cc
@@ -1,10 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/audio/mac/audio_manager_mac.h"
-#include <algorithm>
#include <limits>
#include <memory>
#include <utility>
@@ -19,6 +18,7 @@
#include "base/memory/free_deleter.h"
#include "base/power_monitor/power_monitor.h"
#include "base/power_monitor/power_observer.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/sys_string_conversions.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
@@ -609,14 +609,14 @@ AudioParameters AudioManagerMac::GetInputStreamParameters(
if (device == kAudioObjectUnknown) {
DLOG(ERROR) << "Invalid device " << device_id;
return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, kFallbackSampleRate,
+ ChannelLayoutConfig::Stereo(), kFallbackSampleRate,
ChooseBufferSize(true, kFallbackSampleRate));
}
int channels = 0;
- ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
+ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Stereo();
if (GetDeviceChannels(device, AUElement::INPUT, &channels) && channels <= 2) {
- channel_layout = GuessChannelLayout(channels);
+ channel_layout_config = ChannelLayoutConfig::Guess(channels);
} else {
DLOG(ERROR) << "Failed to get the device channels, use stereo as default "
<< "for device " << device_id;
@@ -633,8 +633,8 @@ AudioParameters AudioManagerMac::GetInputStreamParameters(
// TODO(grunell): query the native channel layout for the specific device.
AudioParameters params(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate,
- buffer_size,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout_config,
+ sample_rate, buffer_size,
AudioParameters::HardwareCapabilities(
GetMinAudioBufferSizeMacOS(limits::kMinAudioBufferSize, sample_rate),
limits::kMaxAudioBufferSize));
@@ -828,7 +828,8 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters(
return input_params.IsValid()
? input_params
: AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, kFallbackSampleRate,
+ ChannelLayoutConfig::Stereo(),
+ kFallbackSampleRate,
ChooseBufferSize(false, kFallbackSampleRate));
}
@@ -873,13 +874,12 @@ AudioParameters AudioManagerMac::GetPreferredOutputStreamParameters(
}
AudioParameters params(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, {channel_layout, output_channels},
hardware_sample_rate, buffer_size,
AudioParameters::HardwareCapabilities(
GetMinAudioBufferSizeMacOS(limits::kMinAudioBufferSize,
hardware_sample_rate),
limits::kMaxAudioBufferSize));
- params.set_channels_for_discrete(output_channels);
return params;
}
@@ -1229,9 +1229,7 @@ void AudioManagerMac::ReleaseOutputStreamUsingRealDevice(
void AudioManagerMac::ReleaseInputStream(AudioInputStream* stream) {
DCHECK(GetTaskRunner()->BelongsToCurrentThread());
- auto stream_it = std::find(basic_input_streams_.begin(),
- basic_input_streams_.end(),
- stream);
+ auto stream_it = base::ranges::find(basic_input_streams_, stream);
if (stream_it == basic_input_streams_.end())
low_latency_input_streams_.remove(static_cast<AUAudioInputStream*>(stream));
else
diff --git a/chromium/media/audio/mac/audio_manager_mac.h b/chromium/media/audio/mac/audio_manager_mac.h
index 77662281466..4947d356986 100644
--- a/chromium/media/audio/mac/audio_manager_mac.h
+++ b/chromium/media/audio/mac/audio_manager_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/core_audio_util_mac.cc b/chromium/media/audio/mac/core_audio_util_mac.cc
index b7e30eace0b..f9a969fc054 100644
--- a/chromium/media/audio/mac/core_audio_util_mac.cc
+++ b/chromium/media/audio/mac/core_audio_util_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -321,7 +321,8 @@ bool IsInputDevice(AudioObjectID device_id) {
auto direction =
GetDeviceUint32Property(stream_id, kAudioStreamPropertyDirection,
kAudioObjectPropertyScopeGlobal);
- DCHECK(direction.has_value());
+ if (!direction.has_value())
+ continue;
const UInt32 kDirectionOutput = 0;
const UInt32 kDirectionInput = 1;
if (direction == kDirectionOutput) {
diff --git a/chromium/media/audio/mac/core_audio_util_mac.h b/chromium/media/audio/mac/core_audio_util_mac.h
index b46243a5167..32848cf1fd2 100644
--- a/chromium/media/audio/mac/core_audio_util_mac.h
+++ b/chromium/media/audio/mac/core_audio_util_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/coreaudio_dispatch_override.cc b/chromium/media/audio/mac/coreaudio_dispatch_override.cc
index 022b3e0cc57..3a27340ea97 100644
--- a/chromium/media/audio/mac/coreaudio_dispatch_override.cc
+++ b/chromium/media/audio/mac/coreaudio_dispatch_override.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/coreaudio_dispatch_override.h b/chromium/media/audio/mac/coreaudio_dispatch_override.h
index efd9f8c12b2..7dbb0a3ab37 100644
--- a/chromium/media/audio/mac/coreaudio_dispatch_override.h
+++ b/chromium/media/audio/mac/coreaudio_dispatch_override.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/scoped_audio_unit.cc b/chromium/media/audio/mac/scoped_audio_unit.cc
index e0633460ec5..99367ddf827 100644
--- a/chromium/media/audio/mac/scoped_audio_unit.cc
+++ b/chromium/media/audio/mac/scoped_audio_unit.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mac/scoped_audio_unit.h b/chromium/media/audio/mac/scoped_audio_unit.h
index d4bc1cfe703..da074d8f705 100644
--- a/chromium/media/audio/mac/scoped_audio_unit.h
+++ b/chromium/media/audio/mac/scoped_audio_unit.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mock_aecdump_recording_manager.cc b/chromium/media/audio/mock_aecdump_recording_manager.cc
new file mode 100644
index 00000000000..64c23848d41
--- /dev/null
+++ b/chromium/media/audio/mock_aecdump_recording_manager.cc
@@ -0,0 +1,17 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/audio/mock_aecdump_recording_manager.h"
+
+#include <utility>
+
+namespace media {
+
+MockAecdumpRecordingManager::MockAecdumpRecordingManager(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner)
+ : AecdumpRecordingManager(task_runner) {}
+
+MockAecdumpRecordingManager::~MockAecdumpRecordingManager() = default;
+
+} // namespace media
diff --git a/chromium/media/audio/mock_aecdump_recording_manager.h b/chromium/media/audio/mock_aecdump_recording_manager.h
new file mode 100644
index 00000000000..e44c63d9afe
--- /dev/null
+++ b/chromium/media/audio/mock_aecdump_recording_manager.h
@@ -0,0 +1,34 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_MOCK_AECDUMP_RECORDING_MANAGER_H_
+#define MEDIA_AUDIO_MOCK_AECDUMP_RECORDING_MANAGER_H_
+
+#include "base/task/single_thread_task_runner.h"
+#include "media/audio/aecdump_recording_manager.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace media {
+
+class MockAecdumpRecordingManager : public AecdumpRecordingManager {
+ public:
+ explicit MockAecdumpRecordingManager(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+
+ MockAecdumpRecordingManager(const MockAecdumpRecordingManager&) = delete;
+ MockAecdumpRecordingManager& operator=(const MockAecdumpRecordingManager&) =
+ delete;
+
+ ~MockAecdumpRecordingManager() override;
+
+ MOCK_METHOD1(RegisterAecdumpSource, void(AecdumpRecordingSource*));
+ MOCK_METHOD1(DeregisterAecdumpSource, void(AecdumpRecordingSource*));
+
+ MOCK_METHOD1(EnableDebugRecording, void(CreateFileCallback));
+ MOCK_METHOD0(DisableDebugRecording, void());
+};
+
+} // namespace media.
+
+#endif // MEDIA_AUDIO_MOCK_AECDUMP_RECORDING_MANAGER_H_
diff --git a/chromium/media/audio/mock_audio_debug_recording_manager.cc b/chromium/media/audio/mock_audio_debug_recording_manager.cc
index 1a38ba2f417..9c7b89b6734 100644
--- a/chromium/media/audio/mock_audio_debug_recording_manager.cc
+++ b/chromium/media/audio/mock_audio_debug_recording_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,9 +8,7 @@
namespace media {
-MockAudioDebugRecordingManager::MockAudioDebugRecordingManager(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner)
- : AudioDebugRecordingManager(std::move(task_runner)) {}
+MockAudioDebugRecordingManager::MockAudioDebugRecordingManager() = default;
MockAudioDebugRecordingManager::~MockAudioDebugRecordingManager() = default;
diff --git a/chromium/media/audio/mock_audio_debug_recording_manager.h b/chromium/media/audio/mock_audio_debug_recording_manager.h
index 7bf2b19d79f..3a5bb07d663 100644
--- a/chromium/media/audio/mock_audio_debug_recording_manager.h
+++ b/chromium/media/audio/mock_audio_debug_recording_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,8 +13,7 @@ namespace media {
class MockAudioDebugRecordingManager : public AudioDebugRecordingManager {
public:
- explicit MockAudioDebugRecordingManager(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+ MockAudioDebugRecordingManager();
MockAudioDebugRecordingManager(const MockAudioDebugRecordingManager&) =
delete;
diff --git a/chromium/media/audio/mock_audio_manager.cc b/chromium/media/audio/mock_audio_manager.cc
index a4056b2edf7..daaef3accd9 100644
--- a/chromium/media/audio/mock_audio_manager.cc
+++ b/chromium/media/audio/mock_audio_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -132,8 +132,7 @@ void MockAudioManager::InitializeDebugRecording() {
}
DCHECK(!debug_recording_manager_);
- debug_recording_manager_ =
- std::make_unique<MockAudioDebugRecordingManager>(GetTaskRunner());
+ debug_recording_manager_ = std::make_unique<MockAudioDebugRecordingManager>();
}
AudioDebugRecordingManager* MockAudioManager::GetAudioDebugRecordingManager() {
@@ -141,6 +140,12 @@ AudioDebugRecordingManager* MockAudioManager::GetAudioDebugRecordingManager() {
return debug_recording_manager_.get();
}
+void MockAudioManager::SetAecDumpRecordingManager(
+ base::WeakPtr<AecdumpRecordingManager>) {
+ DCHECK(GetTaskRunner()->BelongsToCurrentThread());
+ // This is no-op by default.
+}
+
const char* MockAudioManager::GetName() {
return nullptr;
}
diff --git a/chromium/media/audio/mock_audio_manager.h b/chromium/media/audio/mock_audio_manager.h
index e819e910ff7..2b46355000d 100644
--- a/chromium/media/audio/mock_audio_manager.h
+++ b/chromium/media/audio/mock_audio_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -65,6 +65,9 @@ class MockAudioManager : public AudioManager {
void InitializeDebugRecording() override;
AudioDebugRecordingManager* GetAudioDebugRecordingManager() override;
+ void SetAecDumpRecordingManager(base::WeakPtr<AecdumpRecordingManager>
+ aecdump_recording_manager) override;
+
const char* GetName() override;
// Setters to emulate desired in-test behavior.
diff --git a/chromium/media/audio/mock_audio_source_callback.cc b/chromium/media/audio/mock_audio_source_callback.cc
index 106b7550d54..eef525d4227 100644
--- a/chromium/media/audio/mock_audio_source_callback.cc
+++ b/chromium/media/audio/mock_audio_source_callback.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/mock_audio_source_callback.h b/chromium/media/audio/mock_audio_source_callback.h
index 1a8bcad48a1..f636918959e 100644
--- a/chromium/media/audio/mock_audio_source_callback.h
+++ b/chromium/media/audio/mock_audio_source_callback.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/null_audio_sink.cc b/chromium/media/audio/null_audio_sink.cc
index a6d5ca3919c..337ce19cae3 100644
--- a/chromium/media/audio/null_audio_sink.cc
+++ b/chromium/media/audio/null_audio_sink.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/null_audio_sink.h b/chromium/media/audio/null_audio_sink.h
index b6818d3140d..dd037a39d62 100644
--- a/chromium/media/audio/null_audio_sink.h
+++ b/chromium/media/audio/null_audio_sink.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/power_observer_helper.cc b/chromium/media/audio/power_observer_helper.cc
index 187ca85ceaf..16c9e982c54 100644
--- a/chromium/media/audio/power_observer_helper.cc
+++ b/chromium/media/audio/power_observer_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/power_observer_helper.h b/chromium/media/audio/power_observer_helper.h
index ffc31c43639..53268ff4126 100644
--- a/chromium/media/audio/power_observer_helper.h
+++ b/chromium/media/audio/power_observer_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/power_observer_helper_unittest.cc b/chromium/media/audio/power_observer_helper_unittest.cc
index 9f92044a84e..5ad44287bb3 100644
--- a/chromium/media/audio/power_observer_helper_unittest.cc
+++ b/chromium/media/audio/power_observer_helper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/pulse/audio_manager_pulse.cc b/chromium/media/audio/pulse/audio_manager_pulse.cc
index b48b798ac76..45c62d674d1 100644
--- a/chromium/media/audio/pulse/audio_manager_pulse.cc
+++ b/chromium/media/audio/pulse/audio_manager_pulse.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -127,7 +127,7 @@ AudioParameters AudioManagerPulse::GetInputStreamParameters(
const int buffer_size =
user_buffer_size ? user_buffer_size : kDefaultInputBufferSize;
return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO,
+ ChannelLayoutConfig::Stereo(),
native_input_sample_rate_ ? native_input_sample_rate_
: kDefaultSampleRate,
buffer_size);
@@ -221,15 +221,15 @@ AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters(
UpdateNativeAudioHardwareInfo();
int sample_rate = native_input_sample_rate_ ? native_input_sample_rate_
: kDefaultSampleRate;
- ChannelLayout channel_layout =
- GuessChannelLayout(native_channel_count_ ? native_channel_count_ : 2);
+ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Guess(
+ native_channel_count_ ? native_channel_count_ : 2);
if (input_params.IsValid()) {
// Use the system's output channel count for the DISCRETE layout. This is to
// avoid a crash due to the lack of support on the multi-channel beyond 8 in
// the PulseAudio layer.
if (input_params.channel_layout() != CHANNEL_LAYOUT_DISCRETE)
- channel_layout = input_params.channel_layout();
+ channel_layout_config = input_params.channel_layout_config();
buffer_size =
std::min(kMaximumOutputBufferSize,
@@ -240,8 +240,8 @@ AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters(
if (user_buffer_size)
buffer_size = user_buffer_size;
- return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
- sample_rate, buffer_size);
+ return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ channel_layout_config, sample_rate, buffer_size);
}
AudioOutputStream* AudioManagerPulse::MakeOutputStream(
diff --git a/chromium/media/audio/pulse/audio_manager_pulse.h b/chromium/media/audio/pulse/audio_manager_pulse.h
index 78ee188c6d2..11adb3fd203 100644
--- a/chromium/media/audio/pulse/audio_manager_pulse.h
+++ b/chromium/media/audio/pulse/audio_manager_pulse.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/pulse/pulse.sigs b/chromium/media/audio/pulse/pulse.sigs
index 85ff08ab784..2c55eaca54b 100644
--- a/chromium/media/audio/pulse/pulse.sigs
+++ b/chromium/media/audio/pulse/pulse.sigs
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/pulse/pulse_input.cc b/chromium/media/audio/pulse/pulse_input.cc
index 1f7cca7388e..79a8bceaa56 100644
--- a/chromium/media/audio/pulse/pulse_input.cc
+++ b/chromium/media/audio/pulse/pulse_input.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/pulse/pulse_input.h b/chromium/media/audio/pulse/pulse_input.h
index 4c946df7628..9d2c9002392 100644
--- a/chromium/media/audio/pulse/pulse_input.h
+++ b/chromium/media/audio/pulse/pulse_input.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/pulse/pulse_output.cc b/chromium/media/audio/pulse/pulse_output.cc
index 6afe0113d6c..94a3d33f929 100644
--- a/chromium/media/audio/pulse/pulse_output.cc
+++ b/chromium/media/audio/pulse/pulse_output.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -49,7 +49,7 @@ PulseAudioOutputStream::PulseAudioOutputStream(
AudioManagerBase* manager,
AudioManager::LogCallback log_callback)
: params_(AudioParameters(params.format(),
- params.channel_layout(),
+ params.channel_layout_config(),
params.sample_rate(),
params.frames_per_buffer())),
device_id_(device_id),
diff --git a/chromium/media/audio/pulse/pulse_output.h b/chromium/media/audio/pulse/pulse_output.h
index 2529bad79bc..f88fb959287 100644
--- a/chromium/media/audio/pulse/pulse_output.h
+++ b/chromium/media/audio/pulse/pulse_output.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/pulse/pulse_util.cc b/chromium/media/audio/pulse/pulse_util.cc
index 359394cce27..bc589ad6914 100644
--- a/chromium/media/audio/pulse/pulse_util.cc
+++ b/chromium/media/audio/pulse/pulse_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/pulse/pulse_util.h b/chromium/media/audio/pulse/pulse_util.h
index c3c0198f476..2e4151f19f1 100644
--- a/chromium/media/audio/pulse/pulse_util.h
+++ b/chromium/media/audio/pulse/pulse_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/scoped_task_runner_observer.cc b/chromium/media/audio/scoped_task_runner_observer.cc
index b4b7f5bab56..03cb76535a5 100644
--- a/chromium/media/audio/scoped_task_runner_observer.cc
+++ b/chromium/media/audio/scoped_task_runner_observer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/scoped_task_runner_observer.h b/chromium/media/audio/scoped_task_runner_observer.h
index cc92ca70b93..f126fc56907 100644
--- a/chromium/media/audio/scoped_task_runner_observer.h
+++ b/chromium/media/audio/scoped_task_runner_observer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/simple_sources.cc b/chromium/media/audio/simple_sources.cc
index fefaf960d06..873793ed51a 100644
--- a/chromium/media/audio/simple_sources.cc
+++ b/chromium/media/audio/simple_sources.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -199,7 +199,7 @@ void FileSource::LoadWavFile(const base::FilePath& path_to_wav_file) {
// of it at a time and not the whole thing (like 10 ms at a time).
AudioParameters file_audio_slice(
AudioParameters::AUDIO_PCM_LOW_LATENCY,
- GuessChannelLayout(wav_audio_handler_->num_channels()),
+ ChannelLayoutConfig::Guess(wav_audio_handler_->num_channels()),
wav_audio_handler_->sample_rate(), params_.frames_per_buffer());
file_audio_converter_ =
diff --git a/chromium/media/audio/simple_sources.h b/chromium/media/audio/simple_sources.h
index f47f493ea64..84a480cb8ca 100644
--- a/chromium/media/audio/simple_sources.h
+++ b/chromium/media/audio/simple_sources.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/simple_sources_unittest.cc b/chromium/media/audio/simple_sources_unittest.cc
index 263d639242f..fff858c2d10 100644
--- a/chromium/media/audio/simple_sources_unittest.cc
+++ b/chromium/media/audio/simple_sources_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,7 +25,8 @@ TEST(SimpleSources, SineWaveAudioSource) {
static const uint32_t samples = 1024;
static const int freq = 200;
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(),
AudioParameters::kTelephoneSampleRate, samples);
SineWaveAudioSource source(1, freq, params.sample_rate());
@@ -123,7 +124,7 @@ TEST(SimpleSources, FileSourceTestDataWithoutLooping) {
// Create AudioParameters which match those in the WAV data.
AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 48000, kNumFrames);
+ ChannelLayoutConfig::Stereo(), 48000, kNumFrames);
std::unique_ptr<AudioBus> audio_bus = AudioBus::Create(2, kNumFrames);
audio_bus->Zero();
@@ -161,7 +162,7 @@ TEST(SimpleSources, FileSourceTestDataWithLooping) {
// Create AudioParameters which match those in the WAV data.
AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 48000, kNumFrames);
+ ChannelLayoutConfig::Stereo(), 48000, kNumFrames);
std::unique_ptr<AudioBus> audio_bus = AudioBus::Create(2, kNumFrames);
audio_bus->Zero();
@@ -180,7 +181,7 @@ TEST(SimpleSources, FileSourceTestDataWithLooping) {
TEST(SimpleSources, BadFilePathFails) {
AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 48000, 10);
+ ChannelLayoutConfig::Stereo(), 48000, 10);
std::unique_ptr<AudioBus> audio_bus = AudioBus::Create(2, 10);
audio_bus->Zero();
@@ -220,7 +221,7 @@ TEST(SimpleSources, FileSourceCorruptTestDataFails) {
// Create AudioParameters which match those in the WAV data.
AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 48000, kNumFrames);
+ ChannelLayoutConfig::Stereo(), 48000, kNumFrames);
std::unique_ptr<AudioBus> audio_bus = AudioBus::Create(2, kNumFrames);
audio_bus->Zero();
diff --git a/chromium/media/audio/system_glitch_reporter.cc b/chromium/media/audio/system_glitch_reporter.cc
index fea682ccb61..a32a51dccf4 100644
--- a/chromium/media/audio/system_glitch_reporter.cc
+++ b/chromium/media/audio/system_glitch_reporter.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/system_glitch_reporter.h b/chromium/media/audio/system_glitch_reporter.h
index 02cddf84c30..4a516cbabd1 100644
--- a/chromium/media/audio/system_glitch_reporter.h
+++ b/chromium/media/audio/system_glitch_reporter.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/test_audio_thread.cc b/chromium/media/audio/test_audio_thread.cc
index f0cff7359d2..7bc70d3bfd1 100644
--- a/chromium/media/audio/test_audio_thread.cc
+++ b/chromium/media/audio/test_audio_thread.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/test_audio_thread.h b/chromium/media/audio/test_audio_thread.h
index db7acf5a23b..c8b3b6622aa 100644
--- a/chromium/media/audio/test_audio_thread.h
+++ b/chromium/media/audio/test_audio_thread.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/test_data.h b/chromium/media/audio/test_data.h
index c17a1267465..3ab9a93da19 100644
--- a/chromium/media/audio/test_data.h
+++ b/chromium/media/audio/test_data.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/wav_audio_handler.cc b/chromium/media/audio/wav_audio_handler.cc
index d2fa51b1941..d5ec1e3db92 100644
--- a/chromium/media/audio/wav_audio_handler.cc
+++ b/chromium/media/audio/wav_audio_handler.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/wav_audio_handler.h b/chromium/media/audio/wav_audio_handler.h
index fc6acab0f6c..43fcd710f4f 100644
--- a/chromium/media/audio/wav_audio_handler.h
+++ b/chromium/media/audio/wav_audio_handler.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/wav_audio_handler_fuzzer.cc b/chromium/media/audio/wav_audio_handler_fuzzer.cc
index ee3defb924f..6fbe07f1131 100644
--- a/chromium/media/audio/wav_audio_handler_fuzzer.cc
+++ b/chromium/media/audio/wav_audio_handler_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/wav_audio_handler_unittest.cc b/chromium/media/audio/wav_audio_handler_unittest.cc
index b9e1893ab2d..0646471c5eb 100644
--- a/chromium/media/audio/wav_audio_handler_unittest.cc
+++ b/chromium/media/audio/wav_audio_handler_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/audio_device_listener_win.cc b/chromium/media/audio/win/audio_device_listener_win.cc
index cdf7bec9061..c83f2128968 100644
--- a/chromium/media/audio/win/audio_device_listener_win.cc
+++ b/chromium/media/audio/win/audio_device_listener_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/audio_device_listener_win.h b/chromium/media/audio/win/audio_device_listener_win.h
index 5d6b3b490c2..f605959f37f 100644
--- a/chromium/media/audio/win/audio_device_listener_win.h
+++ b/chromium/media/audio/win/audio_device_listener_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/audio_device_listener_win_unittest.cc b/chromium/media/audio/win/audio_device_listener_win_unittest.cc
index 92adc71f2c9..964e7263ec7 100644
--- a/chromium/media/audio/win/audio_device_listener_win_unittest.cc
+++ b/chromium/media/audio/win/audio_device_listener_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/audio_edid_scan_win.cc b/chromium/media/audio/win/audio_edid_scan_win.cc
new file mode 100644
index 00000000000..9527596f8ce
--- /dev/null
+++ b/chromium/media/audio/win/audio_edid_scan_win.cc
@@ -0,0 +1,185 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/audio/win/audio_edid_scan_win.h"
+
+#include <objbase.h>
+#include <oleauto.h>
+#include <string.h>
+
+#include "base/logging.h"
+#include "base/win/scoped_bstr.h"
+#include "base/win/scoped_variant.h"
+#include "base/win/wmi.h"
+
+namespace media {
+
+// Short Audio Descriptor values defined in ANSI/CEA-861
+enum {
+ kEdidAudioLpcm = 1,
+ kEdidAudioDts = 7,
+ kEdidAudioDtsHd = 11,
+};
+
+namespace {
+
+uint32_t EdidParseBlocks(const uint8_t* data, int data_size) {
+ const uint8_t *block = data, *block_end = data + data_size;
+ static constexpr uint8_t kBaseHeader[] = {0, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0};
+ constexpr uint8_t kEdidAudio = 1;
+ constexpr uint8_t kExtensionTagCea = 2;
+ constexpr int kBlockSize = 128;
+ constexpr uint8_t kSadSize = 3;
+ uint32_t bitstream_mask = 0;
+
+ // http://crbug.com/1371473
+ // TODO(dcheng): Use base::BufferIterator to parse EDID block
+ // Skip base EDID structure if present
+ if (block + kBlockSize <= block_end &&
+ (memcmp(block, kBaseHeader, sizeof(kBaseHeader)) == 0)) {
+ block += kBlockSize;
+ }
+
+ // Process CEA EDID (tag 2) extension blocks
+ for (; block + kBlockSize <= block_end; block += kBlockSize) {
+ if (block[0] != kExtensionTagCea)
+ continue;
+
+ // Process the audio data blocks containing Short Audio Descriptors (SADs),
+ // which are three bytes each. SADs start at byte 4 and end before the
+ // byte specified in block[2].
+ const uint8_t *db = block + 4, *db_end = block + block[2];
+ if (db_end > block_end)
+ continue;
+ for (; db + kSadSize <= db_end && db[0]; db += (db[0] & 0x1F) + 1) {
+ if ((db[0] >> 5) != kEdidAudio)
+ continue;
+
+ const int len = 1 + (db[0] & 0x1F);
+ if (db + len > db_end)
+ continue;
+
+ for (int i = 1; i < len; i += 3) {
+ switch ((db[i] >> 3) & 15) {
+ case kEdidAudioLpcm:
+ bitstream_mask |= kAudioBitstreamPcmLinear;
+ break;
+ case kEdidAudioDts:
+ bitstream_mask |= kAudioBitstreamDts;
+ break;
+ case kEdidAudioDtsHd:
+ bitstream_mask |= kAudioBitstreamDts;
+ bitstream_mask |= kAudioBitstreamDtsHd;
+ break;
+ }
+ }
+ }
+ }
+
+ DVLOG(1) << "SERVICE: EdidParseBlocks bitstream mask " << bitstream_mask;
+ return bitstream_mask;
+}
+
+} // namespace
+
+uint32_t ScanEdidBitstreams() {
+ // The WMI service allows the querying of monitor-type devices which report
+ // Extended Display Identification Data (EDID). The WMI service can be
+ // queried for a list of COM objects which represent the "paths" which
+ // are associated with individual EDID devices. Querying each of those
+ // paths using the WmiGetMonitorRawEEdidV1Block method returns the EDID
+ // blocks for those devices. We query the extended blocks which contain
+ // the Short Audio Descriptor (SAD), and parse them to obtain a bitmask
+ // indicating which audio content is supported. The mask consists of
+ // AudioParameters::Format flags. If multiple EDID devices are present,
+ // the intersection of flags is reported.
+ Microsoft::WRL::ComPtr<IWbemServices> wmi_services =
+ base::win::CreateWmiConnection(true, L"ROOT\\WMI");
+ if (!wmi_services)
+ return 0;
+
+ Microsoft::WRL::ComPtr<IWbemClassObject> get_edid_block;
+ if (!base::win::CreateWmiClassMethodObject(
+ wmi_services.Get(), L"WmiMonitorDescriptorMethods",
+ L"WmiGetMonitorRawEEdidV1Block", &get_edid_block)) {
+ return 0;
+ }
+
+ Microsoft::WRL::ComPtr<IEnumWbemClassObject> wmi_enumerator;
+ HRESULT hr = wmi_services->CreateInstanceEnum(
+ base::win::ScopedBstr(L"WmiMonitorDescriptorMethods").Get(),
+ WBEM_FLAG_FORWARD_ONLY, nullptr, &wmi_enumerator);
+ if (FAILED(hr))
+ return 0;
+
+ base::win::ScopedVariant block_id(1);
+ bool first = true;
+ uint32_t bitstream_mask = 0;
+
+ while (true) {
+ Microsoft::WRL::ComPtr<IWbemClassObject> class_object;
+ ULONG items_returned = 0;
+ hr = wmi_enumerator->Next(WBEM_INFINITE, 1, &class_object, &items_returned);
+ if (FAILED(hr) || hr == WBEM_S_FALSE || items_returned == 0)
+ break;
+
+ base::win::ScopedVariant path;
+ class_object->Get(L"__PATH", 0, path.Receive(), nullptr, nullptr);
+
+ if (FAILED(get_edid_block->Put(L"BlockId", 0, block_id.AsInput(), 0)))
+ break;
+
+ Microsoft::WRL::ComPtr<IWbemClassObject> out_params;
+ hr = wmi_services->ExecMethod(
+ V_BSTR(path.ptr()),
+ base::win::ScopedBstr(L"WmiGetMonitorRawEEdidV1Block").Get(), 0,
+ nullptr, get_edid_block.Get(), &out_params, nullptr);
+ if (FAILED(hr))
+ break;
+
+ base::win::ScopedVariant block_type;
+ if (FAILED(out_params->Get(L"BlockType", 0, block_type.Receive(), nullptr,
+ 0))) {
+ continue;
+ }
+
+ base::win::ScopedVariant block_content;
+ if (FAILED(out_params->Get(L"BlockContent", 0, block_content.Receive(),
+ nullptr, 0))) {
+ continue;
+ }
+
+ if (V_I4(block_type.ptr()) != 255)
+ continue;
+
+ if (block_content.type() != (VT_ARRAY | VT_UI1))
+ continue;
+
+ SAFEARRAY* array = V_ARRAY(block_content.ptr());
+ if (SafeArrayGetDim(array) != 1)
+ continue;
+
+ long lower_bound = 0;
+ long upper_bound = 0;
+ SafeArrayGetLBound(array, 1, &lower_bound);
+ SafeArrayGetUBound(array, 1, &upper_bound);
+ if (lower_bound || upper_bound <= lower_bound)
+ continue;
+
+ uint8_t* block = nullptr;
+ SafeArrayAccessData(array, reinterpret_cast<void**>(&block));
+ if (first) {
+ first = false;
+ bitstream_mask = EdidParseBlocks(block, upper_bound + 1);
+ } else {
+ bitstream_mask &= EdidParseBlocks(block, upper_bound + 1);
+ }
+ SafeArrayUnaccessData(array);
+ }
+
+ return bitstream_mask;
+}
+
+} // namespace media
diff --git a/chromium/media/audio/win/audio_edid_scan_win.h b/chromium/media/audio/win/audio_edid_scan_win.h
new file mode 100644
index 00000000000..f57275e6ea2
--- /dev/null
+++ b/chromium/media/audio/win/audio_edid_scan_win.h
@@ -0,0 +1,36 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_AUDIO_WIN_AUDIO_EDID_SCAN_WIN_H_
+#define MEDIA_AUDIO_WIN_AUDIO_EDID_SCAN_WIN_H_
+
+#include <stdint.h>
+
+#include "media/base/media_export.h"
+
+namespace media {
+
+// The WMI service allows the querying of monitor-type devices which report
+// Extended Display Identification Data (EDID). The WMI service can be
+// queried for a list of COM objects which represent the "paths" which
+// are associated with individual EDID devices. Querying each of those
+// paths using the WmiGetMonitorRawEEdidV1Block method returns the EDID
+// blocks for those devices. We query the extended blocks which contain
+// the Short Audio Descriptor (SAD), and parse them to obtain a bitmask
+// indicating which audio content is supported. The mask consists of
+// AudioParameters::Format flags. If multiple EDID devices are present,
+// the intersection of flags is reported.
+MEDIA_EXPORT uint32_t ScanEdidBitstreams();
+
+// Bitmask returned by ScanEdidBitstreams. Set bits indicate detected
+// audio passthrough support.
+enum : uint32_t {
+ kAudioBitstreamPcmLinear = 0x001, // PCM is 'raw' amplitude samples.
+ kAudioBitstreamDts = 0x002, // Compressed DTS bitstream.
+ kAudioBitstreamDtsHd = 0x004, // Compressed DTS-HD bitstream.
+};
+
+} // namespace media
+
+#endif // MEDIA_AUDIO_WIN_AUDIO_EDID_SCAN_WIN_H_
diff --git a/chromium/media/audio/win/audio_low_latency_input_win.cc b/chromium/media/audio/win/audio_low_latency_input_win.cc
index b95f1b5319c..23372ebe4e4 100644
--- a/chromium/media/audio/win/audio_low_latency_input_win.cc
+++ b/chromium/media/audio/win/audio_low_latency_input_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,7 +14,6 @@
#include <memory>
#include <utility>
-#include "base/command_line.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
@@ -424,9 +423,8 @@ AudioInputStream::OpenOutcome WASAPIAudioInputStream::Open() {
}
}
- const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
use_fake_audio_capture_timestamps_ =
- cmd_line->HasSwitch(switches::kUseFakeAudioCaptureTimestamps);
+ base::FeatureList::IsEnabled(media::kUseFakeAudioCaptureTimestamps);
if (use_fake_audio_capture_timestamps_) {
SendLogMessage("%s => (WARNING: capture timestamps will be fake)",
__func__);
@@ -651,15 +649,13 @@ void WASAPIAudioInputStream::Close() {
base::UmaHistogramBoolean("Media.Audio.RawProcessingSupportedWin",
raw_processing_supported_);
+ // These UMAs are deprecated but keep adding the information as text logs
+ // for debugging purposes.
for (auto const& type : default_effect_types_) {
- base::UmaHistogramSparse("Media.Audio.Capture.Win.DefaultEffectType",
- type);
SendLogMessage("%s => (Media.Audio.Capture.Win.DefaultEffectType=%s)",
__func__, EffectTypeToString(type));
}
-
for (auto const& type : raw_effect_types_) {
- base::UmaHistogramSparse("Media.Audio.Capture.Win.RawEffectType", type);
SendLogMessage("%s => (Media.Audio.Capture.Win.RawEffectType=%s)",
__func__, EffectTypeToString(type));
}
@@ -1464,10 +1460,12 @@ void WASAPIAudioInputStream::SetupConverterAndStoreFormatInfo() {
double new_frames_per_buffer =
input_format_.Format.nSamplesPerSec / buffer_ratio;
- const auto input_layout = GuessChannelLayout(input_format_.Format.nChannels);
- DCHECK_NE(CHANNEL_LAYOUT_UNSUPPORTED, input_layout);
- const auto output_layout = GuessChannelLayout(output_format_.nChannels);
- DCHECK_NE(CHANNEL_LAYOUT_UNSUPPORTED, output_layout);
+ const auto input_layout =
+ ChannelLayoutConfig::Guess(input_format_.Format.nChannels);
+ DCHECK_NE(CHANNEL_LAYOUT_UNSUPPORTED, input_layout.channel_layout());
+ const auto output_layout =
+ ChannelLayoutConfig::Guess(output_format_.nChannels);
+ DCHECK_NE(CHANNEL_LAYOUT_UNSUPPORTED, output_layout.channel_layout());
const AudioParameters input(AudioParameters::AUDIO_PCM_LOW_LATENCY,
input_layout, input_format_.Format.nSamplesPerSec,
diff --git a/chromium/media/audio/win/audio_low_latency_input_win.h b/chromium/media/audio/win/audio_low_latency_input_win.h
index 26c7e379473..3357e5b7bb7 100644
--- a/chromium/media/audio/win/audio_low_latency_input_win.h
+++ b/chromium/media/audio/win/audio_low_latency_input_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/win/audio_low_latency_input_win_unittest.cc b/chromium/media/audio/win/audio_low_latency_input_win_unittest.cc
index 6553abc1336..a4daa049897 100644
--- a/chromium/media/audio/win/audio_low_latency_input_win_unittest.cc
+++ b/chromium/media/audio/win/audio_low_latency_input_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -615,12 +615,12 @@ TEST_F(WinAudioInputTest, DISABLED_WASAPIAudioInputStreamResampleToFile) {
struct TestData {
const int rate;
const int frames;
- ChannelLayout layout;
+ ChannelLayoutConfig layout;
} tests[] = {
- {8000, 80, CHANNEL_LAYOUT_MONO},
- {8000, 80, CHANNEL_LAYOUT_STEREO},
- {44100, 441, CHANNEL_LAYOUT_MONO},
- {44100, 1024, CHANNEL_LAYOUT_STEREO},
+ {8000, 80, media::ChannelLayoutConfig::Mono()},
+ {8000, 80, media::ChannelLayoutConfig::Stereo()},
+ {44100, 441, media::ChannelLayoutConfig::Mono()},
+ {44100, 1024, media::ChannelLayoutConfig::Stereo()},
};
for (const auto& test : tests) {
diff --git a/chromium/media/audio/win/audio_low_latency_output_win.cc b/chromium/media/audio/win/audio_low_latency_output_win.cc
index c3a4facf84d..5767a6bafa1 100644
--- a/chromium/media/audio/win/audio_low_latency_output_win.cc
+++ b/chromium/media/audio/win/audio_low_latency_output_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -89,6 +89,7 @@ WASAPIAudioOutputStream::WASAPIAudioOutputStream(
manager_(manager),
glitch_reporter_(SystemGlitchReporter::StreamType::kRender),
format_(),
+ params_(params),
opened_(false),
volume_(1.0),
packet_size_frames_(0),
@@ -102,6 +103,10 @@ WASAPIAudioOutputStream::WASAPIAudioOutputStream(
source_(nullptr),
log_callback_(std::move(log_callback)) {
DCHECK(manager_);
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ if (params.format() == AudioParameters::AUDIO_BITSTREAM_DTS)
+ DCHECK_EQ(GetShareMode(), AUDCLNT_SHAREMODE_EXCLUSIVE);
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
// The empty string is used to indicate a default device and the
// |device_role_| member controls whether that's the default or default
@@ -138,13 +143,28 @@ WASAPIAudioOutputStream::WASAPIAudioOutputStream(
format_.Samples.wValidBitsPerSample = format->wBitsPerSample;
format_.dwChannelMask = CoreAudioUtil::GetChannelConfig(device_id, eRender);
format_.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
- SendLogMessage("%s => (audio engine format=[%s])", __func__,
- CoreAudioUtil::WaveFormatToString(&format_).c_str());
// Store size (in different units) of audio packets which we expect to
// get from the audio endpoint device in each render event.
packet_size_frames_ = params.frames_per_buffer();
packet_size_bytes_ = params.GetBytesPerBuffer(kSampleFormatF32);
+
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ if (params.format() == AudioParameters::AUDIO_BITSTREAM_DTS) {
+ format_.SubFormat = KSDATAFORMAT_SUBTYPE_IEC61937_DTS;
+ format->wBitsPerSample = 16;
+ format->nChannels = 2;
+ format_.dwChannelMask = KSAUDIO_SPEAKER_STEREO;
+ format_.Samples.wValidBitsPerSample = format->wBitsPerSample;
+ format->nBlockAlign = (format->wBitsPerSample / 8) * format->nChannels;
+ format->nAvgBytesPerSec = format->nSamplesPerSec * format->nBlockAlign;
+ packet_size_frames_ = 512;
+ packet_size_bytes_ = params.GetBytesPerBuffer(kSampleFormatS16);
+ }
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ SendLogMessage("%s => (audio engine format=[%s])", __func__,
+ CoreAudioUtil::WaveFormatToString(&format_).c_str());
+
SendLogMessage("%s => (packet size=[%zu bytes/%zu audio frames/%.3f ms])",
__func__, packet_size_bytes_, packet_size_frames_,
params.GetBufferDuration().InMillisecondsF());
@@ -462,6 +482,10 @@ void WASAPIAudioOutputStream::Close() {
void WASAPIAudioOutputStream::Flush() {}
void WASAPIAudioOutputStream::SetVolume(double volume) {
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ if (params_.format() == AudioParameters::AUDIO_BITSTREAM_DTS)
+ return;
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
SendLogMessage("%s({volume=%.2f})", __func__, volume);
float volume_float = static_cast<float>(volume);
if (volume_float < 0.0f || volume_float > 1.0f) {
@@ -707,11 +731,29 @@ bool WASAPIAudioOutputStream::RenderAudioFromSource(UINT64 device_frequency) {
// Read a data packet from the registered client source and
// deliver a delay estimate in the same callback to the client.
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ if (params_.format() == AudioParameters::AUDIO_BITSTREAM_DTS) {
+ std::unique_ptr<AudioBus> audio_bus(
+ AudioBus::WrapMemory(params_, audio_data));
+ audio_bus_->set_is_bitstream_format(true);
+ int frames_filled =
+ source_->OnMoreData(delay, delay_timestamp, 0, audio_bus.get());
+
+ // During pause/seek, keep the pipeline filled with zero'ed frames.
+ if (!frames_filled)
+ memset(audio_data, 0, packet_size_frames_);
+
+ // Release the buffer space acquired in the GetBuffer() call.
+ // Render silence if we were not able to fill up the buffer totally.
+ audio_render_client_->ReleaseBuffer(packet_size_frames_, 0);
+ num_written_frames_ += packet_size_frames_;
+ return true;
+ }
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
int frames_filled =
source_->OnMoreData(delay, delay_timestamp, 0, audio_bus_.get());
uint32_t num_filled_bytes = frames_filled * format_.Format.nBlockAlign;
DCHECK_LE(num_filled_bytes, packet_size_bytes_);
-
audio_bus_->Scale(volume_);
// We skip clipping since that occurs at the shared memory boundary.
diff --git a/chromium/media/audio/win/audio_low_latency_output_win.h b/chromium/media/audio/win/audio_low_latency_output_win.h
index 27c9b1ea79c..19950f18971 100644
--- a/chromium/media/audio/win/audio_low_latency_output_win.h
+++ b/chromium/media/audio/win/audio_low_latency_output_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -207,6 +207,9 @@ class MEDIA_EXPORT WASAPIAudioOutputStream
// Use this for multiple channel and hi-resolution PCM data.
WAVEFORMATPCMEX format_;
+ // AudioParameters from the constructor.
+ const AudioParameters params_;
+
// Set to true when stream is successfully opened.
bool opened_;
diff --git a/chromium/media/audio/win/audio_low_latency_output_win_unittest.cc b/chromium/media/audio/win/audio_low_latency_output_win_unittest.cc
index b91239aceeb..e1495c783aa 100644
--- a/chromium/media/audio/win/audio_low_latency_output_win_unittest.cc
+++ b/chromium/media/audio/win/audio_low_latency_output_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -204,11 +204,8 @@ class AudioOutputStreamWrapper {
private:
AudioOutputStream* CreateOutputStream() {
- AudioParameters params(format_, channel_layout_, sample_rate_,
+ AudioParameters params(format_, {channel_layout_, channels_}, sample_rate_,
samples_per_packet_);
- if (channel_layout_ == CHANNEL_LAYOUT_DISCRETE) {
- params.set_channels_for_discrete(channels_);
- }
DVLOG(1) << params.AsHumanReadableString();
AudioOutputStream* aos = audio_man_->MakeAudioOutputStream(
params, std::string(), AudioManager::LogCallback());
diff --git a/chromium/media/audio/win/audio_manager_win.cc b/chromium/media/audio/win/audio_manager_win.cc
index 370edec9e9f..611e3006d4a 100644
--- a/chromium/media/audio/win/audio_manager_win.cc
+++ b/chromium/media/audio/win/audio_manager_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,7 +13,6 @@
#include <setupapi.h>
#include <stddef.h>
-#include <memory>
#include <utility>
#include "base/bind.h"
@@ -35,6 +34,10 @@
#include "media/base/limits.h"
#include "media/base/media_switches.h"
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#include "media/audio/win/audio_edid_scan_win.h"
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+
// The following are defined in various DDK headers, and we (re)define them here
// to avoid adding the DDK as a chrome dependency.
#define DRV_QUERYDEVICEINTERFACE 0x80c
@@ -66,7 +69,26 @@ constexpr int kWinMaxChannels = 8;
// determined from the system
constexpr int kFallbackBufferSize = 2048;
-static int NumberOfWaveOutBuffers() {
+namespace {
+
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+// Passthrough flags as defined in audio_edid_scan_win.h
+uint32_t bitstream_passthrough_bitmask_;
+
+// Convert result from ScanEdidBitstreams to AudioParameters::Format values
+uint32_t ConvertEdidScanToAudioBitstreamFlags(uint32_t edid_scan) {
+ uint32_t bitstream_codecs = 0;
+ if (edid_scan & kAudioBitstreamPcmLinear)
+ bitstream_codecs |= AudioParameters::AUDIO_PCM_LINEAR;
+ if (edid_scan & kAudioBitstreamDts)
+ bitstream_codecs |= AudioParameters::AUDIO_BITSTREAM_DTS;
+ if (edid_scan & kAudioBitstreamDtsHd)
+ bitstream_codecs |= AudioParameters::AUDIO_BITSTREAM_DTS_HD;
+ return bitstream_codecs;
+}
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+
+int NumberOfWaveOutBuffers() {
// Use the user provided buffer count if provided.
int buffers = 0;
std::string buffers_str(
@@ -79,6 +101,8 @@ static int NumberOfWaveOutBuffers() {
return 3;
}
+} // namespace
+
AudioManagerWin::AudioManagerWin(std::unique_ptr<AudioThread> audio_thread,
AudioLogFactory* audio_log_factory)
: AudioManagerBase(std::move(audio_thread), audio_log_factory) {
@@ -183,9 +207,9 @@ AudioParameters AudioManagerWin::GetInputStreamParameters(
// unavailable device. We should track down those code paths (it is likely
// that they actually don't need a real device but depend on the audio
// code path somehow for a configuration - e.g. tab capture).
- parameters =
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 48000, kFallbackBufferSize);
+ parameters = AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(), 48000,
+ kFallbackBufferSize);
}
int user_buffer_size = GetUserBufferSize();
@@ -218,6 +242,17 @@ AudioOutputStream* AudioManagerWin::MakeLinearOutputStream(
WAVE_MAPPER);
}
+AudioOutputStream* AudioManagerWin::MakeBitstreamOutputStream(
+ const AudioParameters& params,
+ const std::string& device_id,
+ const LogCallback& log_callback) {
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ return MakeLowLatencyOutputStream(params, device_id, log_callback);
+#else // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ return nullptr;
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+}
+
// Factory for the implementations of AudioOutputStream for
// AUDIO_PCM_LOW_LATENCY mode. Two implementations should suffice most
// windows user's needs.
@@ -227,7 +262,14 @@ AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream(
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) {
- DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ DCHECK(params.format() == AudioParameters::AUDIO_BITSTREAM_DTS ||
+ params.format() == AudioParameters::AUDIO_PCM_LOW_LATENCY)
+ << params.format();
+#else
+ DCHECK_EQ(params.format(), AudioParameters::AUDIO_PCM_LOW_LATENCY);
+#endif
+
if (params.channels() > kWinMaxChannels)
return nullptr;
@@ -290,16 +332,13 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters(
const std::string& output_device_id,
const AudioParameters& input_params) {
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
- int channels = 0;
- ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO;
+ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Stereo();
int sample_rate = 48000;
int buffer_size = kFallbackBufferSize;
int effects = AudioParameters::NO_EFFECTS;
int min_buffer_size = 0;
int max_buffer_size = 0;
- // TODO(henrika): Remove kEnableExclusiveAudio and related code. It doesn't
- // look like it's used.
if (cmd_line->HasSwitch(switches::kEnableExclusiveAudio)) {
// TODO(rtoy): tune these values for best possible WebAudio
// performance. WebRTC works well at 48kHz and a buffer size of 480
@@ -309,7 +348,7 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters(
sample_rate = 48000;
buffer_size = 256;
if (input_params.IsValid())
- channel_layout = input_params.channel_layout();
+ channel_layout_config = input_params.channel_layout_config();
} else {
AudioParameters params;
HRESULT hr = CoreAudioUtil::GetPreferredAudioParameters(
@@ -329,9 +368,8 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters(
DVLOG(1) << params.AsHumanReadableString();
DCHECK(params.IsValid());
- channels = params.channels();
+ channel_layout_config = params.channel_layout_config();
buffer_size = params.frames_per_buffer();
- channel_layout = params.channel_layout();
sample_rate = params.sample_rate();
effects = params.effects();
@@ -347,12 +385,13 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters(
// have a valid channel layout yet, try to use the input layout. See bugs
// http://crbug.com/259165 and http://crbug.com/311906 for more details.
if (cmd_line->HasSwitch(switches::kTrySupportedChannelLayouts) ||
- channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) {
+ channel_layout_config.channel_layout() == CHANNEL_LAYOUT_UNSUPPORTED) {
// Check if it is possible to open up at the specified input channel
// layout but avoid checking if the specified layout is the same as the
// hardware (preferred) layout. We do this extra check to avoid the
// CoreAudioUtil::IsChannelLayoutSupported() overhead in most cases.
- if (input_params.channel_layout() != channel_layout) {
+ if (input_params.channel_layout() !=
+ channel_layout_config.channel_layout()) {
// TODO(henrika): Internally, IsChannelLayoutSupported does many of the
// operations that have already been done such as opening up a client
// and fetching the WAVEFORMATPCMEX format. Ideally we should only do
@@ -363,9 +402,10 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters(
input_params.channel_layout())) {
// Open up using the same channel layout as the source if it is
// supported by the hardware.
- channel_layout = input_params.channel_layout();
+ channel_layout_config = input_params.channel_layout_config();
DVLOG(1) << "Hardware channel layout is not used; using same layout"
- << " as the source instead (" << channel_layout << ")";
+ << " as the source instead ("
+ << channel_layout_config.channel_layout() << ")";
}
}
}
@@ -384,14 +424,21 @@ AudioParameters AudioManagerWin::GetPreferredOutputStreamParameters(
if (user_buffer_size)
buffer_size = user_buffer_size;
- AudioParameters params(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate,
- buffer_size,
- AudioParameters::HardwareCapabilities(min_buffer_size, max_buffer_size));
- params.set_effects(effects);
- if (channel_layout == CHANNEL_LAYOUT_DISCRETE) {
- params.set_channels_for_discrete(channels);
+ AudioParameters::HardwareCapabilities hardware_capabilities(min_buffer_size,
+ max_buffer_size);
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ hardware_capabilities.bitstream_formats = 0;
+ hardware_capabilities.require_encapsulation = false;
+ if (WASAPIAudioOutputStream::GetShareMode() == AUDCLNT_SHAREMODE_EXCLUSIVE) {
+ hardware_capabilities.bitstream_formats =
+ ConvertEdidScanToAudioBitstreamFlags(bitstream_passthrough_bitmask_);
+ hardware_capabilities.require_encapsulation = true;
}
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ channel_layout_config, sample_rate, buffer_size,
+ hardware_capabilities);
+ params.set_effects(effects);
DCHECK(params.IsValid());
return params;
}
@@ -404,4 +451,10 @@ std::unique_ptr<AudioManager> CreateAudioManager(
audio_log_factory);
}
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+void AudioManagerWin::SetBitstreamPassthroughBitmask(uint32_t bitmask) {
+ bitstream_passthrough_bitmask_ = bitmask;
+}
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+
} // namespace media
diff --git a/chromium/media/audio/win/audio_manager_win.h b/chromium/media/audio/win/audio_manager_win.h
index d6b0774307d..2f6bf87907d 100644
--- a/chromium/media/audio/win/audio_manager_win.h
+++ b/chromium/media/audio/win/audio_manager_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include <string>
#include "media/audio/audio_manager_base.h"
+#include "media/media_buildflags.h"
namespace media {
@@ -54,11 +55,20 @@ class MEDIA_EXPORT AudioManagerWin : public AudioManagerBase {
const AudioParameters& params,
const std::string& device_id,
const LogCallback& log_callback) override;
+ AudioOutputStream* MakeBitstreamOutputStream(
+ const AudioParameters& params,
+ const std::string& device_id,
+ const LogCallback& log_callback) override;
std::string GetDefaultInputDeviceID() override;
std::string GetDefaultOutputDeviceID() override;
std::string GetCommunicationsInputDeviceID() override;
std::string GetCommunicationsOutputDeviceID() override;
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+ // Bitmask indicating which audio codecs are playable using passthrough.
+ static void SetBitstreamPassthroughBitmask(uint32_t bitmask);
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+
protected:
void ShutdownOnAudioThread() override;
AudioParameters GetPreferredOutputStreamParameters(
@@ -75,6 +85,10 @@ class MEDIA_EXPORT AudioManagerWin : public AudioManagerBase {
void GetAudioDeviceNamesImpl(bool input, AudioDeviceNames* device_names);
+ AudioOutputStream* MakeOutputStream(const AudioParameters& params,
+ const std::string& device_id,
+ const LogCallback& log_callback);
+
// Listen for output device changes.
std::unique_ptr<AudioDeviceListenerWin> output_device_listener_;
};
diff --git a/chromium/media/audio/win/audio_output_win_unittest.cc b/chromium/media/audio/win/audio_output_win_unittest.cc
index fa193d5aa8d..9b537b97cce 100644
--- a/chromium/media/audio/win/audio_output_win_unittest.cc
+++ b/chromium/media/audio/win/audio_output_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -184,8 +184,8 @@ TEST_F(WinAudioTest, PCMWaveStreamGetAndClose) {
ABORT_AUDIO_TEST_IF_NOT(audio_manager_device_info_->HasAudioOutputDevices());
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO,
- 8000, 256),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(), 8000, 256),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
oas->Close();
@@ -196,8 +196,8 @@ TEST_F(WinAudioTest, PCMWaveStreamOpenAndClose) {
ABORT_AUDIO_TEST_IF_NOT(audio_manager_device_info_->HasAudioOutputDevices());
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO,
- 8000, 256),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(), 8000, 256),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
EXPECT_TRUE(oas->Open());
@@ -211,8 +211,8 @@ TEST_F(WinAudioTest, PCMWaveSlowSource) {
ABORT_AUDIO_TEST_IF_NOT(audio_manager_device_info_->HasAudioOutputDevices());
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- 16000, 256),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(), 16000, 256),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
TestSourceLaggy test_laggy(90);
@@ -236,7 +236,8 @@ TEST_F(WinAudioTest, PCMWaveStreamPlaySlowLoop) {
uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10;
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(),
AudioParameters::kAudioCDSampleRate, samples_100_ms),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
@@ -266,7 +267,8 @@ TEST_F(WinAudioTest, PCMWaveStreamPlay200HzTone44Kss) {
uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10;
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(),
AudioParameters::kAudioCDSampleRate, samples_100_ms),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
@@ -290,7 +292,8 @@ TEST_F(WinAudioTest, PCMWaveStreamPlay200HzTone22Kss) {
uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 20;
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(),
AudioParameters::kAudioCDSampleRate / 2, samples_100_ms),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
@@ -326,8 +329,8 @@ TEST_F(WinAudioTest, PushSourceFile16KHz) {
source.CapSamples(kSamples100ms);
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- kSampleRate, kSamples100ms),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(), kSampleRate, kSamples100ms),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
@@ -359,7 +362,8 @@ TEST_F(WinAudioTest, PCMWaveStreamPlayTwice200HzTone44Kss) {
uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10;
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(),
AudioParameters::kAudioCDSampleRate, samples_100_ms),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
@@ -398,7 +402,7 @@ TEST_F(WinAudioTest, PCMWaveStreamPlay200HzToneLowLatency) {
uint32_t samples_10_ms = sample_rate / 100;
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_MONO, sample_rate, samples_10_ms),
+ ChannelLayoutConfig::Mono(), sample_rate, samples_10_ms),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
@@ -427,7 +431,8 @@ TEST_F(WinAudioTest, PCMWaveStreamPendingBytes) {
uint32_t samples_100_ms = AudioParameters::kAudioCDSampleRate / 10;
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(),
AudioParameters::kAudioCDSampleRate, samples_100_ms),
std::string(), AudioManager::LogCallback());
ASSERT_TRUE(NULL != oas);
@@ -599,8 +604,9 @@ TEST_F(WinAudioTest, SyncSocketBasic) {
// We want 2 seconds of audio, which means we need 100 packets as each packet
// contains 20ms worth of audio samples.
static const int kPackets2s = 100;
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- sample_rate, kSamples20ms);
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(), sample_rate,
+ kSamples20ms);
AudioOutputStream* oas = audio_manager_->MakeAudioOutputStream(
params, std::string(), AudioManager::LogCallback());
diff --git a/chromium/media/audio/win/audio_session_event_listener_win.cc b/chromium/media/audio/win/audio_session_event_listener_win.cc
index d344295c077..35f6fe3abb4 100644
--- a/chromium/media/audio/win/audio_session_event_listener_win.cc
+++ b/chromium/media/audio/win/audio_session_event_listener_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/audio_session_event_listener_win.h b/chromium/media/audio/win/audio_session_event_listener_win.h
index b3d9ec4ba14..753ee3dee1a 100644
--- a/chromium/media/audio/win/audio_session_event_listener_win.h
+++ b/chromium/media/audio/win/audio_session_event_listener_win.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/audio_session_event_listener_win_unittest.cc b/chromium/media/audio/win/audio_session_event_listener_win_unittest.cc
index 8ee545e808f..7723fc01860 100644
--- a/chromium/media/audio/win/audio_session_event_listener_win_unittest.cc
+++ b/chromium/media/audio/win/audio_session_event_listener_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/avrt_wrapper_win.cc b/chromium/media/audio/win/avrt_wrapper_win.cc
index bde2f462eac..13956d330d7 100644
--- a/chromium/media/audio/win/avrt_wrapper_win.cc
+++ b/chromium/media/audio/win/avrt_wrapper_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/avrt_wrapper_win.h b/chromium/media/audio/win/avrt_wrapper_win.h
index 0b3462a8556..7a95f8603ab 100644
--- a/chromium/media/audio/win/avrt_wrapper_win.h
+++ b/chromium/media/audio/win/avrt_wrapper_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/win/core_audio_util_win.cc b/chromium/media/audio/win/core_audio_util_win.cc
index 6bd66dec2fc..7ee461a911e 100644
--- a/chromium/media/audio/win/core_audio_util_win.cc
+++ b/chromium/media/audio/win/core_audio_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,6 +25,7 @@
#include "base/win/windows_version.h"
#include "media/audio/audio_device_description.h"
#include "media/audio/audio_features.h"
+#include "media/base/channel_layout.h"
#include "media/base/media_switches.h"
#include "media/base/win/mf_helpers.h"
@@ -564,14 +565,8 @@ HRESULT GetPreferredAudioParametersInternal(IAudioClient* client,
// Retrieve the current channel configuration (e.g. CHANNEL_LAYOUT_STEREO).
ChannelLayout channel_layout = GetChannelLayout(format);
-
- AudioParameters audio_params(
- AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate,
- frames_per_buffer,
- AudioParameters::HardwareCapabilities(min_frames_per_buffer,
- max_frames_per_buffer));
-
- if (audio_params.channel_layout() == CHANNEL_LAYOUT_DISCRETE) {
+ int channels = ChannelLayoutToChannelCount(channel_layout);
+ if (channel_layout == CHANNEL_LAYOUT_DISCRETE) {
if (!is_output_device) {
// Set the number of channels explicitly to two for input devices if
// the channel layout is discrete to ensure that the parameters are valid
@@ -580,7 +575,7 @@ HRESULT GetPreferredAudioParametersInternal(IAudioClient* client,
// input stream implementation instead.
// See crbug.com/868026 for examples where this approach is needed.
DVLOG(1) << "Forcing number of channels to 2 for CHANNEL_LAYOUT_DISCRETE";
- audio_params.set_channels_for_discrete(2);
+ channels = 2;
} else {
// Some output devices return CHANNEL_LAYOUT_DISCRETE. Keep this channel
// format but update the number of channels with the correct value. The
@@ -588,9 +583,16 @@ HRESULT GetPreferredAudioParametersInternal(IAudioClient* client,
// See crbug.com/957886 for more details.
DVLOG(1) << "Setting number of channels to " << format->nChannels
<< " for CHANNEL_LAYOUT_DISCRETE";
- audio_params.set_channels_for_discrete(format->nChannels);
+ channels = format->nChannels;
}
}
+
+ AudioParameters audio_params(
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, {channel_layout, channels},
+ sample_rate, frames_per_buffer,
+ AudioParameters::HardwareCapabilities(min_frames_per_buffer,
+ max_frames_per_buffer));
+
DVLOG(1) << audio_params.AsHumanReadableString();
DCHECK(audio_params.IsValid());
*params = audio_params;
@@ -1086,7 +1088,7 @@ HRESULT CoreAudioUtil::GetPreferredAudioParameters(const std::string& device_id,
params->channel_layout() != CHANNEL_LAYOUT_DISCRETE) {
DLOG(WARNING)
<< "Replacing existing audio parameter with predefined version";
- params->Reset(params->format(), CHANNEL_LAYOUT_STEREO,
+ params->Reset(params->format(), media::ChannelLayoutConfig::Stereo(),
params->sample_rate(), params->frames_per_buffer());
}
diff --git a/chromium/media/audio/win/core_audio_util_win.h b/chromium/media/audio/win/core_audio_util_win.h
index 0e9a55e6059..441678f9edc 100644
--- a/chromium/media/audio/win/core_audio_util_win.h
+++ b/chromium/media/audio/win/core_audio_util_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/core_audio_util_win_unittest.cc b/chromium/media/audio/win/core_audio_util_win_unittest.cc
index 61f74af3404..3d095ddbfd4 100644
--- a/chromium/media/audio/win/core_audio_util_win_unittest.cc
+++ b/chromium/media/audio/win/core_audio_util_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/device_enumeration_win.cc b/chromium/media/audio/win/device_enumeration_win.cc
index df2ad518c86..11b1678768a 100644
--- a/chromium/media/audio/win/device_enumeration_win.cc
+++ b/chromium/media/audio/win/device_enumeration_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/device_enumeration_win.h b/chromium/media/audio/win/device_enumeration_win.h
index 25c162b96ea..d6f73a84244 100644
--- a/chromium/media/audio/win/device_enumeration_win.h
+++ b/chromium/media/audio/win/device_enumeration_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/device_enumeration_win_unittest.cc b/chromium/media/audio/win/device_enumeration_win_unittest.cc
index 0585df46e4b..4de39f7244b 100644
--- a/chromium/media/audio/win/device_enumeration_win_unittest.cc
+++ b/chromium/media/audio/win/device_enumeration_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/volume_range_util.cc b/chromium/media/audio/win/volume_range_util.cc
index 086660309c9..06af2063d38 100644
--- a/chromium/media/audio/win/volume_range_util.cc
+++ b/chromium/media/audio/win/volume_range_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/volume_range_util.h b/chromium/media/audio/win/volume_range_util.h
index 29d0d62c1fa..5dfb07e3215 100644
--- a/chromium/media/audio/win/volume_range_util.h
+++ b/chromium/media/audio/win/volume_range_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/audio/win/volume_range_util_unittest.cc b/chromium/media/audio/win/volume_range_util_unittest.cc
index cc3098eb69f..ce92863f140 100644
--- a/chromium/media/audio/win/volume_range_util_unittest.cc
+++ b/chromium/media/audio/win/volume_range_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/waveout_output_win.cc b/chromium/media/audio/win/waveout_output_win.cc
index 09d65e73d31..81222be288a 100644
--- a/chromium/media/audio/win/waveout_output_win.cc
+++ b/chromium/media/audio/win/waveout_output_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/audio/win/waveout_output_win.h b/chromium/media/audio/win/waveout_output_win.h
index d99b2757eae..644de74a455 100644
--- a/chromium/media/audio/win/waveout_output_win.h
+++ b/chromium/media/audio/win/waveout_output_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/BUILD.gn b/chromium/media/base/BUILD.gn
index ac8d570e1a2..fe3054a0ec0 100644
--- a/chromium/media/base/BUILD.gn
+++ b/chromium/media/base/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -175,10 +175,10 @@ source_set("base") {
"format_utils.h",
"frame_rate_estimator.cc",
"frame_rate_estimator.h",
+ "key_system_info.cc",
+ "key_system_info.h",
"key_system_names.cc",
"key_system_names.h",
- "key_system_properties.cc",
- "key_system_properties.h",
"key_systems.cc",
"key_systems.h",
"localized_strings.cc",
@@ -208,6 +208,8 @@ source_set("base") {
"media_observer.h",
"media_permission.cc",
"media_permission.h",
+ "media_player_logging_id.cc",
+ "media_player_logging_id.h",
"media_resource.cc",
"media_resource.h",
"media_serializers.h",
diff --git a/chromium/media/base/android/BUILD.gn b/chromium/media/base/android/BUILD.gn
index 7d45fe6f05e..b4b17de4ba0 100644
--- a/chromium/media/base/android/BUILD.gn
+++ b/chromium/media/base/android/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/base/android/android_cdm_factory.cc b/chromium/media/base/android/android_cdm_factory.cc
index 15084f3ed7c..a6346151f6c 100644
--- a/chromium/media/base/android/android_cdm_factory.cc
+++ b/chromium/media/base/android/android_cdm_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/android_cdm_factory.h b/chromium/media/base/android/android_cdm_factory.h
index 1aa9f68dcd5..20d4f66bb09 100644
--- a/chromium/media/base/android/android_cdm_factory.h
+++ b/chromium/media/base/android/android_cdm_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/android_overlay.cc b/chromium/media/base/android/android_overlay.cc
index 22a02a23f97..c034210618c 100644
--- a/chromium/media/base/android/android_overlay.cc
+++ b/chromium/media/base/android/android_overlay.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/android_overlay.h b/chromium/media/base/android/android_overlay.h
index 1c37622c97c..67c77534771 100644
--- a/chromium/media/base/android/android_overlay.h
+++ b/chromium/media/base/android/android_overlay.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/android_util.cc b/chromium/media/base/android/android_util.cc
index ca627d9b006..29a86c0f2c1 100644
--- a/chromium/media/base/android/android_util.cc
+++ b/chromium/media/base/android/android_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/android_util.h b/chromium/media/base/android/android_util.h
index b70b6495d57..9098e2ef549 100644
--- a/chromium/media/base/android/android_util.h
+++ b/chromium/media/base/android/android_util.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/extract_sps_and_pps.cc b/chromium/media/base/android/extract_sps_and_pps.cc
index 213b419d43b..b96f3f9e49e 100644
--- a/chromium/media/base/android/extract_sps_and_pps.cc
+++ b/chromium/media/base/android/extract_sps_and_pps.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/extract_sps_and_pps.h b/chromium/media/base/android/extract_sps_and_pps.h
index d3310a6c4d6..3a11d54e1c6 100644
--- a/chromium/media/base/android/extract_sps_and_pps.h
+++ b/chromium/media/base/android/extract_sps_and_pps.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/jni_hdr_metadata.cc b/chromium/media/base/android/jni_hdr_metadata.cc
index eebeb4d5282..f004b0171b2 100644
--- a/chromium/media/base/android/jni_hdr_metadata.cc
+++ b/chromium/media/base/android/jni_hdr_metadata.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/jni_hdr_metadata.h b/chromium/media/base/android/jni_hdr_metadata.h
index 38d1a0efe36..009297d7278 100644
--- a/chromium/media/base/android/jni_hdr_metadata.h
+++ b/chromium/media/base/android/jni_hdr_metadata.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_codec_bridge.h b/chromium/media/base/android/media_codec_bridge.h
index 1a58bbd7563..2b0ac8e924a 100644
--- a/chromium/media/base/android/media_codec_bridge.h
+++ b/chromium/media/base/android/media_codec_bridge.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_codec_bridge_impl.cc b/chromium/media/base/android/media_codec_bridge_impl.cc
index aac199d9b32..347cbba1fc4 100644
--- a/chromium/media/base/android/media_codec_bridge_impl.cc
+++ b/chromium/media/base/android/media_codec_bridge_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_codec_bridge_impl.h b/chromium/media/base/android/media_codec_bridge_impl.h
index 5e64ddd20ff..96b6b8d961c 100644
--- a/chromium/media/base/android/media_codec_bridge_impl.h
+++ b/chromium/media/base/android/media_codec_bridge_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_codec_bridge_impl_unittest.cc b/chromium/media/base/android/media_codec_bridge_impl_unittest.cc
index d1010650e7e..43eecb6dc9d 100644
--- a/chromium/media/base/android/media_codec_bridge_impl_unittest.cc
+++ b/chromium/media/base/android/media_codec_bridge_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_codec_direction.h b/chromium/media/base/android/media_codec_direction.h
index 3e972c2802d..b71abb97a03 100644
--- a/chromium/media/base/android/media_codec_direction.h
+++ b/chromium/media/base/android/media_codec_direction.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_codec_loop.cc b/chromium/media/base/android/media_codec_loop.cc
index ba2feac5134..010c5056a04 100644
--- a/chromium/media/base/android/media_codec_loop.cc
+++ b/chromium/media/base/android/media_codec_loop.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_codec_loop.h b/chromium/media/base/android/media_codec_loop.h
index 7427df5a019..f8632c726a0 100644
--- a/chromium/media/base/android/media_codec_loop.h
+++ b/chromium/media/base/android/media_codec_loop.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_codec_loop_unittest.cc b/chromium/media/base/android/media_codec_loop_unittest.cc
index 5613ea9098b..559cb8c8229 100644
--- a/chromium/media/base/android/media_codec_loop_unittest.cc
+++ b/chromium/media/base/android/media_codec_loop_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -91,7 +91,7 @@ class MediaCodecLoopTest : public testing::Test {
}
void ConstructCodecLoop() {
- int sdk_int = base::android::SDK_VERSION_MARSHMALLOW;
+ int sdk_int = base::android::SDK_VERSION_NOUGAT;
auto codec = std::make_unique<MockMediaCodecBridge>();
// Since we're providing a codec, we do not expect an error.
EXPECT_CALL(*client_, OnCodecLoopError()).Times(0);
@@ -199,7 +199,7 @@ class MediaCodecLoopTest : public testing::Test {
TEST_F(MediaCodecLoopTest, TestConstructionWithNullCodec) {
std::unique_ptr<MediaCodecBridge> codec;
EXPECT_CALL(*client_, OnCodecLoopError()).Times(1);
- const int sdk_int = base::android::SDK_VERSION_MARSHMALLOW;
+ const int sdk_int = base::android::SDK_VERSION_NOUGAT;
codec_loop_ = std::make_unique<MediaCodecLoop>(
sdk_int, client_.get(), std::move(codec),
scoped_refptr<base::SingleThreadTaskRunner>());
diff --git a/chromium/media/base/android/media_codec_util.cc b/chromium/media/base/android/media_codec_util.cc
index fe96d28fc6b..9c14831d39b 100644
--- a/chromium/media/base/android/media_codec_util.cc
+++ b/chromium/media/base/android/media_codec_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,13 +6,13 @@
#include <stddef.h>
-#include <algorithm>
#include <vector>
#include "base/android/build_info.h"
#include "base/android/jni_android.h"
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
@@ -68,19 +68,7 @@ static bool IsSupportedAndroidMimeType(const std::string& mime_type) {
kMp3MimeType, kAacMimeType, kOpusMimeType, kVorbisMimeType,
kAvcMimeType, kDolbyVisionMimeType, kHevcMimeType, kVp8MimeType,
kVp9MimeType, kAv1MimeType};
- return std::find(supported.begin(), supported.end(), mime_type) !=
- supported.end();
-}
-
-static std::string GetDefaultCodecName(const std::string& mime_type,
- MediaCodecDirection direction,
- bool requires_software_codec) {
- JNIEnv* env = AttachCurrentThread();
- ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime_type);
- ScopedJavaLocalRef<jstring> j_codec_name =
- Java_MediaCodecUtil_getDefaultCodecName(
- env, j_mime, static_cast<int>(direction), requires_software_codec);
- return ConvertJavaStringToUTF8(env, j_codec_name.obj());
+ return base::Contains(supported, mime_type);
}
static bool IsDecoderSupportedByDevice(const std::string& android_mime_type) {
@@ -203,13 +191,6 @@ std::set<int> MediaCodecUtil::GetEncoderColorFormats(
return color_formats;
}
-#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
-// static
-bool MediaCodecUtil::IsDolbyVisionDecoderAvailable() {
- return IsDecoderSupportedByDevice(kDolbyVisionMimeType);
-}
-#endif
-
// static
bool MediaCodecUtil::IsVp8DecoderAvailable() {
return IsDecoderSupportedByDevice(kVp8MimeType);
@@ -330,33 +311,28 @@ void MediaCodecUtil::AddSupportedCodecProfileLevels(
// static
bool MediaCodecUtil::IsKnownUnaccelerated(VideoCodec codec,
MediaCodecDirection direction) {
- std::string codec_name =
- GetDefaultCodecName(CodecToAndroidMimeType(codec), direction, false);
- DVLOG(1) << __func__ << "Default codec for " << GetCodecName(codec) << " : "
- << codec_name << ", direction: " << static_cast<int>(direction);
+ auto* env = AttachCurrentThread();
+ auto j_mime = ConvertUTF8ToJavaString(env, CodecToAndroidMimeType(codec));
+ auto j_codec_name = Java_MediaCodecUtil_getDefaultCodecName(
+ env, j_mime, static_cast<int>(direction), /*requireSoftwareCodec=*/false,
+ /*requireHardwareCodec=*/true);
+
+ auto codec_name = ConvertJavaStringToUTF8(env, j_codec_name.obj());
+ DVLOG(1) << __func__ << "Default hardware codec for " << GetCodecName(codec)
+ << " : " << codec_name
+ << ", direction: " << static_cast<int>(direction);
if (codec_name.empty())
return true;
// MediaTek hardware vp8 is known slower than the software implementation.
- if (base::StartsWith(codec_name, "OMX.MTK.", base::CompareCase::SENSITIVE)) {
- if (codec == VideoCodec::kVP8) {
- // We may still reject VP8 hardware decoding later on certain chipsets,
- // see isDecoderSupportedForDevice(). We don't have the the chipset ID
- // here to check now though.
- return base::android::BuildInfo::GetInstance()->sdk_int() < SDK_VERSION_P;
- }
-
- return false;
+ if (base::StartsWith(codec_name, "OMX.MTK.") && codec == VideoCodec::kVP8) {
+ // We may still reject VP8 hardware decoding later on certain chipsets,
+ // see isDecoderSupportedForDevice(). We don't have the the chipset ID
+ // here to check now though.
+ return base::android::BuildInfo::GetInstance()->sdk_int() < SDK_VERSION_P;
}
- // It would be nice if MediaCodecInfo externalized some notion of
- // HW-acceleration but it doesn't. Android Media guidance is that the
- // "OMX.google" prefix is always used for SW decoders, so that's what we
- // use. "OMX.SEC.*" codec is Samsung software implementation - report it
- // as unaccelerated as well.
- return base::StartsWith(codec_name, "OMX.google.",
- base::CompareCase::SENSITIVE) ||
- base::StartsWith(codec_name, "OMX.SEC.", base::CompareCase::SENSITIVE);
+ return false;
}
} // namespace media
diff --git a/chromium/media/base/android/media_codec_util.h b/chromium/media/base/android/media_codec_util.h
index 4afc89f0019..15e49568a47 100644
--- a/chromium/media/base/android/media_codec_util.h
+++ b/chromium/media/base/android/media_codec_util.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -34,11 +34,6 @@ class MEDIA_EXPORT MediaCodecUtil {
// Returns true if MediaCodec supports CBCS Encryption.
static bool PlatformSupportsCbcsEncryption(int sdk);
-#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
- // Indicates if Dolby Vision decoder is available on this device.
- static bool IsDolbyVisionDecoderAvailable();
-#endif
-
// Indicates if the vp8 decoder or encoder is available on this device.
static bool IsVp8DecoderAvailable();
static bool IsVp8EncoderAvailable();
diff --git a/chromium/media/base/android/media_codec_util_unittest.cc b/chromium/media/base/android/media_codec_util_unittest.cc
index 91e18618df2..ed999a4a5e5 100644
--- a/chromium/media/base/android/media_codec_util_unittest.cc
+++ b/chromium/media/base/android/media_codec_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,6 @@
namespace media {
// These will come from mockable BuildInfo, once it exists.
-using base::android::SDK_VERSION_MARSHMALLOW;
using base::android::SDK_VERSION_NOUGAT;
using base::android::SDK_VERSION_NOUGAT_MR1;
@@ -27,8 +26,6 @@ class MediaCodecUtilTest : public testing::Test {
TEST_F(MediaCodecUtilTest, TestCbcsAvailableIfNewerVersion) {
EXPECT_FALSE(
- MediaCodecUtil::PlatformSupportsCbcsEncryption(SDK_VERSION_MARSHMALLOW));
- EXPECT_FALSE(
MediaCodecUtil::PlatformSupportsCbcsEncryption(SDK_VERSION_NOUGAT));
EXPECT_TRUE(
MediaCodecUtil::PlatformSupportsCbcsEncryption(SDK_VERSION_NOUGAT_MR1));
diff --git a/chromium/media/base/android/media_common_android.h b/chromium/media/base/android/media_common_android.h
index c86f21fc8e6..8ddff37cac5 100644
--- a/chromium/media/base/android/media_common_android.h
+++ b/chromium/media/base/android/media_common_android.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_crypto_context.h b/chromium/media/base/android/media_crypto_context.h
index a1a079258ec..de88108507d 100644
--- a/chromium/media/base/android/media_crypto_context.h
+++ b/chromium/media/base/android/media_crypto_context.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_crypto_context_impl.cc b/chromium/media/base/android/media_crypto_context_impl.cc
index 5fbc550441f..35a8cf8844a 100644
--- a/chromium/media/base/android/media_crypto_context_impl.cc
+++ b/chromium/media/base/android/media_crypto_context_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_crypto_context_impl.h b/chromium/media/base/android/media_crypto_context_impl.h
index 1985a36e771..8258385e563 100644
--- a/chromium/media/base/android/media_crypto_context_impl.h
+++ b/chromium/media/base/android/media_crypto_context_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_bridge.cc b/chromium/media/base/android/media_drm_bridge.cc
index 0c38fc73c66..4460bad02cf 100644
--- a/chromium/media/base/android/media_drm_bridge.cc
+++ b/chromium/media/base/android/media_drm_bridge.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_bridge.h b/chromium/media/base/android/media_drm_bridge.h
index f46afa4588f..1f138040d8f 100644
--- a/chromium/media/base/android/media_drm_bridge.h
+++ b/chromium/media/base/android/media_drm_bridge.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_bridge_client.cc b/chromium/media/base/android/media_drm_bridge_client.cc
index 182e43e5dc6..0b85c86d7d1 100644
--- a/chromium/media/base/android/media_drm_bridge_client.cc
+++ b/chromium/media/base/android/media_drm_bridge_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_bridge_client.h b/chromium/media/base/android/media_drm_bridge_client.h
index 59d907e4507..46f26916e07 100644
--- a/chromium/media/base/android/media_drm_bridge_client.h
+++ b/chromium/media/base/android/media_drm_bridge_client.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_bridge_delegate.cc b/chromium/media/base/android/media_drm_bridge_delegate.cc
index 8bd43ca1120..711146e8846 100644
--- a/chromium/media/base/android/media_drm_bridge_delegate.cc
+++ b/chromium/media/base/android/media_drm_bridge_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_bridge_delegate.h b/chromium/media/base/android/media_drm_bridge_delegate.h
index 79bcf9f5a2c..2abb7cdb2bc 100644
--- a/chromium/media/base/android/media_drm_bridge_delegate.h
+++ b/chromium/media/base/android/media_drm_bridge_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_bridge_factory.cc b/chromium/media/base/android/media_drm_bridge_factory.cc
index 613e45bbaaf..c67d69c9b88 100644
--- a/chromium/media/base/android/media_drm_bridge_factory.cc
+++ b/chromium/media/base/android/media_drm_bridge_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_bridge_factory.h b/chromium/media/base/android/media_drm_bridge_factory.h
index 236edeaa1f2..03abfe54531 100644
--- a/chromium/media/base/android/media_drm_bridge_factory.h
+++ b/chromium/media/base/android/media_drm_bridge_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_bridge_unittest.cc b/chromium/media/base/android/media_drm_bridge_unittest.cc
index dca6d3e747b..180523094c4 100644
--- a/chromium/media/base/android/media_drm_bridge_unittest.cc
+++ b/chromium/media/base/android/media_drm_bridge_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,14 +23,14 @@ using ::testing::StrictMock;
namespace media {
-#define EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(a) \
- do { \
- if (!MediaDrmBridge::IsKeySystemSupported(kWidevineKeySystem)) { \
- VLOG(0) << "Widevine not supported on device."; \
- EXPECT_FALSE(a); \
- } else { \
- EXPECT_TRUE(a); \
- } \
+#define EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(a) \
+ do { \
+ if (!MediaDrmBridge::IsKeySystemSupported(kWidevineKeySystem)) { \
+ VLOG(0) << "Widevine not supported on device."; \
+ EXPECT_FALSE(a); \
+ } else { \
+ EXPECT_TRUE(a); \
+ } \
} while (0)
const char kAudioMp4[] = "audio/mp4";
@@ -128,11 +128,10 @@ TEST_F(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) {
EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(
IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoMp4));
-
EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(
- IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM));
+ IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM));
EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(
- IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM));
+ IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM));
EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "unknown"));
EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "video/avi"));
@@ -171,7 +170,8 @@ TEST_F(MediaDrmBridgeTest, CreateWithSecurityLevel_Widevine) {
CreateWithoutSessionSupport(kWidevineKeySystem, kTestOrigin, kL1);
}
-TEST_F(MediaDrmBridgeTest, Provision_Widevine) {
+// See https://crbug.com/1370782.
+TEST_F(MediaDrmBridgeTest, DISABLED_Provision_Widevine) {
// Only test this if Widevine is supported. Otherwise
// CreateWithoutSessionSupport() will return null and it can't be tested.
if (!MediaDrmBridge::IsKeySystemSupported(kWidevineKeySystem)) {
@@ -186,16 +186,6 @@ TEST_F(MediaDrmBridgeTest, Provision_Widevine) {
return;
}
- // On Android M occasionally MediaDrm.getProvisionRequest() throws and thus a
- // request can not be generated. This has been fixed in Android N. As Android
- // M is unlikely to be fixed, disabling this test if running on Android M.
- // http://crbug.com/973096#c21
- if (base::android::BuildInfo::GetInstance()->sdk_int() ==
- base::android::SDK_VERSION_MARSHMALLOW) {
- VLOG(0) << "Disabled for Android M.";
- return;
- }
-
// Calling Provision() later should trigger a provisioning request. As we
// can't pass the request to a license server,
// MockProvisionFetcher::Retrieve() simply drops the request and never
diff --git a/chromium/media/base/android/media_drm_storage_bridge.cc b/chromium/media/base/android/media_drm_storage_bridge.cc
index 803d8407d8e..a9f7df570c8 100644
--- a/chromium/media/base/android/media_drm_storage_bridge.cc
+++ b/chromium/media/base/android/media_drm_storage_bridge.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_drm_storage_bridge.h b/chromium/media/base/android/media_drm_storage_bridge.h
index 8787f9f6d97..5ccef3885b6 100644
--- a/chromium/media/base/android/media_drm_storage_bridge.h
+++ b/chromium/media/base/android/media_drm_storage_bridge.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_player_bridge.cc b/chromium/media/base/android/media_player_bridge.cc
index 9ed5a3f9d37..36a58acfcd2 100644
--- a/chromium/media/base/android/media_player_bridge.cc
+++ b/chromium/media/base/android/media_player_bridge.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_player_bridge.h b/chromium/media/base/android/media_player_bridge.h
index 98b88b97105..a6426d49a33 100644
--- a/chromium/media/base/android/media_player_bridge.h
+++ b/chromium/media/base/android/media_player_bridge.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_player_bridge_unittest.cc b/chromium/media/base/android/media_player_bridge_unittest.cc
index 13b651f9943..fdd01711e68 100644
--- a/chromium/media/base/android/media_player_bridge_unittest.cc
+++ b/chromium/media/base/android/media_player_bridge_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_player_listener.cc b/chromium/media/base/android/media_player_listener.cc
index 9720a3f0ac4..249a3298189 100644
--- a/chromium/media/base/android/media_player_listener.cc
+++ b/chromium/media/base/android/media_player_listener.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_player_listener.h b/chromium/media/base/android/media_player_listener.h
index 166afc4bd0f..54c99f5f80f 100644
--- a/chromium/media/base/android/media_player_listener.h
+++ b/chromium/media/base/android/media_player_listener.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_resource_getter.cc b/chromium/media/base/android/media_resource_getter.cc
index 5fdff06b946..5340054ae3d 100644
--- a/chromium/media/base/android/media_resource_getter.cc
+++ b/chromium/media/base/android/media_resource_getter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_resource_getter.h b/chromium/media/base/android/media_resource_getter.h
index b0b822261fa..32712c2fd11 100644
--- a/chromium/media/base/android/media_resource_getter.h
+++ b/chromium/media/base/android/media_resource_getter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_server_crash_listener.cc b/chromium/media/base/android/media_server_crash_listener.cc
index 958df440d1f..ed37491eb0d 100644
--- a/chromium/media/base/android/media_server_crash_listener.cc
+++ b/chromium/media/base/android/media_server_crash_listener.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_server_crash_listener.h b/chromium/media/base/android/media_server_crash_listener.h
index b66e222aef5..9bdb8471156 100644
--- a/chromium/media/base/android/media_server_crash_listener.h
+++ b/chromium/media/base/android/media_server_crash_listener.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_service_throttler.cc b/chromium/media/base/android/media_service_throttler.cc
index 603e5543365..5ea844d27d7 100644
--- a/chromium/media/base/android/media_service_throttler.cc
+++ b/chromium/media/base/android/media_service_throttler.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_service_throttler.h b/chromium/media/base/android/media_service_throttler.h
index e3057efd59a..1bae14a7c47 100644
--- a/chromium/media/base/android/media_service_throttler.h
+++ b/chromium/media/base/android/media_service_throttler.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_service_throttler_unittest.cc b/chromium/media/base/android/media_service_throttler_unittest.cc
index 7b12f8aef9b..af2eefdd1d7 100644
--- a/chromium/media/base/android/media_service_throttler_unittest.cc
+++ b/chromium/media/base/android/media_service_throttler_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/media_url_interceptor.h b/chromium/media/base/android/media_url_interceptor.h
index d099ee0d260..ff53cb06da5 100644
--- a/chromium/media/base/android/media_url_interceptor.h
+++ b/chromium/media/base/android/media_url_interceptor.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/mock_android_overlay.cc b/chromium/media/base/android/mock_android_overlay.cc
index e16d68116f2..b2155f46f7a 100644
--- a/chromium/media/base/android/mock_android_overlay.cc
+++ b/chromium/media/base/android/mock_android_overlay.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/mock_android_overlay.h b/chromium/media/base/android/mock_android_overlay.h
index 52d1cdf934e..cbfbf2d92c4 100644
--- a/chromium/media/base/android/mock_android_overlay.h
+++ b/chromium/media/base/android/mock_android_overlay.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/mock_media_codec_bridge.cc b/chromium/media/base/android/mock_media_codec_bridge.cc
index 3799d0c172e..4be6f9fa4eb 100644
--- a/chromium/media/base/android/mock_media_codec_bridge.cc
+++ b/chromium/media/base/android/mock_media_codec_bridge.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/mock_media_codec_bridge.h b/chromium/media/base/android/mock_media_codec_bridge.h
index 3bbc17ff1a2..874d78652f9 100644
--- a/chromium/media/base/android/mock_media_codec_bridge.h
+++ b/chromium/media/base/android/mock_media_codec_bridge.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/mock_media_crypto_context.cc b/chromium/media/base/android/mock_media_crypto_context.cc
index 8276c9897e6..d09fdb264f9 100644
--- a/chromium/media/base/android/mock_media_crypto_context.cc
+++ b/chromium/media/base/android/mock_media_crypto_context.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/mock_media_crypto_context.h b/chromium/media/base/android/mock_media_crypto_context.h
index 24061c01020..ecde6f81488 100644
--- a/chromium/media/base/android/mock_media_crypto_context.h
+++ b/chromium/media/base/android/mock_media_crypto_context.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/stream_texture_wrapper.h b/chromium/media/base/android/stream_texture_wrapper.h
index 2e4275ac985..b0a4dd5ef45 100644
--- a/chromium/media/base/android/stream_texture_wrapper.h
+++ b/chromium/media/base/android/stream_texture_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/test_destruction_observable.cc b/chromium/media/base/android/test_destruction_observable.cc
index eb8c226323a..035e4412634 100644
--- a/chromium/media/base/android/test_destruction_observable.cc
+++ b/chromium/media/base/android/test_destruction_observable.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android/test_destruction_observable.h b/chromium/media/base/android/test_destruction_observable.h
index c4b77bbe3b4..5993bf84f7e 100644
--- a/chromium/media/base/android/test_destruction_observable.h
+++ b/chromium/media/base/android/test_destruction_observable.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android_overlay_config.cc b/chromium/media/base/android_overlay_config.cc
index 41e4aa09675..64b619be3be 100644
--- a/chromium/media/base/android_overlay_config.cc
+++ b/chromium/media/base/android_overlay_config.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android_overlay_config.h b/chromium/media/base/android_overlay_config.h
index bed54bed35e..a9c401d43c9 100644
--- a/chromium/media/base/android_overlay_config.h
+++ b/chromium/media/base/android_overlay_config.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/android_overlay_mojo_factory.h b/chromium/media/base/android_overlay_mojo_factory.h
index 87034657333..ecfd70b190c 100644
--- a/chromium/media/base/android_overlay_mojo_factory.h
+++ b/chromium/media/base/android_overlay_mojo_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/async_destroy_video_decoder.h b/chromium/media/base/async_destroy_video_decoder.h
index e0f9f9352d7..93456f19f52 100644
--- a/chromium/media/base/async_destroy_video_decoder.h
+++ b/chromium/media/base/async_destroy_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/async_destroy_video_encoder.h b/chromium/media/base/async_destroy_video_encoder.h
index 6debc10fee7..d6ab76221a3 100644
--- a/chromium/media/base/async_destroy_video_encoder.h
+++ b/chromium/media/base/async_destroy_video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_block_fifo.cc b/chromium/media/base/audio_block_fifo.cc
index ad49cff0637..41c1f1a5b66 100644
--- a/chromium/media/base/audio_block_fifo.cc
+++ b/chromium/media/base/audio_block_fifo.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_block_fifo.h b/chromium/media/base/audio_block_fifo.h
index a3abd8b2bc2..b2778d708bc 100644
--- a/chromium/media/base/audio_block_fifo.h
+++ b/chromium/media/base/audio_block_fifo.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_block_fifo_unittest.cc b/chromium/media/base/audio_block_fifo_unittest.cc
index fd443e69a10..82095509b6d 100644
--- a/chromium/media/base/audio_block_fifo_unittest.cc
+++ b/chromium/media/base/audio_block_fifo_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_buffer.cc b/chromium/media/base/audio_buffer.cc
index 93f3e33612e..d5fa4722d61 100644
--- a/chromium/media/base/audio_buffer.cc
+++ b/chromium/media/base/audio_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -100,6 +100,7 @@ AudioBuffer::AudioBuffer(SampleFormat sample_format,
CHECK_GE(channel_count_, 0);
CHECK_LE(channel_count_, limits::kMaxChannels);
CHECK_GE(frame_count, 0);
+
DCHECK(channel_layout == CHANNEL_LAYOUT_DISCRETE ||
ChannelLayoutToChannelCount(channel_layout) == channel_count);
@@ -112,6 +113,25 @@ AudioBuffer::AudioBuffer(SampleFormat sample_format,
CHECK_NE(sample_format, kUnknownSampleFormat);
+ if (sample_format == kSampleFormatIECDts) {
+ // Allocate a contiguous buffer for IEC61937 encapsulated Bitstream.
+ data_size_ = frame_count * bytes_per_channel * channel_count_;
+ if (pool_) {
+ data_ = pool_->CreateBuffer(data_size_);
+ } else {
+ // Aligned buffer ensures compatibility with AudioBus
+ // and audio sink which have been optimized for SSE
+ data_.reset(static_cast<uint8_t*>(
+ base::AlignedAlloc(data_size, kChannelAlignment)));
+ }
+ channel_data_.reserve(1);
+ channel_data_.push_back(data_.get());
+
+ // Copy data
+ if (data)
+ memcpy(channel_data_[0], data[0], data_size);
+ return;
+ }
int data_size_per_channel = frame_count * bytes_per_channel;
if (IsPlanar(sample_format)) {
DCHECK(!IsBitstreamFormat()) << sample_format_;
@@ -510,6 +530,7 @@ void AudioBuffer::TrimRange(int start, int end) {
case kSampleFormatMpegHAudio:
case kSampleFormatDts:
case kSampleFormatDtsxP2:
+ case kSampleFormatIECDts:
NOTREACHED() << "Invalid sample format!";
}
} else {
diff --git a/chromium/media/base/audio_buffer.h b/chromium/media/base/audio_buffer.h
index 5c1de98422b..0518da9977b 100644
--- a/chromium/media/base/audio_buffer.h
+++ b/chromium/media/base/audio_buffer.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_buffer_converter.cc b/chromium/media/base/audio_buffer_converter.cc
index a62b6113bdb..c8655f3d412 100644
--- a/chromium/media/base/audio_buffer_converter.cc
+++ b/chromium/media/base/audio_buffer_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -140,14 +140,14 @@ void AudioBufferConverter::ResetConverter(const AudioBuffer& buffer) {
Flush();
audio_converter_.reset();
input_params_.Reset(
- input_params_.format(), buffer.channel_layout(), buffer.sample_rate(),
+ input_params_.format(), {buffer.channel_layout(), buffer.channel_count()},
+ buffer.sample_rate(),
// If resampling is needed and the FIFO disabled, the AudioConverter will
// always request SincResampler::kDefaultRequestSize frames. Otherwise it
// will use the output frame size.
buffer.sample_rate() == output_params_.sample_rate()
? output_params_.frames_per_buffer()
: SincResampler::kDefaultRequestSize);
- input_params_.set_channels_for_discrete(buffer.channel_count());
io_sample_rate_ratio_ = static_cast<double>(input_params_.sample_rate()) /
output_params_.sample_rate();
diff --git a/chromium/media/base/audio_buffer_converter.h b/chromium/media/base/audio_buffer_converter.h
index f59e8f23354..511cb3f51e5 100644
--- a/chromium/media/base/audio_buffer_converter.h
+++ b/chromium/media/base/audio_buffer_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_buffer_converter_unittest.cc b/chromium/media/base/audio_buffer_converter_unittest.cc
index a72a1703ff3..beec133aad4 100644
--- a/chromium/media/base/audio_buffer_converter_unittest.cc
+++ b/chromium/media/base/audio_buffer_converter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,7 +19,7 @@ namespace media {
// Important: Use an odd buffer size here so SIMD issues are caught.
const int kOutFrameSize = 441;
const int kOutSampleRate = 44100;
-const ChannelLayout kOutChannelLayout = CHANNEL_LAYOUT_STEREO;
+constexpr ChannelLayout kOutChannelLayout = CHANNEL_LAYOUT_STEREO;
const int kOutChannelCount = 2;
static scoped_refptr<AudioBuffer> MakeTestBuffer(int sample_rate,
@@ -38,7 +38,7 @@ class AudioBufferConverterTest : public ::testing::Test {
expected_output_frames_(0.0),
output_frames_(0),
output_params_(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- kOutChannelLayout,
+ ChannelLayoutConfig::FromLayout<kOutChannelLayout>(),
kOutSampleRate,
kOutFrameSize) {
audio_buffer_converter_ =
@@ -208,8 +208,7 @@ TEST_F(AudioBufferConverterTest, ResetThenConvert) {
TEST_F(AudioBufferConverterTest, DiscreteChannelLayout) {
output_params_ =
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_DISCRETE, kOutSampleRate, 512);
- output_params_.set_channels_for_discrete(2);
+ {CHANNEL_LAYOUT_DISCRETE, 2}, kOutSampleRate, 512);
audio_buffer_converter_ =
std::make_unique<AudioBufferConverter>(output_params_);
AddInput(MakeTestBuffer(kOutSampleRate, CHANNEL_LAYOUT_STEREO, 2, 512));
@@ -217,10 +216,10 @@ TEST_F(AudioBufferConverterTest, DiscreteChannelLayout) {
}
TEST_F(AudioBufferConverterTest, LargeBuffersResampling) {
- output_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- kOutChannelLayout,
- kOutSampleRate,
- 2048);
+ output_params_ =
+ AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::FromLayout<kOutChannelLayout>(),
+ kOutSampleRate, 2048);
audio_buffer_converter_ =
std::make_unique<AudioBufferConverter>(output_params_);
diff --git a/chromium/media/base/audio_buffer_queue.cc b/chromium/media/base/audio_buffer_queue.cc
index ca5be72da5c..a8cdc8e2e84 100644
--- a/chromium/media/base/audio_buffer_queue.cc
+++ b/chromium/media/base/audio_buffer_queue.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_buffer_queue.h b/chromium/media/base/audio_buffer_queue.h
index c6d1d990797..098c509c32b 100644
--- a/chromium/media/base/audio_buffer_queue.h
+++ b/chromium/media/base/audio_buffer_queue.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_buffer_queue_unittest.cc b/chromium/media/base/audio_buffer_queue_unittest.cc
index f7760654537..ad12a991884 100644
--- a/chromium/media/base/audio_buffer_queue_unittest.cc
+++ b/chromium/media/base/audio_buffer_queue_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_buffer_unittest.cc b/chromium/media/base/audio_buffer_unittest.cc
index e20fff84008..4b6b9b39076 100644
--- a/chromium/media/base/audio_buffer_unittest.cc
+++ b/chromium/media/base/audio_buffer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -255,6 +255,48 @@ TEST(AudioBufferTest, CreateBitstreamBuffer) {
EXPECT_FALSE(buffer->end_of_stream());
}
+TEST(AudioBufferTest, CopyBitstreamFromIECDts) {
+ const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
+ const int kChannelCount = ChannelLayoutToChannelCount(kChannelLayout);
+ constexpr int kFrameCount = 512;
+ constexpr uint8_t kTestData[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
+ const base::TimeDelta kTimestamp = base::Microseconds(1337);
+ const uint8_t* const data[] = {kTestData};
+
+ scoped_refptr<AudioBuffer> buffer = AudioBuffer::CopyBitstreamFrom(
+ kSampleFormatIECDts, kChannelLayout, kChannelCount, kSampleRate,
+ kFrameCount, data, sizeof(kTestData), kTimestamp);
+
+ EXPECT_EQ(kChannelLayout, buffer->channel_layout());
+ EXPECT_EQ(kFrameCount, buffer->frame_count());
+ EXPECT_EQ(kSampleRate, buffer->sample_rate());
+ EXPECT_EQ(kFrameCount, buffer->frame_count());
+ EXPECT_EQ(kTimestamp, buffer->timestamp());
+ EXPECT_TRUE(buffer->IsBitstreamFormat());
+ EXPECT_FALSE(buffer->end_of_stream());
+}
+
+TEST(AudioBufferTest, CreateBitstreamBufferIECDts) {
+ const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_MONO;
+ const int kChannelCount = ChannelLayoutToChannelCount(kChannelLayout);
+ const int kFrameCount = 512;
+ const int kDataSize = 2048;
+
+ scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateBitstreamBuffer(
+ kSampleFormatIECDts, kChannelLayout, kChannelCount, kSampleRate,
+ kFrameCount, kDataSize);
+
+ EXPECT_EQ(kChannelLayout, buffer->channel_layout());
+ EXPECT_EQ(kFrameCount, buffer->frame_count());
+ EXPECT_EQ(kSampleRate, buffer->sample_rate());
+ EXPECT_EQ(kFrameCount, buffer->frame_count());
+ EXPECT_EQ(kNoTimestamp, buffer->timestamp());
+ EXPECT_TRUE(buffer->IsBitstreamFormat());
+ EXPECT_FALSE(buffer->end_of_stream());
+}
+
TEST(AudioBufferTest, CreateEOSBuffer) {
scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateEOSBuffer();
EXPECT_TRUE(buffer->end_of_stream());
@@ -303,6 +345,27 @@ TEST(AudioBufferTest, ReadBitstream) {
VerifyBitstreamAudioBus(bus.get(), data_size, 1, 1);
}
+TEST(AudioBufferTest, ReadBitstreamIECDts) {
+ const ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO;
+ const int channels = ChannelLayoutToChannelCount(channel_layout);
+ const int frames = 512;
+ const size_t data_size = frames * 2 * 2;
+ const base::TimeDelta start_time;
+
+ scoped_refptr<AudioBuffer> buffer = MakeBitstreamAudioBuffer(
+ kSampleFormatIECDts, channel_layout, channels, kSampleRate, 1, 1, frames,
+ data_size, start_time);
+ EXPECT_TRUE(buffer->IsBitstreamFormat());
+
+ std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, frames);
+ buffer->ReadFrames(frames, 0, 0, bus.get());
+
+ EXPECT_TRUE(bus->is_bitstream_format());
+ EXPECT_EQ(frames, bus->GetBitstreamFrames());
+ EXPECT_EQ(data_size, bus->GetBitstreamDataSize());
+ VerifyBitstreamAudioBus(bus.get(), data_size, 1, 1);
+}
+
TEST(AudioBufferTest, ReadU8) {
const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0;
const int channels = ChannelLayoutToChannelCount(channel_layout);
diff --git a/chromium/media/base/audio_bus.cc b/chromium/media/base/audio_bus.cc
index 3115558f367..5213c5db0dd 100644
--- a/chromium/media/base/audio_bus.cc
+++ b/chromium/media/base/audio_bus.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,7 +7,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <cstring>
#include <limits>
#include <utility>
diff --git a/chromium/media/base/audio_bus.h b/chromium/media/base/audio_bus.h
index 5278bbfa5f1..62ab56d6afd 100644
--- a/chromium/media/base/audio_bus.h
+++ b/chromium/media/base/audio_bus.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_bus_perftest.cc b/chromium/media/base/audio_bus_perftest.cc
index 45d1fdc2a9c..e0b6f43459e 100644
--- a/chromium/media/base/audio_bus_perftest.cc
+++ b/chromium/media/base/audio_bus_perftest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_bus_unittest.cc b/chromium/media/base/audio_bus_unittest.cc
index 753b407d92f..387cf96daf7 100644
--- a/chromium/media/base/audio_bus_unittest.cc
+++ b/chromium/media/base/audio_bus_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,7 +24,7 @@
namespace media {
static const int kChannels = 6;
-static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_5_1;
+static constexpr ChannelLayout kChannelLayout = CHANNEL_LAYOUT_5_1;
// Use a buffer size which is intentionally not a multiple of kChannelAlignment.
static const int kFrameCount = media::AudioBus::kChannelAlignment * 32 - 1;
static const int kSampleRate = 48000;
@@ -141,7 +141,8 @@ TEST_F(AudioBusTest, Create) {
// Verify Create(...) using AudioParameters works as advertised.
TEST_F(AudioBusTest, CreateUsingAudioParameters) {
std::unique_ptr<AudioBus> bus = AudioBus::Create(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
kSampleRate, kFrameCount));
VerifyChannelAndFrameCount(bus.get());
VerifyReadWriteAndAlignment(bus.get());
@@ -187,7 +188,8 @@ TEST_F(AudioBusTest, WrapVector) {
// Verify an AudioBus created via wrapping a memory block works as advertised.
TEST_F(AudioBusTest, WrapMemory) {
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
kSampleRate, kFrameCount);
int data_size = AudioBus::CalculateMemorySize(params);
std::unique_ptr<float, base::AlignedFreeDeleter> data(static_cast<float*>(
@@ -215,7 +217,8 @@ TEST_F(AudioBusTest, WrapMemory) {
TEST_F(AudioBusTest, CopyTo) {
// Create one bus with AudioParameters and the other through direct values to
// test for parity between the Create() functions.
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
kSampleRate, kFrameCount);
std::unique_ptr<AudioBus> bus1 = AudioBus::Create(kChannels, kFrameCount);
std::unique_ptr<AudioBus> bus2 = AudioBus::Create(params);
diff --git a/chromium/media/base/audio_capturer_source.h b/chromium/media/base/audio_capturer_source.h
index 14664c21927..3745397bb7c 100644
--- a/chromium/media/base/audio_capturer_source.h
+++ b/chromium/media/base/audio_capturer_source.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_codecs.cc b/chromium/media/base/audio_codecs.cc
index 7f5b6e0e80b..5ce194a4c13 100644
--- a/chromium/media/base/audio_codecs.cc
+++ b/chromium/media/base/audio_codecs.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_codecs.h b/chromium/media/base/audio_codecs.h
index 168ef272374..f4dfece0113 100644
--- a/chromium/media/base/audio_codecs.h
+++ b/chromium/media/base/audio_codecs.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_converter.cc b/chromium/media/base/audio_converter.cc
index ac54e86ed35..a9d261b9b91 100644
--- a/chromium/media/base/audio_converter.cc
+++ b/chromium/media/base/audio_converter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -10,11 +10,11 @@
#include "media/base/audio_converter.h"
-#include <algorithm>
#include <memory>
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/trace_event/trace_event.h"
#include "media/base/audio_bus.h"
@@ -88,14 +88,12 @@ AudioConverter::AudioConverter(const AudioParameters& input_params,
AudioConverter::~AudioConverter() = default;
void AudioConverter::AddInput(InputCallback* input) {
- DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) ==
- transform_inputs_.end());
+ DCHECK(!base::Contains(transform_inputs_, input));
transform_inputs_.push_back(input);
}
void AudioConverter::RemoveInput(InputCallback* input) {
- DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) !=
- transform_inputs_.end());
+ DCHECK(base::Contains(transform_inputs_, input));
transform_inputs_.remove(input);
if (transform_inputs_.empty())
diff --git a/chromium/media/base/audio_converter.h b/chromium/media/base/audio_converter.h
index c48a59c8892..bf557c8e294 100644
--- a/chromium/media/base/audio_converter.h
+++ b/chromium/media/base/audio_converter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/base/audio_converter_perftest.cc b/chromium/media/base/audio_converter_perftest.cc
index 75f02888503..44519176155 100644
--- a/chromium/media/base/audio_converter_perftest.cc
+++ b/chromium/media/base/audio_converter_perftest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -55,9 +55,10 @@ TEST(AudioConverterPerfTest, ConvertBenchmark) {
// Create input and output parameters to convert between the two most common
// sets of parameters (as indicated via UMA data).
AudioParameters input_params(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_MONO, 48000, 2048);
+ media::ChannelLayoutConfig::Mono(), 48000, 2048);
AudioParameters output_params(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 44100, 440);
+ media::ChannelLayoutConfig::Stereo(), 44100,
+ 440);
RunConvertBenchmark(input_params, output_params, false, "convert");
}
@@ -66,11 +67,11 @@ TEST(AudioConverterPerfTest, ConvertBenchmarkFIFO) {
// Create input and output parameters to convert between common buffer sizes
// without any resampling for the FIFO vs no FIFO benchmarks.
AudioParameters input_params(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO,
- 44100,
+ media::ChannelLayoutConfig::Stereo(), 44100,
2048);
AudioParameters output_params(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 44100, 440);
+ media::ChannelLayoutConfig::Stereo(), 44100,
+ 440);
RunConvertBenchmark(input_params, output_params, true, "convert_fifo_only");
RunConvertBenchmark(input_params, output_params, false,
diff --git a/chromium/media/base/audio_converter_unittest.cc b/chromium/media/base/audio_converter_unittest.cc
index b7a8240f1f1..730af83fb36 100644
--- a/chromium/media/base/audio_converter_unittest.cc
+++ b/chromium/media/base/audio_converter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,7 +22,7 @@ static const int kConvertInputs = 8;
static const int kConvertCycles = 3;
// Parameters used for testing.
-static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
+static constexpr ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
static const int kHighLatencyBufferSize = 2048;
static const int kLowLatencyBufferSize = 256;
static const int kSampleRate = 48000;
@@ -30,15 +30,17 @@ static const int kSampleRate = 48000;
// Number of full sine wave cycles for each Render() call.
static const int kSineCycles = 4;
-// Tuple of <input rate, output rate, output channel layout, epsilon>.
-typedef std::tuple<int, int, ChannelLayout, double> AudioConverterTestData;
+// Tuple of <input rate, output rate, output channel layout config, epsilon>.
+typedef std::tuple<int, int, ChannelLayoutConfig, double>
+ AudioConverterTestData;
class AudioConverterTest
: public testing::TestWithParam<AudioConverterTestData> {
public:
AudioConverterTest() : epsilon_(std::get<3>(GetParam())) {
// Create input and output parameters based on test parameters.
input_parameters_ =
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
std::get<0>(GetParam()), kHighLatencyBufferSize);
output_parameters_ = AudioParameters(
AudioParameters::AUDIO_PCM_LOW_LATENCY, std::get<2>(GetParam()),
@@ -200,13 +202,11 @@ TEST(AudioConverterTest, AudioDelayAndDiscreteChannelCount) {
// Choose input and output parameters such that the transform must make
// multiple calls to fill the buffer.
AudioParameters input_parameters(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_DISCRETE, kSampleRate,
+ {CHANNEL_LAYOUT_DISCRETE, 10}, kSampleRate,
kLowLatencyBufferSize);
- input_parameters.set_channels_for_discrete(10);
AudioParameters output_parameters(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_DISCRETE, kSampleRate * 2,
- kHighLatencyBufferSize);
- output_parameters.set_channels_for_discrete(5);
+ {CHANNEL_LAYOUT_DISCRETE, 5},
+ kSampleRate * 2, kHighLatencyBufferSize);
AudioConverter converter(input_parameters, output_parameters, false);
FakeAudioRenderCallback callback(0.2, kSampleRate);
@@ -257,12 +257,18 @@ INSTANTIATE_TEST_SUITE_P(
AudioConverterTest,
testing::Values(
// No resampling. No channel mixing.
- std::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048),
+ std::make_tuple(44100,
+ 44100,
+ ChannelLayoutConfig::Stereo(),
+ 0.00000048),
// Upsampling. Channel upmixing.
- std::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033),
+ std::make_tuple(44100,
+ 48000,
+ ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_QUAD>(),
+ 0.033),
// Downsampling. Channel downmixing.
- std::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042)));
+ std::make_tuple(48000, 41000, ChannelLayoutConfig::Mono(), 0.042)));
} // namespace media
diff --git a/chromium/media/base/audio_decoder.cc b/chromium/media/base/audio_decoder.cc
index 4ff425e9dfd..8b53ad699fb 100644
--- a/chromium/media/base/audio_decoder.cc
+++ b/chromium/media/base/audio_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_decoder.h b/chromium/media/base/audio_decoder.h
index fea0a1394e0..9a1d5bb04fb 100644
--- a/chromium/media/base/audio_decoder.h
+++ b/chromium/media/base/audio_decoder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_decoder_config.cc b/chromium/media/base/audio_decoder_config.cc
index 1285f096f83..f49f19d87da 100644
--- a/chromium/media/base/audio_decoder_config.cc
+++ b/chromium/media/base/audio_decoder_config.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_decoder_config.h b/chromium/media/base/audio_decoder_config.h
index 63379a2c1e1..2f53e231bdc 100644
--- a/chromium/media/base/audio_decoder_config.h
+++ b/chromium/media/base/audio_decoder_config.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_discard_helper.cc b/chromium/media/base/audio_discard_helper.cc
index 2a59daa7bc9..1e706faba4e 100644
--- a/chromium/media/base/audio_discard_helper.cc
+++ b/chromium/media/base/audio_discard_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_discard_helper.h b/chromium/media/base/audio_discard_helper.h
index 20e8d54ec81..f4bc886a292 100644
--- a/chromium/media/base/audio_discard_helper.h
+++ b/chromium/media/base/audio_discard_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_discard_helper_unittest.cc b/chromium/media/base/audio_discard_helper_unittest.cc
index 0b892c96401..c13409b2ea1 100644
--- a/chromium/media/base/audio_discard_helper_unittest.cc
+++ b/chromium/media/base/audio_discard_helper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_encoder.cc b/chromium/media/base/audio_encoder.cc
index bb19db69df8..af4b72c4b6c 100644
--- a/chromium/media/base/audio_encoder.cc
+++ b/chromium/media/base/audio_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_encoder.h b/chromium/media/base/audio_encoder.h
index c94c137e049..50dfaf95495 100644
--- a/chromium/media/base/audio_encoder.h
+++ b/chromium/media/base/audio_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_fifo.cc b/chromium/media/base/audio_fifo.cc
index e1307316b98..1f8aa15c853 100644
--- a/chromium/media/base/audio_fifo.cc
+++ b/chromium/media/base/audio_fifo.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_fifo.h b/chromium/media/base/audio_fifo.h
index 019c846be51..9810db4b318 100644
--- a/chromium/media/base/audio_fifo.h
+++ b/chromium/media/base/audio_fifo.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_fifo_unittest.cc b/chromium/media/base/audio_fifo_unittest.cc
index 2d76c2a5d97..bacccae18fd 100644
--- a/chromium/media/base/audio_fifo_unittest.cc
+++ b/chromium/media/base/audio_fifo_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_hash.cc b/chromium/media/base/audio_hash.cc
index 236d92d8920..24908d316d7 100644
--- a/chromium/media/base/audio_hash.cc
+++ b/chromium/media/base/audio_hash.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_hash.h b/chromium/media/base/audio_hash.h
index 758198591ac..f0df5a81ff9 100644
--- a/chromium/media/base/audio_hash.h
+++ b/chromium/media/base/audio_hash.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_hash_unittest.cc b/chromium/media/base/audio_hash_unittest.cc
index 60b4982a92d..60a64803f4c 100644
--- a/chromium/media/base/audio_hash_unittest.cc
+++ b/chromium/media/base/audio_hash_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_latency.cc b/chromium/media/base/audio_latency.cc
index f102f238116..ced5873f122 100644
--- a/chromium/media/base/audio_latency.cc
+++ b/chromium/media/base/audio_latency.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,11 +24,15 @@
#include "media/base/mac/audio_latency_mac.h"
#endif
+#if BUILDFLAG(IS_FUCHSIA)
+#include "base/fuchsia/scheduler.h"
+#endif
+
namespace media {
namespace {
-#if !BUILDFLAG(IS_WIN)
+#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_FUCHSIA)
// Taken from "Bit Twiddling Hacks"
// http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
uint32_t RoundUpToPowerOfTwo(uint32_t v) {
@@ -67,6 +71,8 @@ int LCM(int a, int b) {
bool AudioLatency::IsResamplingPassthroughSupported(LatencyType type) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
return true;
+#elif BUILDFLAG(IS_FUCHSIA)
+ return true;
#elif BUILDFLAG(IS_ANDROID)
// Only N MR1+ has support for OpenSLES performance modes which allow for
// power efficient playback. Per the Android audio team, we shouldn't waste
@@ -83,12 +89,20 @@ bool AudioLatency::IsResamplingPassthroughSupported(LatencyType type) {
// static
int AudioLatency::GetHighLatencyBufferSize(int sample_rate,
int preferred_buffer_size) {
- // Empirically, we consider 20ms of samples to be high latency.
-#if !defined(USE_CRAS)
+#if defined(USE_CRAS)
+ // Use 80ms rounded to a power of 2.
+ const double eighty_ms_size = 8.0 * sample_rate / 100;
+ const int high_latency_buffer_size = RoundUpToPowerOfTwo(eighty_ms_size);
+#elif BUILDFLAG(IS_FUCHSIA)
+ // Use 80ms buffers. Doesn't need to be aligned to power of 2, but it should
+ // be a multiple of the scheduling period used for audio threads.
+ constexpr base::TimeDelta period = base::Milliseconds(80);
+ static_assert(static_cast<int>(period / base::kAudioSchedulingPeriod) ==
+ period / base::kAudioSchedulingPeriod);
+ const int high_latency_buffer_size = period.InMilliseconds() * sample_rate /
+ base::Time::kMillisecondsPerSecond;
+#elif BUILDFLAG(IS_WIN)
const double twenty_ms_size = 2.0 * sample_rate / 100;
-#endif
-
-#if BUILDFLAG(IS_WIN)
preferred_buffer_size = std::max(preferred_buffer_size, 1);
// Windows doesn't use power of two buffer sizes, so we should always round up
@@ -109,13 +123,9 @@ int AudioLatency::GetHighLatencyBufferSize(int sample_rate,
//
// On Linux, the minimum hardware buffer size is 512, so the lower calculated
// values are unused. OSX may have a value as low as 128.
-#if defined(USE_CRAS)
- const double eighty_ms_size = 8.0 * sample_rate / 100;
- const int high_latency_buffer_size = RoundUpToPowerOfTwo(eighty_ms_size);
-#else
+ const double twenty_ms_size = 2.0 * sample_rate / 100;
const int high_latency_buffer_size = RoundUpToPowerOfTwo(twenty_ms_size);
-#endif // defined(USE_CRAS)
-#endif // BUILDFLAG(IS_WIN)
+#endif
return std::max(preferred_buffer_size, high_latency_buffer_size);
}
diff --git a/chromium/media/base/audio_latency.h b/chromium/media/base/audio_latency.h
index 5e024f315ae..2b000bc37ac 100644
--- a/chromium/media/base/audio_latency.h
+++ b/chromium/media/base/audio_latency.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_latency_unittest.cc b/chromium/media/base/audio_latency_unittest.cc
index d3c75657326..6b5145cfaed 100644
--- a/chromium/media/base/audio_latency_unittest.cc
+++ b/chromium/media/base/audio_latency_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -122,19 +122,15 @@ class AudioLatencyTest : public testing::TestWithParam<AudioLatencyTestData> {
// TODO(olka): extend unit tests, use real-world sample rates.
TEST(AudioLatency, HighLatencyBufferSizes) {
+ for (int i = 6400; i <= 204800; i *= 2)
#if BUILDFLAG(IS_WIN)
- for (int i = 6400; i <= 204800; i *= 2) {
EXPECT_EQ(2 * (i / 100),
AudioLatency::GetHighLatencyBufferSize(i, i / 100));
- }
-#else
- for (int i = 6400; i <= 204800; i *= 2)
-#if defined(USE_CRAS)
+#elif defined(USE_CRAS) || BUILDFLAG(IS_FUCHSIA)
EXPECT_EQ(8 * (i / 100), AudioLatency::GetHighLatencyBufferSize(i, 32));
#else
EXPECT_EQ(2 * (i / 100), AudioLatency::GetHighLatencyBufferSize(i, 32));
#endif // defined(USE_CRAS)
-#endif // BUILDFLAG(IS_WIN)
}
TEST(AudioLatency, InteractiveBufferSizes) {
diff --git a/chromium/media/base/audio_parameters.cc b/chromium/media/base/audio_parameters.cc
index a06134c67a7..d9c200ee667 100644
--- a/chromium/media/base/audio_parameters.cc
+++ b/chromium/media/base/audio_parameters.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,11 +6,32 @@
#include <sstream>
+#include "base/check_op.h"
#include "media/base/audio_bus.h"
+#include "media/base/channel_layout.h"
#include "media/base/limits.h"
namespace media {
+namespace {
+
+int ComputeChannelCount(ChannelLayout channel_layout, int channels) {
+ if (channel_layout == CHANNEL_LAYOUT_DISCRETE) {
+ CHECK_NE(0, channels);
+ return channels;
+ } else if (channel_layout == CHANNEL_LAYOUT_5_1_4_DOWNMIX && channels != 0) {
+ // For CHANNEL_LAYOUT_5_1_4_DOWNMIX we can set a custom number of channels,
+ // but we are not forced to.
+ return channels;
+ }
+ const int calculated_channel_count =
+ ChannelLayoutToChannelCount(channel_layout);
+ DCHECK_EQ(calculated_channel_count, channels);
+ return calculated_channel_count;
+}
+
+} // namespace
+
static_assert(AudioBus::kChannelAlignment == kParametersAlignment,
"Audio buffer parameters struct alignment not same as AudioBus");
static_assert(sizeof(AudioInputBufferParameters) %
@@ -40,6 +61,8 @@ const char* FormatToString(AudioParameters::Format format) {
return "BITSTREAM_DTSX_P2";
case AudioParameters::AUDIO_BITSTREAM_IEC61937:
return "BITSTREAM_IEC61937";
+ case AudioParameters::AUDIO_BITSTREAM_DTS_HD_MA:
+ return "BITSTREAM_DTS_HD_MA";
case AudioParameters::AUDIO_FAKE:
return "FAKE";
}
@@ -91,26 +114,56 @@ uint32_t ComputeAudioOutputBufferSize(int channels, int frames) {
return result.ValueOrDie();
}
+ChannelLayoutConfig::ChannelLayoutConfig(const ChannelLayoutConfig& other) =
+ default;
+ChannelLayoutConfig& ChannelLayoutConfig::operator=(
+ const ChannelLayoutConfig& other) = default;
+ChannelLayoutConfig::~ChannelLayoutConfig() = default;
+
+ChannelLayoutConfig::ChannelLayoutConfig()
+ : ChannelLayoutConfig(
+ ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_NONE>()) {}
+
+ChannelLayoutConfig::ChannelLayoutConfig(ChannelLayout channel_layout,
+ int channels)
+ : channel_layout_(channel_layout),
+ channels_(ComputeChannelCount(channel_layout, channels)) {}
+
+ChannelLayoutConfig ChannelLayoutConfig::Mono() {
+ return FromLayout<CHANNEL_LAYOUT_MONO>();
+}
+
+ChannelLayoutConfig ChannelLayoutConfig::Stereo() {
+ return FromLayout<CHANNEL_LAYOUT_STEREO>();
+}
+
+ChannelLayoutConfig ChannelLayoutConfig::Guess(int channels) {
+ return ChannelLayoutConfig(GuessChannelLayout(channels), channels);
+}
+
AudioParameters::AudioParameters()
- : AudioParameters(AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_NONE, 0, 0) {}
+ : AudioParameters(AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_NONE>(),
+ 0,
+ 0) {}
AudioParameters::AudioParameters(Format format,
- ChannelLayout channel_layout,
+ ChannelLayoutConfig channel_layout_config,
int sample_rate,
int frames_per_buffer)
: latency_tag_(AudioLatency::LATENCY_COUNT) {
- Reset(format, channel_layout, sample_rate, frames_per_buffer);
+ Reset(format, channel_layout_config, sample_rate, frames_per_buffer);
}
AudioParameters::AudioParameters(
Format format,
- ChannelLayout channel_layout,
+ ChannelLayoutConfig channel_layout_config,
int sample_rate,
int frames_per_buffer,
const HardwareCapabilities& hardware_capabilities)
: latency_tag_(AudioLatency::LATENCY_COUNT),
hardware_capabilities_(hardware_capabilities) {
- Reset(format, channel_layout, sample_rate, frames_per_buffer);
+ Reset(format, channel_layout_config, sample_rate, frames_per_buffer);
}
AudioParameters::~AudioParameters() = default;
@@ -119,12 +172,11 @@ AudioParameters::AudioParameters(const AudioParameters&) = default;
AudioParameters& AudioParameters::operator=(const AudioParameters&) = default;
void AudioParameters::Reset(Format format,
- ChannelLayout channel_layout,
+ ChannelLayoutConfig channel_layout_config,
int sample_rate,
int frames_per_buffer) {
format_ = format;
- channel_layout_ = channel_layout;
- channels_ = ChannelLayoutToChannelCount(channel_layout);
+ channel_layout_config_ = channel_layout_config;
sample_rate_ = sample_rate;
frames_per_buffer_ = frames_per_buffer;
effects_ = NO_EFFECTS;
@@ -132,8 +184,8 @@ void AudioParameters::Reset(Format format,
}
bool AudioParameters::IsValid() const {
- return (channels_ > 0) && (channels_ <= media::limits::kMaxChannels) &&
- (channel_layout_ > CHANNEL_LAYOUT_UNSUPPORTED) &&
+ return (channels() > 0) && (channels() <= media::limits::kMaxChannels) &&
+ (channel_layout() > CHANNEL_LAYOUT_UNSUPPORTED) &&
(sample_rate_ >= media::limits::kMinSampleRate) &&
(sample_rate_ <= media::limits::kMaxSampleRate) &&
(frames_per_buffer_ > 0) &&
@@ -147,9 +199,9 @@ bool AudioParameters::IsValid() const {
media::limits::kMaxSamplesPerPacket) &&
(hardware_capabilities_->max_frames_per_buffer >=
hardware_capabilities_->min_frames_per_buffer))) &&
- (channel_layout_ == CHANNEL_LAYOUT_DISCRETE ||
- channel_layout_ == CHANNEL_LAYOUT_5_1_4_DOWNMIX ||
- channels_ == ChannelLayoutToChannelCount(channel_layout_));
+ (channel_layout() == CHANNEL_LAYOUT_DISCRETE ||
+ channel_layout() == CHANNEL_LAYOUT_5_1_4_DOWNMIX ||
+ channels() == ChannelLayoutToChannelCount(channel_layout()));
}
std::string AudioParameters::AsHumanReadableString() const {
@@ -165,7 +217,9 @@ std::string AudioParameters::AsHumanReadableString() const {
<< hardware_capabilities_->min_frames_per_buffer
<< ", max_frames_per_buffer: "
<< hardware_capabilities_->max_frames_per_buffer
- << ", bitstream_formats:" << hardware_capabilities_->bitstream_formats;
+ << ", bitstream_formats:" << hardware_capabilities_->bitstream_formats
+ << ", require_encapsulation:"
+ << hardware_capabilities_->require_encapsulation;
}
return s.str();
}
@@ -175,7 +229,7 @@ int AudioParameters::GetBytesPerBuffer(SampleFormat fmt) const {
}
int AudioParameters::GetBytesPerFrame(SampleFormat fmt) const {
- return channels_ * SampleFormatToBytesPerChannel(fmt);
+ return channels() * SampleFormatToBytesPerChannel(fmt);
}
double AudioParameters::GetMicrosecondsPerFrame() const {
@@ -190,8 +244,8 @@ base::TimeDelta AudioParameters::GetBufferDuration() const {
bool AudioParameters::Equals(const AudioParameters& other) const {
return format_ == other.format() && sample_rate_ == other.sample_rate() &&
- channel_layout_ == other.channel_layout() &&
- channels_ == other.channels() &&
+ channel_layout() == other.channel_layout() &&
+ channels() == other.channels() &&
frames_per_buffer_ == other.frames_per_buffer() &&
effects_ == other.effects() && mic_positions_ == other.mic_positions_;
}
@@ -215,13 +269,23 @@ bool AudioParameters::IsFormatSupportedByHardware(Format format) const {
(hardware_capabilities_->bitstream_formats & format);
}
+void AudioParameters::SetChannelLayoutConfig(ChannelLayout layout,
+ int channels) {
+ channel_layout_config_ = {layout, channels};
+}
+
+bool AudioParameters::RequireEncapsulation() const {
+ return hardware_capabilities_.has_value() &&
+ hardware_capabilities_->require_encapsulation;
+}
+
// static
AudioParameters AudioParameters::UnavailableDeviceParams() {
// Using 10 ms buffer since WebAudioMediaStreamSource::DeliverRebufferedAudio
// deals incorrectly with reference time calculation if output buffer size
// significantly differs from 10 ms used there, see http://crbug/701000.
return media::AudioParameters(
- media::AudioParameters::AUDIO_FAKE, media::CHANNEL_LAYOUT_STEREO,
+ media::AudioParameters::AUDIO_FAKE, ChannelLayoutConfig::Stereo(),
media::AudioParameters::kAudioCDSampleRate,
media::AudioParameters::kAudioCDSampleRate / 100);
}
diff --git a/chromium/media/base/audio_parameters.h b/chromium/media/base/audio_parameters.h
index dccb01bfe1a..6ba5066b0d1 100644
--- a/chromium/media/base/audio_parameters.h
+++ b/chromium/media/base/audio_parameters.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -112,23 +112,61 @@ ComputeAudioOutputBufferSize(const AudioParameters& parameters);
MEDIA_SHMEM_EXPORT uint32_t ComputeAudioOutputBufferSize(int channels,
int frames);
+// Channel count and ChannelLayout pair, with helper methods to enforce safe
+// construction.
+class MEDIA_SHMEM_EXPORT ChannelLayoutConfig {
+ public:
+ ChannelLayoutConfig(const ChannelLayoutConfig& other);
+ ChannelLayoutConfig& operator=(const ChannelLayoutConfig& other);
+ ChannelLayoutConfig();
+ ChannelLayoutConfig(ChannelLayout channel_layout, int channels);
+ ~ChannelLayoutConfig();
+
+ template <ChannelLayout layout>
+ static ChannelLayoutConfig FromLayout() {
+ return ChannelLayoutConfig(layout, ChannelLayoutToChannelCount(layout));
+ }
+
+ static ChannelLayoutConfig Mono();
+
+ static ChannelLayoutConfig Stereo();
+
+ static ChannelLayoutConfig Guess(int channels);
+
+ ChannelLayout channel_layout() const { return channel_layout_; }
+
+ int channels() const { return channels_; }
+
+ private:
+ ChannelLayout channel_layout_; // Order of surround sound channels.
+ int channels_; // Number of channels.
+};
+
+// For |CHANNEL_LAYOUT_DISCRETE|, we have to explicitly set the number of
+// channels, so we need to use the normal constructor.
+template <>
+ChannelLayoutConfig ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_DISCRETE>() =
+ delete;
+
class MEDIA_SHMEM_EXPORT AudioParameters {
public:
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media
// GENERATED_JAVA_CLASS_NAME_OVERRIDE: AudioEncodingFormat
// GENERATED_JAVA_PREFIX_TO_STRIP: AUDIO_
enum Format {
- AUDIO_FAKE = 0x00, // Creates a fake AudioOutputStream object
- AUDIO_PCM_LINEAR = 0x01, // PCM is 'raw' amplitude samples.
- AUDIO_PCM_LOW_LATENCY = 0x02, // Linear PCM, low latency requested.
- AUDIO_BITSTREAM_AC3 = 0x04, // Compressed AC3 bitstream.
- AUDIO_BITSTREAM_EAC3 = 0x08, // Compressed E-AC3 bitstream.
- AUDIO_BITSTREAM_DTS = 0x10, // Compressed DTS bitstream.
- AUDIO_BITSTREAM_DTS_HD = 0x20, // Compressed DTS-HD bitstream.
- AUDIO_BITSTREAM_DTSX_P2 = 0x40, // Compressed DTS-HD bitstream.
- AUDIO_BITSTREAM_IEC61937 = 0x80, // Compressed IEC61937 bitstream.
+ AUDIO_FAKE = 0x000, // Creates a fake AudioOutputStream object
+ AUDIO_PCM_LINEAR = 0x001, // PCM is 'raw' amplitude samples.
+ AUDIO_PCM_LOW_LATENCY = 0x002, // Linear PCM, low latency requested.
+ AUDIO_BITSTREAM_AC3 = 0x004, // Compressed AC3 bitstream.
+ AUDIO_BITSTREAM_EAC3 = 0x008, // Compressed E-AC3 bitstream.
+ AUDIO_BITSTREAM_DTS = 0x010, // Compressed DTS bitstream.
+ AUDIO_BITSTREAM_DTS_HD = 0x020, // Compressed DTS-HD bitstream.
+ AUDIO_BITSTREAM_DTSX_P2 = 0x040, // Compressed DTSX Profile 2 bitstream.
+ AUDIO_BITSTREAM_IEC61937 = 0x080, // Compressed IEC61937 bitstream.
+ AUDIO_BITSTREAM_DTS_HD_MA =
+ 0x100, // Compressed DTS-HD Master Audio bitstream.
AUDIO_FORMAT_LAST =
- AUDIO_BITSTREAM_IEC61937, // Only used for validation of format.
+ AUDIO_BITSTREAM_DTS_HD_MA, // Only used for validation of format.
};
enum {
@@ -162,21 +200,30 @@ class MEDIA_SHMEM_EXPORT AudioParameters {
ALLOW_DSP_ECHO_CANCELLER = 1 << 9,
ALLOW_DSP_NOISE_SUPPRESSION = 1 << 10,
ALLOW_DSP_AUTOMATIC_GAIN_CONTROL = 1 << 11,
+
+ FUCHSIA_RENDER_USAGE_BACKGROUND = 1 << 12,
+ FUCHSIA_RENDER_USAGE_MEDIA = 1 << 13,
+ FUCHSIA_RENDER_USAGE_INTERRUPTION = 1 << 14,
+ FUCHSIA_RENDER_USAGE_SYSTEM_AGENT = 1 << 15,
+ FUCHSIA_RENDER_USAGE_COMMUNICATION = 1 << 16,
};
struct HardwareCapabilities {
HardwareCapabilities(int min_frames_per_buffer, int max_frames_per_buffer)
: min_frames_per_buffer(min_frames_per_buffer),
max_frames_per_buffer(max_frames_per_buffer),
- bitstream_formats(0) {}
- explicit HardwareCapabilities(int bitstream_formats)
+ bitstream_formats(0),
+ require_encapsulation(false) {}
+ HardwareCapabilities(int bitstream_formats, bool require_encapsulation)
: min_frames_per_buffer(0),
max_frames_per_buffer(0),
- bitstream_formats(bitstream_formats) {}
+ bitstream_formats(bitstream_formats),
+ require_encapsulation(require_encapsulation) {}
HardwareCapabilities()
: min_frames_per_buffer(0),
max_frames_per_buffer(0),
- bitstream_formats(0) {}
+ bitstream_formats(0),
+ require_encapsulation(false) {}
// Minimum and maximum buffer sizes supported by the audio hardware. Opening
// a device with frames_per_buffer set to a value between min and max should
@@ -185,16 +232,22 @@ class MEDIA_SHMEM_EXPORT AudioParameters {
// Either value can be 0 and means that the min or max is not known.
int min_frames_per_buffer;
int max_frames_per_buffer;
+ // Bitstream formats (OR'ed) supported by audio hardware.
int bitstream_formats;
+ // Bitstream will need to be encapsulated in IEC61937 to be
+ // passed through to the audio hardware.
+ bool require_encapsulation;
};
AudioParameters();
+
AudioParameters(Format format,
- ChannelLayout channel_layout,
+ ChannelLayoutConfig channel_layout_config,
int sample_rate,
int frames_per_buffer);
+
AudioParameters(Format format,
- ChannelLayout channel_layout,
+ ChannelLayoutConfig channel_layout_config,
int sample_rate,
int frames_per_buffer,
const HardwareCapabilities& hardware_capabilities);
@@ -203,7 +256,7 @@ class MEDIA_SHMEM_EXPORT AudioParameters {
// Re-initializes all members except for |hardware_capabilities_|.
void Reset(Format format,
- ChannelLayout channel_layout,
+ ChannelLayoutConfig channel_layout_config,
int sample_rate,
int frames_per_buffer);
@@ -240,21 +293,22 @@ class MEDIA_SHMEM_EXPORT AudioParameters {
bool IsFormatSupportedByHardware(Format format) const;
+ bool RequireEncapsulation() const;
+
void set_format(Format format) { format_ = format; }
Format format() const { return format_; }
- // A setter for channel_layout_ is intentionally excluded.
- ChannelLayout channel_layout() const { return channel_layout_; }
+ void SetChannelLayoutConfig(ChannelLayout layout, int channels);
- // The number of channels is usually computed from channel_layout_. Setting
- // this explicitly is only required with CHANNEL_LAYOUT_DISCRETE.
- void set_channels_for_discrete(int channels) {
- DCHECK(channel_layout_ == CHANNEL_LAYOUT_DISCRETE ||
- channel_layout_ == CHANNEL_LAYOUT_5_1_4_DOWNMIX ||
- channels == ChannelLayoutToChannelCount(channel_layout_));
- channels_ = channels;
+ const ChannelLayoutConfig& channel_layout_config() const {
+ return channel_layout_config_;
}
- int channels() const { return channels_; }
+
+ ChannelLayout channel_layout() const {
+ return channel_layout_config_.channel_layout();
+ }
+
+ int channels() const { return channel_layout_config_.channels(); }
void set_sample_rate(int sample_rate) { sample_rate_ = sample_rate; }
int sample_rate() const { return sample_rate_; }
@@ -294,9 +348,8 @@ class MEDIA_SHMEM_EXPORT AudioParameters {
private:
Format format_; // Format of the stream.
- ChannelLayout channel_layout_; // Order of surround sound channels.
- int channels_; // Number of channels. Value set based on
- // |channel_layout|.
+ ChannelLayoutConfig channel_layout_config_; // The channel layout and the
+ // number of channels.
int sample_rate_; // Sampling frequency/rate.
int frames_per_buffer_; // Number of frames in a buffer.
int effects_; // Bitmask using PlatformEffectsMask.
diff --git a/chromium/media/base/audio_parameters_unittest.cc b/chromium/media/base/audio_parameters_unittest.cc
index 021f044991e..7ed6f52d5ff 100644
--- a/chromium/media/base/audio_parameters_unittest.cc
+++ b/chromium/media/base/audio_parameters_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include <stddef.h>
#include "base/strings/string_number_conversions.h"
+#include "media/base/channel_layout.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
@@ -36,75 +37,100 @@ TEST(AudioParameters, Constructor_ParameterValues) {
AudioParameters::Format expected_format =
AudioParameters::AUDIO_PCM_LOW_LATENCY;
int expected_channels = 6;
- ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_5_1;
+ constexpr ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_5_1;
int expected_rate = 44100;
int expected_samples = 880;
- AudioParameters params(expected_format, expected_channel_layout,
- expected_rate, expected_samples);
+ AudioParameters params(
+ expected_format,
+ ChannelLayoutConfig::FromLayout<expected_channel_layout>(), expected_rate,
+ expected_samples);
EXPECT_EQ(expected_format, params.format());
EXPECT_EQ(expected_channels, params.channels());
EXPECT_EQ(expected_channel_layout, params.channel_layout());
EXPECT_EQ(expected_rate, params.sample_rate());
EXPECT_EQ(expected_samples, params.frames_per_buffer());
+ EXPECT_FALSE(params.RequireEncapsulation());
+}
+
+TEST(AudioParameters, Constructor_ParameterValuesPlusHardwareCapabilities) {
+ AudioParameters::Format expected_format =
+ AudioParameters::AUDIO_PCM_LOW_LATENCY;
+ int expected_channels = 6;
+ constexpr ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_5_1;
+ int expected_rate = 44100;
+ int expected_samples = 880;
+
+ AudioParameters::HardwareCapabilities hardware_capabilities(0, true);
+ AudioParameters params(
+ expected_format,
+ ChannelLayoutConfig::FromLayout<expected_channel_layout>(), expected_rate,
+ expected_samples, hardware_capabilities);
+
+ EXPECT_EQ(expected_format, params.format());
+ EXPECT_EQ(expected_channels, params.channels());
+ EXPECT_EQ(expected_channel_layout, params.channel_layout());
+ EXPECT_EQ(expected_rate, params.sample_rate());
+ EXPECT_EQ(expected_samples, params.frames_per_buffer());
+ EXPECT_TRUE(params.RequireEncapsulation());
}
TEST(AudioParameters, GetBytesPerBuffer) {
EXPECT_EQ(100, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_MONO, 1000, 100)
+ ChannelLayoutConfig::Mono(), 1000, 100)
.GetBytesPerBuffer(kSampleFormatU8));
EXPECT_EQ(200, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_MONO, 1000, 100)
+ ChannelLayoutConfig::Mono(), 1000, 100)
.GetBytesPerBuffer(kSampleFormatS16));
EXPECT_EQ(200, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 1000, 100)
+ ChannelLayoutConfig::Stereo(), 1000, 100)
.GetBytesPerBuffer(kSampleFormatU8));
EXPECT_EQ(200, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_MONO, 1000, 200)
+ ChannelLayoutConfig::Mono(), 1000, 200)
.GetBytesPerBuffer(kSampleFormatU8));
EXPECT_EQ(800, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
- CHANNEL_LAYOUT_STEREO, 1000, 200)
+ ChannelLayoutConfig::Stereo(), 1000, 200)
.GetBytesPerBuffer(kSampleFormatS16));
}
TEST(AudioParameters, Compare) {
AudioParameters values[] = {
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- 1000, 100),
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- 1000, 200),
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- 2000, 100),
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO,
- 2000, 200),
-
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO,
- 1000, 100),
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO,
- 1000, 200),
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO,
- 2000, 100),
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO,
- 2000, 200),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(), 1000, 100),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(), 1000, 200),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(), 2000, 100),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Mono(), 2000, 200),
+
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(), 1000, 100),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(), 1000, 200),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(), 2000, 100),
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Stereo(), 2000, 200),
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_MONO, 1000, 100),
+ ChannelLayoutConfig::Mono(), 1000, 100),
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_MONO, 1000, 200),
+ ChannelLayoutConfig::Mono(), 1000, 200),
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_MONO, 2000, 100),
+ ChannelLayoutConfig::Mono(), 2000, 100),
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_MONO, 2000, 200),
+ ChannelLayoutConfig::Mono(), 2000, 200),
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, 1000, 100),
+ ChannelLayoutConfig::Stereo(), 1000, 100),
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, 1000, 200),
+ ChannelLayoutConfig::Stereo(), 1000, 200),
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, 2000, 100),
+ ChannelLayoutConfig::Stereo(), 2000, 100),
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, 2000, 200),
+ ChannelLayoutConfig::Stereo(), 2000, 200),
};
for (size_t i = 0; i < std::size(values); ++i) {
@@ -122,13 +148,63 @@ TEST(AudioParameters, Compare) {
TEST(AudioParameters, Constructor_ValidChannelCounts) {
int expected_channels = 8;
ChannelLayout expected_layout = CHANNEL_LAYOUT_DISCRETE;
+ ChannelLayoutConfig channel_layout_config(CHANNEL_LAYOUT_DISCRETE,
+ expected_channels);
+
+ AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ channel_layout_config, 44100, 880);
+ EXPECT_EQ(expected_channels, params.channels());
+ EXPECT_EQ(expected_layout, params.channel_layout());
+ EXPECT_TRUE(params.IsValid());
+}
+
+TEST(AudioParameters, Constructor_ValidChannelCountsFor514Downmix) {
+ int expected_channels = 7;
+ constexpr ChannelLayout expected_layout = CHANNEL_LAYOUT_5_1_4_DOWNMIX;
+ ChannelLayoutConfig channel_layout_config(expected_layout, expected_channels);
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- expected_layout, 44100, 880);
- params.set_channels_for_discrete(expected_channels);
+ channel_layout_config, 44100, 880);
EXPECT_EQ(expected_channels, params.channels());
EXPECT_EQ(expected_layout, params.channel_layout());
EXPECT_TRUE(params.IsValid());
+
+ // We do not have to explicitly set the channels for this layout.
+ params.Reset(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::FromLayout<expected_layout>(), 44100, 880);
+ EXPECT_EQ(6, params.channels());
+ EXPECT_EQ(expected_layout, params.channel_layout());
+ EXPECT_TRUE(params.IsValid());
+}
+
+TEST(AudioParameters, Constructor_CopyChannelLayoutConfig) {
+ int expected_channels = 8;
+ ChannelLayout expected_layout = CHANNEL_LAYOUT_DISCRETE;
+ ChannelLayoutConfig channel_layout_config(CHANNEL_LAYOUT_DISCRETE,
+ expected_channels);
+
+ AudioParameters params1(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ channel_layout_config, 44100, 880);
+ AudioParameters params2(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ params1.channel_layout_config(), 44100, 880);
+
+ EXPECT_EQ(expected_channels, params2.channels());
+ EXPECT_EQ(expected_layout, params2.channel_layout());
+ EXPECT_TRUE(params2.IsValid());
+}
+
+TEST(AudioParameters, ShouldCheckDiscreteWithNoChannels) {
+ ASSERT_DEATH(
+ {
+ ChannelLayoutConfig channel_layout_config(CHANNEL_LAYOUT_DISCRETE, 0);
+ },
+ "");
+}
+
+TEST(AudioParameters, ChannelLayoutConfig_Guess) {
+ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Guess(2);
+ EXPECT_EQ(CHANNEL_LAYOUT_STEREO, channel_layout_config.channel_layout());
+ EXPECT_EQ(2, channel_layout_config.channels());
}
} // namespace media
diff --git a/chromium/media/base/audio_point.cc b/chromium/media/base/audio_point.cc
index fd1ee46261d..5177b88a6e8 100644
--- a/chromium/media/base/audio_point.cc
+++ b/chromium/media/base/audio_point.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_point.h b/chromium/media/base/audio_point.h
index 3b5632868e4..30c81958d39 100644
--- a/chromium/media/base/audio_point.h
+++ b/chromium/media/base/audio_point.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_point_unittest.cc b/chromium/media/base/audio_point_unittest.cc
index bd91e447203..635f8e0b826 100644
--- a/chromium/media/base/audio_point_unittest.cc
+++ b/chromium/media/base/audio_point_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_power_monitor.cc b/chromium/media/base/audio_power_monitor.cc
index 84d157a6cda..8a1616f99a6 100644
--- a/chromium/media/base/audio_power_monitor.cc
+++ b/chromium/media/base/audio_power_monitor.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_power_monitor.h b/chromium/media/base/audio_power_monitor.h
index b78531279ab..4ca6358edc4 100644
--- a/chromium/media/base/audio_power_monitor.h
+++ b/chromium/media/base/audio_power_monitor.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_power_monitor_unittest.cc b/chromium/media/base/audio_power_monitor_unittest.cc
index eae79205eac..7525bde6179 100644
--- a/chromium/media/base/audio_power_monitor_unittest.cc
+++ b/chromium/media/base/audio_power_monitor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_processing.cc b/chromium/media/base/audio_processing.cc
index 710c5aea61c..1f38697c6b1 100644
--- a/chromium/media/base/audio_processing.cc
+++ b/chromium/media/base/audio_processing.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_processing.h b/chromium/media/base/audio_processing.h
index ca80199673e..a5fbf0dd623 100644
--- a/chromium/media/base/audio_processing.h
+++ b/chromium/media/base/audio_processing.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_processor_controls.h b/chromium/media/base/audio_processor_controls.h
index b429f8035a6..b7c870a85c7 100644
--- a/chromium/media/base/audio_processor_controls.h
+++ b/chromium/media/base/audio_processor_controls.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_pull_fifo.cc b/chromium/media/base/audio_pull_fifo.cc
index ed9e9efcc17..7dcaf1c06cd 100644
--- a/chromium/media/base/audio_pull_fifo.cc
+++ b/chromium/media/base/audio_pull_fifo.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_pull_fifo.h b/chromium/media/base/audio_pull_fifo.h
index 420a230f45c..d46cb70973c 100644
--- a/chromium/media/base/audio_pull_fifo.h
+++ b/chromium/media/base/audio_pull_fifo.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_pull_fifo_unittest.cc b/chromium/media/base/audio_pull_fifo_unittest.cc
index 37982d4c6f5..382161c5aeb 100644
--- a/chromium/media/base/audio_pull_fifo_unittest.cc
+++ b/chromium/media/base/audio_pull_fifo_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_push_fifo.cc b/chromium/media/base/audio_push_fifo.cc
index afb2b0fbeba..7a5bf7c5b24 100644
--- a/chromium/media/base/audio_push_fifo.cc
+++ b/chromium/media/base/audio_push_fifo.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_push_fifo.h b/chromium/media/base/audio_push_fifo.h
index c4f617694d0..f0c56af74bf 100644
--- a/chromium/media/base/audio_push_fifo.h
+++ b/chromium/media/base/audio_push_fifo.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_push_fifo_unittest.cc b/chromium/media/base/audio_push_fifo_unittest.cc
index aa9f42fb6db..4fd4a861d4d 100644
--- a/chromium/media/base/audio_push_fifo_unittest.cc
+++ b/chromium/media/base/audio_push_fifo_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_renderer.cc b/chromium/media/base/audio_renderer.cc
index e3f63ac281b..c02e432de56 100644
--- a/chromium/media/base/audio_renderer.cc
+++ b/chromium/media/base/audio_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_renderer.h b/chromium/media/base/audio_renderer.h
index e327f275862..173380d3550 100644
--- a/chromium/media/base/audio_renderer.h
+++ b/chromium/media/base/audio_renderer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_renderer_mixer.cc b/chromium/media/base/audio_renderer_mixer.cc
index 91ba595752d..3b13af58002 100644
--- a/chromium/media/base/audio_renderer_mixer.cc
+++ b/chromium/media/base/audio_renderer_mixer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_renderer_mixer.h b/chromium/media/base/audio_renderer_mixer.h
index cbdc0f7dfbe..622a11db152 100644
--- a/chromium/media/base/audio_renderer_mixer.h
+++ b/chromium/media/base/audio_renderer_mixer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_renderer_mixer_input.cc b/chromium/media/base/audio_renderer_mixer_input.cc
index 578cdcaa85f..42f963c4daf 100644
--- a/chromium/media/base/audio_renderer_mixer_input.cc
+++ b/chromium/media/base/audio_renderer_mixer_input.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_renderer_mixer_input.h b/chromium/media/base/audio_renderer_mixer_input.h
index c4d598c11ed..37fd393d019 100644
--- a/chromium/media/base/audio_renderer_mixer_input.h
+++ b/chromium/media/base/audio_renderer_mixer_input.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/base/audio_renderer_mixer_input_unittest.cc b/chromium/media/base/audio_renderer_mixer_input_unittest.cc
index 5884bb7353f..ee3b3fea1da 100644
--- a/chromium/media/base/audio_renderer_mixer_input_unittest.cc
+++ b/chromium/media/base/audio_renderer_mixer_input_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -26,7 +26,7 @@ static const int kSampleRate = 48000;
static const int kBufferSize = 8192;
static const base::UnguessableToken kFrameToken =
base::UnguessableToken::Create();
-static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
+static constexpr ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
static const char kDefaultDeviceId[] = "default";
static const char kAnotherDeviceId[] = "another";
static const char kUnauthorizedDeviceId[] = "unauthorized";
@@ -37,7 +37,8 @@ class AudioRendererMixerInputTest : public testing::Test,
public:
AudioRendererMixerInputTest() {
audio_parameters_ =
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
kSampleRate, kBufferSize);
CreateMixerInput(kDefaultDeviceId);
diff --git a/chromium/media/base/audio_renderer_mixer_pool.h b/chromium/media/base/audio_renderer_mixer_pool.h
index 9071f1ff8e3..5dbeac71b15 100644
--- a/chromium/media/base/audio_renderer_mixer_pool.h
+++ b/chromium/media/base/audio_renderer_mixer_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_renderer_mixer_unittest.cc b/chromium/media/base/audio_renderer_mixer_unittest.cc
index d094586e7ab..64ba7ad52e0 100644
--- a/chromium/media/base/audio_renderer_mixer_unittest.cc
+++ b/chromium/media/base/audio_renderer_mixer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -34,7 +34,7 @@ const int kOddMixerInputs = 7;
const int kMixerCycles = 3;
// Parameters used for testing.
-const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
+constexpr ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
const int kHighLatencyBufferSize = 8192;
const int kLowLatencyBufferSize = 256;
@@ -61,13 +61,15 @@ class AudioRendererMixerTest
const int* const sample_rates = std::get<0>(GetParam());
size_t sample_rates_count = std::get<1>(GetParam());
for (size_t i = 0; i < sample_rates_count; ++i)
- input_parameters_.push_back(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
- sample_rates[i], kHighLatencyBufferSize));
+ input_parameters_.emplace_back(
+ AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(), sample_rates[i],
+ kHighLatencyBufferSize);
// Create output parameters based on test parameters.
output_parameters_ =
- AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, kChannelLayout,
+ AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
std::get<2>(GetParam()), kLowLatencyBufferSize);
sink_ = new MockAudioRendererSink();
diff --git a/chromium/media/base/audio_renderer_sink.h b/chromium/media/base/audio_renderer_sink.h
index e04bcd0aef0..38e883cb94c 100644
--- a/chromium/media/base/audio_renderer_sink.h
+++ b/chromium/media/base/audio_renderer_sink.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_sample_types.h b/chromium/media/base/audio_sample_types.h
index af734ec68a6..6081f9537ad 100644
--- a/chromium/media/base/audio_sample_types.h
+++ b/chromium/media/base/audio_sample_types.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_sample_types_unittest.cc b/chromium/media/base/audio_sample_types_unittest.cc
index 1aa9953f0dd..54f9671b8f7 100644
--- a/chromium/media/base/audio_sample_types_unittest.cc
+++ b/chromium/media/base/audio_sample_types_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_shifter.cc b/chromium/media/base/audio_shifter.cc
index e6e0e6de959..bbb2785e799 100644
--- a/chromium/media/base/audio_shifter.cc
+++ b/chromium/media/base/audio_shifter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_shifter.h b/chromium/media/base/audio_shifter.h
index 36e6e2b4d60..7c09be418b2 100644
--- a/chromium/media/base/audio_shifter.h
+++ b/chromium/media/base/audio_shifter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_shifter_unittest.cc b/chromium/media/base/audio_shifter_unittest.cc
index 4d99ceac4f7..a3ec81a5966 100644
--- a/chromium/media/base/audio_shifter_unittest.cc
+++ b/chromium/media/base/audio_shifter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_timestamp_helper.cc b/chromium/media/base/audio_timestamp_helper.cc
index 240467b4da9..32d4b2adcce 100644
--- a/chromium/media/base/audio_timestamp_helper.cc
+++ b/chromium/media/base/audio_timestamp_helper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_timestamp_helper.h b/chromium/media/base/audio_timestamp_helper.h
index 116826d800e..92111d5893c 100644
--- a/chromium/media/base/audio_timestamp_helper.h
+++ b/chromium/media/base/audio_timestamp_helper.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/audio_timestamp_helper_unittest.cc b/chromium/media/base/audio_timestamp_helper_unittest.cc
index 2beb9414f11..3b74280426f 100644
--- a/chromium/media/base/audio_timestamp_helper_unittest.cc
+++ b/chromium/media/base/audio_timestamp_helper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bind_to_current_loop.h b/chromium/media/base/bind_to_current_loop.h
index d57fb6446a8..956a4412e24 100644
--- a/chromium/media/base/bind_to_current_loop.h
+++ b/chromium/media/base/bind_to_current_loop.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bit_reader.cc b/chromium/media/base/bit_reader.cc
index a956e976583..fc5b9d7573a 100644
--- a/chromium/media/base/bit_reader.cc
+++ b/chromium/media/base/bit_reader.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bit_reader.h b/chromium/media/base/bit_reader.h
index aceb75def80..0be3c24b5a6 100644
--- a/chromium/media/base/bit_reader.h
+++ b/chromium/media/base/bit_reader.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bit_reader_core.cc b/chromium/media/base/bit_reader_core.cc
index 715a25b3e36..580ded8d28a 100644
--- a/chromium/media/base/bit_reader_core.cc
+++ b/chromium/media/base/bit_reader_core.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bit_reader_core.h b/chromium/media/base/bit_reader_core.h
index 361b28d6990..d91b474a289 100644
--- a/chromium/media/base/bit_reader_core.h
+++ b/chromium/media/base/bit_reader_core.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bit_reader_fuzzertest.cc b/chromium/media/base/bit_reader_fuzzertest.cc
index 9b91f1317c3..17c20989f2e 100644
--- a/chromium/media/base/bit_reader_fuzzertest.cc
+++ b/chromium/media/base/bit_reader_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bit_reader_unittest.cc b/chromium/media/base/bit_reader_unittest.cc
index e8ba51c12f7..1d74e146f89 100644
--- a/chromium/media/base/bit_reader_unittest.cc
+++ b/chromium/media/base/bit_reader_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bitrate.cc b/chromium/media/base/bitrate.cc
index b265cc90d1e..d2ae94baae9 100644
--- a/chromium/media/base/bitrate.cc
+++ b/chromium/media/base/bitrate.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bitrate.h b/chromium/media/base/bitrate.h
index f72692b5b8f..a99075afe06 100644
--- a/chromium/media/base/bitrate.h
+++ b/chromium/media/base/bitrate.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bitrate_unittest.cc b/chromium/media/base/bitrate_unittest.cc
index 0e385b2c3b7..9f270119180 100644
--- a/chromium/media/base/bitrate_unittest.cc
+++ b/chromium/media/base/bitrate_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bitstream_buffer.cc b/chromium/media/base/bitstream_buffer.cc
index 202e974601f..f4548494e11 100644
--- a/chromium/media/base/bitstream_buffer.cc
+++ b/chromium/media/base/bitstream_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/bitstream_buffer.h b/chromium/media/base/bitstream_buffer.h
index 52dadb02495..8e00154e8f5 100644
--- a/chromium/media/base/bitstream_buffer.h
+++ b/chromium/media/base/bitstream_buffer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/buffering_state.cc b/chromium/media/base/buffering_state.cc
index eabc940bf52..1407a48e3b9 100644
--- a/chromium/media/base/buffering_state.cc
+++ b/chromium/media/base/buffering_state.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/buffering_state.h b/chromium/media/base/buffering_state.h
index 3bae42ec3f8..134d6852b50 100644
--- a/chromium/media/base/buffering_state.h
+++ b/chromium/media/base/buffering_state.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/byte_queue.cc b/chromium/media/base/byte_queue.cc
index 79cd83e7ef4..53ed0775b05 100644
--- a/chromium/media/base/byte_queue.cc
+++ b/chromium/media/base/byte_queue.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/byte_queue.h b/chromium/media/base/byte_queue.h
index ebc1f9e8fed..18b425f41b4 100644
--- a/chromium/media/base/byte_queue.h
+++ b/chromium/media/base/byte_queue.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/callback_holder.h b/chromium/media/base/callback_holder.h
index ee2da8cef9a..3144f1de642 100644
--- a/chromium/media/base/callback_holder.h
+++ b/chromium/media/base/callback_holder.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/callback_holder_unittest.cc b/chromium/media/base/callback_holder_unittest.cc
index 79830971fdb..c9f13bcf848 100644
--- a/chromium/media/base/callback_holder_unittest.cc
+++ b/chromium/media/base/callback_holder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/callback_registry.h b/chromium/media/base/callback_registry.h
index faf55049cd6..85252739941 100644
--- a/chromium/media/base/callback_registry.h
+++ b/chromium/media/base/callback_registry.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/callback_registry_unittest.cc b/chromium/media/base/callback_registry_unittest.cc
index 69a382a3d5b..bbeb084c19c 100644
--- a/chromium/media/base/callback_registry_unittest.cc
+++ b/chromium/media/base/callback_registry_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_callback_promise.cc b/chromium/media/base/cdm_callback_promise.cc
index 26d6f7aa839..243cfa881a0 100644
--- a/chromium/media/base/cdm_callback_promise.cc
+++ b/chromium/media/base/cdm_callback_promise.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_callback_promise.h b/chromium/media/base/cdm_callback_promise.h
index e10adfa2682..cee0a357bd1 100644
--- a/chromium/media/base/cdm_callback_promise.h
+++ b/chromium/media/base/cdm_callback_promise.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_config.cc b/chromium/media/base/cdm_config.cc
index fa8ce23eb88..a08da7d8c01 100644
--- a/chromium/media/base/cdm_config.cc
+++ b/chromium/media/base/cdm_config.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_config.h b/chromium/media/base/cdm_config.h
index d00e1cf68b8..658fc53ad6b 100644
--- a/chromium/media/base/cdm_config.h
+++ b/chromium/media/base/cdm_config.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_context.cc b/chromium/media/base/cdm_context.cc
index 0a3ee1a1414..50d95a78575 100644
--- a/chromium/media/base/cdm_context.cc
+++ b/chromium/media/base/cdm_context.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_context.h b/chromium/media/base/cdm_context.h
index 2e206d2c022..94df106f894 100644
--- a/chromium/media/base/cdm_context.h
+++ b/chromium/media/base/cdm_context.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_factory.cc b/chromium/media/base/cdm_factory.cc
index 7de8570c5de..89c3aa031cd 100644
--- a/chromium/media/base/cdm_factory.cc
+++ b/chromium/media/base/cdm_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_factory.h b/chromium/media/base/cdm_factory.h
index 4a6e0ccb786..e098bbb5d20 100644
--- a/chromium/media/base/cdm_factory.h
+++ b/chromium/media/base/cdm_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_initialized_promise.cc b/chromium/media/base/cdm_initialized_promise.cc
index 8c36e0b1747..1b8cbc0695e 100644
--- a/chromium/media/base/cdm_initialized_promise.cc
+++ b/chromium/media/base/cdm_initialized_promise.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_initialized_promise.h b/chromium/media/base/cdm_initialized_promise.h
index 3e28a7eabc3..fbc3e4ca974 100644
--- a/chromium/media/base/cdm_initialized_promise.h
+++ b/chromium/media/base/cdm_initialized_promise.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_key_information.cc b/chromium/media/base/cdm_key_information.cc
index 38aed14c87f..bcf74f60c5f 100644
--- a/chromium/media/base/cdm_key_information.cc
+++ b/chromium/media/base/cdm_key_information.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_key_information.h b/chromium/media/base/cdm_key_information.h
index 7e2cc57c45e..7d743a6e22c 100644
--- a/chromium/media/base/cdm_key_information.h
+++ b/chromium/media/base/cdm_key_information.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_promise.cc b/chromium/media/base/cdm_promise.cc
index d1cb7ade052..45200679cf8 100644
--- a/chromium/media/base/cdm_promise.cc
+++ b/chromium/media/base/cdm_promise.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_promise.h b/chromium/media/base/cdm_promise.h
index fec3a705cb2..9de5113c481 100644
--- a/chromium/media/base/cdm_promise.h
+++ b/chromium/media/base/cdm_promise.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_promise_adapter.cc b/chromium/media/base/cdm_promise_adapter.cc
index da0ae36e712..9285d961bac 100644
--- a/chromium/media/base/cdm_promise_adapter.cc
+++ b/chromium/media/base/cdm_promise_adapter.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_promise_adapter.h b/chromium/media/base/cdm_promise_adapter.h
index 10d3d66174f..286b32ff1e0 100644
--- a/chromium/media/base/cdm_promise_adapter.h
+++ b/chromium/media/base/cdm_promise_adapter.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_session_tracker.cc b/chromium/media/base/cdm_session_tracker.cc
index be2a63850cd..a21dc78dfe3 100644
--- a/chromium/media/base/cdm_session_tracker.cc
+++ b/chromium/media/base/cdm_session_tracker.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/cdm_session_tracker.h b/chromium/media/base/cdm_session_tracker.h
index f88ab6c5a1a..8132e784e7d 100644
--- a/chromium/media/base/cdm_session_tracker.h
+++ b/chromium/media/base/cdm_session_tracker.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/channel_layout.cc b/chromium/media/base/channel_layout.cc
index b1be4cb5162..f4836f8ee80 100644
--- a/chromium/media/base/channel_layout.cc
+++ b/chromium/media/base/channel_layout.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/channel_layout.h b/chromium/media/base/channel_layout.h
index 2bf24ef8b1f..45936f2a7ca 100644
--- a/chromium/media/base/channel_layout.h
+++ b/chromium/media/base/channel_layout.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/channel_mixer.cc b/chromium/media/base/channel_mixer.cc
index 87e6c4590db..1092c290593 100644
--- a/chromium/media/base/channel_mixer.cc
+++ b/chromium/media/base/channel_mixer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/channel_mixer.h b/chromium/media/base/channel_mixer.h
index 12a2759cf48..c4e1756cdcd 100644
--- a/chromium/media/base/channel_mixer.h
+++ b/chromium/media/base/channel_mixer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/channel_mixer_unittest.cc b/chromium/media/base/channel_mixer_unittest.cc
index 56facff6325..3af82e80718 100644
--- a/chromium/media/base/channel_mixer_unittest.cc
+++ b/chromium/media/base/channel_mixer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -105,19 +105,17 @@ TEST_P(ChannelMixerTest, Mixing) {
int input_channels = GetParam().input_channels;
std::unique_ptr<AudioBus> input_bus =
AudioBus::Create(input_channels, kFrames);
- AudioParameters input_audio(AudioParameters::AUDIO_PCM_LINEAR, input_layout,
+ AudioParameters input_audio(AudioParameters::AUDIO_PCM_LINEAR,
+ {input_layout, input_channels},
AudioParameters::kAudioCDSampleRate, kFrames);
- if (input_layout == CHANNEL_LAYOUT_DISCRETE)
- input_audio.set_channels_for_discrete(input_channels);
ChannelLayout output_layout = GetParam().output_layout;
int output_channels = GetParam().output_channels;
std::unique_ptr<AudioBus> output_bus =
AudioBus::Create(output_channels, kFrames);
- AudioParameters output_audio(AudioParameters::AUDIO_PCM_LINEAR, output_layout,
+ AudioParameters output_audio(AudioParameters::AUDIO_PCM_LINEAR,
+ {output_layout, output_channels},
AudioParameters::kAudioCDSampleRate, kFrames);
- if (output_layout == CHANNEL_LAYOUT_DISCRETE)
- output_audio.set_channels_for_discrete(output_channels);
const float* channel_values = GetParam().channel_values;
ASSERT_EQ(input_bus->channels(), GetParam().num_channel_values);
diff --git a/chromium/media/base/channel_mixing_matrix.cc b/chromium/media/base/channel_mixing_matrix.cc
index a8dd62dd4f3..1b0b3bd874c 100644
--- a/chromium/media/base/channel_mixing_matrix.cc
+++ b/chromium/media/base/channel_mixing_matrix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,9 +6,9 @@
#include <stddef.h>
-#include <algorithm>
-
#include "base/check_op.h"
+#include "base/containers/contains.h"
+#include "base/ranges/algorithm.h"
#include "media/base/channel_mixer.h"
namespace media {
@@ -260,13 +260,11 @@ bool ChannelMixingMatrix::CreateTransformationMatrix(
}
void ChannelMixingMatrix::AccountFor(Channels ch) {
- unaccounted_inputs_.erase(std::find(
- unaccounted_inputs_.begin(), unaccounted_inputs_.end(), ch));
+ unaccounted_inputs_.erase(base::ranges::find(unaccounted_inputs_, ch));
}
bool ChannelMixingMatrix::IsUnaccounted(Channels ch) const {
- return std::find(unaccounted_inputs_.begin(), unaccounted_inputs_.end(),
- ch) != unaccounted_inputs_.end();
+ return base::Contains(unaccounted_inputs_, ch);
}
bool ChannelMixingMatrix::HasInputChannel(Channels ch) const {
diff --git a/chromium/media/base/channel_mixing_matrix.h b/chromium/media/base/channel_mixing_matrix.h
index a1a5f82ef55..05886bd57a3 100644
--- a/chromium/media/base/channel_mixing_matrix.h
+++ b/chromium/media/base/channel_mixing_matrix.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/channel_mixing_matrix_unittest.cc b/chromium/media/base/channel_mixing_matrix_unittest.cc
index 3bee28210a7..f7c1cfaf50e 100644
--- a/chromium/media/base/channel_mixing_matrix_unittest.cc
+++ b/chromium/media/base/channel_mixing_matrix_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/color_plane_layout.cc b/chromium/media/base/color_plane_layout.cc
index da4fbdc55ce..1d258be8288 100644
--- a/chromium/media/base/color_plane_layout.cc
+++ b/chromium/media/base/color_plane_layout.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/color_plane_layout.h b/chromium/media/base/color_plane_layout.h
index 922cc1b0786..30406f7c3a5 100644
--- a/chromium/media/base/color_plane_layout.h
+++ b/chromium/media/base/color_plane_layout.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/container_names.cc b/chromium/media/base/container_names.cc
index 08315dcdb55..63bc689aff6 100644
--- a/chromium/media/base/container_names.cc
+++ b/chromium/media/base/container_names.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/container_names.h b/chromium/media/base/container_names.h
index 99cb7bf7ccd..8fb1cffbfb3 100644
--- a/chromium/media/base/container_names.h
+++ b/chromium/media/base/container_names.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/container_names_fuzzertest.cc b/chromium/media/base/container_names_fuzzertest.cc
index 281fcc4b792..5f304911926 100644
--- a/chromium/media/base/container_names_fuzzertest.cc
+++ b/chromium/media/base/container_names_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/container_names_unittest.cc b/chromium/media/base/container_names_unittest.cc
index 3b0d883dba1..e914a8015fb 100644
--- a/chromium/media/base/container_names_unittest.cc
+++ b/chromium/media/base/container_names_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/content_decryption_module.cc b/chromium/media/base/content_decryption_module.cc
index b76374459e6..6e711293866 100644
--- a/chromium/media/base/content_decryption_module.cc
+++ b/chromium/media/base/content_decryption_module.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/content_decryption_module.h b/chromium/media/base/content_decryption_module.h
index f352dda1345..531b065738d 100644
--- a/chromium/media/base/content_decryption_module.h
+++ b/chromium/media/base/content_decryption_module.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/converting_audio_fifo.cc b/chromium/media/base/converting_audio_fifo.cc
index e74b5a7d42c..77633d692ec 100644
--- a/chromium/media/base/converting_audio_fifo.cc
+++ b/chromium/media/base/converting_audio_fifo.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -134,7 +134,7 @@ std::unique_ptr<AudioBus> ConvertingAudioFifo::EnsureExpectedChannelCount(
// Both the format and the sample rate are unused for mixing, but we still
// need to pass a value below.
mixer_input_params_.Reset(input_params_.format(),
- GuessChannelLayout(incoming_channels),
+ ChannelLayoutConfig::Guess(incoming_channels),
incoming_channels, input_params_.sample_rate());
mixer_ = std::make_unique<ChannelMixer>(mixer_input_params_, input_params_);
diff --git a/chromium/media/base/converting_audio_fifo.h b/chromium/media/base/converting_audio_fifo.h
index 4350f6b4a53..617ca1fda03 100644
--- a/chromium/media/base/converting_audio_fifo.h
+++ b/chromium/media/base/converting_audio_fifo.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/converting_audio_fifo_unittest.cc b/chromium/media/base/converting_audio_fifo_unittest.cc
index 1efff7c8f99..04643aa3d48 100644
--- a/chromium/media/base/converting_audio_fifo_unittest.cc
+++ b/chromium/media/base/converting_audio_fifo_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,6 +14,7 @@
#include "base/test/bind.h"
#include "base/time/time.h"
#include "media/base/audio_bus.h"
+#include "media/base/audio_parameters.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
@@ -29,7 +30,7 @@ struct TestAudioParams {
const AudioParameters kDefaultParams =
AudioParameters(AudioParameters::Format::AUDIO_PCM_LINEAR,
- GuessChannelLayout(kDefaultChannels),
+ ChannelLayoutConfig::Guess(kDefaultChannels),
kInputSampleRate,
kDefaultFrames);
@@ -52,7 +53,7 @@ class ConvertingAudioFifoTest
AudioParameters TestOutputParams() {
return AudioParameters(AudioParameters::Format::AUDIO_PCM_LINEAR,
- GuessChannelLayout(output_channels()),
+ ChannelLayoutConfig::Guess(output_channels()),
output_sample_rate(), output_frames());
}
diff --git a/chromium/media/base/crc_16.h b/chromium/media/base/crc_16.h
index 773bbacdcf7..d6c539b9072 100644
--- a/chromium/media/base/crc_16.h
+++ b/chromium/media/base/crc_16.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/crc_16_unittest.cc b/chromium/media/base/crc_16_unittest.cc
index 1149ff98001..a0d6f06ba5a 100644
--- a/chromium/media/base/crc_16_unittest.cc
+++ b/chromium/media/base/crc_16_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/data_buffer.cc b/chromium/media/base/data_buffer.cc
index 97e90f276af..5114345b2ae 100644
--- a/chromium/media/base/data_buffer.cc
+++ b/chromium/media/base/data_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/data_buffer.h b/chromium/media/base/data_buffer.h
index 3d5a3ffd80a..64086ed6d9b 100644
--- a/chromium/media/base/data_buffer.h
+++ b/chromium/media/base/data_buffer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/data_buffer_unittest.cc b/chromium/media/base/data_buffer_unittest.cc
index 0faaecd8b48..ca1a97b4bc5 100644
--- a/chromium/media/base/data_buffer_unittest.cc
+++ b/chromium/media/base/data_buffer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/data_source.cc b/chromium/media/base/data_source.cc
index 48f76091f31..90aef55e647 100644
--- a/chromium/media/base/data_source.cc
+++ b/chromium/media/base/data_source.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/data_source.h b/chromium/media/base/data_source.h
index 882ef1ca4c8..96301279fca 100644
--- a/chromium/media/base/data_source.h
+++ b/chromium/media/base/data_source.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decoder.cc b/chromium/media/base/decoder.cc
index 5b3e69f57b0..8bd5d6afb01 100644
--- a/chromium/media/base/decoder.cc
+++ b/chromium/media/base/decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -71,6 +71,8 @@ std::string GetDecoderName(AudioDecoderType type) {
return "MediaCodecAudioDecoder";
case AudioDecoderType::kBroker:
return "AudioDecoderBroker";
+ case AudioDecoderType::kPassthroughDTS:
+ return "PassthroughDTSAudioDecoder";
case AudioDecoderType::kTesting:
return "Testing or Mock Audio decoder";
case AudioDecoderType::kAudioToolbox:
diff --git a/chromium/media/base/decoder.h b/chromium/media/base/decoder.h
index dcf860045d7..40e919468bc 100644
--- a/chromium/media/base/decoder.h
+++ b/chromium/media/base/decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,9 +25,10 @@ enum class AudioDecoderType : int {
kTesting = 6, // Never send this to UKM, for tests only.
kAudioToolbox = 7, // AudioToolbox (macOS)
kMediaFoundation = 8, // MediaFoundationAudioDecoder
+ kPassthroughDTS = 9, // Passthrough DTS audio
// Keep this at the end and equal to the last entry.
- kMaxValue = kMediaFoundation,
+ kMaxValue = kPassthroughDTS,
};
// List of known VideoDecoder implementations; recorded to UKM, always add new
diff --git a/chromium/media/base/decoder_buffer.cc b/chromium/media/base/decoder_buffer.cc
index 620fc447c10..57acc5e9401 100644
--- a/chromium/media/base/decoder_buffer.cc
+++ b/chromium/media/base/decoder_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decoder_buffer.h b/chromium/media/base/decoder_buffer.h
index 28befa6c9aa..b5a1489a6bf 100644
--- a/chromium/media/base/decoder_buffer.h
+++ b/chromium/media/base/decoder_buffer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decoder_buffer_queue.cc b/chromium/media/base/decoder_buffer_queue.cc
index 9b1f70cdd3a..411dc719cb5 100644
--- a/chromium/media/base/decoder_buffer_queue.cc
+++ b/chromium/media/base/decoder_buffer_queue.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decoder_buffer_queue.h b/chromium/media/base/decoder_buffer_queue.h
index 781e8a7cd98..8c5aa7294e5 100644
--- a/chromium/media/base/decoder_buffer_queue.h
+++ b/chromium/media/base/decoder_buffer_queue.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decoder_buffer_queue_unittest.cc b/chromium/media/base/decoder_buffer_queue_unittest.cc
index ce233a15dc7..4272b142b6f 100644
--- a/chromium/media/base/decoder_buffer_queue_unittest.cc
+++ b/chromium/media/base/decoder_buffer_queue_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decoder_buffer_unittest.cc b/chromium/media/base/decoder_buffer_unittest.cc
index ac3c736a3ea..4d4d982b0bf 100644
--- a/chromium/media/base/decoder_buffer_unittest.cc
+++ b/chromium/media/base/decoder_buffer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decoder_factory.cc b/chromium/media/base/decoder_factory.cc
index 458e0fa6ca8..acc29c364da 100644
--- a/chromium/media/base/decoder_factory.cc
+++ b/chromium/media/base/decoder_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,11 +17,6 @@ void DecoderFactory::CreateAudioDecoders(
MediaLog* media_log,
std::vector<std::unique_ptr<AudioDecoder>>* audio_decoders) {}
-SupportedVideoDecoderConfigs
-DecoderFactory::GetSupportedVideoDecoderConfigsForWebRTC() {
- return {};
-}
-
void DecoderFactory::CreateVideoDecoders(
scoped_refptr<base::SequencedTaskRunner> task_runner,
GpuVideoAcceleratorFactories* gpu_factories,
diff --git a/chromium/media/base/decoder_factory.h b/chromium/media/base/decoder_factory.h
index 3f65c663bb4..3f91a33b8d2 100644
--- a/chromium/media/base/decoder_factory.h
+++ b/chromium/media/base/decoder_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -45,13 +45,6 @@ class MEDIA_EXPORT DecoderFactory {
MediaLog* media_log,
std::vector<std::unique_ptr<AudioDecoder>>* audio_decoders);
- // Returns the union of all decoder configs supported by the decoders created
- // when CreateVideoDecoders is called.
- // TODO(crbug.com/1173503): Rename to GetSupportedVideoDecoderConfigs after
- // being properly implemented for all factories.
- virtual SupportedVideoDecoderConfigs
- GetSupportedVideoDecoderConfigsForWebRTC();
-
// Creates video decoders and append them to the end of |video_decoders|.
// Decoders are single-threaded, each decoder should run on |task_runner|.
virtual void CreateVideoDecoders(
diff --git a/chromium/media/base/decoder_status.cc b/chromium/media/base/decoder_status.cc
index caba2464b35..09ef67bda5b 100644
--- a/chromium/media/base/decoder_status.cc
+++ b/chromium/media/base/decoder_status.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decoder_status.h b/chromium/media/base/decoder_status.h
index 1142cb61d2d..c87582a3fb3 100644
--- a/chromium/media/base/decoder_status.h
+++ b/chromium/media/base/decoder_status.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decrypt_config.cc b/chromium/media/base/decrypt_config.cc
index b874b34c373..7c348c621e3 100644
--- a/chromium/media/base/decrypt_config.cc
+++ b/chromium/media/base/decrypt_config.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decrypt_config.h b/chromium/media/base/decrypt_config.h
index 7bbde2d63dd..109f31c133d 100644
--- a/chromium/media/base/decrypt_config.h
+++ b/chromium/media/base/decrypt_config.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decrypt_config_unittest.cc b/chromium/media/base/decrypt_config_unittest.cc
index 014ee6a4d23..b6eb25fe3ee 100644
--- a/chromium/media/base/decrypt_config_unittest.cc
+++ b/chromium/media/base/decrypt_config_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decryptor.cc b/chromium/media/base/decryptor.cc
index 8d24de8d34d..fe5fcb3aa2d 100644
--- a/chromium/media/base/decryptor.cc
+++ b/chromium/media/base/decryptor.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/decryptor.h b/chromium/media/base/decryptor.h
index 2a84abeb038..97dec7aaf61 100644
--- a/chromium/media/base/decryptor.h
+++ b/chromium/media/base/decryptor.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer.cc b/chromium/media/base/demuxer.cc
index 46d2e709ba3..c78afd57782 100644
--- a/chromium/media/base/demuxer.cc
+++ b/chromium/media/base/demuxer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer.h b/chromium/media/base/demuxer.h
index 8a5241cec01..87bf6841c6d 100644
--- a/chromium/media/base/demuxer.h
+++ b/chromium/media/base/demuxer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer_memory_limit.h b/chromium/media/base/demuxer_memory_limit.h
index 4a492d7771e..10f6740075a 100644
--- a/chromium/media/base/demuxer_memory_limit.h
+++ b/chromium/media/base/demuxer_memory_limit.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer_memory_limit_android.cc b/chromium/media/base/demuxer_memory_limit_android.cc
index 3ea849942e2..269856362b7 100644
--- a/chromium/media/base/demuxer_memory_limit_android.cc
+++ b/chromium/media/base/demuxer_memory_limit_android.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer_memory_limit_cast.cc b/chromium/media/base/demuxer_memory_limit_cast.cc
index addbf15ec03..8459d74ddb2 100644
--- a/chromium/media/base/demuxer_memory_limit_cast.cc
+++ b/chromium/media/base/demuxer_memory_limit_cast.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer_memory_limit_cast_unittest.cc b/chromium/media/base/demuxer_memory_limit_cast_unittest.cc
index 76444445254..2e92b2812aa 100644
--- a/chromium/media/base/demuxer_memory_limit_cast_unittest.cc
+++ b/chromium/media/base/demuxer_memory_limit_cast_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer_memory_limit_default.cc b/chromium/media/base/demuxer_memory_limit_default.cc
index 896d534098a..8dcf763a0bb 100644
--- a/chromium/media/base/demuxer_memory_limit_default.cc
+++ b/chromium/media/base/demuxer_memory_limit_default.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer_memory_limit_low.cc b/chromium/media/base/demuxer_memory_limit_low.cc
index 71dc442d42a..7dea8bd0a45 100644
--- a/chromium/media/base/demuxer_memory_limit_low.cc
+++ b/chromium/media/base/demuxer_memory_limit_low.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer_stream.cc b/chromium/media/base/demuxer_stream.cc
index ccc922440e5..7addad4152a 100644
--- a/chromium/media/base/demuxer_stream.cc
+++ b/chromium/media/base/demuxer_stream.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/demuxer_stream.h b/chromium/media/base/demuxer_stream.h
index f866d62c0cb..2a5bda07e7d 100644
--- a/chromium/media/base/demuxer_stream.h
+++ b/chromium/media/base/demuxer_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/djb2.cc b/chromium/media/base/djb2.cc
index b4b440e6791..c525d83cb80 100644
--- a/chromium/media/base/djb2.cc
+++ b/chromium/media/base/djb2.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/djb2.h b/chromium/media/base/djb2.h
index cb592b71b7d..3b2c1886e3a 100644
--- a/chromium/media/base/djb2.h
+++ b/chromium/media/base/djb2.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/djb2_unittest.cc b/chromium/media/base/djb2_unittest.cc
index e4450893120..3abb6b9ca09 100644
--- a/chromium/media/base/djb2_unittest.cc
+++ b/chromium/media/base/djb2_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Copyright 2008 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/eme_constants.h b/chromium/media/base/eme_constants.h
index 4d4dcd74437..72772a76f3d 100644
--- a/chromium/media/base/eme_constants.h
+++ b/chromium/media/base/eme_constants.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/encoder_status.h b/chromium/media/base/encoder_status.h
index 36cb0390cc7..342e181a8a5 100644
--- a/chromium/media/base/encoder_status.h
+++ b/chromium/media/base/encoder_status.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/encryption_pattern.cc b/chromium/media/base/encryption_pattern.cc
index ea07abb380d..515b4493f4f 100644
--- a/chromium/media/base/encryption_pattern.cc
+++ b/chromium/media/base/encryption_pattern.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/encryption_pattern.h b/chromium/media/base/encryption_pattern.h
index 89c3e28b115..6a2c3e94090 100644
--- a/chromium/media/base/encryption_pattern.h
+++ b/chromium/media/base/encryption_pattern.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/encryption_scheme.cc b/chromium/media/base/encryption_scheme.cc
index 12728f71c89..0f05f860e31 100644
--- a/chromium/media/base/encryption_scheme.cc
+++ b/chromium/media/base/encryption_scheme.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/encryption_scheme.h b/chromium/media/base/encryption_scheme.h
index 24a7141f9e0..1fe09feaada 100644
--- a/chromium/media/base/encryption_scheme.h
+++ b/chromium/media/base/encryption_scheme.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_audio_render_callback.cc b/chromium/media/base/fake_audio_render_callback.cc
index d31303a345c..9a03df6e53b 100644
--- a/chromium/media/base/fake_audio_render_callback.cc
+++ b/chromium/media/base/fake_audio_render_callback.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_audio_render_callback.h b/chromium/media/base/fake_audio_render_callback.h
index 1f5e39bf7e0..a0bddb24a07 100644
--- a/chromium/media/base/fake_audio_render_callback.h
+++ b/chromium/media/base/fake_audio_render_callback.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_audio_renderer_sink.cc b/chromium/media/base/fake_audio_renderer_sink.cc
index ff9af5bfd54..8c9a772f7f0 100644
--- a/chromium/media/base/fake_audio_renderer_sink.cc
+++ b/chromium/media/base/fake_audio_renderer_sink.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,7 +14,7 @@ namespace media {
FakeAudioRendererSink::FakeAudioRendererSink()
: FakeAudioRendererSink(
AudioParameters(AudioParameters::AUDIO_FAKE,
- CHANNEL_LAYOUT_STEREO,
+ ChannelLayoutConfig::Stereo(),
AudioParameters::kTelephoneSampleRate,
1)) {}
diff --git a/chromium/media/base/fake_audio_renderer_sink.h b/chromium/media/base/fake_audio_renderer_sink.h
index 681b0d59fe3..0325da3eb92 100644
--- a/chromium/media/base/fake_audio_renderer_sink.h
+++ b/chromium/media/base/fake_audio_renderer_sink.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_audio_worker.cc b/chromium/media/base/fake_audio_worker.cc
index 505ea02323c..291c2f82e28 100644
--- a/chromium/media/base/fake_audio_worker.cc
+++ b/chromium/media/base/fake_audio_worker.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_audio_worker.h b/chromium/media/base/fake_audio_worker.h
index 524829d9038..097bc0b28ac 100644
--- a/chromium/media/base/fake_audio_worker.h
+++ b/chromium/media/base/fake_audio_worker.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_audio_worker_unittest.cc b/chromium/media/base/fake_audio_worker_unittest.cc
index 355fed2145d..f46bdeb1874 100644
--- a/chromium/media/base/fake_audio_worker_unittest.cc
+++ b/chromium/media/base/fake_audio_worker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -32,7 +32,10 @@ using testing::SizeIs;
class FakeAudioWorkerTest : public testing::Test {
public:
FakeAudioWorkerTest()
- : params_(AudioParameters::AUDIO_FAKE, CHANNEL_LAYOUT_STEREO, 44100, 128),
+ : params_(AudioParameters::AUDIO_FAKE,
+ ChannelLayoutConfig::Stereo(),
+ 44100,
+ 128),
fake_worker_(task_environment_.GetMainThreadTaskRunner(), params_) {
time_between_callbacks_ = base::Microseconds(
params_.frames_per_buffer() * base::Time::kMicrosecondsPerSecond /
@@ -176,7 +179,10 @@ TEST_F(FakeAudioWorkerTest, StartStopClearsCallbacks) {
class FakeAudioWorkerMockTaskTest : public testing::Test {
public:
FakeAudioWorkerMockTaskTest()
- : params_(AudioParameters::AUDIO_FAKE, CHANNEL_LAYOUT_STEREO, 44100, 128),
+ : params_(AudioParameters::AUDIO_FAKE,
+ ChannelLayoutConfig::Stereo(),
+ 44100,
+ 128),
fake_worker_(task_runner_, params_) {
DCHECK(!global_clock_);
global_clock_ = task_runner_->GetMockTickClock();
diff --git a/chromium/media/base/fake_demuxer_stream.cc b/chromium/media/base/fake_demuxer_stream.cc
index d6020caddc1..0f0c2a31ae2 100644
--- a/chromium/media/base/fake_demuxer_stream.cc
+++ b/chromium/media/base/fake_demuxer_stream.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_demuxer_stream.h b/chromium/media/base/fake_demuxer_stream.h
index 1a2251e0515..f7ad006342b 100644
--- a/chromium/media/base/fake_demuxer_stream.h
+++ b/chromium/media/base/fake_demuxer_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_demuxer_stream_unittest.cc b/chromium/media/base/fake_demuxer_stream_unittest.cc
index 04437210db9..4be65e3409d 100644
--- a/chromium/media/base/fake_demuxer_stream_unittest.cc
+++ b/chromium/media/base/fake_demuxer_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_localized_strings.cc b/chromium/media/base/fake_localized_strings.cc
index 888821fa361..9c1663221b1 100644
--- a/chromium/media/base/fake_localized_strings.cc
+++ b/chromium/media/base/fake_localized_strings.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_localized_strings.h b/chromium/media/base/fake_localized_strings.h
index 29e8f2e36f3..e3cb0a86ac8 100644
--- a/chromium/media/base/fake_localized_strings.h
+++ b/chromium/media/base/fake_localized_strings.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_single_thread_task_runner.cc b/chromium/media/base/fake_single_thread_task_runner.cc
index daf7f9c5778..cd058e31716 100644
--- a/chromium/media/base/fake_single_thread_task_runner.cc
+++ b/chromium/media/base/fake_single_thread_task_runner.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_single_thread_task_runner.h b/chromium/media/base/fake_single_thread_task_runner.h
index fd61d665b0b..275bcbaa227 100644
--- a/chromium/media/base/fake_single_thread_task_runner.h
+++ b/chromium/media/base/fake_single_thread_task_runner.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_text_track_stream.cc b/chromium/media/base/fake_text_track_stream.cc
index 7807c9c251d..f5075dc4e1b 100644
--- a/chromium/media/base/fake_text_track_stream.cc
+++ b/chromium/media/base/fake_text_track_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/fake_text_track_stream.h b/chromium/media/base/fake_text_track_stream.h
index 0364b6389c9..ff819442d8e 100644
--- a/chromium/media/base/fake_text_track_stream.h
+++ b/chromium/media/base/fake_text_track_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/feedback_signal_accumulator.h b/chromium/media/base/feedback_signal_accumulator.h
index 02617275be5..df73c7bb8aa 100644
--- a/chromium/media/base/feedback_signal_accumulator.h
+++ b/chromium/media/base/feedback_signal_accumulator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/feedback_signal_accumulator_unittest.cc b/chromium/media/base/feedback_signal_accumulator_unittest.cc
index f1d09baa765..93bd68d0ac3 100644
--- a/chromium/media/base/feedback_signal_accumulator_unittest.cc
+++ b/chromium/media/base/feedback_signal_accumulator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/flinging_controller.h b/chromium/media/base/flinging_controller.h
index 1bf26345445..0883dc6a0ed 100644
--- a/chromium/media/base/flinging_controller.h
+++ b/chromium/media/base/flinging_controller.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/format_utils.cc b/chromium/media/base/format_utils.cc
index b9fc8143bd6..2fed1c2cd1a 100644
--- a/chromium/media/base/format_utils.cc
+++ b/chromium/media/base/format_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/format_utils.h b/chromium/media/base/format_utils.h
index eed468b553f..137e527c77e 100644
--- a/chromium/media/base/format_utils.h
+++ b/chromium/media/base/format_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/frame_rate_estimator.cc b/chromium/media/base/frame_rate_estimator.cc
index 48cf9f9a56d..246d7b0482a 100644
--- a/chromium/media/base/frame_rate_estimator.cc
+++ b/chromium/media/base/frame_rate_estimator.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/frame_rate_estimator.h b/chromium/media/base/frame_rate_estimator.h
index f35b2f45833..1449191af35 100644
--- a/chromium/media/base/frame_rate_estimator.h
+++ b/chromium/media/base/frame_rate_estimator.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/frame_rate_estimator_unittest.cc b/chromium/media/base/frame_rate_estimator_unittest.cc
index 2ba25e6ab5d..87e231b247f 100644
--- a/chromium/media/base/frame_rate_estimator_unittest.cc
+++ b/chromium/media/base/frame_rate_estimator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/ipc/BUILD.gn b/chromium/media/base/ipc/BUILD.gn
index c1112cbb9bf..6217873522c 100644
--- a/chromium/media/base/ipc/BUILD.gn
+++ b/chromium/media/base/ipc/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/base/ipc/media_param_traits.cc b/chromium/media/base/ipc/media_param_traits.cc
index 0bb2011c22e..e0b8f50fb3f 100644
--- a/chromium/media/base/ipc/media_param_traits.cc
+++ b/chromium/media/base/ipc/media_param_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -55,14 +55,13 @@ bool ParamTraits<AudioParameters>::Read(const base::Pickle* m,
}
if (hardware_capabilities) {
- *r = AudioParameters(format, channel_layout, sample_rate, frames_per_buffer,
- *hardware_capabilities);
+ *r = AudioParameters(format, {channel_layout, channels}, sample_rate,
+ frames_per_buffer, *hardware_capabilities);
} else {
- *r =
- AudioParameters(format, channel_layout, sample_rate, frames_per_buffer);
+ *r = AudioParameters(format, {channel_layout, channels}, sample_rate,
+ frames_per_buffer);
}
- r->set_channels_for_discrete(channels);
r->set_effects(effects);
r->set_mic_positions(mic_positions);
r->set_latency_tag(latency_tag);
@@ -81,6 +80,7 @@ void ParamTraits<AudioParameters::HardwareCapabilities>::Write(
WriteParam(m, p.min_frames_per_buffer);
WriteParam(m, p.max_frames_per_buffer);
WriteParam(m, p.bitstream_formats);
+ WriteParam(m, p.require_encapsulation);
}
bool ParamTraits<AudioParameters::HardwareCapabilities>::Read(
@@ -88,16 +88,19 @@ bool ParamTraits<AudioParameters::HardwareCapabilities>::Read(
base::PickleIterator* iter,
param_type* r) {
int bitstream_formats;
+ bool require_encapsulation;
int max_frames_per_buffer;
int min_frames_per_buffer;
if (!ReadParam(m, iter, &min_frames_per_buffer) ||
!ReadParam(m, iter, &max_frames_per_buffer) ||
- !ReadParam(m, iter, &bitstream_formats)) {
+ !ReadParam(m, iter, &bitstream_formats) ||
+ !ReadParam(m, iter, &require_encapsulation)) {
return false;
}
r->min_frames_per_buffer = min_frames_per_buffer;
r->max_frames_per_buffer = max_frames_per_buffer;
r->bitstream_formats = bitstream_formats;
+ r->require_encapsulation = require_encapsulation;
return true;
}
diff --git a/chromium/media/base/ipc/media_param_traits.h b/chromium/media/base/ipc/media_param_traits.h
index 4771d463930..edc38ed5fe7 100644
--- a/chromium/media/base/ipc/media_param_traits.h
+++ b/chromium/media/base/ipc/media_param_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/ipc/media_param_traits_macros.h b/chromium/media/base/ipc/media_param_traits_macros.h
index aa5e11a7d0a..2596e244c0f 100644
--- a/chromium/media/base/ipc/media_param_traits_macros.h
+++ b/chromium/media/base/ipc/media_param_traits_macros.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/key_system_info.cc b/chromium/media/base/key_system_info.cc
new file mode 100644
index 00000000000..b8add8a5783
--- /dev/null
+++ b/chromium/media/base/key_system_info.cc
@@ -0,0 +1,27 @@
+// Copyright 2013 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/key_system_info.h"
+
+namespace media {
+
+bool KeySystemInfo::IsSupportedKeySystem(const std::string& key_system) const {
+ // By default, only support the base key system.
+ return key_system == GetBaseKeySystemName();
+}
+
+bool KeySystemInfo::ShouldUseBaseKeySystemName() const {
+ // By default, use the sub key system names for creating CDMs.
+ return false;
+}
+
+SupportedCodecs KeySystemInfo::GetSupportedHwSecureCodecs() const {
+ return EME_CODEC_NONE;
+}
+
+bool KeySystemInfo::UseAesDecryptor() const {
+ return false;
+}
+
+} // namespace media
diff --git a/chromium/media/base/key_system_properties.h b/chromium/media/base/key_system_info.h
index 4500f4eace3..4df1a786af9 100644
--- a/chromium/media/base/key_system_properties.h
+++ b/chromium/media/base/key_system_info.h
@@ -1,9 +1,9 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef MEDIA_BASE_KEY_SYSTEM_PROPERTIES_H_
-#define MEDIA_BASE_KEY_SYSTEM_PROPERTIES_H_
+#ifndef MEDIA_BASE_KEY_SYSTEM_INFO_H_
+#define MEDIA_BASE_KEY_SYSTEM_INFO_H_
#include <string>
@@ -17,9 +17,9 @@
namespace media {
// Provides an interface for querying the properties of a registered key system.
-class MEDIA_EXPORT KeySystemProperties {
+class MEDIA_EXPORT KeySystemInfo {
public:
- virtual ~KeySystemProperties() {}
+ virtual ~KeySystemInfo() {}
// Gets the base key system name, e.g. "org.chromium.foo".
virtual std::string GetBaseKeySystemName() const = 0;
@@ -84,12 +84,11 @@ class MEDIA_EXPORT KeySystemProperties {
virtual bool UseAesDecryptor() const;
};
-using KeySystemPropertiesVector =
- std::vector<std::unique_ptr<KeySystemProperties>>;
+using KeySystemInfoVector = std::vector<std::unique_ptr<KeySystemInfo>>;
using GetSupportedKeySystemsCB =
- base::RepeatingCallback<void(KeySystemPropertiesVector)>;
+ base::RepeatingCallback<void(KeySystemInfoVector)>;
} // namespace media
-#endif // MEDIA_BASE_KEY_SYSTEM_PROPERTIES_H_
+#endif // MEDIA_BASE_KEY_SYSTEM_INFO_H_
diff --git a/chromium/media/base/key_system_names.cc b/chromium/media/base/key_system_names.cc
index 6a8bc0a9f42..3ecdc56c5e3 100644
--- a/chromium/media/base/key_system_names.cc
+++ b/chromium/media/base/key_system_names.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/key_system_names.h b/chromium/media/base/key_system_names.h
index e7ed8840b1e..aacbd278463 100644
--- a/chromium/media/base/key_system_names.h
+++ b/chromium/media/base/key_system_names.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/key_system_properties.cc b/chromium/media/base/key_system_properties.cc
deleted file mode 100644
index 0a52ade933d..00000000000
--- a/chromium/media/base/key_system_properties.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/base/key_system_properties.h"
-
-namespace media {
-
-bool KeySystemProperties::IsSupportedKeySystem(
- const std::string& key_system) const {
- // By default, only support the base key system.
- return key_system == GetBaseKeySystemName();
-}
-
-bool KeySystemProperties::ShouldUseBaseKeySystemName() const {
- // By default, use the sub key system names for creating CDMs.
- return false;
-}
-
-SupportedCodecs KeySystemProperties::GetSupportedHwSecureCodecs() const {
- return EME_CODEC_NONE;
-}
-
-bool KeySystemProperties::UseAesDecryptor() const {
- return false;
-}
-
-} // namespace media
diff --git a/chromium/media/base/key_systems.cc b/chromium/media/base/key_systems.cc
index 0b27e769ef5..40fdc0e159d 100644
--- a/chromium/media/base/key_systems.cc
+++ b/chromium/media/base/key_systems.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,8 +20,8 @@
#include "base/threading/thread_checker.h"
#include "build/build_config.h"
#include "media/base/eme_constants.h"
+#include "media/base/key_system_info.h"
#include "media/base/key_system_names.h"
-#include "media/base/key_system_properties.h"
#include "media/base/media.h"
#include "media/base/media_client.h"
#include "media/base/media_switches.h"
@@ -31,6 +31,8 @@
namespace media {
+namespace {
+
const char kClearKeyKeySystem[] = "org.w3.clearkey";
// These names are used by UMA. Do not change them!
@@ -142,7 +144,7 @@ EmeCodec ToVideoEmeCodec(VideoCodec codec, VideoCodecProfile profile) {
}
}
-class ClearKeyProperties : public KeySystemProperties {
+class ClearKeyProperties : public KeySystemInfo {
public:
std::string GetBaseKeySystemName() const final { return kClearKeyKeySystem; }
@@ -250,7 +252,7 @@ static bool IsPotentiallySupportedKeySystem(const std::string& key_system) {
// Returns whether distinctive identifiers and persistent state can be reliably
// blocked for |properties| (and therefore be safely configurable).
-static bool CanBlock(const KeySystemProperties& properties) {
+static bool CanBlock(const KeySystemInfo& properties) {
// When AesDecryptor is used, we are sure we can block.
if (properties.UseAesDecryptor())
return true;
@@ -310,18 +312,17 @@ class KeySystemsImpl : public KeySystems {
EmeFeatureSupport GetDistinctiveIdentifierSupport(
const std::string& key_system) const override;
- // These two functions are for testing purpose only.
+ // These functions are for testing purpose only.
void AddCodecMaskForTesting(EmeMediaType media_type,
const std::string& codec,
uint32_t mask);
void AddMimeTypeCodecMaskForTesting(const std::string& mime_type,
uint32_t mask);
+ void ResetForTesting();
private:
friend class base::NoDestructor<KeySystemsImpl>;
- using KeySystemPropertiesMap =
- std::unordered_map<std::string, std::unique_ptr<KeySystemProperties>>;
using MimeTypeToCodecsMap = std::unordered_map<std::string, SupportedCodecs>;
using CodecMap = std::unordered_map<std::string, EmeCodec>;
using InitDataTypesMap = std::unordered_map<std::string, EmeInitDataType>;
@@ -329,12 +330,13 @@ class KeySystemsImpl : public KeySystems {
KeySystemsImpl();
~KeySystemsImpl() override;
+ void Initialize();
+
void UpdateSupportedKeySystems();
- void OnSupportedKeySystemsUpdated(KeySystemPropertiesVector key_systems);
- void ProcessSupportedKeySystems(KeySystemPropertiesVector key_systems);
+ void OnSupportedKeySystemsUpdated(KeySystemInfoVector key_systems);
+ void ProcessSupportedKeySystems(KeySystemInfoVector key_systems);
- const KeySystemProperties* GetKeySystemProperties(
- const std::string& key_system) const;
+ const KeySystemInfo* GetKeySystemInfo(const std::string& key_system) const;
void RegisterMimeType(const std::string& mime_type, SupportedCodecs codecs);
bool IsValidMimeTypeCodecsCombination(const std::string& mime_type,
@@ -357,8 +359,8 @@ class KeySystemsImpl : public KeySystems {
// Pending callbacks for UpdateIfNeeded() calls.
base::OnceClosureList update_callbacks_;
- // Map from key system string to KeySystemProperties instance.
- KeySystemPropertiesMap key_system_properties_map_;
+ // Vector of KeySystemInfo .
+ KeySystemInfoVector key_system_properties_vector_;
// This member should only be modified by RegisterMimeType().
MimeTypeToCodecsMap mime_type_to_codecs_map_;
@@ -381,10 +383,7 @@ KeySystemsImpl* KeySystemsImpl::GetInstance() {
}
KeySystemsImpl::KeySystemsImpl() {
- for (const auto& [mime_type, codecs] : kMimeTypeToCodecsMap)
- RegisterMimeType(mime_type, codecs);
-
- UpdateSupportedKeySystems();
+ Initialize();
}
KeySystemsImpl::~KeySystemsImpl() {
@@ -392,6 +391,13 @@ KeySystemsImpl::~KeySystemsImpl() {
update_callbacks_.Notify();
}
+void KeySystemsImpl::Initialize() {
+ for (const auto& [mime_type, codecs] : kMimeTypeToCodecsMap)
+ RegisterMimeType(mime_type, codecs);
+
+ UpdateSupportedKeySystems();
+}
+
void KeySystemsImpl::UpdateSupportedKeySystems() {
DCHECK(!is_updating_);
is_updating_ = true;
@@ -471,7 +477,7 @@ EmeCodec KeySystemsImpl::GetEmeCodecForString(
}
void KeySystemsImpl::OnSupportedKeySystemsUpdated(
- KeySystemPropertiesVector key_systems) {
+ KeySystemInfoVector key_systems) {
DVLOG(1) << __func__;
is_updating_ = false;
@@ -485,11 +491,11 @@ void KeySystemsImpl::OnSupportedKeySystemsUpdated(
}
void KeySystemsImpl::ProcessSupportedKeySystems(
- KeySystemPropertiesVector key_systems) {
+ KeySystemInfoVector key_systems) {
DCHECK(thread_checker_.CalledOnValidThread());
- // Clear `key_system_properties_map_` before we repopulating it.
- key_system_properties_map_.clear();
+ // Clear `key_system_properties_vector_` before repopulating it.
+ key_system_properties_vector_.clear();
for (auto& properties : key_systems) {
DCHECK(!properties->GetBaseKeySystemName().empty());
@@ -520,23 +526,20 @@ void KeySystemsImpl::ProcessSupportedKeySystems(
}
const auto base_key_system_name = properties->GetBaseKeySystemName();
- DCHECK(!key_system_properties_map_.count(base_key_system_name))
- << "Key system '" << base_key_system_name << "' already registered";
DVLOG(1) << __func__ << ": Adding key system " << base_key_system_name;
- key_system_properties_map_[base_key_system_name] = std::move(properties);
+ key_system_properties_vector_.push_back(std::move(properties));
}
}
-const KeySystemProperties* KeySystemsImpl::GetKeySystemProperties(
+const KeySystemInfo* KeySystemsImpl::GetKeySystemInfo(
const std::string& key_system) const {
DCHECK(!is_updating_);
- for (const auto& entry : key_system_properties_map_) {
- const auto& base_key_system = entry.first;
- const auto* properties = entry.second.get();
+ for (const auto& key_system_properties : key_system_properties_vector_) {
+ const auto& base_key_system = key_system_properties->GetBaseKeySystemName();
if ((key_system == base_key_system ||
IsSubKeySystemOf(key_system, base_key_system)) &&
- properties->IsSupportedKeySystem(key_system)) {
- return properties;
+ key_system_properties->IsSupportedKeySystem(key_system)) {
+ return key_system_properties.get();
}
}
@@ -578,7 +581,7 @@ bool KeySystemsImpl::IsSupportedInitDataType(
EmeInitDataType init_data_type) const {
DCHECK(thread_checker_.CalledOnValidThread());
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
NOTREACHED();
return false;
@@ -592,7 +595,7 @@ EmeConfig::Rule KeySystemsImpl::GetEncryptionSchemeConfigRule(
EncryptionScheme encryption_scheme) const {
DCHECK(thread_checker_.CalledOnValidThread());
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
NOTREACHED();
return EmeConfig::UnsupportedRule();
@@ -620,11 +623,25 @@ void KeySystemsImpl::AddMimeTypeCodecMaskForTesting(
RegisterMimeType(mime_type, static_cast<EmeCodec>(codecs_mask));
}
+void KeySystemsImpl::ResetForTesting() {
+ weak_factory_.InvalidateWeakPtrs();
+ is_updating_ = false;
+ DCHECK(update_callbacks_.empty())
+ << "Should have no update callbacks for a clean test.";
+ key_system_properties_vector_.clear();
+ mime_type_to_codecs_map_.clear();
+ codec_map_for_testing_.clear();
+ audio_codec_mask_ = EME_CODEC_AUDIO_ALL;
+ video_codec_mask_ = EME_CODEC_VIDEO_ALL;
+
+ Initialize();
+}
+
std::string KeySystemsImpl::GetBaseKeySystemName(
const std::string& key_system) const {
DCHECK(thread_checker_.CalledOnValidThread());
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
NOTREACHED() << "Key system support should have been checked";
return key_system;
@@ -636,14 +653,14 @@ std::string KeySystemsImpl::GetBaseKeySystemName(
bool KeySystemsImpl::IsSupportedKeySystem(const std::string& key_system) const {
DCHECK(thread_checker_.CalledOnValidThread());
- return GetKeySystemProperties(key_system);
+ return GetKeySystemInfo(key_system);
}
bool KeySystemsImpl::ShouldUseBaseKeySystemName(
const std::string& key_system) const {
DCHECK(thread_checker_.CalledOnValidThread());
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
NOTREACHED() << "Key system support should have been checked";
return false;
@@ -655,7 +672,7 @@ bool KeySystemsImpl::ShouldUseBaseKeySystemName(
bool KeySystemsImpl::CanUseAesDecryptor(const std::string& key_system) const {
DCHECK(thread_checker_.CalledOnValidThread());
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
DLOG(ERROR) << key_system << " is not a known supported key system";
return false;
@@ -688,7 +705,7 @@ EmeConfig::Rule KeySystemsImpl::GetContentTypeConfigRule(
}
// Double check whether the key system is supported.
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
NOTREACHED() << "Key system support should have been checked";
return EmeConfig::UnsupportedRule();
@@ -768,7 +785,7 @@ EmeConfig::Rule KeySystemsImpl::GetRobustnessConfigRule(
const bool* hw_secure_requirement) const {
DCHECK(thread_checker_.CalledOnValidThread());
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
NOTREACHED();
return EmeConfig::UnsupportedRule();
@@ -782,7 +799,7 @@ EmeConfig::Rule KeySystemsImpl::GetPersistentLicenseSessionSupport(
const std::string& key_system) const {
DCHECK(thread_checker_.CalledOnValidThread());
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
NOTREACHED();
return EmeConfig::UnsupportedRule();
@@ -795,7 +812,7 @@ EmeFeatureSupport KeySystemsImpl::GetPersistentStateSupport(
const std::string& key_system) const {
DCHECK(thread_checker_.CalledOnValidThread());
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
NOTREACHED();
return EmeFeatureSupport::INVALID;
@@ -808,7 +825,7 @@ EmeFeatureSupport KeySystemsImpl::GetDistinctiveIdentifierSupport(
const std::string& key_system) const {
DCHECK(thread_checker_.CalledOnValidThread());
- const auto* properties = GetKeySystemProperties(key_system);
+ const auto* properties = GetKeySystemInfo(key_system);
if (!properties) {
NOTREACHED();
return EmeFeatureSupport::INVALID;
@@ -817,12 +834,12 @@ EmeFeatureSupport KeySystemsImpl::GetDistinctiveIdentifierSupport(
return properties->GetDistinctiveIdentifierSupport();
}
+} // namespace
+
KeySystems* KeySystems::GetInstance() {
return KeySystemsImpl::GetInstance();
}
-//------------------------------------------------------------------------------
-
bool IsSupportedKeySystemWithInitDataType(const std::string& key_system,
EmeInitDataType init_data_type) {
return KeySystemsImpl::GetInstance()->IsSupportedInitDataType(key_system,
@@ -868,7 +885,7 @@ bool CanUseAesDecryptor(const std::string& key_system) {
return KeySystemsImpl::GetInstance()->CanUseAesDecryptor(key_system);
}
-// These two functions are for testing purpose only. The declaration in the
+// These three functions are for testing purpose only. The declaration in the
// header file is guarded by "#if defined(UNIT_TEST)" so that they can be used
// by tests but not non-test code. However, this .cc file is compiled as part of
// "media" where "UNIT_TEST" is not defined. So we need to specify
@@ -887,4 +904,8 @@ MEDIA_EXPORT void AddMimeTypeCodecMaskForTesting(const std::string& mime_type,
mask);
}
+MEDIA_EXPORT void ResetKeySystemsForTesting() {
+ KeySystemsImpl::GetInstance()->ResetForTesting();
+}
+
} // namespace media
diff --git a/chromium/media/base/key_systems.h b/chromium/media/base/key_systems.h
index 4a24550ed7d..2edc4d20ee1 100644
--- a/chromium/media/base/key_systems.h
+++ b/chromium/media/base/key_systems.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -127,6 +127,8 @@ MEDIA_EXPORT void AddCodecMaskForTesting(EmeMediaType media_type,
uint32_t mask);
MEDIA_EXPORT void AddMimeTypeCodecMaskForTesting(const std::string& mime_type,
uint32_t mask);
+// Resets and reinitializes the KeySystems for testing.
+MEDIA_EXPORT void ResetKeySystemsForTesting();
#endif // defined(UNIT_TEST)
} // namespace media
diff --git a/chromium/media/base/key_systems_unittest.cc b/chromium/media/base/key_systems_unittest.cc
index 771cf263868..075232ee82b 100644
--- a/chromium/media/base/key_systems_unittest.cc
+++ b/chromium/media/base/key_systems_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -66,7 +66,7 @@ static_assert((TEST_CODEC_FOO_ALL & EME_CODEC_ALL) == EME_CODEC_NONE,
"test codec masks should only use invalid codec masks");
// Base class to provide default implementations.
-class TestKeySystemPropertiesBase : public KeySystemProperties {
+class TestKeySystemInfoBase : public KeySystemInfo {
public:
bool IsSupportedInitDataType(EmeInitDataType init_data_type) const override {
return init_data_type == EmeInitDataType::WEBM;
@@ -89,9 +89,9 @@ class TestKeySystemPropertiesBase : public KeySystemProperties {
}
};
-class AesKeySystemProperties : public TestKeySystemPropertiesBase {
+class AesKeySystemInfo : public TestKeySystemInfoBase {
public:
- AesKeySystemProperties(const std::string& name) : name_(name) {}
+ explicit AesKeySystemInfo(const std::string& name) : name_(name) {}
std::string GetBaseKeySystemName() const override { return name_; }
@@ -122,7 +122,7 @@ class AesKeySystemProperties : public TestKeySystemPropertiesBase {
std::string name_;
};
-class ExternalKeySystemProperties : public TestKeySystemPropertiesBase {
+class ExternalKeySystemInfo : public TestKeySystemInfoBase {
public:
std::string GetBaseKeySystemName() const override { return kExternal; }
@@ -231,21 +231,12 @@ EmeConfig::Rule GetRobustnessConfigRule(
// Therefore, SetMediaClient() must be called before this function to make sure
// MediaClient in effect when constructing KeySystems.
void AddContainerAndCodecMasksForTest() {
- // Since KeySystems is a singleton. Make sure we only add test container and
- // codec masks once per process.
- static bool is_test_masks_added = false;
-
- if (is_test_masks_added)
- return;
-
AddCodecMaskForTesting(EmeMediaType::AUDIO, "fooaudio", TEST_CODEC_FOO_AUDIO);
AddCodecMaskForTesting(EmeMediaType::VIDEO, "foovideo", TEST_CODEC_FOO_VIDEO);
AddCodecMaskForTesting(EmeMediaType::VIDEO, "securefoovideo",
TEST_CODEC_FOO_SECURE_VIDEO);
AddMimeTypeCodecMaskForTesting("audio/foo", TEST_CODEC_FOO_AUDIO_ALL);
AddMimeTypeCodecMaskForTesting("video/foo", TEST_CODEC_FOO_VIDEO_ALL);
-
- is_test_masks_added = true;
}
class TestMediaClient : public MediaClient {
@@ -267,7 +258,7 @@ class TestMediaClient : public MediaClient {
GetAudioRendererAlgorithmParameters(AudioParameters audio_parameters) final;
private:
- KeySystemPropertiesVector GetSupportedKeySystemsInternal();
+ KeySystemInfoVector GetSupportedKeySystemsInternal();
GetSupportedKeySystemsCB get_supported_key_systems_cb_;
bool supports_external_key_system_ = true;
@@ -278,7 +269,6 @@ TestMediaClient::~TestMediaClient() = default;
void TestMediaClient::GetSupportedKeySystems(GetSupportedKeySystemsCB cb) {
// Save the callback for future updates.
- DCHECK(!get_supported_key_systems_cb_);
get_supported_key_systems_cb_ = cb;
get_supported_key_systems_cb_.Run(GetSupportedKeySystemsInternal());
@@ -307,13 +297,13 @@ TestMediaClient::GetAudioRendererAlgorithmParameters(
return absl::nullopt;
}
-KeySystemPropertiesVector TestMediaClient::GetSupportedKeySystemsInternal() {
- KeySystemPropertiesVector key_systems;
+KeySystemInfoVector TestMediaClient::GetSupportedKeySystemsInternal() {
+ KeySystemInfoVector key_systems;
- key_systems.emplace_back(std::make_unique<AesKeySystemProperties>(kUsesAes));
+ key_systems.emplace_back(std::make_unique<AesKeySystemInfo>(kUsesAes));
if (supports_external_key_system_)
- key_systems.emplace_back(std::make_unique<ExternalKeySystemProperties>());
+ key_systems.emplace_back(std::make_unique<ExternalKeySystemInfo>());
return key_systems;
}
@@ -360,6 +350,9 @@ class KeySystemsTest : public testing::Test {
mixed_codecs_.push_back("foovideo");
SetMediaClient(&test_media_client_);
+
+ // Reset KeySystems since it's a singleton.
+ ResetKeySystemsForTesting();
}
void SetUp() override {
@@ -372,7 +365,7 @@ class KeySystemsTest : public testing::Test {
~KeySystemsTest() override {
// Clear the use of |test_media_client_|, which was set in SetUp().
- // NOTE: This does not clear any cached KeySystemProperties in the global
+ // NOTE: This does not clear any cached KeySystemInfo in the global
// KeySystems instance.
SetMediaClient(nullptr);
}
diff --git a/chromium/media/base/limits.h b/chromium/media/base/limits.h
index c5cb20e36ee..817077f1d83 100644
--- a/chromium/media/base/limits.h
+++ b/chromium/media/base/limits.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/localized_strings.cc b/chromium/media/base/localized_strings.cc
index ae3217e5b1e..c3e36729f05 100644
--- a/chromium/media/base/localized_strings.cc
+++ b/chromium/media/base/localized_strings.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/localized_strings.h b/chromium/media/base/localized_strings.h
index f8bfbf04f1e..3535b0d43aa 100644
--- a/chromium/media/base/localized_strings.h
+++ b/chromium/media/base/localized_strings.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/logging_override_if_enabled.h b/chromium/media/base/logging_override_if_enabled.h
index 4ab438c0398..2e4515c1565 100644
--- a/chromium/media/base/logging_override_if_enabled.h
+++ b/chromium/media/base/logging_override_if_enabled.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/loopback_audio_converter.cc b/chromium/media/base/loopback_audio_converter.cc
index 715675d28b8..d22e23d2620 100644
--- a/chromium/media/base/loopback_audio_converter.cc
+++ b/chromium/media/base/loopback_audio_converter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/loopback_audio_converter.h b/chromium/media/base/loopback_audio_converter.h
index 705ad353ae6..e3a9189466e 100644
--- a/chromium/media/base/loopback_audio_converter.h
+++ b/chromium/media/base/loopback_audio_converter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mac/BUILD.gn b/chromium/media/base/mac/BUILD.gn
index 9dd95bbc171..0c770ef02ae 100644
--- a/chromium/media/base/mac/BUILD.gn
+++ b/chromium/media/base/mac/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/base/mac/audio_latency_mac.cc b/chromium/media/base/mac/audio_latency_mac.cc
index 3d1aa2fd638..a7d7b1bcccf 100644
--- a/chromium/media/base/mac/audio_latency_mac.cc
+++ b/chromium/media/base/mac/audio_latency_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mac/audio_latency_mac.h b/chromium/media/base/mac/audio_latency_mac.h
index 23fd37954b8..7955485618d 100644
--- a/chromium/media/base/mac/audio_latency_mac.h
+++ b/chromium/media/base/mac/audio_latency_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mac/color_space_util_mac.h b/chromium/media/base/mac/color_space_util_mac.h
index ab2a4459aad..321747964da 100644
--- a/chromium/media/base/mac/color_space_util_mac.h
+++ b/chromium/media/base/mac/color_space_util_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,12 +21,6 @@ MEDIA_EXPORT gfx::ColorSpace GetImageBufferColorSpace(
MEDIA_EXPORT gfx::ColorSpace GetFormatDescriptionColorSpace(
CMFormatDescriptionRef format_description);
-MEDIA_EXPORT CFDataRef
-GenerateContentLightLevelInfo(const gfx::HDRMetadata& hdr_metadata);
-
-MEDIA_EXPORT CFDataRef
-GenerateMasteringDisplayColorVolume(const gfx::HDRMetadata& hdr_metadata);
-
} // namespace media
#endif // MEDIA_BASE_MAC_COLOR_SPACE_UTIL_MAC_H_
diff --git a/chromium/media/base/mac/color_space_util_mac.mm b/chromium/media/base/mac/color_space_util_mac.mm
index 9110f1a19f7..5074bb05f2a 100644
--- a/chromium/media/base/mac/color_space_util_mac.mm
+++ b/chromium/media/base/mac/color_space_util_mac.mm
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -269,65 +269,4 @@ gfx::ColorSpace GetFormatDescriptionColorSpace(
format_description, kCMFormatDescriptionExtension_YCbCrMatrix));
}
-CFDataRef GenerateContentLightLevelInfo(const gfx::HDRMetadata& hdr_metadata) {
- // This is a SMPTEST2086 Content Light Level Information box.
- struct ContentLightLevelInfoSEI {
- uint16_t max_content_light_level;
- uint16_t max_frame_average_light_level;
- } __attribute__((packed, aligned(2)));
- static_assert(sizeof(ContentLightLevelInfoSEI) == 4, "Must be 4 bytes");
-
- // Values are stored in big-endian...
- ContentLightLevelInfoSEI sei;
- sei.max_content_light_level =
- __builtin_bswap16(hdr_metadata.max_content_light_level);
- sei.max_frame_average_light_level =
- __builtin_bswap16(hdr_metadata.max_frame_average_light_level);
-
- NSData* nsdata_sei = [NSData dataWithBytes:&sei length:4];
- return base::mac::NSToCFCast(nsdata_sei);
-}
-
-CFDataRef GenerateMasteringDisplayColorVolume(
- const gfx::HDRMetadata& hdr_metadata) {
- // This is a SMPTEST2086 Mastering Display Color Volume box.
- struct MasteringDisplayColorVolumeSEI {
- vector_ushort2 primaries[3]; // GBR
- vector_ushort2 white_point;
- uint32_t luminance_max;
- uint32_t luminance_min;
- } __attribute__((packed, aligned(4)));
- static_assert(sizeof(MasteringDisplayColorVolumeSEI) == 24,
- "Must be 24 bytes");
-
- // Make a copy which we can manipulate.
- auto md = hdr_metadata.color_volume_metadata;
-
- constexpr float kColorCoordinateUpperBound = 50000.0f;
- md.primary_r.Scale(kColorCoordinateUpperBound);
- md.primary_g.Scale(kColorCoordinateUpperBound);
- md.primary_b.Scale(kColorCoordinateUpperBound);
- md.white_point.Scale(kColorCoordinateUpperBound);
-
- constexpr float kUnitOfMasteringLuminance = 10000.0f;
- md.luminance_max *= kUnitOfMasteringLuminance;
- md.luminance_min *= kUnitOfMasteringLuminance;
-
- // Values are stored in big-endian...
- MasteringDisplayColorVolumeSEI sei;
- sei.primaries[0].x = __builtin_bswap16(md.primary_g.x() + 0.5f);
- sei.primaries[0].y = __builtin_bswap16(md.primary_g.y() + 0.5f);
- sei.primaries[1].x = __builtin_bswap16(md.primary_b.x() + 0.5f);
- sei.primaries[1].y = __builtin_bswap16(md.primary_b.y() + 0.5f);
- sei.primaries[2].x = __builtin_bswap16(md.primary_r.x() + 0.5f);
- sei.primaries[2].y = __builtin_bswap16(md.primary_r.y() + 0.5f);
- sei.white_point.x = __builtin_bswap16(md.white_point.x() + 0.5f);
- sei.white_point.y = __builtin_bswap16(md.white_point.y() + 0.5f);
- sei.luminance_max = __builtin_bswap32(md.luminance_max + 0.5f);
- sei.luminance_min = __builtin_bswap32(md.luminance_min + 0.5f);
-
- NSData* nsdata_sei = [NSData dataWithBytes:&sei length:24];
- return base::mac::NSToCFCast(nsdata_sei);
-}
-
} // namespace media
diff --git a/chromium/media/base/mac/video_frame_mac.cc b/chromium/media/base/mac/video_frame_mac.cc
index ced632c600e..a0adb8e9527 100644
--- a/chromium/media/base/mac/video_frame_mac.cc
+++ b/chromium/media/base/mac/video_frame_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "media/base/video_frame.h"
+#include "media/base/video_util.h"
#include "ui/gfx/gpu_memory_buffer.h"
#include "ui/gfx/mac/io_surface.h"
@@ -34,33 +35,44 @@ void CvPixelBufferReleaseCallback(void* frame_ref,
} // namespace
MEDIA_EXPORT base::ScopedCFTypeRef<CVPixelBufferRef>
-WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) {
+WrapVideoFrameInCVPixelBuffer(scoped_refptr<VideoFrame> frame) {
base::ScopedCFTypeRef<CVPixelBufferRef> pixel_buffer;
-
- // If the frame is backed by a pixel buffer, just return that buffer.
- if (frame.CvPixelBuffer()) {
- pixel_buffer.reset(frame.CvPixelBuffer(), base::scoped_policy::RETAIN);
+ if (!frame)
return pixel_buffer;
- }
+ const gfx::Rect& visible_rect = frame->visible_rect();
+ bool crop_needed = visible_rect != gfx::Rect(frame->coded_size());
+
+ if (!crop_needed) {
+ // If the frame is backed by a pixel buffer, just return that buffer.
+ if (frame->CvPixelBuffer()) {
+ pixel_buffer.reset(frame->CvPixelBuffer(), base::scoped_policy::RETAIN);
+ return pixel_buffer;
+ }
- // If the frame has a GMB, yank out its IOSurface if possible.
- if (frame.GetGpuMemoryBuffer()) {
- gfx::GpuMemoryBufferHandle handle =
- frame.GetGpuMemoryBuffer()->CloneHandle();
- if (handle.type == gfx::GpuMemoryBufferType::IO_SURFACE_BUFFER) {
- gfx::ScopedIOSurface io_surface = handle.io_surface;
- if (io_surface) {
- const CVReturn cv_return = CVPixelBufferCreateWithIOSurface(
- nullptr, io_surface, nullptr, pixel_buffer.InitializeInto());
- if (cv_return == kCVReturnSuccess) {
- VLOG(3) << "Returning IOSurface-based CVPixelBuffer.";
+ // If the frame has a GMB, yank out its IOSurface if possible.
+ if (frame->HasGpuMemoryBuffer()) {
+ auto handle = frame->GetGpuMemoryBuffer()->CloneHandle();
+ if (handle.type == gfx::GpuMemoryBufferType::IO_SURFACE_BUFFER) {
+ gfx::ScopedIOSurface io_surface = handle.io_surface;
+ if (io_surface) {
+ CVReturn cv_return = CVPixelBufferCreateWithIOSurface(
+ nullptr, io_surface, nullptr, pixel_buffer.InitializeInto());
+ if (cv_return != kCVReturnSuccess) {
+ DLOG(ERROR) << "CVPixelBufferCreateWithIOSurface failed: "
+ << cv_return;
+ pixel_buffer.reset();
+ }
return pixel_buffer;
}
- pixel_buffer.reset();
}
}
}
+ // If the frame is backed by a GPU buffer, but needs cropping, map it and
+ // and handle like a software frame. There is no memcpy here.
+ if (frame->HasGpuMemoryBuffer())
+ frame = ConvertToMemoryMappedFrame(std::move(frame));
+
VLOG(3) << "Returning RAM based CVPixelBuffer.";
// VideoFrame only supports YUV formats and most of them are 'YVU' ordered,
@@ -68,7 +80,7 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) {
// represent I420 and NV12 frames. In addition, VideoFrame does not carry
// colorimetric information, so this function assumes standard video range
// and ITU Rec 709 primaries.
- const VideoPixelFormat video_frame_format = frame.format();
+ const VideoPixelFormat video_frame_format = frame->format();
OSType cv_format;
if (video_frame_format == PIXEL_FORMAT_I420) {
cv_format = kCVPixelFormatType_420YpCbCr8Planar;
@@ -81,7 +93,6 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) {
int num_planes = VideoFrame::NumPlanes(video_frame_format);
DCHECK_LE(num_planes, kMaxPlanes);
- const gfx::Rect& visible_rect = frame.visible_rect();
// Build arrays for each plane's data pointer, dimensions and byte alignment.
void* plane_ptrs[kMaxPlanes];
@@ -89,12 +100,12 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) {
size_t plane_heights[kMaxPlanes];
size_t plane_bytes_per_row[kMaxPlanes];
for (int plane_i = 0; plane_i < num_planes; ++plane_i) {
- plane_ptrs[plane_i] = const_cast<uint8_t*>(frame.visible_data(plane_i));
+ plane_ptrs[plane_i] = const_cast<uint8_t*>(frame->visible_data(plane_i));
gfx::Size plane_size =
VideoFrame::PlaneSize(video_frame_format, plane_i, visible_rect.size());
plane_widths[plane_i] = plane_size.width();
plane_heights[plane_i] = plane_size.height();
- plane_bytes_per_row[plane_i] = frame.stride(plane_i);
+ plane_bytes_per_row[plane_i] = frame->stride(plane_i);
}
// CVPixelBufferCreateWithPlanarBytes needs a dummy plane descriptor or the
@@ -110,7 +121,7 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) {
kCFAllocatorDefault, visible_rect.width(), visible_rect.height(),
cv_format, descriptor, 0, num_planes, plane_ptrs, plane_widths,
plane_heights, plane_bytes_per_row, &CvPixelBufferReleaseCallback,
- const_cast<VideoFrame*>(&frame), nullptr, pixel_buffer.InitializeInto());
+ frame.get(), nullptr, pixel_buffer.InitializeInto());
if (result != kCVReturnSuccess) {
DLOG(ERROR) << " CVPixelBufferCreateWithPlanarBytes failed: " << result;
return base::ScopedCFTypeRef<CVPixelBufferRef>(nullptr);
@@ -119,7 +130,7 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) {
// The CVPixelBuffer now references the data of the frame, so increment its
// reference count manually. The release callback set on the pixel buffer will
// release the frame.
- frame.AddRef();
+ frame->AddRef();
// Apply required colorimetric attachments.
CVBufferSetAttachment(pixel_buffer, kCVImageBufferColorPrimariesKey,
diff --git a/chromium/media/base/mac/video_frame_mac.h b/chromium/media/base/mac/video_frame_mac.h
index 93bcb77b362..2d316e27177 100644
--- a/chromium/media/base/mac/video_frame_mac.h
+++ b/chromium/media/base/mac/video_frame_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include <CoreVideo/CVPixelBuffer.h>
#include "base/mac/scoped_cftyperef.h"
+#include "base/memory/ref_counted.h"
#include "media/base/media_export.h"
namespace media {
@@ -23,7 +24,7 @@ class VideoFrame;
// (the visible rect's size does not match the coded size) are not supported.
// If an unsupported frame is specified, null is returned.
MEDIA_EXPORT base::ScopedCFTypeRef<CVPixelBufferRef>
-WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame);
+WrapVideoFrameInCVPixelBuffer(scoped_refptr<VideoFrame> frame);
} // namespace media
diff --git a/chromium/media/base/mac/video_frame_mac_unittests.cc b/chromium/media/base/mac/video_frame_mac_unittests.cc
index 1122f447615..8ccb45e14d4 100644
--- a/chromium/media/base/mac/video_frame_mac_unittests.cc
+++ b/chromium/media/base/mac/video_frame_mac_unittests.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -40,7 +40,7 @@ TEST(VideoFrameMac, CheckBasicAttributes) {
size, kTimestamp);
ASSERT_TRUE(frame.get());
- auto pb = WrapVideoFrameInCVPixelBuffer(*frame);
+ auto pb = WrapVideoFrameInCVPixelBuffer(frame);
ASSERT_TRUE(pb.get());
const gfx::Size coded_size = frame->coded_size();
@@ -77,7 +77,7 @@ TEST(VideoFrameMac, CheckFormats) {
auto frame = VideoFrame::CreateFrame(format_pair.chrome, size,
gfx::Rect(size), size, kTimestamp);
ASSERT_TRUE(frame.get());
- auto pb = WrapVideoFrameInCVPixelBuffer(*frame);
+ auto pb = WrapVideoFrameInCVPixelBuffer(frame);
if (format_pair.corevideo) {
EXPECT_EQ(format_pair.corevideo, CVPixelBufferGetPixelFormatType(pb));
} else {
@@ -99,7 +99,7 @@ TEST(VideoFrameMac, CheckLifetime) {
base::BindOnce(&Increment, &instances_destroyed));
ASSERT_TRUE(wrapper_frame.get());
- auto pb = WrapVideoFrameInCVPixelBuffer(*wrapper_frame);
+ auto pb = WrapVideoFrameInCVPixelBuffer(wrapper_frame);
ASSERT_TRUE(pb.get());
wrapper_frame = nullptr;
@@ -156,7 +156,7 @@ TEST(VideoFrameMac, CorrectlyWrapsFramesWithPadding) {
ASSERT_TRUE(frame.get());
FillFrameWithPredictableValues(*frame);
- auto pb = WrapVideoFrameInCVPixelBuffer(*frame);
+ auto pb = WrapVideoFrameInCVPixelBuffer(frame);
ASSERT_TRUE(pb.get());
EXPECT_EQ(kCVPixelFormatType_420YpCbCr8Planar,
CVPixelBufferGetPixelFormatType(pb));
diff --git a/chromium/media/base/mac/videotoolbox_helpers.cc b/chromium/media/base/mac/videotoolbox_helpers.cc
index 8b0bb92b3b0..3e689a3173d 100644
--- a/chromium/media/base/mac/videotoolbox_helpers.cc
+++ b/chromium/media/base/mac/videotoolbox_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mac/videotoolbox_helpers.h b/chromium/media/base/mac/videotoolbox_helpers.h
index 1f24b6d2ff4..a00512be900 100644
--- a/chromium/media/base/mac/videotoolbox_helpers.h
+++ b/chromium/media/base/mac/videotoolbox_helpers.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media.cc b/chromium/media/base/media.cc
index ef6ffe81646..7f2220ea360 100644
--- a/chromium/media/base/media.cc
+++ b/chromium/media/base/media.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media.h b/chromium/media/base/media.h
index 7ee3f33870e..436192f2fd6 100644
--- a/chromium/media/base/media.h
+++ b/chromium/media/base/media.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_client.cc b/chromium/media/base/media_client.cc
index 011f3b74137..3e54a2e392a 100644
--- a/chromium/media/base/media_client.cc
+++ b/chromium/media/base/media_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_client.h b/chromium/media/base/media_client.h
index 5e8ac795f72..fd22d95e89c 100644
--- a/chromium/media/base/media_client.h
+++ b/chromium/media/base/media_client.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,7 +10,7 @@
#include "media/base/audio_codecs.h"
#include "media/base/audio_parameters.h"
-#include "media/base/key_system_properties.h"
+#include "media/base/key_system_info.h"
#include "media/base/media_export.h"
#include "media/base/media_types.h"
#include "media/base/video_codecs.h"
diff --git a/chromium/media/base/media_content_type.cc b/chromium/media/base/media_content_type.cc
index 2d3ca0b83bf..5e0c1421ef3 100644
--- a/chromium/media/base/media_content_type.cc
+++ b/chromium/media/base/media_content_type.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_content_type.h b/chromium/media/base/media_content_type.h
index efafd43ef52..4e3e127c9df 100644
--- a/chromium/media/base/media_content_type.h
+++ b/chromium/media/base/media_content_type.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_controller.h b/chromium/media/base/media_controller.h
index afd1f063cbf..47cdd30b6e0 100644
--- a/chromium/media/base/media_controller.h
+++ b/chromium/media/base/media_controller.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_drm_key_type.h b/chromium/media/base/media_drm_key_type.h
index fea284d0ed2..6c037ca4914 100644
--- a/chromium/media/base/media_drm_key_type.h
+++ b/chromium/media/base/media_drm_key_type.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_drm_storage.cc b/chromium/media/base/media_drm_storage.cc
index f27eba98ea1..43d78e301a7 100644
--- a/chromium/media/base/media_drm_storage.cc
+++ b/chromium/media/base/media_drm_storage.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_drm_storage.h b/chromium/media/base/media_drm_storage.h
index 08fc91ca355..f3c7f68942e 100644
--- a/chromium/media/base/media_drm_storage.h
+++ b/chromium/media/base/media_drm_storage.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_export.h b/chromium/media/base/media_export.h
index 08091844ada..45785997b43 100644
--- a/chromium/media/base/media_export.h
+++ b/chromium/media/base/media_export.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_log.cc b/chromium/media/base/media_log.cc
index 46887da3dc2..d599c5b3838 100644
--- a/chromium/media/base/media_log.cc
+++ b/chromium/media/base/media_log.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,6 @@
#include <utility>
-#include "base/atomic_sequence_num.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/values.h"
@@ -18,10 +17,6 @@ namespace media {
// only in one spot.
const char MediaLog::kEventKey[] = "event";
-// A count of all MediaLogs created in the current process. Used to generate
-// unique IDs.
-static base::AtomicSequenceNumber g_media_log_count;
-
MediaLog::MediaLog() : MediaLog(new ParentLogRecord(this)) {}
MediaLog::MediaLog(scoped_refptr<ParentLogRecord> parent_log_record)
@@ -55,8 +50,9 @@ void MediaLog::Stop() {}
void MediaLog::AddMessage(MediaLogMessageLevel level, std::string message) {
std::unique_ptr<MediaLogRecord> record(
CreateRecord(MediaLogRecord::Type::kMessage));
- record->params.SetStringPath(MediaLogMessageLevelToString(level),
- std::move(message));
+ if (!base::IsStringUTF8AllowingNoncharacters(message))
+ message = "WARNING: system message could not be rendered!";
+ record->params.Set(MediaLogMessageLevelToString(level), std::move(message));
AddLogRecord(std::move(record));
}
@@ -93,7 +89,9 @@ void MediaLog::AddLogRecord(std::unique_ptr<MediaLogRecord> record) {
std::unique_ptr<MediaLogRecord> MediaLog::CreateRecord(
MediaLogRecord::Type type) {
auto record = std::make_unique<MediaLogRecord>();
- record->id = id();
+ // Record IDs are populated by event handlers before they are sent to various
+ // log viewers, such as the media-internals page, or devtools.
+ record->id = 0;
record->type = type;
record->time = base::TimeTicks::Now();
return record;
@@ -108,8 +106,7 @@ void MediaLog::InvalidateLog() {
// Keep |parent_log_record_| around, since the lock must keep working.
}
-MediaLog::ParentLogRecord::ParentLogRecord(MediaLog* log)
- : id(g_media_log_count.GetNext()), media_log(log) {}
+MediaLog::ParentLogRecord::ParentLogRecord(MediaLog* log) : media_log(log) {}
MediaLog::ParentLogRecord::~ParentLogRecord() = default;
LogHelper::LogHelper(MediaLogMessageLevel level, MediaLog* media_log)
diff --git a/chromium/media/base/media_log.h b/chromium/media/base/media_log.h
index cce6a266327..a9d85baa5f1 100644
--- a/chromium/media/base/media_log.h
+++ b/chromium/media/base/media_log.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -97,8 +97,9 @@ class MEDIA_EXPORT MediaLog {
DCHECK(!status.is_ok());
std::unique_ptr<MediaLogRecord> record =
CreateRecord(MediaLogRecord::Type::kMediaStatus);
- auto serialized = MediaSerialize(status);
- record->params.MergeDictionary(&serialized);
+ base::Value serialized = MediaSerialize(status);
+ DCHECK(serialized.is_dict());
+ record->params.Merge(std::move(serialized.GetDict()));
AddLogRecord(std::move(record));
}
@@ -115,11 +116,6 @@ class MEDIA_EXPORT MediaLog {
// TODO(tmathmeyer) Use a media::Status when that is ready.
std::string GetErrorMessage();
- // Getter for |id_|. Used by MojoMediaLogService to construct MediaLogRecords
- // to log into this MediaLog. Also used in trace events to associate each
- // event with a specific media playback.
- int32_t id() const { return parent_log_record_->id; }
-
// Add a record to this log. Inheritors should override AddLogRecordLocked to
// do something. This needs to be public for MojoMediaLogService to use it.
void AddLogRecord(std::unique_ptr<MediaLogRecord> event);
@@ -152,16 +148,16 @@ class MEDIA_EXPORT MediaLog {
template <MediaLogProperty P, typename T>
std::unique_ptr<MediaLogRecord> CreatePropertyRecord(const T& value) {
auto record = CreateRecord(MediaLogRecord::Type::kMediaPropertyChange);
- record->params.SetKey(MediaLogPropertyKeyToString(P),
- MediaLogPropertyTypeSupport<P, T>::Convert(value));
+ record->params.Set(MediaLogPropertyKeyToString(P),
+ MediaLogPropertyTypeSupport<P, T>::Convert(value));
return record;
}
template <MediaLogEvent E, typename... Opt>
std::unique_ptr<MediaLogRecord> CreateEventRecord() {
std::unique_ptr<MediaLogRecord> record(
CreateRecord(MediaLogRecord::Type::kMediaEventTriggered));
- record->params.SetString(MediaLog::kEventKey,
- MediaLogEventTypeSupport<E, Opt...>::TypeName());
+ record->params.Set(MediaLog::kEventKey,
+ MediaLogEventTypeSupport<E, Opt...>::TypeName());
return record;
}
@@ -178,9 +174,6 @@ class MEDIA_EXPORT MediaLog {
ParentLogRecord(const ParentLogRecord&) = delete;
ParentLogRecord& operator=(const ParentLogRecord&) = delete;
- // A unique (to this process) id for this MediaLog.
- int32_t id;
-
// |lock_| protects the rest of this structure.
base::Lock lock;
diff --git a/chromium/media/base/media_log_events.cc b/chromium/media/base/media_log_events.cc
index c628a511c1b..384c0fa2351 100644
--- a/chromium/media/base/media_log_events.cc
+++ b/chromium/media/base/media_log_events.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_log_events.h b/chromium/media/base/media_log_events.h
index ddf71e1f5a2..7f74b458cdf 100644
--- a/chromium/media/base/media_log_events.h
+++ b/chromium/media/base/media_log_events.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_log_message_levels.cc b/chromium/media/base/media_log_message_levels.cc
index c39257c8a31..bf1359738d1 100644
--- a/chromium/media/base/media_log_message_levels.cc
+++ b/chromium/media/base/media_log_message_levels.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_log_message_levels.h b/chromium/media/base/media_log_message_levels.h
index d79df67db10..502fd9bb828 100644
--- a/chromium/media/base/media_log_message_levels.h
+++ b/chromium/media/base/media_log_message_levels.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_log_properties.cc b/chromium/media/base/media_log_properties.cc
index 6203fe01493..5d4adf31ad2 100644
--- a/chromium/media/base/media_log_properties.cc
+++ b/chromium/media/base/media_log_properties.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_log_properties.h b/chromium/media/base/media_log_properties.h
index ddd20e971d6..41fe6bac668 100644
--- a/chromium/media/base/media_log_properties.h
+++ b/chromium/media/base/media_log_properties.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_log_record.h b/chromium/media/base/media_log_record.h
index cb030168957..2caaffac6f5 100644
--- a/chromium/media/base/media_log_record.h
+++ b/chromium/media/base/media_log_record.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,6 @@
#define MEDIA_BASE_MEDIA_LOG_RECORD_H_
#include <stdint.h>
-#include <memory>
#include "base/time/time.h"
#include "base/values.h"
@@ -23,9 +22,7 @@ struct MediaLogRecord {
MediaLogRecord& operator=(const MediaLogRecord& event) {
id = event.id;
type = event.type;
- params.Swap(base::DictionaryValue::From(
- base::Value::ToUniquePtrValue(event.params.Clone()))
- .get());
+ params = event.params.Clone();
time = event.time;
return *this;
}
@@ -56,7 +53,7 @@ struct MediaLogRecord {
int32_t id;
Type type;
- base::DictionaryValue params;
+ base::Value::Dict params;
base::TimeTicks time;
};
diff --git a/chromium/media/base/media_log_type_enforcement.h b/chromium/media/base/media_log_type_enforcement.h
index 7624ce34490..979c8da5dac 100644
--- a/chromium/media/base/media_log_type_enforcement.h
+++ b/chromium/media/base/media_log_type_enforcement.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -36,32 +36,32 @@ struct MediaLogEventTypeSupport {};
} \
}
-#define MEDIA_LOG_EVENT_NAMED_DATA(EVENT, TYPE, DISPLAY) \
- template <> \
- struct MediaLogEventTypeSupport<MediaLogEvent::EVENT, TYPE> { \
- static void AddExtraData(base::Value* params, const TYPE& t) { \
- DCHECK(params); \
- params->SetKey(DISPLAY, MediaSerialize<TYPE>(t)); \
- } \
- static std::string TypeName() { return #EVENT; } \
+#define MEDIA_LOG_EVENT_NAMED_DATA(EVENT, TYPE, DISPLAY) \
+ template <> \
+ struct MediaLogEventTypeSupport<MediaLogEvent::EVENT, TYPE> { \
+ static void AddExtraData(base::Value::Dict* params, const TYPE& t) { \
+ DCHECK(params); \
+ params->Set(DISPLAY, MediaSerialize<TYPE>(t)); \
+ } \
+ static std::string TypeName() { return #EVENT; } \
}
-#define MEDIA_LOG_EVENT_NAMED_DATA_OP(EVENT, TYPE, DISPLAY, OP) \
- template <> \
- struct MediaLogEventTypeSupport<MediaLogEvent::EVENT, TYPE> { \
- static void AddExtraData(base::Value* params, const TYPE& t) { \
- DCHECK(params); \
- params->SetKey(DISPLAY, MediaSerialize<TYPE>(OP(t))); \
- } \
- static std::string TypeName() { return #EVENT; } \
+#define MEDIA_LOG_EVENT_NAMED_DATA_OP(EVENT, TYPE, DISPLAY, OP) \
+ template <> \
+ struct MediaLogEventTypeSupport<MediaLogEvent::EVENT, TYPE> { \
+ static void AddExtraData(base::Value::Dict* params, const TYPE& t) { \
+ DCHECK(params); \
+ params->Set(DISPLAY, MediaSerialize<TYPE>(OP(t))); \
+ } \
+ static std::string TypeName() { return #EVENT; } \
}
// Specifically do not create the Convert or DisplayName methods
-#define MEDIA_LOG_EVENT_TYPELESS(EVENT) \
- template <> \
- struct MediaLogEventTypeSupport<MediaLogEvent::EVENT> { \
- static std::string TypeName() { return #EVENT; } \
- static void AddExtraData(base::Value* params) {} \
+#define MEDIA_LOG_EVENT_TYPELESS(EVENT) \
+ template <> \
+ struct MediaLogEventTypeSupport<MediaLogEvent::EVENT> { \
+ static std::string TypeName() { return #EVENT; } \
+ static void AddExtraData(base::Value::Dict* params) {} \
}
} // namespace media
diff --git a/chromium/media/base/media_log_unittest.cc b/chromium/media/base/media_log_unittest.cc
index 97e641a1736..52f85c48c32 100644
--- a/chromium/media/base/media_log_unittest.cc
+++ b/chromium/media/base/media_log_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -46,7 +46,7 @@ TEST_F(MediaLogTest, ClonedLogsInhertParentPlayerId) {
child_media_log->AddMessage(MediaLogMessageLevel::kERROR, "test");
auto event = root_log->take_most_recent_event();
EXPECT_NE(event, nullptr);
- EXPECT_EQ(event->id, root_log->id());
+ EXPECT_EQ(event->id, 0);
}
TEST_F(MediaLogTest, DontTruncateShortUrlString) {
@@ -58,13 +58,13 @@ TEST_F(MediaLogTest, DontTruncateShortUrlString) {
root_log_->AddEvent<MediaLogEvent::kLoad>(short_url);
auto event = root_log_->take_most_recent_event();
EXPECT_NE(event, nullptr);
- EXPECT_EQ(*event->params.FindStringPath("url"), "chromium.org");
+ EXPECT_EQ(*event->params.FindString("url"), "chromium.org");
// Verify that CreatedEvent does not truncate the short URL.
root_log_->AddEvent<MediaLogEvent::kWebMediaPlayerCreated>(short_url);
event = root_log_->take_most_recent_event();
EXPECT_NE(event, nullptr);
- EXPECT_EQ(*event->params.FindStringPath("origin_url"), "chromium.org");
+ EXPECT_EQ(*event->params.FindString("origin_url"), "chromium.org");
}
TEST_F(MediaLogTest, TruncateLongUrlStrings) {
@@ -90,13 +90,13 @@ TEST_F(MediaLogTest, TruncateLongUrlStrings) {
root_log_->AddEvent<MediaLogEvent::kLoad>(long_url);
auto event = root_log_->take_most_recent_event();
EXPECT_NE(event, nullptr);
- EXPECT_EQ(*event->params.FindStringPath("url"), expected_url);
+ EXPECT_EQ(*event->params.FindString("url"), expected_url);
// Verify that CreatedEvent does not truncate the short URL.
root_log_->AddEvent<MediaLogEvent::kWebMediaPlayerCreated>(long_url);
event = root_log_->take_most_recent_event();
EXPECT_NE(event, nullptr);
- EXPECT_EQ(*event->params.FindStringPath("origin_url"), expected_url);
+ EXPECT_EQ(*event->params.FindString("origin_url"), expected_url);
}
} // namespace media
diff --git a/chromium/media/base/media_observer.cc b/chromium/media/base/media_observer.cc
index de70f9f6abc..125a79dfb99 100644
--- a/chromium/media/base/media_observer.cc
+++ b/chromium/media/base/media_observer.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_observer.h b/chromium/media/base/media_observer.h
index 533b60dd728..34dfd49b86a 100644
--- a/chromium/media/base/media_observer.h
+++ b/chromium/media/base/media_observer.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -73,6 +73,9 @@ class MEDIA_EXPORT MediaObserver {
virtual void OnPlaying() = 0;
virtual void OnPaused() = 0;
+ // Called when the media is frozen.
+ virtual void OnFrozen() = 0;
+
// Called when the data source is asynchronously initialized.
virtual void OnDataSourceInitialized(const GURL& url_after_redirects) = 0;
diff --git a/chromium/media/base/media_permission.cc b/chromium/media/base/media_permission.cc
index 307ccb91ec4..0de7e7ff22d 100644
--- a/chromium/media/base/media_permission.cc
+++ b/chromium/media/base/media_permission.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_permission.h b/chromium/media/base/media_permission.h
index b58ae16498e..99df4196f7b 100644
--- a/chromium/media/base/media_permission.h
+++ b/chromium/media/base/media_permission.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_player_logging_id.cc b/chromium/media/base/media_player_logging_id.cc
new file mode 100644
index 00000000000..f22ce91b210
--- /dev/null
+++ b/chromium/media/base/media_player_logging_id.cc
@@ -0,0 +1,21 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/base/media_player_logging_id.h"
+
+namespace media {
+
+namespace {
+
+// A count of all MediaLogs created in the current process. Used to generate
+// unique IDs.
+static base::AtomicSequenceNumber g_next_player_id;
+
+} // namespace
+
+MediaPlayerLoggingID GetNextMediaPlayerLoggingID() {
+ return g_next_player_id.GetNext();
+}
+
+} // namespace media
diff --git a/chromium/media/base/media_player_logging_id.h b/chromium/media/base/media_player_logging_id.h
new file mode 100644
index 00000000000..836e368d085
--- /dev/null
+++ b/chromium/media/base/media_player_logging_id.h
@@ -0,0 +1,20 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BASE_MEDIA_PLAYER_LOGGING_ID_H_
+#define MEDIA_BASE_MEDIA_PLAYER_LOGGING_ID_H_
+
+#include "base/atomic_sequence_num.h"
+#include "media/base/media_export.h"
+
+namespace media {
+
+// alias the name for readability
+using MediaPlayerLoggingID = int32_t;
+
+MEDIA_EXPORT MediaPlayerLoggingID GetNextMediaPlayerLoggingID();
+
+} // namespace media
+
+#endif // MEDIA_BASE_MEDIA_PLAYER_LOGGING_ID_H_
diff --git a/chromium/media/base/media_resource.cc b/chromium/media/base/media_resource.cc
index 7ca58445bba..802a8ddc90e 100644
--- a/chromium/media/base/media_resource.cc
+++ b/chromium/media/base/media_resource.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_resource.h b/chromium/media/base/media_resource.h
index b3e687143b3..90d278cc474 100644
--- a/chromium/media/base/media_resource.h
+++ b/chromium/media/base/media_resource.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_serializers.h b/chromium/media/base/media_serializers.h
index a41080d969b..2148825be71 100644
--- a/chromium/media/base/media_serializers.h
+++ b/chromium/media/base/media_serializers.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -263,7 +263,12 @@ struct MediaSerializer<VideoTransformation> {
template <>
struct MediaSerializer<VideoColorSpace> {
static inline base::Value Serialize(const VideoColorSpace& value) {
- return base::Value(value.ToGfxColorSpace().ToString());
+ base::Value result(base::Value::Type::DICTIONARY);
+ FIELD_SERIALIZE("primaries", value.primaries);
+ FIELD_SERIALIZE("transfer", value.transfer);
+ FIELD_SERIALIZE("matrix", value.matrix);
+ FIELD_SERIALIZE("range", value.range);
+ return result;
}
};
@@ -483,6 +488,97 @@ struct MediaSerializer<base::Location> {
}
};
+#define ENUM_CASE_TO_STRING(ENUM_NAME) \
+ case ENUM_NAME: \
+ return base::Value(##ENUM_NAME);
+
+#define ENUM_CLASS_CASE_TO_STRING(ENUM_CLASS, ENUM_NAME) \
+ case ENUM_CLASS::ENUM_NAME: \
+ return base::Value(#ENUM_NAME);
+
+// Enum (simple)
+template <>
+struct MediaSerializer<VideoColorSpace::PrimaryID> {
+ static inline base::Value Serialize(VideoColorSpace::PrimaryID value) {
+ switch (value) {
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, INVALID);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, BT709);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, UNSPECIFIED);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, BT470M);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, BT470BG);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTE170M);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTE240M);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, FILM);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, BT2020);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTEST428_1);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTEST431_2);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTEST432_1);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, EBU_3213_E);
+ }
+ }
+};
+
+// Enum (simple)
+template <>
+struct MediaSerializer<VideoColorSpace::TransferID> {
+ static inline base::Value Serialize(VideoColorSpace::TransferID value) {
+ switch (value) {
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, INVALID);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, BT709);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, UNSPECIFIED);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, GAMMA22);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, GAMMA28);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, SMPTE170M);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, SMPTE240M);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, LINEAR);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, LOG);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, LOG_SQRT);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, IEC61966_2_4);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, BT1361_ECG);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, IEC61966_2_1);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, BT2020_10);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, BT2020_12);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, SMPTEST2084);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, SMPTEST428_1);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, ARIB_STD_B67);
+ }
+ }
+};
+
+// Enum (simple)
+template <>
+struct MediaSerializer<VideoColorSpace::MatrixID> {
+ static inline base::Value Serialize(VideoColorSpace::MatrixID value) {
+ switch (value) {
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, RGB);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, BT709);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, UNSPECIFIED);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, FCC);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, BT470BG);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, SMPTE170M);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, SMPTE240M);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, YCOCG);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, BT2020_NCL);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, BT2020_CL);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, YDZDX);
+ ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, INVALID);
+ }
+ }
+};
+
+// Enum (simple)
+template <>
+struct MediaSerializer<gfx::ColorSpace::RangeID> {
+ static inline base::Value Serialize(gfx::ColorSpace::RangeID value) {
+ switch (value) {
+ ENUM_CLASS_CASE_TO_STRING(gfx::ColorSpace::RangeID, INVALID);
+ ENUM_CLASS_CASE_TO_STRING(gfx::ColorSpace::RangeID, LIMITED);
+ ENUM_CLASS_CASE_TO_STRING(gfx::ColorSpace::RangeID, FULL);
+ ENUM_CLASS_CASE_TO_STRING(gfx::ColorSpace::RangeID, DERIVED);
+ }
+ }
+};
+
#undef FIELD_SERIALIZE
} // namespace internal
diff --git a/chromium/media/base/media_serializers_base.h b/chromium/media/base/media_serializers_base.h
index bbc6ce34f68..2208346460b 100644
--- a/chromium/media/base/media_serializers_base.h
+++ b/chromium/media/base/media_serializers_base.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_serializers_unittest.cc b/chromium/media/base/media_serializers_unittest.cc
index 53407ded0f0..91545a7af28 100644
--- a/chromium/media/base/media_serializers_unittest.cc
+++ b/chromium/media/base/media_serializers_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_shmem_export.h b/chromium/media/base/media_shmem_export.h
index d7973e462a2..352d219a477 100644
--- a/chromium/media/base/media_shmem_export.h
+++ b/chromium/media/base/media_shmem_export.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_status.cc b/chromium/media/base/media_status.cc
index 63e988e8141..3fff6a5adb1 100644
--- a/chromium/media/base/media_status.cc
+++ b/chromium/media/base/media_status.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/media_status.h"
diff --git a/chromium/media/base/media_status.h b/chromium/media/base/media_status.h
index f1e8b5cc645..0612904880c 100644
--- a/chromium/media/base/media_status.h
+++ b/chromium/media/base/media_status.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_status_observer.h b/chromium/media/base/media_status_observer.h
index b9cccac1c88..6c8abf04a32 100644
--- a/chromium/media/base/media_status_observer.h
+++ b/chromium/media/base/media_status_observer.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_switches.cc b/chromium/media/base/media_switches.cc
index b41411546bd..24b2208d8dd 100644
--- a/chromium/media/base/media_switches.cc
+++ b/chromium/media/base/media_switches.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,6 +19,14 @@ namespace switches {
// Allow users to specify a custom buffer size for debugging purpose.
const char kAudioBufferSize[] = "audio-buffer-size";
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN)
+// Audio codecs supported by the HDMI sink is retrieved from the audio
+// service process. EDID contains the Short Audio Descriptors, which list
+// the audio decoders supported, and the information is presented as a
+// bitmask of supported audio codecs.
+const char kAudioCodecsFromEDID[] = "audio-codecs-from-edid";
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN)
+
// Set a timeout (in milliseconds) for the audio service to quit if there are no
// client connections to it. If the value is negative the service never quits.
const char kAudioServiceQuitTimeoutMs[] = "audio-service-quit-timeout-ms";
@@ -72,12 +80,6 @@ const char kTrySupportedChannelLayouts[] = "try-supported-channel-layouts";
// Number of buffers to use for WaveOut.
const char kWaveOutBuffers[] = "waveout-buffers";
-
-// Emulates audio capture timestamps instead of using timestamps from the actual
-// audio device.
-// See crbug.com/1315231 for more details.
-const char kUseFakeAudioCaptureTimestamps[] =
- "use-fake-audio-capture-timestamps";
#endif // BUILDFLAG(IS_WIN)
#if BUILDFLAG(IS_FUCHSIA)
@@ -95,6 +97,12 @@ const char kDisableAudioInput[] = "disable-audio-input";
// Present video content as overlays.
const char kUseOverlaysForVideo[] = "use-overlays-for-video";
+// Minimum size for buffer size used for output video frames in
+// FuchsiaVideoDecoder. May be set to avoid re-allocating video buffers when an
+// application upgrades video resolution mid-stream.
+const char kMinVideoDecoderOutputBufferSize[] =
+ "min-video-decoder-output-buffer-size";
+
// Forces AudioManagerFuchsia to assume that the AudioCapturer implements echo
// cancellation.
// TODO(crbug.com/852834): Remove this once AudioManagerFuchsia is updated to
@@ -196,10 +204,12 @@ const char kOverrideEnabledCdmInterfaceVersion[] =
// Overrides hardware secure codecs support for testing. If specified, real
// platform hardware secure codecs check will be skipped. Valid codecs are:
-// - video: "vp8", "vp9", "avc1", "hevc", "dolbyvision"
+// - video: "vp8", "vp9", "avc1", "hevc", "dolbyvision", "av01"
+// - video that does not support clear lead: `<video>-no-clearlead`, where
+// <video> is from the list above.
// - audio: "mp4a", "vorbis"
// Codecs are separated by comma. For example:
-// --override-hardware-secure-codecs-for-testing=vp8,vp9,vorbis
+// --override-hardware-secure-codecs-for-testing=vp8,vp9-no-clearlead,vorbis
// --override-hardware-secure-codecs-for-testing=avc1,mp4a
// CENC encryption scheme is assumed to be supported for the specified codecs.
// If no valid codecs specified, no hardware secure codecs are supported. This
@@ -257,75 +267,86 @@ const char kMaxChromeOSDecoderThreads[] = "max-chromeos-decoder-threads";
namespace media {
// Prefer FFmpeg to LibVPX for Vp8 decoding with opaque alpha mode.
-const base::Feature kFFmpegDecodeOpaqueVP8{"FFmpegDecodeOpaqueVP8",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kFFmpegDecodeOpaqueVP8,
+ "FFmpegDecodeOpaqueVP8",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Only used for disabling overlay fullscreen (aka SurfaceView) in Clank.
-const base::Feature kOverlayFullscreenVideo{"overlay-fullscreen-video",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kOverlayFullscreenVideo,
+ "overlay-fullscreen-video",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables user control over muting tab audio from the tab strip.
-const base::Feature kEnableTabMuting{"EnableTabMuting",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kEnableTabMuting,
+ "EnableTabMuting",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enable Picture-in-Picture.
-const base::Feature kPictureInPicture{"PictureInPicture",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kPictureInPicture,
+ "PictureInPicture",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
// Enables HEVC hardware accelerated decoding.
-const base::Feature kPlatformHEVCDecoderSupport{
- "PlatformHEVCDecoderSupport", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kPlatformHEVCDecoderSupport,
+ "PlatformHEVCDecoderSupport",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC)
// Only decode preload=metadata elements upon visibility.
// TODO(crbug.com/879406): Remove this after M76 ships to stable
-const base::Feature kPreloadMetadataLazyLoad{"PreloadMetadataLazyLoad",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kPreloadMetadataLazyLoad,
+ "PreloadMetadataLazyLoad",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Let videos be resumed via remote controls (for example, the notification)
// when in background.
-const base::Feature kResumeBackgroundVideo {
- "resume-background-video",
+BASE_FEATURE(kResumeBackgroundVideo,
+ "resume-background-video",
#if BUILDFLAG(IS_ANDROID)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
// When enabled, MediaCapabilities will check with GPU Video Accelerator
// Factories to determine isPowerEfficient = true/false.
-const base::Feature kMediaCapabilitiesQueryGpuFactories{
- "MediaCapabilitiesQueryGpuFactories", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaCapabilitiesQueryGpuFactories,
+ "MediaCapabilitiesQueryGpuFactories",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable Media Capabilities with finch-parameters.
-const base::Feature kMediaCapabilitiesWithParameters{
- "MediaCapabilitiesWithParameters", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaCapabilitiesWithParameters,
+ "MediaCapabilitiesWithParameters",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Used to set a few tunable parameters for the WebRTC Media Capabilities
// implementation.
-const base::Feature kWebrtcMediaCapabilitiesParameters{
- "WebrtcMediaCapabilitiesParameters", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kWebrtcMediaCapabilitiesParameters,
+ "WebrtcMediaCapabilitiesParameters",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Display the Cast overlay button on the media controls.
-const base::Feature kMediaCastOverlayButton{"MediaCastOverlayButton",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaCastOverlayButton,
+ "MediaCastOverlayButton",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Use AndroidOverlay only if required for secure video playback. This requires
// that |kOverlayFullscreenVideo| is true, else it is ignored.
-const base::Feature kUseAndroidOverlayForSecureOnly{
- "UseAndroidOverlayForSecureOnly", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kUseAndroidOverlayForSecureOnly,
+ "UseAndroidOverlayForSecureOnly",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Allows usage of OS-level (platform) audio encoders.
-const base::Feature kPlatformAudioEncoder {
- "PlatformAudioEncoder",
+BASE_FEATURE(kPlatformAudioEncoder,
+ "PlatformAudioEncoder",
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
// If enabled, RTCVideoDecoderAdapter will wrap a DecoderStream as a video
// decoder, rather than using MojoVideoDecoder. This causes the RTC external
@@ -333,34 +354,40 @@ const base::Feature kPlatformAudioEncoder {
// non-RTC pipeline.
// TODO(liberato): This also causes the external decoder to use software
// decoding sometimes, which changes the interpretation of "ExternalDecoder".
-const base::Feature kUseDecoderStreamForWebRTC{
- "UseDecoderStreamForWebRTC", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kUseDecoderStreamForWebRTC,
+ "UseDecoderStreamForWebRTC",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// If enabled, when RTCVideoDecoderAdapter is used then SW decoders will be
// exposed directly to WebRTC.
-const base::Feature kExposeSwDecodersToWebRTC{
- "ExposeSwDecodersToWebRTC", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kExposeSwDecodersToWebRTC,
+ "ExposeSwDecodersToWebRTC",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Let video without audio be paused when it is playing in the background.
-const base::Feature kBackgroundVideoPauseOptimization{
- "BackgroundVideoPauseOptimization", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kBackgroundVideoPauseOptimization,
+ "BackgroundVideoPauseOptimization",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// CDM host verification is enabled by default. Can be disabled for testing.
// Has no effect if ENABLE_CDM_HOST_VERIFICATION buildflag is false.
-const base::Feature kCdmHostVerification{"CdmHostVerification",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kCdmHostVerification,
+ "CdmHostVerification",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Use per-CDM-type, per-user and per-site CDM processes (for library CDM). If
// disabled, the CDM processes are only per-CDM-type, meaning different sites
// using the same CDM type would share one CDM process.
-const base::Feature kCdmProcessSiteIsolation{"CdmProcessSiteIsolation",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kCdmProcessSiteIsolation,
+ "CdmProcessSiteIsolation",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#if BUILDFLAG(CHROME_WIDE_ECHO_CANCELLATION)
// If echo cancellation for a mic signal is requested, mix and cancel all audio
// playback going to a specific output device in the audio service.
-const base::Feature kChromeWideEchoCancellation{
- "ChromeWideEchoCancellation", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kChromeWideEchoCancellation,
+ "ChromeWideEchoCancellation",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// If non-zero, audio processing is done on a dedicated processing thread which
// receives audio from the audio capture thread via a fifo of a specified size.
@@ -397,24 +424,26 @@ const base::FeatureParam<bool> kChromeWideEchoCancellationAllowAllSampleRates{
// Make MSE garbage collection algorithm more aggressive when we are under
// moderate or critical memory pressure. This will relieve memory pressure by
// releasing stale data from MSE buffers.
-const base::Feature kMemoryPressureBasedSourceBufferGC{
- "MemoryPressureBasedSourceBufferGC", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMemoryPressureBasedSourceBufferGC,
+ "MemoryPressureBasedSourceBufferGC",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enable binding multiple shared images to a single GpuMemoryBuffer for video
// frames created by video capture.
-const base::Feature kMultiPlaneVideoCaptureSharedImages {
- "MultiPlaneVideoCaptureSharedImages",
+BASE_FEATURE(kMultiPlaneVideoCaptureSharedImages,
+ "MultiPlaneVideoCaptureSharedImages",
#if BUILDFLAG(IS_MAC)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
// Controls whether the Open Screen libcast SenderSession is used for
// initializing and managing streaming sessions, or the legacy implementation.
-const base::Feature kOpenscreenCastStreamingSession{
- "OpenscreenCastStreamingSession", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kOpenscreenCastStreamingSession,
+ "OpenscreenCastStreamingSession",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Approach original pre-REC MSE object URL autorevoking behavior, though await
// actual attempt to use the object URL for attachment to perform revocation.
@@ -431,47 +460,54 @@ const base::Feature kOpenscreenCastStreamingSession{
// (MSE-in-workers), where there could be significant delay between the worker
// thread creation of the object URL and the main thread usage of the object URL
// for starting attachment to HTMLME.
-const base::Feature kRevokeMediaSourceObjectURLOnAttach{
- "RevokeMediaSourceObjectURLOnAttach", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kRevokeMediaSourceObjectURLOnAttach,
+ "RevokeMediaSourceObjectURLOnAttach",
+ base::FEATURE_ENABLED_BY_DEFAULT);
-const base::Feature kD3D11VideoDecoderUseSharedHandle{
- "D3D11VideoDecoderUseSharedHandle", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kD3D11VideoDecoderUseSharedHandle,
+ "D3D11VideoDecoderUseSharedHandle",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Falls back to other decoders after audio/video decode error happens. The
// implementation may choose different strategies on when to fallback. See
// DecoderStream for details. When disabled, playback will fail immediately
// after a decode error happens. This can be useful in debugging and testing
// because the behavior is simpler and more predictable.
-const base::Feature kFallbackAfterDecodeError{"FallbackAfterDecodeError",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kFallbackAfterDecodeError,
+ "FallbackAfterDecodeError",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Use Gav1VideoDecoder to decode AV1 streams.
-const base::Feature kGav1VideoDecoder{"Gav1VideoDecoder",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kGav1VideoDecoder,
+ "Gav1VideoDecoder",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Show toolbar button that opens dialog for controlling media sessions.
-const base::Feature kGlobalMediaControls {
- "GlobalMediaControls",
+BASE_FEATURE(kGlobalMediaControls,
+ "GlobalMediaControls",
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
// Auto-dismiss global media controls.
-const base::Feature kGlobalMediaControlsAutoDismiss{
- "GlobalMediaControlsAutoDismiss", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kGlobalMediaControlsAutoDismiss,
+ "GlobalMediaControlsAutoDismiss",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#if BUILDFLAG(IS_CHROMEOS)
// Show Cast sessions in Global Media Controls.
-const base::Feature kGlobalMediaControlsForCast{
- "GlobalMediaControlsForCast", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kGlobalMediaControlsForCast,
+ "GlobalMediaControlsForCast",
+ base::FEATURE_DISABLED_BY_DEFAULT);
#endif
// Allow Global Media Controls in system tray of CrOS.
-const base::Feature kGlobalMediaControlsForChromeOS{
- "GlobalMediaControlsForChromeOS", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kGlobalMediaControlsForChromeOS,
+ "GlobalMediaControlsForChromeOS",
+ base::FEATURE_ENABLED_BY_DEFAULT);
constexpr base::FeatureParam<kCrosGlobalMediaControlsPinOptions>::Option
kCrosGlobalMediaControlsParamOptions[] = {
@@ -487,147 +523,169 @@ constexpr base::FeatureParam<kCrosGlobalMediaControlsPinOptions>
&kCrosGlobalMediaControlsParamOptions);
// Show picture-in-picture button in Global Media Controls.
-const base::Feature kGlobalMediaControlsPictureInPicture {
- "GlobalMediaControlsPictureInPicture",
+BASE_FEATURE(kGlobalMediaControlsPictureInPicture,
+ "GlobalMediaControlsPictureInPicture",
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_CHROMEOS_LACROS)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
// Enable selection of audio output device in Global Media Controls.
-const base::Feature kGlobalMediaControlsSeamlessTransfer{
- "GlobalMediaControlsSeamlessTransfer", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kGlobalMediaControlsSeamlessTransfer,
+ "GlobalMediaControlsSeamlessTransfer",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enable an updated version of the Global Media Controls UI.
-const base::Feature kGlobalMediaControlsModernUI{
- "GlobalMediaControlsModernUI", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kGlobalMediaControlsModernUI,
+ "GlobalMediaControlsModernUI",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// CanPlayThrough issued according to standard.
-const base::Feature kSpecCompliantCanPlayThrough{
- "SpecCompliantCanPlayThrough", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kSpecCompliantCanPlayThrough,
+ "SpecCompliantCanPlayThrough",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Disables the real audio output stream after silent audio has been delivered
// for too long. Should save quite a bit of power in the muted video case.
-const base::Feature kSuspendMutedAudio{"SuspendMutedAudio",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kSuspendMutedAudio,
+ "SuspendMutedAudio",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables using the media history store to store media engagement metrics.
-const base::Feature kUseMediaHistoryStore{"UseMediaHistoryStore",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kUseMediaHistoryStore,
+ "UseMediaHistoryStore",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Use R16 texture for 9-16 bit channel instead of half-float conversion by CPU.
-const base::Feature kUseR16Texture{"use-r16-texture",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kUseR16Texture,
+ "use-r16-texture",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables the Unified Autoplay policy by overriding the platform's default
// autoplay policy.
-const base::Feature kUnifiedAutoplay{"UnifiedAutoplay",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kUnifiedAutoplay,
+ "UnifiedAutoplay",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#if BUILDFLAG(IS_LINUX)
// Enable vaapi video decoding on linux. This is already enabled by default on
// chromeos, but needs an experiment on linux.
-const base::Feature kVaapiVideoDecodeLinux{"VaapiVideoDecoder",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiVideoDecodeLinux,
+ "VaapiVideoDecoder",
+ base::FEATURE_ENABLED_BY_DEFAULT);
-const base::Feature kVaapiVideoEncodeLinux{"VaapiVideoEncoder",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiVideoEncodeLinux,
+ "VaapiVideoEncoder",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Ignore the non-intel driver blacklist for VaapiVideoDecoder implementations.
// Intended for manual usage only in order to gague the status of newer driver
// implementations.
-const base::Feature kVaapiIgnoreDriverChecks{"VaapiIgnoreDriverChecks",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiIgnoreDriverChecks,
+ "VaapiIgnoreDriverChecks",
+ base::FEATURE_DISABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_LINUX)
// Enable VA-API hardware decode acceleration for AV1.
-const base::Feature kVaapiAV1Decoder{"VaapiAV1Decoder",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiAV1Decoder,
+ "VaapiAV1Decoder",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable VA-API hardware low power encoder for all codecs on intel Gen9x gpu.
-const base::Feature kVaapiLowPowerEncoderGen9x{
- "VaapiLowPowerEncoderGen9x", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiLowPowerEncoderGen9x,
+ "VaapiLowPowerEncoderGen9x",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Reject creation of encode/decode VAContexts when the requested resolution is
// outside the enumerated minimum and maximum. TODO(b/171041334): Remove and
// enable by default once the ARC++ hw codecs issue is fixed.
-const base::Feature kVaapiEnforceVideoMinMaxResolution{
- "VaapiEnforceVideoMinMaxResolution", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiEnforceVideoMinMaxResolution,
+ "VaapiEnforceVideoMinMaxResolution",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Ensure the advertised minimum supported resolution is larger than or equal to
// a given one (likely QVGA + 1) for certain codecs/modes and platforms, for
// performance reasons. This does not affect JPEG decoding.
-const base::Feature kVaapiVideoMinResolutionForPerformance{
- "VaapiVideoMinResolutionForPerformance", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiVideoMinResolutionForPerformance,
+ "VaapiVideoMinResolutionForPerformance",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable VA-API hardware encode acceleration for VP8.
-const base::Feature kVaapiVP8Encoder{"VaapiVP8Encoder",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiVP8Encoder,
+ "VaapiVP8Encoder",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable VA-API hardware encode acceleration for VP9.
-const base::Feature kVaapiVP9Encoder{"VaapiVP9Encoder",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiVP9Encoder,
+ "VaapiVP9Encoder",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable global VA-API lock. Disable this to use lock-free VA-API function
// calls for thread safe backends.
-const base::Feature kGlobalVaapiLock{"GlobalVaapiLock",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kGlobalVaapiLock,
+ "GlobalVaapiLock",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#if defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS)
// TODO(b/214589754): revisit the need for the BUILDFLAG(IS_CHROMEOS) guard (as
// opposed to BUILDFLAG(IS_CHROMEOS_ASH)) when the final design for HW
// encoding is implemented for lacros-chrome.
// Enable H264 temporal layer encoding with HW encoder on ChromeOS.
-const base::Feature kVaapiH264TemporalLayerHWEncoding{
- "VaapiH264TemporalLayerEncoding", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiH264TemporalLayerHWEncoding,
+ "VaapiH264TemporalLayerEncoding",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable VP8 temporal layer encoding with HW encoder on ChromeOS.
-const base::Feature kVaapiVp8TemporalLayerHWEncoding{
- "VaapiVp8TemporalLayerEncoding", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiVp8TemporalLayerHWEncoding,
+ "VaapiVp8TemporalLayerEncoding",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enable VP9 k-SVC encoding with HW encoder for webrtc use case on ChromeOS.
-const base::Feature kVaapiVp9kSVCHWEncoding{"VaapiVp9kSVCHWEncoding",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kVaapiVp9kSVCHWEncoding,
+ "VaapiVp9kSVCHWEncoding",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS)
// Inform video blitter of video color space.
-const base::Feature kVideoBlitColorAccuracy{"video-blit-color-accuracy",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kVideoBlitColorAccuracy,
+ "video-blit-color-accuracy",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable VP9 k-SVC decoding with HW decoder for webrtc use case.
-const base::Feature kVp9kSVCHWDecoding {
- "Vp9kSVCHWDecoding",
+BASE_FEATURE(kVp9kSVCHWDecoding,
+ "Vp9kSVCHWDecoding",
#if BUILDFLAG(IS_CHROMEOS)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
// Takes a reference on a video frame, keeping it alive during the duration of a
// video.requestVideoFrameCallback call. Doesn't change anything to the API for
// now, as this is only used to measure the potential impact of keeping frames
// alive for longer. See crbug.com/1259784.
-const base::Feature kKeepRvfcFrameAlive{"keep-rvfc-frame-alive",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kKeepRvfcFrameAlive,
+ "keep-rvfc-frame-alive",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables support for External Clear Key (ECK) key system for testing on
// supported platforms. On platforms that do not support ECK, this feature has
// no effect.
-const base::Feature kExternalClearKeyForTesting{
- "ExternalClearKeyForTesting", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kExternalClearKeyForTesting,
+ "ExternalClearKeyForTesting",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables the Live Caption feature on supported devices.
-const base::Feature kLiveCaption{"LiveCaption",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kLiveCaption, "LiveCaption", base::FEATURE_ENABLED_BY_DEFAULT);
// Controls whether a "Share this tab instead" button should be shown for
// getDisplayMedia captures. Note: This flag does not control if the "Share this
// tab instead" button is shown for chrome.desktopCapture captures.
-const base::Feature kShareThisTabInsteadButtonGetDisplayMedia{
- "ShareThisTabInsteadButtonGetDisplayMedia",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kShareThisTabInsteadButtonGetDisplayMedia,
+ "ShareThisTabInsteadButtonGetDisplayMedia",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// If kShareThisTabInsteadButtonGetDisplayMedia is ENABLED, this flag controls
// whether a "Share this tab instead" button should be enabled for
@@ -636,225 +694,275 @@ const base::Feature kShareThisTabInsteadButtonGetDisplayMedia{
// effect.
// Note: This flag does not control if the "Share this tab instead" button is
// shown for chrome.desktopCapture captures.
-const base::Feature kShareThisTabInsteadButtonGetDisplayMediaAudio{
- "ShareThisTabInsteadButtonGetDisplayMediaAudio",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kShareThisTabInsteadButtonGetDisplayMediaAudio,
+ "ShareThisTabInsteadButtonGetDisplayMediaAudio",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable the Speaker Change Detection feature, which inserts a line break when
// the Speech On-Device API (SODA) detects a speaker change.
-const base::Feature kSpeakerChangeDetection{"SpeakerChangeDetection",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kSpeakerChangeDetection,
+ "SpeakerChangeDetection",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Live Caption can be used in multiple languages, as opposed to just English.
-const base::Feature kLiveCaptionMultiLanguage{
- "LiveCaptionMultiLanguage", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kLiveCaptionMultiLanguage,
+ "LiveCaptionMultiLanguage",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+// Enable or disable Live Caption from the right click menu.
+BASE_FEATURE(kLiveCaptionRightClick,
+ "LiveCaptionRightClick",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Live Caption runs system-wide on ChromeOS, as opposed to just in the browser.
-const base::Feature kLiveCaptionSystemWideOnChromeOS{
- "LiveCaptionSystemWideOnChromeOS", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kLiveCaptionSystemWideOnChromeOS,
+ "LiveCaptionSystemWideOnChromeOS",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+// Live Translate translates captions generated by Live Caption.
+BASE_FEATURE(kLiveTranslate,
+ "LiveTranslate",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Prevents UrlProvisionFetcher from making a provisioning request. If
// specified, any provisioning request made will not be sent to the provisioning
// server, and the response will indicate a failure to communicate with the
// provisioning server.
-const base::Feature kFailUrlProvisionFetcherForTesting{
- "FailUrlProvisionFetcherForTesting", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kFailUrlProvisionFetcherForTesting,
+ "FailUrlProvisionFetcherForTesting",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables hardware secure decryption if supported by hardware and CDM.
// TODO(xhwang): Currently this is only used for development of new features.
// Apply this to Android and ChromeOS as well where hardware secure decryption
// is already available.
-const base::Feature kHardwareSecureDecryption{
- "HardwareSecureDecryption", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kHardwareSecureDecryption,
+ "HardwareSecureDecryption",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+// By default, a codec is not supported for hardware secure decryption if it
+// does not support clear lead. This option forces the support for testing.
+const base::FeatureParam<bool> kHardwareSecureDecryptionForceSupportClearLead{
+ &kHardwareSecureDecryption, "force_support_clear_lead", false};
// Same as `kHardwareSecureDecryption` above, but only enable experimental
// sub key systems. Which sub key system is experimental is key system specific.
-const base::Feature kHardwareSecureDecryptionExperiment{
- "HardwareSecureDecryptionExperiment", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kHardwareSecureDecryptionExperiment,
+ "HardwareSecureDecryptionExperiment",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Allows automatically disabling hardware secure Content Decryption Module
// (CDM) after failures or crashes to fallback to software secure CDMs. If this
// feature is disabled, the fallback will never happen and users could be stuck
// in playback failures.
-const base::Feature kHardwareSecureDecryptionFallback{
- "HardwareSecureDecryptionFallback", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kHardwareSecureDecryptionFallback,
+ "HardwareSecureDecryptionFallback",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+// The minimum and maximum number of days to disable hardware secure Content
+// Decryption Module (CDM) as part of the fallback logic.
+const base::FeatureParam<int> kHardwareSecureDecryptionFallbackMinDisablingDays{
+ &kHardwareSecureDecryptionFallback, "min_disabling_days", 30};
+const base::FeatureParam<int> kHardwareSecureDecryptionFallbackMaxDisablingDays{
+ &kHardwareSecureDecryptionFallback, "max_disabling_days", 180};
-const base::Feature kWakeLockOptimisationHiddenMuted{
- "kWakeLockOptimisationHiddenMuted", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kWakeLockOptimisationHiddenMuted,
+ "kWakeLockOptimisationHiddenMuted",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// If active, enable HiDPI mode that increases the display scale factor
// while capturing a low-resolution tab.
-const base::Feature kWebContentsCaptureHiDpi{"WebContentsCaptureHiDPI",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kWebContentsCaptureHiDpi,
+ "WebContentsCaptureHiDPI",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables handling of hardware media keys for controlling media.
-const base::Feature kHardwareMediaKeyHandling {
- "HardwareMediaKeyHandling",
+BASE_FEATURE(kHardwareMediaKeyHandling,
+ "HardwareMediaKeyHandling",
#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
BUILDFLAG(USE_MPRIS)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
// Enables a platform-specific resolution cutoff for prioritizing platform
// decoders over software decoders or vice-versa.
-const base::Feature kResolutionBasedDecoderPriority{
- "ResolutionBasedDecoderPriority", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kResolutionBasedDecoderPriority,
+ "ResolutionBasedDecoderPriority",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Forces use of hardware (platform) video decoders in
// `media::DecoderSelector`.
-const base::Feature kForceHardwareVideoDecoders{
- "ForceHardwareVideoDecoders", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kForceHardwareVideoDecoders,
+ "ForceHardwareVideoDecoders",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Forces use of hardware (platform) audio decoders in
// `media::DecoderSelector`.
-const base::Feature kForceHardwareAudioDecoders{
- "ForceHardwareAudioDecoders", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kForceHardwareAudioDecoders,
+ "ForceHardwareAudioDecoders",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables low-delay video rendering in media pipeline on "live" stream.
-const base::Feature kLowDelayVideoRenderingOnLiveStream{
- "low-delay-video-rendering-on-live-stream",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kLowDelayVideoRenderingOnLiveStream,
+ "low-delay-video-rendering-on-live-stream",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Whether the autoplay policy should ignore Web Audio. When ignored, the
// autoplay policy will be hardcoded to be the legacy one on based on the
// platform
-const base::Feature kAutoplayIgnoreWebAudio{"AutoplayIgnoreWebAudio",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kAutoplayIgnoreWebAudio,
+ "AutoplayIgnoreWebAudio",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Whether we should show a setting to disable autoplay policy.
-const base::Feature kAutoplayDisableSettings{"AutoplayDisableSettings",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kAutoplayDisableSettings,
+ "AutoplayDisableSettings",
+ base::FEATURE_DISABLED_BY_DEFAULT);
#if BUILDFLAG(IS_ANDROID)
// Should we allow video playback to use an overlay if it's not needed for
// security? Normally, we'd always want to allow this, except as part of the
// power testing A/B experiment. https://crbug.com/1081346 .
-const base::Feature kAllowNonSecureOverlays{"AllowNonSecureOverlays",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kAllowNonSecureOverlays,
+ "AllowNonSecureOverlays",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable a gesture to make the media controls expaned into the display cutout.
// TODO(beccahughes): Remove this.
-const base::Feature kMediaControlsExpandGesture{
- "MediaControlsExpandGesture", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaControlsExpandGesture,
+ "MediaControlsExpandGesture",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// An experimental feature to enable persistent-license type support in MediaDrm
// when using Encrypted Media Extensions (EME) API.
// TODO(xhwang): Remove this after feature launch. See http://crbug.com/493521
-const base::Feature kMediaDrmPersistentLicense{
- "MediaDrmPersistentLicense", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaDrmPersistentLicense,
+ "MediaDrmPersistentLicense",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables MediaDrmOriginIdManager to provide preprovisioned origin IDs for
// MediaDrmBridge. If disabled, MediaDrmBridge will get unprovisioned origin IDs
// which will trigger provisioning process after MediaDrmBridge is created.
-const base::Feature kMediaDrmPreprovisioning{"MediaDrmPreprovisioning",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaDrmPreprovisioning,
+ "MediaDrmPreprovisioning",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Determines if MediaDrmOriginIdManager should attempt to pre-provision origin
// IDs at startup (whenever a profile is loaded). Also used by tests that
// disable it so that the tests can setup before pre-provisioning is done.
// Note: Has no effect if kMediaDrmPreprovisioning feature is disabled.
-const base::Feature kMediaDrmPreprovisioningAtStartup{
- "MediaDrmPreprovisioningAtStartup", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaDrmPreprovisioningAtStartup,
+ "MediaDrmPreprovisioningAtStartup",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enable picture in picture web api for android.
-const base::Feature kPictureInPictureAPI{"PictureInPictureAPI",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kPictureInPictureAPI,
+ "PictureInPictureAPI",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables CanPlayType() (and other queries) for HLS MIME types. Note that
// disabling this also causes navigation to .m3u8 files to trigger downloading
// instead of playback.
-const base::Feature kCanPlayHls{"CanPlayHls", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kCanPlayHls, "CanPlayHls", base::FEATURE_ENABLED_BY_DEFAULT);
// Enables the use of MediaPlayerRenderer for HLS playback. When disabled,
// HLS manifests will fail to load (triggering source fallback or load error).
-const base::Feature kHlsPlayer{"HlsPlayer", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kHlsPlayer, "HlsPlayer", base::FEATURE_ENABLED_BY_DEFAULT);
// When enabled, Playing media sessions will request audio focus from the
// Android system.
-const base::Feature kRequestSystemAudioFocus{"RequestSystemAudioFocus",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kRequestSystemAudioFocus,
+ "RequestSystemAudioFocus",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Use the (hacky) AudioManager.getOutputLatency() call to get the estimated
// hardware latency for a stream for OpenSLES playback. This is normally not
// needed, except for some Android TV devices.
-const base::Feature kUseAudioLatencyFromHAL{"UseAudioLatencyFromHAL",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kUseAudioLatencyFromHAL,
+ "UseAudioLatencyFromHAL",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enable pooling of SharedImageVideo objects for use by MCVD, to save a hop to
// the GPU main thread during VideoFrame construction.
-const base::Feature kUsePooledSharedImageVideoProvider{
- "UsePooledSharedImageVideoProvider", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kUsePooledSharedImageVideoProvider,
+ "UsePooledSharedImageVideoProvider",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Historically we hardcoded sRGB for color space. This flags controls if we
// pass real color space to VideoFrame/SharedImages.
-const base::Feature kUseRealColorSpaceForAndroidVideo{
- "UseRealColorSpaceForAndroidVideo", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kUseRealColorSpaceForAndroidVideo,
+ "UseRealColorSpaceForAndroidVideo",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
// Enable Variable Bitrate encoding with hardware accelerated encoders on
// ChromeOS.
-const base::Feature kChromeOSHWVBREncoding{"ChromeOSHWVBREncoding",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kChromeOSHWVBREncoding,
+ "ChromeOSHWVBREncoding",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enable the hardware-accelerated direct video decoder instead of the one
// needing the VdaVideoDecoder adapter. This flag is used mainly as a
// chrome:flag for developers debugging issues as well as to be able to
// experiment with direct VideoDecoder path on Linux Desktop.
// TODO(b/159825227): remove when the direct video decoder is fully launched.
-const base::Feature kUseChromeOSDirectVideoDecoder{
- "UseChromeOSDirectVideoDecoder", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kUseChromeOSDirectVideoDecoder,
+ "UseChromeOSDirectVideoDecoder",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Limit the number of concurrent hardware decoder instances on ChromeOS.
-const base::Feature kLimitConcurrentDecoderInstances{
- "LimitConcurrentDecoderInstances", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kLimitConcurrentDecoderInstances,
+ "LimitConcurrentDecoderInstances",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#if defined(ARCH_CPU_ARM_FAMILY)
// Some architectures have separate image processor hardware that
// can be used by Chromium's ImageProcessor to color convert/crop/etc.
// video buffers. Sometimes it is more efficient/performant/correct
-// to use libYUV instead of the hardware to do this processing.
-const base::Feature kPreferLibYuvImageProcessor{
- "PreferLibYUVImageProcessor", base::FEATURE_DISABLED_BY_DEFAULT};
+// to use a libYUV or GL based implementation instead of the hardware to
+// do this processing.
+BASE_FEATURE(kPreferLibYuvImageProcessor,
+ "PreferLibYUVImageProcessor",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+BASE_FEATURE(kPreferGLImageProcessor,
+ "PreferGLImageProcessor",
+ base::FEATURE_DISABLED_BY_DEFAULT);
#endif // defined(ARCH_CPU_ARM_FAMILY)
#if BUILDFLAG(IS_CHROMEOS)
// ChromeOS has one of two VideoDecoder implementations active based on
// SoC/board specific configurations that are sent via command line flags. This
// switch allows using the non default implementation for testing.
// TODO(b/159825227): remove when the "old" video decoder is fully launched.
-const base::Feature kUseAlternateVideoDecoderImplementation{
- "UseAlternateVideoDecoderImplementation",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kUseAlternateVideoDecoderImplementation,
+ "UseAlternateVideoDecoderImplementation",
+ base::FEATURE_DISABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_CHROMEOS)
#endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
-#if BUILDFLAG(IS_MAC)
-// Enable binding multiple shared images to a single GpuMemoryBuffer for
-// accelerated video decode using VideoToolbox.
-const base::Feature kMultiPlaneVideoToolboxSharedImages{
- "MultiPlaneVideoToolboxSharedImages", base::FEATURE_ENABLED_BY_DEFAULT};
-#endif // BUILDFLAG(IS_MAC)
-
#if BUILDFLAG(IS_WIN)
// Does NV12->NV12 video copy on the main thread right before the texture's
// used by GL.
-const base::Feature kDelayCopyNV12Textures{"DelayCopyNV12Textures",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kDelayCopyNV12Textures,
+ "DelayCopyNV12Textures",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables DirectShow GetPhotoState implementation
// Created to act as a kill switch by disabling it, in the case of the
// resurgence of https://crbug.com/722038
-const base::Feature kDirectShowGetPhotoState{"DirectShowGetPhotoState",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kDirectShowGetPhotoState,
+ "DirectShowGetPhotoState",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Includes Infrared cameras in the list returned for EnumerateDevices() on
// Windows.
-const base::Feature kIncludeIRCamerasInDeviceEnumeration{
- "IncludeIRCamerasInDeviceEnumeration", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kIncludeIRCamerasInDeviceEnumeration,
+ "IncludeIRCamerasInDeviceEnumeration",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables AV1 encode acceleration for Windows.
const base::Feature MEDIA_EXPORT kMediaFoundationAV1Encoding{
@@ -871,14 +979,16 @@ const base::Feature MEDIA_EXPORT kMediaFoundationVP9Encoding{
"MediaFoundationVP9Encoding", base::FEATURE_DISABLED_BY_DEFAULT};
// Enables MediaFoundation based video capture
-const base::Feature kMediaFoundationVideoCapture{
- "MediaFoundationVideoCapture", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaFoundationVideoCapture,
+ "MediaFoundationVideoCapture",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables MediaFoundation based video capture with D3D11
// For feature check of kMediaFoundationD3D11VideoCapture at runtime,
// please use IsMediaFoundationD3D11VideoCaptureEnabled() instead.
-const base::Feature kMediaFoundationD3D11VideoCapture{
- "MediaFoundationD3D11VideoCapture", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaFoundationD3D11VideoCapture,
+ "MediaFoundationD3D11VideoCapture",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables VP8 decode acceleration for Windows.
const base::Feature MEDIA_EXPORT kMediaFoundationVP8Decoding{
@@ -886,8 +996,9 @@ const base::Feature MEDIA_EXPORT kMediaFoundationVP8Decoding{
// Enables the use of MediaFoundationRenderer for clear content on supported
// systems.
-const base::Feature kMediaFoundationClearPlayback{
- "MediaFoundationClearPlayback", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaFoundationClearPlayback,
+ "MediaFoundationClearPlayback",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Use the AUDCLNT_STREAMOPTIONS_RAW option on WASAPI input audio streams in
// combination with the IAudioClient2::SetClientProperties() API.
@@ -898,9 +1009,16 @@ const base::Feature kMediaFoundationClearPlayback{
const base::Feature MEDIA_EXPORT kWasapiRawAudioCapture{
"WASAPIRawAudioCapture", base::FEATURE_ENABLED_BY_DEFAULT};
+// Emulates audio capture timestamps instead of using timestamps from the actual
+// audio device.
+// See crbug.com/1315231 for more details.
+const base::Feature MEDIA_EXPORT kUseFakeAudioCaptureTimestamps{
+ "UseFakeAudioCaptureTimestamps", base::FEATURE_DISABLED_BY_DEFAULT};
+
// Enable VP9 kSVC decoding with HW decoder for webrtc use case on Windows.
-const base::Feature kD3D11Vp9kSVCHWDecoding{"D3D11Vp9kSVCHWDecoding",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kD3D11Vp9kSVCHWDecoding,
+ "D3D11Vp9kSVCHWDecoding",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// The Media Foundation Rendering Strategy determines which presentation mode
// Media Foundation Renderer should use for presenting clear content. This
@@ -920,8 +1038,9 @@ const base::Feature kD3D11Vp9kSVCHWDecoding{"D3D11Vp9kSVCHWDecoding",
// --enable-features=MediaFoundationClearRendering:strategy/direct-composition
// --enable-features=MediaFoundationClearRendering:strategy/frame-server
// --enable-features=MediaFoundationClearRendering:strategy/dynamic
-const base::Feature kMediaFoundationClearRendering = {
- "MediaFoundationClearRendering", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaFoundationClearRendering,
+ "MediaFoundationClearRendering",
+ base::FEATURE_ENABLED_BY_DEFAULT);
constexpr base::FeatureParam<MediaFoundationClearRenderingStrategy>::Option
kMediaFoundationClearRenderingStrategyOptions[] = {
@@ -949,6 +1068,13 @@ const base::Feature MEDIA_EXPORT kUseOutOfProcessVideoDecoding{
"UseOutOfProcessVideoDecoding", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+// Spawn utility processes to perform hardware encode acceleration instead of
+// using the GPU process.
+const base::Feature MEDIA_EXPORT kUseOutOfProcessVideoEncoding{
+ "UseOutOfProcessVideoEncoding", base::FEATURE_DISABLED_BY_DEFAULT};
+#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
std::string GetEffectiveAutoplayPolicy(const base::CommandLine& command_line) {
// Return the autoplay policy set in the command line, if any.
if (command_line.HasSwitch(switches::kAutoplayPolicy))
@@ -967,12 +1093,14 @@ std::string GetEffectiveAutoplayPolicy(const base::CommandLine& command_line) {
// Enables Media Engagement Index recording. This data will be used to determine
// when to bypass autoplay policies. This is recorded on all platforms.
-const base::Feature kRecordMediaEngagementScores{
- "RecordMediaEngagementScores", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kRecordMediaEngagementScores,
+ "RecordMediaEngagementScores",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables Media Engagement Index recording for Web Audio playbacks.
-const base::Feature kRecordWebAudioEngagement{"RecordWebAudioEngagement",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kRecordWebAudioEngagement,
+ "RecordWebAudioEngagement",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// The following Media Engagement flags are not enabled on mobile platforms:
// - MediaEngagementBypassAutoplayPolicies: enables the Media Engagement Index
@@ -982,90 +1110,105 @@ const base::Feature kRecordWebAudioEngagement{"RecordWebAudioEngagement",
// having a high MEI until there is enough local data to determine the user's
// preferred behaviour.
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
-const base::Feature kMediaEngagementBypassAutoplayPolicies{
- "MediaEngagementBypassAutoplayPolicies", base::FEATURE_DISABLED_BY_DEFAULT};
-const base::Feature kPreloadMediaEngagementData{
- "PreloadMediaEngagementData", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaEngagementBypassAutoplayPolicies,
+ "MediaEngagementBypassAutoplayPolicies",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+BASE_FEATURE(kPreloadMediaEngagementData,
+ "PreloadMediaEngagementData",
+ base::FEATURE_DISABLED_BY_DEFAULT);
#else
-const base::Feature kMediaEngagementBypassAutoplayPolicies{
- "MediaEngagementBypassAutoplayPolicies", base::FEATURE_ENABLED_BY_DEFAULT};
-const base::Feature kPreloadMediaEngagementData{
- "PreloadMediaEngagementData", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaEngagementBypassAutoplayPolicies,
+ "MediaEngagementBypassAutoplayPolicies",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+BASE_FEATURE(kPreloadMediaEngagementData,
+ "PreloadMediaEngagementData",
+ base::FEATURE_ENABLED_BY_DEFAULT);
#endif
-const base::Feature kMediaEngagementHTTPSOnly{
- "MediaEngagementHTTPSOnly", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaEngagementHTTPSOnly,
+ "MediaEngagementHTTPSOnly",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables experimental local learning for media. Used in the context of media
// capabilities only. Adds reporting only; does not change media behavior.
-const base::Feature kMediaLearningExperiment{"MediaLearningExperiment",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaLearningExperiment,
+ "MediaLearningExperiment",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables the general purpose media machine learning framework. Adds reporting
// only; does not change media behavior.
-const base::Feature kMediaLearningFramework{"MediaLearningFramework",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaLearningFramework,
+ "MediaLearningFramework",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enables the smoothness prediction experiment. Requires
// kMediaLearningFramework to be enabled also, else it does nothing.
-const base::Feature kMediaLearningSmoothnessExperiment{
- "MediaLearningSmoothnessExperiment", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaLearningSmoothnessExperiment,
+ "MediaLearningSmoothnessExperiment",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enable the prototype global optimization of tuneables via finch. See
// media/base/tuneable.h for how to create tuneable parameters.
-const base::Feature kMediaOptimizer{"JointMediaOptimizer",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaOptimizer,
+ "JointMediaOptimizer",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enable aggregate power measurement for media playback.
-const base::Feature kMediaPowerExperiment{"MediaPowerExperiment",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaPowerExperiment,
+ "MediaPowerExperiment",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Enable WebRTC actions for the Media Session API.
-const base::Feature kMediaSessionWebRTC{"MediaSessionWebRTC",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kMediaSessionWebRTC,
+ "MediaSessionWebRTC",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables flash to be ducked by audio focus. This is enabled on Chrome OS which
// has audio focus enabled.
-const base::Feature kAudioFocusDuckFlash {
- "AudioFocusDuckFlash",
+BASE_FEATURE(kAudioFocusDuckFlash,
+ "AudioFocusDuckFlash",
#if BUILDFLAG(IS_CHROMEOS_ASH)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
// Only affects Android. Suspends a media session when audio focus is lost; when
// this setting is disabled, an Android media session will not be suspended when
// Audio focus is lost. This is used by Cast which sometimes needs to drive
// multiple media sessions.
-const base::Feature kAudioFocusLossSuspendMediaSession{
- "AudioFocusMediaSession", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kAudioFocusLossSuspendMediaSession,
+ "AudioFocusMediaSession",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables the internal Media Session logic without enabling the Media Session
// service.
-const base::Feature kInternalMediaSession {
- "InternalMediaSession",
+BASE_FEATURE(kInternalMediaSession,
+ "InternalMediaSession",
#if BUILDFLAG(IS_ANDROID)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
// Keypress detection which serves as input to noise suppression methods
// in WebRTC clients. This functionality is enabled by default but it can be
// disabled experemantally by using --disable-features=KeyPressMonitoring.
-const base::Feature kKeyPressMonitoring{"KeyPressMonitoring",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kKeyPressMonitoring,
+ "KeyPressMonitoring",
+ base::FEATURE_ENABLED_BY_DEFAULT);
-const base::Feature kUseFakeDeviceForMediaStream{
- "use-fake-device-for-media-stream", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kUseFakeDeviceForMediaStream,
+ "use-fake-device-for-media-stream",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Makes VideoCadenceEstimator use Bresenham-like algorithm for frame cadence
// estimations.
-const base::Feature kBresenhamCadence{"BresenhamCadence",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kBresenhamCadence,
+ "BresenhamCadence",
+ base::FEATURE_DISABLED_BY_DEFAULT);
bool IsChromeWideEchoCancellationEnabled() {
#if BUILDFLAG(CHROME_WIDE_ECHO_CANCELLATION)
diff --git a/chromium/media/base/media_switches.h b/chromium/media/base/media_switches.h
index 582c358348b..d481a84f2ab 100644
--- a/chromium/media/base/media_switches.h
+++ b/chromium/media/base/media_switches.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,6 +24,10 @@ namespace switches {
MEDIA_EXPORT extern const char kAudioBufferSize[];
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN)
+MEDIA_EXPORT extern const char kAudioCodecsFromEDID[];
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN)
+
MEDIA_EXPORT extern const char kAudioServiceQuitTimeoutMs[];
MEDIA_EXPORT extern const char kAutoplayPolicy[];
@@ -48,7 +52,6 @@ MEDIA_EXPORT extern const char kEnableExclusiveAudio[];
MEDIA_EXPORT extern const char kForceWaveAudio[];
MEDIA_EXPORT extern const char kTrySupportedChannelLayouts[];
MEDIA_EXPORT extern const char kWaveOutBuffers[];
-MEDIA_EXPORT extern const char kUseFakeAudioCaptureTimestamps[];
#endif
#if BUILDFLAG(IS_FUCHSIA)
@@ -56,6 +59,7 @@ MEDIA_EXPORT extern const char kEnableProtectedVideoBuffers[];
MEDIA_EXPORT extern const char kForceProtectedVideoOutputBuffers[];
MEDIA_EXPORT extern const char kDisableAudioInput[];
MEDIA_EXPORT extern const char kUseOverlaysForVideo[];
+MEDIA_EXPORT extern const char kMinVideoDecoderOutputBufferSize[];
MEDIA_EXPORT extern const char kAudioCapturerWithEchoCancellation[];
#endif
@@ -115,16 +119,16 @@ namespace media {
// All features in alphabetical order. The features should be documented
// alongside the definition of their values in the .cc file.
-MEDIA_EXPORT extern const base::Feature kAudioFocusDuckFlash;
-MEDIA_EXPORT extern const base::Feature kAudioFocusLossSuspendMediaSession;
-MEDIA_EXPORT extern const base::Feature kAutoplayIgnoreWebAudio;
-MEDIA_EXPORT extern const base::Feature kAutoplayDisableSettings;
-MEDIA_EXPORT extern const base::Feature kBackgroundVideoPauseOptimization;
-MEDIA_EXPORT extern const base::Feature kBresenhamCadence;
-MEDIA_EXPORT extern const base::Feature kCdmHostVerification;
-MEDIA_EXPORT extern const base::Feature kCdmProcessSiteIsolation;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kAudioFocusDuckFlash);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kAudioFocusLossSuspendMediaSession);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kAutoplayIgnoreWebAudio);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kAutoplayDisableSettings);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kBackgroundVideoPauseOptimization);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kBresenhamCadence);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCdmHostVerification);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCdmProcessSiteIsolation);
#if BUILDFLAG(CHROME_WIDE_ECHO_CANCELLATION)
-MEDIA_EXPORT extern const base::Feature kChromeWideEchoCancellation;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kChromeWideEchoCancellation);
MEDIA_EXPORT extern const base::FeatureParam<int>
kChromeWideEchoCancellationProcessingFifoSize;
MEDIA_EXPORT extern const base::FeatureParam<bool>
@@ -134,155 +138,160 @@ MEDIA_EXPORT extern const base::FeatureParam<double>
MEDIA_EXPORT extern const base::FeatureParam<bool>
kChromeWideEchoCancellationAllowAllSampleRates;
#endif
-MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoderUseSharedHandle;
-MEDIA_EXPORT extern const base::Feature kEnableTabMuting;
-MEDIA_EXPORT extern const base::Feature kExposeSwDecodersToWebRTC;
-MEDIA_EXPORT extern const base::Feature kExternalClearKeyForTesting;
-MEDIA_EXPORT extern const base::Feature kFFmpegDecodeOpaqueVP8;
-MEDIA_EXPORT extern const base::Feature kFailUrlProvisionFetcherForTesting;
-MEDIA_EXPORT extern const base::Feature kFallbackAfterDecodeError;
-MEDIA_EXPORT extern const base::Feature kGav1VideoDecoder;
-MEDIA_EXPORT extern const base::Feature kGlobalMediaControls;
-MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsAutoDismiss;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kD3D11VideoDecoderUseSharedHandle);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kEnableTabMuting);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kExposeSwDecodersToWebRTC);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kExternalClearKeyForTesting);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kFFmpegDecodeOpaqueVP8);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kFailUrlProvisionFetcherForTesting);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kFallbackAfterDecodeError);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kGav1VideoDecoder);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControls);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsAutoDismiss);
#if BUILDFLAG(IS_CHROMEOS)
-MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsForCast;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsForCast);
#endif
-MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsForChromeOS;
-MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsPictureInPicture;
-MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsSeamlessTransfer;
-MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsModernUI;
-MEDIA_EXPORT extern const base::Feature kHardwareMediaKeyHandling;
-MEDIA_EXPORT extern const base::Feature kHardwareSecureDecryption;
-MEDIA_EXPORT extern const base::Feature kHardwareSecureDecryptionExperiment;
-MEDIA_EXPORT extern const base::Feature kHardwareSecureDecryptionFallback;
-MEDIA_EXPORT extern const base::Feature kInternalMediaSession;
-MEDIA_EXPORT extern const base::Feature kKeepRvfcFrameAlive;
-MEDIA_EXPORT extern const base::Feature kKeyPressMonitoring;
-MEDIA_EXPORT extern const base::Feature kLiveCaption;
-MEDIA_EXPORT extern const base::Feature kLiveCaptionMultiLanguage;
-MEDIA_EXPORT extern const base::Feature kLiveCaptionSystemWideOnChromeOS;
-MEDIA_EXPORT extern const base::Feature kLowDelayVideoRenderingOnLiveStream;
-MEDIA_EXPORT extern const base::Feature kMediaCapabilitiesQueryGpuFactories;
-MEDIA_EXPORT extern const base::Feature kMediaCapabilitiesWithParameters;
-MEDIA_EXPORT extern const base::Feature kMediaCastOverlayButton;
-MEDIA_EXPORT extern const base::Feature kMediaEngagementBypassAutoplayPolicies;
-MEDIA_EXPORT extern const base::Feature kMediaEngagementHTTPSOnly;
-MEDIA_EXPORT extern const base::Feature kMediaLearningExperiment;
-MEDIA_EXPORT extern const base::Feature kMediaLearningFramework;
-MEDIA_EXPORT extern const base::Feature kMediaLearningSmoothnessExperiment;
-MEDIA_EXPORT extern const base::Feature kMediaOptimizer;
-MEDIA_EXPORT extern const base::Feature kMediaPowerExperiment;
-MEDIA_EXPORT extern const base::Feature kMediaSessionWebRTC;
-MEDIA_EXPORT extern const base::Feature kMemoryPressureBasedSourceBufferGC;
-MEDIA_EXPORT extern const base::Feature kMultiPlaneVideoCaptureSharedImages;
-MEDIA_EXPORT extern const base::Feature kOpenscreenCastStreamingSession;
-MEDIA_EXPORT extern const base::Feature kOverlayFullscreenVideo;
-MEDIA_EXPORT extern const base::Feature kPictureInPicture;
-MEDIA_EXPORT extern const base::Feature kPlatformAudioEncoder;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsForChromeOS);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsPictureInPicture);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsSeamlessTransfer);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsModernUI);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kHardwareMediaKeyHandling);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kHardwareSecureDecryption);
+MEDIA_EXPORT extern const base::FeatureParam<bool>
+ kHardwareSecureDecryptionForceSupportClearLead;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kHardwareSecureDecryptionExperiment);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kHardwareSecureDecryptionFallback);
+MEDIA_EXPORT extern const base::FeatureParam<int>
+ kHardwareSecureDecryptionFallbackMinDisablingDays;
+MEDIA_EXPORT extern const base::FeatureParam<int>
+ kHardwareSecureDecryptionFallbackMaxDisablingDays;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kInternalMediaSession);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kKeepRvfcFrameAlive);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kKeyPressMonitoring);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveCaption);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveCaptionRightClick);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveCaptionMultiLanguage);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveCaptionSystemWideOnChromeOS);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveTranslate);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kLowDelayVideoRenderingOnLiveStream);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaCapabilitiesQueryGpuFactories);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaCapabilitiesWithParameters);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaCastOverlayButton);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaEngagementBypassAutoplayPolicies);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaEngagementHTTPSOnly);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaLearningExperiment);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaLearningFramework);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaLearningSmoothnessExperiment);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaOptimizer);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaPowerExperiment);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaSessionWebRTC);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMemoryPressureBasedSourceBufferGC);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMultiPlaneVideoCaptureSharedImages);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kOpenscreenCastStreamingSession);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kOverlayFullscreenVideo);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPictureInPicture);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPlatformAudioEncoder);
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
-MEDIA_EXPORT extern const base::Feature kPlatformHEVCDecoderSupport;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPlatformHEVCDecoderSupport);
#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC)
-MEDIA_EXPORT extern const base::Feature kPlaybackSpeedButton;
-MEDIA_EXPORT extern const base::Feature kPreloadMediaEngagementData;
-MEDIA_EXPORT extern const base::Feature kPreloadMetadataLazyLoad;
-MEDIA_EXPORT extern const base::Feature kPreloadMetadataSuspend;
-MEDIA_EXPORT extern const base::Feature kRecordMediaEngagementScores;
-MEDIA_EXPORT extern const base::Feature kRecordWebAudioEngagement;
-MEDIA_EXPORT extern const base::Feature kResumeBackgroundVideo;
-MEDIA_EXPORT extern const base::Feature kRevokeMediaSourceObjectURLOnAttach;
-MEDIA_EXPORT extern const base::Feature
- kShareThisTabInsteadButtonGetDisplayMedia;
-MEDIA_EXPORT extern const base::Feature
- kShareThisTabInsteadButtonGetDisplayMediaAudio;
-MEDIA_EXPORT extern const base::Feature kSpeakerChangeDetection;
-MEDIA_EXPORT extern const base::Feature kSpecCompliantCanPlayThrough;
-MEDIA_EXPORT extern const base::Feature kSuspendMutedAudio;
-MEDIA_EXPORT extern const base::Feature kUnifiedAutoplay;
-MEDIA_EXPORT extern const base::Feature kUseAndroidOverlayForSecureOnly;
-MEDIA_EXPORT extern const base::Feature kUseDecoderStreamForWebRTC;
-MEDIA_EXPORT extern const base::Feature kUseFakeDeviceForMediaStream;
-MEDIA_EXPORT extern const base::Feature kUseMediaHistoryStore;
-MEDIA_EXPORT extern const base::Feature kUseR16Texture;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPlaybackSpeedButton);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMediaEngagementData);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMetadataLazyLoad);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMetadataSuspend);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kRecordMediaEngagementScores);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kRecordWebAudioEngagement);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kResumeBackgroundVideo);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kRevokeMediaSourceObjectURLOnAttach);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kShareThisTabInsteadButtonGetDisplayMedia);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(
+ kShareThisTabInsteadButtonGetDisplayMediaAudio);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kSpeakerChangeDetection);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kSpecCompliantCanPlayThrough);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kSuspendMutedAudio);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUnifiedAutoplay);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAndroidOverlayForSecureOnly);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseDecoderStreamForWebRTC);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseFakeDeviceForMediaStream);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseMediaHistoryStore);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseR16Texture);
#if BUILDFLAG(IS_LINUX)
-MEDIA_EXPORT extern const base::Feature kVaapiVideoDecodeLinux;
-MEDIA_EXPORT extern const base::Feature kVaapiVideoEncodeLinux;
-MEDIA_EXPORT extern const base::Feature kVaapiIgnoreDriverChecks;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoDecodeLinux);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoEncodeLinux);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiIgnoreDriverChecks);
#endif // BUILDFLAG(IS_LINUX)
-MEDIA_EXPORT extern const base::Feature kVaapiAV1Decoder;
-MEDIA_EXPORT extern const base::Feature kVaapiLowPowerEncoderGen9x;
-MEDIA_EXPORT extern const base::Feature kVaapiEnforceVideoMinMaxResolution;
-MEDIA_EXPORT extern const base::Feature kVaapiVideoMinResolutionForPerformance;
-MEDIA_EXPORT extern const base::Feature kVaapiVP8Encoder;
-MEDIA_EXPORT extern const base::Feature kVaapiVP9Encoder;
-MEDIA_EXPORT extern const base::Feature kGlobalVaapiLock;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiAV1Decoder);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiLowPowerEncoderGen9x);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiEnforceVideoMinMaxResolution);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoMinResolutionForPerformance);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVP8Encoder);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVP9Encoder);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalVaapiLock);
#if defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS)
-MEDIA_EXPORT extern const base::Feature kVaapiH264TemporalLayerHWEncoding;
-MEDIA_EXPORT extern const base::Feature kVaapiVp8TemporalLayerHWEncoding;
-MEDIA_EXPORT extern const base::Feature kVaapiVp9kSVCHWEncoding;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiH264TemporalLayerHWEncoding);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp8TemporalLayerHWEncoding);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp9kSVCHWEncoding);
#endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS)
-MEDIA_EXPORT extern const base::Feature kVideoBlitColorAccuracy;
-MEDIA_EXPORT extern const base::Feature kVp9kSVCHWDecoding;
-MEDIA_EXPORT extern const base::Feature kWakeLockOptimisationHiddenMuted;
-MEDIA_EXPORT extern const base::Feature kWebContentsCaptureHiDpi;
-MEDIA_EXPORT extern const base::Feature kWebrtcMediaCapabilitiesParameters;
-MEDIA_EXPORT extern const base::Feature kResolutionBasedDecoderPriority;
-MEDIA_EXPORT extern const base::Feature kForceHardwareVideoDecoders;
-MEDIA_EXPORT extern const base::Feature kForceHardwareAudioDecoders;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVideoBlitColorAccuracy);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kVp9kSVCHWDecoding);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kWakeLockOptimisationHiddenMuted);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kWebContentsCaptureHiDpi);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kWebrtcMediaCapabilitiesParameters);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kResolutionBasedDecoderPriority);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kForceHardwareVideoDecoders);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kForceHardwareAudioDecoders);
#if BUILDFLAG(IS_ANDROID)
-MEDIA_EXPORT extern const base::Feature kAllowNonSecureOverlays;
-MEDIA_EXPORT extern const base::Feature kMediaControlsExpandGesture;
-MEDIA_EXPORT extern const base::Feature kMediaDrmPersistentLicense;
-MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioning;
-MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioningAtStartup;
-MEDIA_EXPORT extern const base::Feature kCanPlayHls;
-MEDIA_EXPORT extern const base::Feature kPictureInPictureAPI;
-MEDIA_EXPORT extern const base::Feature kHlsPlayer;
-MEDIA_EXPORT extern const base::Feature kRequestSystemAudioFocus;
-MEDIA_EXPORT extern const base::Feature kUseAudioLatencyFromHAL;
-MEDIA_EXPORT extern const base::Feature kUsePooledSharedImageVideoProvider;
-MEDIA_EXPORT extern const base::Feature kUseRealColorSpaceForAndroidVideo;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kAllowNonSecureOverlays);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaControlsExpandGesture);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaDrmPersistentLicense);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaDrmPreprovisioning);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaDrmPreprovisioningAtStartup);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kCanPlayHls);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPictureInPictureAPI);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kHlsPlayer);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kRequestSystemAudioFocus);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAudioLatencyFromHAL);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUsePooledSharedImageVideoProvider);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseRealColorSpaceForAndroidVideo);
#endif // BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
-MEDIA_EXPORT extern const base::Feature kChromeOSHWVBREncoding;
-MEDIA_EXPORT extern const base::Feature kUseChromeOSDirectVideoDecoder;
-MEDIA_EXPORT extern const base::Feature kLimitConcurrentDecoderInstances;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kChromeOSHWVBREncoding);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseChromeOSDirectVideoDecoder);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kLimitConcurrentDecoderInstances);
#if defined(ARCH_CPU_ARM_FAMILY)
-MEDIA_EXPORT extern const base::Feature kPreferLibYuvImageProcessor;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreferLibYuvImageProcessor);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreferGLImageProcessor);
#endif // defined(ARCH_CPU_ARM_FAMILY)
#if BUILDFLAG(IS_CHROMEOS)
-MEDIA_EXPORT extern const base::Feature kUseAlternateVideoDecoderImplementation;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAlternateVideoDecoderImplementation);
#endif // BUILDFLAG(IS_CHROMEOS)
#endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION)
-#if BUILDFLAG(IS_MAC)
-MEDIA_EXPORT extern const base::Feature kMultiPlaneVideoToolboxSharedImages;
-#endif // BUILDFLAG(IS_MAC)
-
#if BUILDFLAG(IS_WIN)
-MEDIA_EXPORT extern const base::Feature kDelayCopyNV12Textures;
-MEDIA_EXPORT extern const base::Feature kDirectShowGetPhotoState;
-MEDIA_EXPORT extern const base::Feature kIncludeIRCamerasInDeviceEnumeration;
-MEDIA_EXPORT extern const base::Feature kMediaFoundationAV1Encoding;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kDelayCopyNV12Textures);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kDirectShowGetPhotoState);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kIncludeIRCamerasInDeviceEnumeration);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationAV1Encoding);
// For feature check of kMediaFoundationH264CbpEncoding at runtime,
// please use IsMediaFoundationH264CbpEncodingEnabled() instead.
-MEDIA_EXPORT extern const base::Feature kMediaFoundationH264CbpEncoding;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationH264CbpEncoding);
-MEDIA_EXPORT extern const base::Feature kMediaFoundationVP9Encoding;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationVP9Encoding);
-MEDIA_EXPORT extern const base::Feature kMediaFoundationVideoCapture;
-MEDIA_EXPORT extern const base::Feature kMediaFoundationVP8Decoding;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationVideoCapture);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationVP8Decoding);
// For feature check of kMediaFoundationD3D11VideoCapture at runtime,
// please use IsMediaFoundationD3D11VideoCaptureEnabled() instead.
-MEDIA_EXPORT extern const base::Feature kMediaFoundationD3D11VideoCapture;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationD3D11VideoCapture);
-MEDIA_EXPORT extern const base::Feature kMediaFoundationClearPlayback;
-MEDIA_EXPORT extern const base::Feature kAllowMediaFoundationFrameServerMode;
-MEDIA_EXPORT extern const base::Feature kWasapiRawAudioCapture;
-MEDIA_EXPORT extern const base::Feature kD3D11Vp9kSVCHWDecoding;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationClearPlayback);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kAllowMediaFoundationFrameServerMode);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kWasapiRawAudioCapture);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseFakeAudioCaptureTimestamps);
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kD3D11Vp9kSVCHWDecoding);
// Strategy affecting how Media Foundation Renderer determines its rendering
// mode when used with clear video media. This strategy does not impact
@@ -300,18 +309,22 @@ enum class MediaFoundationClearRenderingStrategy {
// Under this feature, a given MediaFoundationClearRenderingStrategy param is
// used by the Media Foundation Renderer for Clear content scenarios.
-MEDIA_EXPORT extern const base::Feature kMediaFoundationClearRendering;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationClearRendering);
MEDIA_EXPORT extern const base::FeatureParam<
MediaFoundationClearRenderingStrategy>
kMediaFoundationClearRenderingStrategyParam;
#endif // BUILDFLAG(IS_WIN)
#if BUILDFLAG(IS_CHROMEOS)
-MEDIA_EXPORT extern const base::Feature kDeprecateLowUsageCodecs;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kDeprecateLowUsageCodecs);
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
-MEDIA_EXPORT extern const base::Feature kUseOutOfProcessVideoDecoding;
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseOutOfProcessVideoDecoding);
+#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseOutOfProcessVideoEncoding);
#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
// Based on a |command_line| and the current platform, returns the effective
diff --git a/chromium/media/base/media_track.cc b/chromium/media/base/media_track.cc
index a8fb272776e..0ca8ed68fc0 100644
--- a/chromium/media/base/media_track.cc
+++ b/chromium/media/base/media_track.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_track.h b/chromium/media/base/media_track.h
index c0e020a9caa..370958923aa 100644
--- a/chromium/media/base/media_track.h
+++ b/chromium/media/base/media_track.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_tracks.cc b/chromium/media/base/media_tracks.cc
index 39da608055f..25763611108 100644
--- a/chromium/media/base/media_tracks.cc
+++ b/chromium/media/base/media_tracks.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_tracks.h b/chromium/media/base/media_tracks.h
index 6407c23b0bd..f52341b9c34 100644
--- a/chromium/media/base/media_tracks.h
+++ b/chromium/media/base/media_tracks.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_types.cc b/chromium/media/base/media_types.cc
index a33fb235c3f..807fda7955f 100644
--- a/chromium/media/base/media_types.cc
+++ b/chromium/media/base/media_types.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_types.h b/chromium/media/base/media_types.h
index f0b910ab1a9..3139d1a1492 100644
--- a/chromium/media/base/media_types.h
+++ b/chromium/media/base/media_types.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_url_demuxer.cc b/chromium/media/base/media_url_demuxer.cc
index 344b44d85d5..180887a1924 100644
--- a/chromium/media/base/media_url_demuxer.cc
+++ b/chromium/media/base/media_url_demuxer.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_url_demuxer.h b/chromium/media/base/media_url_demuxer.h
index b2a8c39cb26..f4c721a2848 100644
--- a/chromium/media/base/media_url_demuxer.h
+++ b/chromium/media/base/media_url_demuxer.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_url_demuxer_unittest.cc b/chromium/media/base/media_url_demuxer_unittest.cc
index bdf01d2ff38..efea95fa94a 100644
--- a/chromium/media/base/media_url_demuxer_unittest.cc
+++ b/chromium/media/base/media_url_demuxer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_url_params.cc b/chromium/media/base/media_url_params.cc
index 236efaff6d5..f7c078a09c8 100644
--- a/chromium/media/base/media_url_params.cc
+++ b/chromium/media/base/media_url_params.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_url_params.h b/chromium/media/base/media_url_params.h
index ebbc80c91ef..15128b49ed0 100644
--- a/chromium/media/base/media_url_params.h
+++ b/chromium/media/base/media_url_params.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/media_util.cc b/chromium/media/base/media_util.cc
index dafaad63ccd..27451d93483 100644
--- a/chromium/media/base/media_util.cc
+++ b/chromium/media/base/media_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,6 +18,8 @@ AudioParameters::Format ConvertAudioCodecToBitstreamFormat(AudioCodec codec) {
return AudioParameters::Format::AUDIO_BITSTREAM_EAC3;
case AudioCodec::kDTS:
return AudioParameters::Format::AUDIO_BITSTREAM_DTS;
+ case AudioCodec::kDTSXP2:
+ return AudioParameters::Format::AUDIO_BITSTREAM_DTSX_P2;
// No support for DTS_HD yet as this section is related to the incoming
// stream type. DTS_HD support is only added for audio track output to
// support audiosink reporting DTS_HD support.
diff --git a/chromium/media/base/media_util.h b/chromium/media/base/media_util.h
index b2d3b117faf..9481757af0b 100644
--- a/chromium/media/base/media_util.h
+++ b/chromium/media/base/media_util.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/memory_dump_provider_proxy.cc b/chromium/media/base/memory_dump_provider_proxy.cc
index 72117cb3a78..8dcde768831 100644
--- a/chromium/media/base/memory_dump_provider_proxy.cc
+++ b/chromium/media/base/memory_dump_provider_proxy.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/memory_dump_provider_proxy.h b/chromium/media/base/memory_dump_provider_proxy.h
index 24783d3231c..fa418aadd0e 100644
--- a/chromium/media/base/memory_dump_provider_proxy.h
+++ b/chromium/media/base/memory_dump_provider_proxy.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mime_util.cc b/chromium/media/base/mime_util.cc
index ff8aa2e13ab..e199a949114 100644
--- a/chromium/media/base/mime_util.cc
+++ b/chromium/media/base/mime_util.cc
@@ -1,10 +1,11 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/mime_util.h"
#include "base/no_destructor.h"
+#include "base/strings/string_piece.h"
#include "media/base/mime_util_internal.h"
namespace media {
@@ -15,22 +16,22 @@ static const internal::MimeUtil* GetMimeUtil() {
return &(*mime_util);
}
-bool IsSupportedMediaMimeType(const std::string& mime_type) {
+bool IsSupportedMediaMimeType(base::StringPiece mime_type) {
return GetMimeUtil()->IsSupportedMediaMimeType(mime_type);
}
-SupportsType IsSupportedMediaFormat(const std::string& mime_type,
+SupportsType IsSupportedMediaFormat(base::StringPiece mime_type,
const std::vector<std::string>& codecs) {
return GetMimeUtil()->IsSupportedMediaFormat(mime_type, codecs, false);
}
SupportsType IsSupportedEncryptedMediaFormat(
- const std::string& mime_type,
+ base::StringPiece mime_type,
const std::vector<std::string>& codecs) {
return GetMimeUtil()->IsSupportedMediaFormat(mime_type, codecs, true);
}
-void SplitCodecs(const std::string& codecs,
+void SplitCodecs(base::StringPiece codecs,
std::vector<std::string>* codecs_out) {
GetMimeUtil()->SplitCodecs(codecs, codecs_out);
}
@@ -39,8 +40,8 @@ void StripCodecs(std::vector<std::string>* codecs) {
GetMimeUtil()->StripCodecs(codecs);
}
-bool ParseVideoCodecString(const std::string& mime_type,
- const std::string& codec_id,
+bool ParseVideoCodecString(base::StringPiece mime_type,
+ base::StringPiece codec_id,
bool* ambiguous_codec_string,
VideoCodec* out_codec,
VideoCodecProfile* out_profile,
@@ -51,8 +52,8 @@ bool ParseVideoCodecString(const std::string& mime_type,
out_level, out_colorspace);
}
-bool ParseAudioCodecString(const std::string& mime_type,
- const std::string& codec_id,
+bool ParseAudioCodecString(base::StringPiece mime_type,
+ base::StringPiece codec_id,
bool* ambiguous_codec_string,
AudioCodec* out_codec) {
return GetMimeUtil()->ParseAudioCodecString(
diff --git a/chromium/media/base/mime_util.h b/chromium/media/base/mime_util.h
index c0106e528be..4f23e2278c1 100644
--- a/chromium/media/base/mime_util.h
+++ b/chromium/media/base/mime_util.h
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/strings/string_piece_forward.h"
#include "media/base/audio_codecs.h"
#include "media/base/media_export.h"
#include "media/base/video_codecs.h"
@@ -16,13 +17,13 @@ namespace media {
// Check to see if a particular MIME type is in the list of
// supported/recognized MIME types.
-MEDIA_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type);
+MEDIA_EXPORT bool IsSupportedMediaMimeType(base::StringPiece mime_type);
// Splits |codecs| separated by comma into |codecs_out|. Codecs in |codecs| may
// or may not be quoted. For example, "\"aaa.b.c,dd.eee\"" and "aaa.b.c,dd.eee"
// will both be split into {"aaa.b.c", "dd.eee"}.
// See http://www.ietf.org/rfc/rfc4281.txt.
-MEDIA_EXPORT void SplitCodecs(const std::string& codecs,
+MEDIA_EXPORT void SplitCodecs(base::StringPiece,
std::vector<std::string>* codecs_out);
// Strips the profile and level info from |codecs| in place. For example,
@@ -40,8 +41,8 @@ MEDIA_EXPORT void StripCodecs(std::vector<std::string>* codecs);
//
// Returns false if parsing fails (invalid string, or unrecognized video codec),
// in which case values for |out_*| arguments are undefined.
-MEDIA_EXPORT bool ParseVideoCodecString(const std::string& mime_type,
- const std::string& codec_id,
+MEDIA_EXPORT bool ParseVideoCodecString(base::StringPiece mime_type,
+ base::StringPiece codec_id,
bool* out_is_ambiguous,
VideoCodec* out_codec,
VideoCodecProfile* out_profile,
@@ -57,8 +58,8 @@ MEDIA_EXPORT bool ParseVideoCodecString(const std::string& mime_type,
//
// Returns false if parsing fails (invalid string, or unrecognized audio codec),
// in which case values for |out_*| arguments are undefined.
-MEDIA_EXPORT bool ParseAudioCodecString(const std::string& mime_type,
- const std::string& codec_id,
+MEDIA_EXPORT bool ParseAudioCodecString(base::StringPiece mime_type,
+ base::StringPiece codec_id,
bool* out_is_ambiguous,
AudioCodec* out_codec);
@@ -87,12 +88,12 @@ enum class SupportsType {
// |mime_type| is supported but at least one of the codecs within |codecs| is
// not supported for the |mime_type|.
MEDIA_EXPORT SupportsType
-IsSupportedMediaFormat(const std::string& mime_type,
+IsSupportedMediaFormat(base::StringPiece mime_type,
const std::vector<std::string>& codecs);
// Similar to the above, but for encrypted formats.
MEDIA_EXPORT SupportsType
-IsSupportedEncryptedMediaFormat(const std::string& mime_type,
+IsSupportedEncryptedMediaFormat(base::StringPiece mime_type,
const std::vector<std::string>& codecs);
} // namespace media
diff --git a/chromium/media/base/mime_util_internal.cc b/chromium/media/base/mime_util_internal.cc
index 2d89808c1b0..5779a4706e6 100644
--- a/chromium/media/base/mime_util_internal.cc
+++ b/chromium/media/base/mime_util_internal.cc
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
@@ -30,8 +31,7 @@
#include "media/base/android/media_codec_util.h" // nogncheck
#endif
-namespace media {
-namespace internal {
+namespace media::internal {
// A map from codec string to MimeUtil::Codec.
using StringToCodecMap = base::flat_map<std::string, MimeUtil::Codec>;
@@ -102,8 +102,8 @@ const StringToCodecMap& GetStringToCodecMap() {
return *kStringToCodecMap;
}
-static bool ParseVp9CodecID(const std::string& mime_type_lower_case,
- const std::string& codec_id,
+static bool ParseVp9CodecID(base::StringPiece mime_type_lower_case,
+ base::StringPiece codec_id,
VideoCodecProfile* out_profile,
uint8_t* out_level,
VideoColorSpace* out_color_space) {
@@ -147,10 +147,6 @@ static MimeUtil::ParsedCodecResult MakeDefaultParsedCodecResult() {
MimeUtil::MimeUtil() {
#if BUILDFLAG(IS_ANDROID)
-#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
- platform_info_.has_platform_dv_decoder =
- MediaCodecUtil::IsDolbyVisionDecoderAvailable();
-#endif
platform_info_.has_platform_vp8_decoder =
MediaCodecUtil::IsVp8DecoderAvailable();
platform_info_.has_platform_vp9_decoder =
@@ -224,7 +220,7 @@ VideoCodec MimeUtilToVideoCodec(MimeUtil::Codec codec) {
SupportsType MimeUtil::AreSupportedCodecs(
const std::vector<ParsedCodecResult>& parsed_codecs,
- const std::string& mime_type_lower_case,
+ base::StringPiece mime_type_lower_case,
bool is_encrypted) const {
DCHECK(!parsed_codecs.empty());
DCHECK_EQ(base::ToLowerASCII(mime_type_lower_case), mime_type_lower_case);
@@ -418,16 +414,15 @@ void MimeUtil::AddSupportedMediaFormats() {
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
}
-void MimeUtil::AddContainerWithCodecs(const std::string& mime_type,
- const CodecSet& codecs) {
- media_format_map_[mime_type] = codecs;
+void MimeUtil::AddContainerWithCodecs(std::string mime_type, CodecSet codecs) {
+ media_format_map_.insert_or_assign(std::move(mime_type), std::move(codecs));
}
-bool MimeUtil::IsSupportedMediaMimeType(const std::string& mime_type) const {
+bool MimeUtil::IsSupportedMediaMimeType(base::StringPiece mime_type) const {
return media_format_map_.contains(base::ToLowerASCII(mime_type));
}
-void MimeUtil::SplitCodecs(const std::string& codecs,
+void MimeUtil::SplitCodecs(base::StringPiece codecs,
std::vector<std::string>* codecs_out) const {
*codecs_out =
base::SplitString(base::TrimString(codecs, "\"", base::TRIM_ALL), ",",
@@ -440,15 +435,15 @@ void MimeUtil::SplitCodecs(const std::string& codecs,
void MimeUtil::StripCodecs(std::vector<std::string>* codecs) const {
// Strip everything past the first '.'
- for (auto it = codecs->begin(); it != codecs->end(); ++it) {
- size_t found = it->find_first_of('.');
+ for (auto& codec : *codecs) {
+ size_t found = codec.find_first_of('.');
if (found != std::string::npos)
- it->resize(found);
+ codec.resize(found);
}
}
-bool MimeUtil::ParseVideoCodecString(const std::string& mime_type,
- const std::string& codec_id,
+bool MimeUtil::ParseVideoCodecString(base::StringPiece mime_type,
+ base::StringPiece codec_id,
bool* out_is_ambiguous,
VideoCodec* out_codec,
VideoCodecProfile* out_profile,
@@ -464,7 +459,7 @@ bool MimeUtil::ParseVideoCodecString(const std::string& mime_type,
std::vector<ParsedCodecResult> parsed_results;
std::vector<std::string> codec_strings;
if (!codec_id.empty())
- codec_strings.push_back(codec_id);
+ codec_strings.emplace_back(codec_id);
if (!ParseCodecStrings(base::ToLowerASCII(mime_type), codec_strings,
&parsed_results)) {
@@ -490,8 +485,8 @@ bool MimeUtil::ParseVideoCodecString(const std::string& mime_type,
return true;
}
-bool MimeUtil::ParseAudioCodecString(const std::string& mime_type,
- const std::string& codec_id,
+bool MimeUtil::ParseAudioCodecString(base::StringPiece mime_type,
+ base::StringPiece codec_id,
bool* out_is_ambiguous,
AudioCodec* out_codec) const {
DCHECK(out_is_ambiguous);
@@ -501,7 +496,7 @@ bool MimeUtil::ParseAudioCodecString(const std::string& mime_type,
std::vector<ParsedCodecResult> parsed_results;
std::vector<std::string> codec_strings;
if (!codec_id.empty())
- codec_strings.push_back(codec_id);
+ codec_strings.emplace_back(codec_id);
if (!ParseCodecStrings(base::ToLowerASCII(mime_type), codec_strings,
&parsed_results)) {
@@ -525,7 +520,7 @@ bool MimeUtil::ParseAudioCodecString(const std::string& mime_type,
}
SupportsType MimeUtil::IsSupportedMediaFormat(
- const std::string& mime_type,
+ base::StringPiece mime_type,
const std::vector<std::string>& codecs,
bool is_encrypted) const {
const std::string mime_type_lower_case = base::ToLowerASCII(mime_type);
@@ -555,12 +550,11 @@ SupportsType MimeUtil::IsSupportedMediaFormat(
}
// static
-bool MimeUtil::IsCodecSupportedOnAndroid(
- Codec codec,
- const std::string& mime_type_lower_case,
- bool is_encrypted,
- VideoCodecProfile video_profile,
- const PlatformInfo& platform_info) {
+bool MimeUtil::IsCodecSupportedOnAndroid(Codec codec,
+ base::StringPiece mime_type_lower_case,
+ bool is_encrypted,
+ VideoCodecProfile video_profile,
+ const PlatformInfo& platform_info) {
DVLOG(3) << __func__;
DCHECK_NE(mime_type_lower_case, "");
@@ -654,7 +648,7 @@ bool MimeUtil::IsCodecSupportedOnAndroid(
case DOLBY_VISION:
#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
- return platform_info.has_platform_dv_decoder;
+ return true;
#else
return false;
#endif
@@ -680,7 +674,7 @@ bool MimeUtil::IsCodecSupportedOnAndroid(
}
bool MimeUtil::ParseCodecStrings(
- const std::string& mime_type_lower_case,
+ base::StringPiece mime_type_lower_case,
const std::vector<std::string>& codecs,
std::vector<ParsedCodecResult>* out_results) const {
DCHECK(out_results);
@@ -768,8 +762,8 @@ bool MimeUtil::ParseCodecStrings(
return true;
}
-bool MimeUtil::ParseCodecHelper(const std::string& mime_type_lower_case,
- const std::string& codec_id,
+bool MimeUtil::ParseCodecHelper(base::StringPiece mime_type_lower_case,
+ base::StringPiece codec_id,
ParsedCodecResult* out_result) const {
DCHECK_EQ(base::ToLowerASCII(mime_type_lower_case), mime_type_lower_case);
DCHECK(out_result);
@@ -871,7 +865,7 @@ bool MimeUtil::ParseCodecHelper(const std::string& mime_type_lower_case,
return false;
}
-SupportsType MimeUtil::IsCodecSupported(const std::string& mime_type_lower_case,
+SupportsType MimeUtil::IsCodecSupported(base::StringPiece mime_type_lower_case,
Codec codec,
VideoCodecProfile video_profile,
uint8_t video_level,
@@ -948,7 +942,7 @@ SupportsType MimeUtil::IsCodecSupported(const std::string& mime_type_lower_case,
: SupportsType::kSupported;
}
-bool MimeUtil::GetDefaultCodec(const std::string& mime_type,
+bool MimeUtil::GetDefaultCodec(base::StringPiece mime_type,
Codec* default_codec) const {
// Codecs below are unambiguously implied by the mime type string. DO NOT add
// default codecs for ambiguous mime types.
@@ -972,5 +966,4 @@ bool MimeUtil::GetDefaultCodec(const std::string& mime_type,
return false;
}
-} // namespace internal
-} // namespace media
+} // namespace media::internal
diff --git a/chromium/media/base/mime_util_internal.h b/chromium/media/base/mime_util_internal.h
index 6affc4798eb..849ce4ba202 100644
--- a/chromium/media/base/mime_util_internal.h
+++ b/chromium/media/base/mime_util_internal.h
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,15 +10,14 @@
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
+#include "base/strings/string_piece_forward.h"
#include "build/build_config.h"
#include "media/base/media_export.h"
#include "media/base/mime_util.h"
#include "media/base/video_codecs.h"
#include "media/base/video_color_space.h"
-namespace media {
-
-namespace internal {
+namespace media::internal {
// Internal utility class for handling mime types. Should only be invoked by
// tests and the functions within mime_util.cc -- NOT for direct use by others.
@@ -79,23 +78,23 @@ class MEDIA_EXPORT MimeUtil {
};
// See mime_util.h for more information on these methods.
- bool IsSupportedMediaMimeType(const std::string& mime_type) const;
- void SplitCodecs(const std::string& codecs,
+ bool IsSupportedMediaMimeType(base::StringPiece mime_type) const;
+ void SplitCodecs(base::StringPiece codecs,
std::vector<std::string>* codecs_out) const;
void StripCodecs(std::vector<std::string>* codecs) const;
bool ParseVideoCodecString(
- const std::string& mime_type, // fixme, make optional
- const std::string& codec_id,
+ base::StringPiece mime_type, // fixme, make optional
+ base::StringPiece codec_id,
bool* out_is_ambiguous,
VideoCodec* out_codec,
VideoCodecProfile* out_profile,
uint8_t* out_level,
VideoColorSpace* out_color_space) const;
- bool ParseAudioCodecString(const std::string& mime_type,
- const std::string& codec_id,
+ bool ParseAudioCodecString(base::StringPiece mime_type,
+ base::StringPiece codec_id,
bool* out_is_ambiguous,
AudioCodec* out_codec) const;
- SupportsType IsSupportedMediaFormat(const std::string& mime_type,
+ SupportsType IsSupportedMediaFormat(base::StringPiece mime_type,
const std::vector<std::string>& codecs,
bool is_encrypted) const;
@@ -105,7 +104,7 @@ class MEDIA_EXPORT MimeUtil {
// |platform_info| describes the availability of various platform features;
// see PlatformInfo for more details.
static bool IsCodecSupportedOnAndroid(Codec codec,
- const std::string& mime_type_lower_case,
+ base::StringPiece mime_type_lower_case,
bool is_encrypted,
VideoCodecProfile video_profile,
const PlatformInfo& platform_info);
@@ -121,8 +120,7 @@ class MEDIA_EXPORT MimeUtil {
void AddSupportedMediaFormats();
// Adds |mime_type| with the specified codecs to |media_format_map_|.
- void AddContainerWithCodecs(const std::string& mime_type,
- const CodecSet& codecs_list);
+ void AddContainerWithCodecs(std::string mime_type, CodecSet codecs_list);
// Returns SupportsType::kSupported if all codec IDs in |codecs| are
// unambiguous and are supported in |mime_type_lower_case|. kMaybeSupported is
@@ -133,7 +131,7 @@ class MEDIA_EXPORT MimeUtil {
// encrypted blocks.
SupportsType AreSupportedCodecs(
const std::vector<ParsedCodecResult>& parsed_codecs,
- const std::string& mime_type_lower_case,
+ base::StringPiece mime_type_lower_case,
bool is_encrypted) const;
// Parse the combination of |mime_type_lower_case| and |codecs|. Returns true
@@ -142,7 +140,7 @@ class MEDIA_EXPORT MimeUtil {
// - invalid/unrecognized codec strings and mime_types
// - invalid combinations of codec strings and mime_types (e.g. H264 in WebM)
// See comment for ParseCodecHelper().
- bool ParseCodecStrings(const std::string& mime_type_lower_case,
+ bool ParseCodecStrings(base::StringPiece mime_type_lower_case,
const std::vector<std::string>& codecs,
std::vector<ParsedCodecResult>* out_results) const;
@@ -167,8 +165,8 @@ class MEDIA_EXPORT MimeUtil {
// |out_result|'s |video_color_space| will report the codec strings color
// space when provided. Most codec strings do not yet describe color, so this
// will often be set to the default of REC709.
- bool ParseCodecHelper(const std::string& mime_type_lower_case,
- const std::string& codec_id,
+ bool ParseCodecHelper(base::StringPiece mime_type_lower_case,
+ base::StringPiece codec_id,
ParsedCodecResult* out_result) const;
// Returns kSupported if |codec| when platform supports codec contained in
@@ -179,7 +177,7 @@ class MEDIA_EXPORT MimeUtil {
// blocks.
// TODO(chcunningham): Make this method return a bool. Platform support should
// always be knowable for a fully specified codec.
- SupportsType IsCodecSupported(const std::string& mime_type_lower_case,
+ SupportsType IsCodecSupported(base::StringPiece mime_type_lower_case,
Codec codec,
VideoCodecProfile video_profile,
uint8_t video_level,
@@ -192,7 +190,7 @@ class MEDIA_EXPORT MimeUtil {
// Returns true and sets |*default_codec| if |mime_type_lower_case| has a
// default codec associated with it. Returns false otherwise and the value of
// |*default_codec| is undefined.
- bool GetDefaultCodec(const std::string& mime_type_lower_case,
+ bool GetDefaultCodec(base::StringPiece mime_type_lower_case,
Codec* default_codec) const;
#if BUILDFLAG(IS_ANDROID)
@@ -204,7 +202,6 @@ class MEDIA_EXPORT MimeUtil {
MediaFormatMappings media_format_map_;
};
-} // namespace internal
-} // namespace media
+} // namespace media::internal
#endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_
diff --git a/chromium/media/base/mime_util_unittest.cc b/chromium/media/base/mime_util_unittest.cc
index 8137fbc7d5b..85d72c9c4f5 100644
--- a/chromium/media/base/mime_util_unittest.cc
+++ b/chromium/media/base/mime_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,8 +23,7 @@
#include "base/android/build_info.h"
#endif
-namespace media {
-namespace internal {
+namespace media::internal {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
// TODO(https://crbug.com/1117275): Remove conditioning of kUsePropCodecs when
@@ -123,7 +122,11 @@ static MimeUtil::PlatformInfo VaryAllFields() {
// This is to validate MimeUtil::IsCodecSupportedOnPlatform(), which is used
// only on Android platform.
static bool HasDolbyVisionSupport() {
+#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
+ return true;
+#else
return false;
+#endif
}
static bool HasEac3Support() {
@@ -149,8 +152,8 @@ TEST(MimeUtilTest, CommonMediaMimeType) {
EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType("application/x-mpegurl"));
EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType("Application/X-MPEGURL"));
- EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType(
- "application/vnd.apple.mpegurl"));
+ EXPECT_EQ(kHlsSupported,
+ IsSupportedMediaMimeType("application/vnd.apple.mpegurl"));
EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType("audio/mpegurl"));
EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType("audio/x-mpegurl"));
EXPECT_TRUE(IsSupportedMediaMimeType("audio/mp4"));
@@ -211,18 +214,18 @@ TEST(MimeUtilTest, SplitAndStripCodecs) {
{",", 2, {"", ""}, {"", ""}},
};
- for (size_t i = 0; i < std::size(tests); ++i) {
+ for (const auto& test : tests) {
std::vector<std::string> codecs_out;
- SplitCodecs(tests[i].original, &codecs_out);
- ASSERT_EQ(tests[i].expected_size, codecs_out.size());
- for (size_t j = 0; j < tests[i].expected_size; ++j)
- EXPECT_EQ(tests[i].split_results[j], codecs_out[j]);
+ SplitCodecs(test.original, &codecs_out);
+ ASSERT_EQ(test.expected_size, codecs_out.size());
+ for (size_t j = 0; j < test.expected_size; ++j)
+ EXPECT_EQ(test.split_results[j], codecs_out[j]);
StripCodecs(&codecs_out);
- ASSERT_EQ(tests[i].expected_size, codecs_out.size());
- for (size_t j = 0; j < tests[i].expected_size; ++j)
- EXPECT_EQ(tests[i].strip_results[j], codecs_out[j]);
+ ASSERT_EQ(test.expected_size, codecs_out.size());
+ for (size_t j = 0; j < test.expected_size; ++j)
+ EXPECT_EQ(test.strip_results[j], codecs_out[j]);
}
}
@@ -726,5 +729,4 @@ TEST(IsCodecSupportedOnAndroidTest, AndroidHLSAAC) {
// platform support).
}
-} // namespace internal
-} // namespace media
+} // namespace media::internal
diff --git a/chromium/media/base/mock_audio_renderer_sink.cc b/chromium/media/base/mock_audio_renderer_sink.cc
index 4c7c656d135..5cb182eb8fe 100644
--- a/chromium/media/base/mock_audio_renderer_sink.cc
+++ b/chromium/media/base/mock_audio_renderer_sink.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,7 +20,7 @@ MockAudioRendererSink::MockAudioRendererSink(const std::string& device_id,
device_id,
device_status,
AudioParameters(AudioParameters::AUDIO_FAKE,
- CHANNEL_LAYOUT_STEREO,
+ ChannelLayoutConfig::Stereo(),
AudioParameters::kTelephoneSampleRate,
1)) {}
diff --git a/chromium/media/base/mock_audio_renderer_sink.h b/chromium/media/base/mock_audio_renderer_sink.h
index d37d06240c6..68d1f709d20 100644
--- a/chromium/media/base/mock_audio_renderer_sink.h
+++ b/chromium/media/base/mock_audio_renderer_sink.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mock_demuxer_host.cc b/chromium/media/base/mock_demuxer_host.cc
index 5a33a0da3e4..c0ae9760e6d 100644
--- a/chromium/media/base/mock_demuxer_host.cc
+++ b/chromium/media/base/mock_demuxer_host.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mock_demuxer_host.h b/chromium/media/base/mock_demuxer_host.h
index 51d5025cfa2..cc1a11c8536 100644
--- a/chromium/media/base/mock_demuxer_host.h
+++ b/chromium/media/base/mock_demuxer_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/base/mock_filters.cc b/chromium/media/base/mock_filters.cc
index 3ab836a646c..a502332521d 100644
--- a/chromium/media/base/mock_filters.cc
+++ b/chromium/media/base/mock_filters.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mock_filters.h b/chromium/media/base/mock_filters.h
index 4d6126d9bef..e2b22f028d6 100644
--- a/chromium/media/base/mock_filters.h
+++ b/chromium/media/base/mock_filters.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -89,19 +89,19 @@ class MockPipeline : public Pipeline {
void Start(StartType start_type,
Demuxer* demuxer,
Client* client,
- PipelineStatusCallback seek_cb) {
+ PipelineStatusCallback seek_cb) override {
OnStart(start_type, demuxer, client, seek_cb);
}
MOCK_METHOD4(OnStart,
void(StartType, Demuxer*, Client*, PipelineStatusCallback&));
MOCK_METHOD0(Stop, void());
- void Seek(base::TimeDelta time, PipelineStatusCallback seek_cb) {
+ void Seek(base::TimeDelta time, PipelineStatusCallback seek_cb) override {
OnSeek(time, seek_cb);
}
MOCK_METHOD2(OnSeek, void(base::TimeDelta, PipelineStatusCallback&));
- void Suspend(PipelineStatusCallback cb) { OnSuspend(cb); }
+ void Suspend(PipelineStatusCallback cb) override { OnSuspend(cb); }
MOCK_METHOD1(OnSuspend, void(PipelineStatusCallback&));
- void Resume(base::TimeDelta time, PipelineStatusCallback seek_cb) {
+ void Resume(base::TimeDelta time, PipelineStatusCallback seek_cb) override {
OnResume(time, seek_cb);
}
MOCK_METHOD2(OnResume, void(base::TimeDelta, PipelineStatusCallback&));
@@ -163,14 +163,14 @@ class MockDemuxer : public Demuxer {
// Demuxer implementation.
std::string GetDisplayName() const override;
- void Initialize(DemuxerHost* host, PipelineStatusCallback cb) {
+ void Initialize(DemuxerHost* host, PipelineStatusCallback cb) override {
OnInitialize(host, cb);
}
MOCK_METHOD2(OnInitialize,
void(DemuxerHost* host, PipelineStatusCallback& cb));
MOCK_METHOD1(StartWaitingForSeek, void(base::TimeDelta));
MOCK_METHOD1(CancelPendingSeek, void(base::TimeDelta));
- void Seek(base::TimeDelta time, PipelineStatusCallback cb) {
+ void Seek(base::TimeDelta time, PipelineStatusCallback cb) override {
OnSeek(time, cb);
}
MOCK_METHOD2(OnSeek, void(base::TimeDelta time, PipelineStatusCallback& cb));
@@ -435,7 +435,7 @@ class MockVideoRenderer : public VideoRenderer {
CdmContext* cdm_context,
RendererClient* client,
const TimeSource::WallClockTimeCB& wall_clock_time_cb,
- PipelineStatusCallback init_cb) {
+ PipelineStatusCallback init_cb) override {
OnInitialize(stream, cdm_context, client, wall_clock_time_cb, init_cb);
}
MOCK_METHOD5(OnInitialize,
@@ -465,7 +465,7 @@ class MockAudioRenderer : public AudioRenderer {
void Initialize(DemuxerStream* stream,
CdmContext* cdm_context,
RendererClient* client,
- PipelineStatusCallback init_cb) {
+ PipelineStatusCallback init_cb) override {
OnInitialize(stream, cdm_context, client, init_cb);
}
MOCK_METHOD4(OnInitialize,
@@ -835,16 +835,15 @@ class MockStreamParser : public StreamParser {
~MockStreamParser() override;
// StreamParser interface
- MOCK_METHOD8(
- Init,
- void(InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
- bool ignore_text_track,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
- MediaLog* media_log));
+ MOCK_METHOD8(Init,
+ void(InitCB init_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
+ bool ignore_text_track,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
+ MediaLog* media_log));
MOCK_METHOD0(Flush, void());
MOCK_CONST_METHOD0(GetGenerateTimestampsFlag, bool());
MOCK_METHOD2(Parse, bool(const uint8_t*, int));
diff --git a/chromium/media/base/mock_media_log.cc b/chromium/media/base/mock_media_log.cc
index 80d0d304261..eccb18d2a89 100644
--- a/chromium/media/base/mock_media_log.cc
+++ b/chromium/media/base/mock_media_log.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,9 +23,9 @@ std::string MockMediaLog::MediaEventToLogString(const MediaLogRecord& event) {
// event for figuring out media pipeline failures, and just reporting
// pipeline status as numeric code is not very helpful/user-friendly.
if (event.type == MediaLogRecord::Type::kMediaStatus) {
- const std::string* group = event.params.FindStringKey("group");
+ const std::string* group = event.params.FindString("group");
if (group && *group == "PipelineStatus") {
- auto code = event.params.FindIntKey("code").value_or(0);
+ auto code = event.params.FindInt("code").value_or(0);
return PipelineStatusToString(static_cast<PipelineStatusCodes>(code));
}
}
diff --git a/chromium/media/base/mock_media_log.h b/chromium/media/base/mock_media_log.h
index 2ab57f02a7d..7c162519343 100644
--- a/chromium/media/base/mock_media_log.h
+++ b/chromium/media/base/mock_media_log.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mock_video_renderer_sink.cc b/chromium/media/base/mock_video_renderer_sink.cc
index 131ad4a374e..2de98c4c08b 100644
--- a/chromium/media/base/mock_video_renderer_sink.cc
+++ b/chromium/media/base/mock_video_renderer_sink.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/mock_video_renderer_sink.h b/chromium/media/base/mock_video_renderer_sink.h
index 7509c65b3b1..db48d7fc369 100644
--- a/chromium/media/base/mock_video_renderer_sink.h
+++ b/chromium/media/base/mock_video_renderer_sink.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/moving_average.cc b/chromium/media/base/moving_average.cc
index c3d9d6bbd98..13495bb9f90 100644
--- a/chromium/media/base/moving_average.cc
+++ b/chromium/media/base/moving_average.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/moving_average.h b/chromium/media/base/moving_average.h
index 92df3fada1a..7e6d42dc80c 100644
--- a/chromium/media/base/moving_average.h
+++ b/chromium/media/base/moving_average.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/moving_average_unittest.cc b/chromium/media/base/moving_average_unittest.cc
index f3d06d89db1..70ab263d922 100644
--- a/chromium/media/base/moving_average_unittest.cc
+++ b/chromium/media/base/moving_average_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/multi_channel_resampler.cc b/chromium/media/base/multi_channel_resampler.cc
index b37b72632a0..d7ce47b6f1e 100644
--- a/chromium/media/base/multi_channel_resampler.cc
+++ b/chromium/media/base/multi_channel_resampler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/multi_channel_resampler.h b/chromium/media/base/multi_channel_resampler.h
index f0f9d9a0009..9d3c4bd5028 100644
--- a/chromium/media/base/multi_channel_resampler.h
+++ b/chromium/media/base/multi_channel_resampler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/multi_channel_resampler_unittest.cc b/chromium/media/base/multi_channel_resampler_unittest.cc
index 0f2285b89d4..b106375d895 100644
--- a/chromium/media/base/multi_channel_resampler_unittest.cc
+++ b/chromium/media/base/multi_channel_resampler_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/null_video_sink.cc b/chromium/media/base/null_video_sink.cc
index a69b9755461..d1b0f86cbc4 100644
--- a/chromium/media/base/null_video_sink.cc
+++ b/chromium/media/base/null_video_sink.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/null_video_sink.h b/chromium/media/base/null_video_sink.h
index 28ddf2a6043..b6cba54a68d 100644
--- a/chromium/media/base/null_video_sink.h
+++ b/chromium/media/base/null_video_sink.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/null_video_sink_unittest.cc b/chromium/media/base/null_video_sink_unittest.cc
index 63dbe22988f..47a301b811f 100644
--- a/chromium/media/base/null_video_sink_unittest.cc
+++ b/chromium/media/base/null_video_sink_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/offloading_audio_encoder.cc b/chromium/media/base/offloading_audio_encoder.cc
index eafa2f0e292..ccbd07665b8 100644
--- a/chromium/media/base/offloading_audio_encoder.cc
+++ b/chromium/media/base/offloading_audio_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/offloading_audio_encoder.h b/chromium/media/base/offloading_audio_encoder.h
index 63a2f70d2b1..af67ffedef7 100644
--- a/chromium/media/base/offloading_audio_encoder.h
+++ b/chromium/media/base/offloading_audio_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/offloading_audio_encoder_unittest.cc b/chromium/media/base/offloading_audio_encoder_unittest.cc
index 39c2719ac85..617db335a60 100644
--- a/chromium/media/base/offloading_audio_encoder_unittest.cc
+++ b/chromium/media/base/offloading_audio_encoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/offloading_video_encoder.cc b/chromium/media/base/offloading_video_encoder.cc
index a2517981ec9..f037da44400 100644
--- a/chromium/media/base/offloading_video_encoder.cc
+++ b/chromium/media/base/offloading_video_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/offloading_video_encoder.h b/chromium/media/base/offloading_video_encoder.h
index 8b296d61358..60129884221 100644
--- a/chromium/media/base/offloading_video_encoder.h
+++ b/chromium/media/base/offloading_video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/offloading_video_encoder_unittest.cc b/chromium/media/base/offloading_video_encoder_unittest.cc
index c5afc025474..301e2847ba5 100644
--- a/chromium/media/base/offloading_video_encoder_unittest.cc
+++ b/chromium/media/base/offloading_video_encoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/output_device_info.cc b/chromium/media/base/output_device_info.cc
index b1270471f08..04f10148524 100644
--- a/chromium/media/base/output_device_info.cc
+++ b/chromium/media/base/output_device_info.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/output_device_info.h b/chromium/media/base/output_device_info.h
index 88290779234..7387896fa3d 100644
--- a/chromium/media/base/output_device_info.h
+++ b/chromium/media/base/output_device_info.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/overlay_info.cc b/chromium/media/base/overlay_info.cc
index 5f6e83307a1..e2bbfdb9926 100644
--- a/chromium/media/base/overlay_info.cc
+++ b/chromium/media/base/overlay_info.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/overlay_info.h b/chromium/media/base/overlay_info.h
index 02915514b5b..88b0b22f273 100644
--- a/chromium/media/base/overlay_info.h
+++ b/chromium/media/base/overlay_info.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/pipeline.h b/chromium/media/base/pipeline.h
index 0dd708ea7a5..d97fb4abab3 100644
--- a/chromium/media/base/pipeline.h
+++ b/chromium/media/base/pipeline.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/pipeline_impl.cc b/chromium/media/base/pipeline_impl.cc
index c37a9568876..4f79aa74fc0 100644
--- a/chromium/media/base/pipeline_impl.cc
+++ b/chromium/media/base/pipeline_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/pipeline_impl.h b/chromium/media/base/pipeline_impl.h
index 37d884deb69..04d1fa61679 100644
--- a/chromium/media/base/pipeline_impl.h
+++ b/chromium/media/base/pipeline_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/pipeline_impl_unittest.cc b/chromium/media/base/pipeline_impl_unittest.cc
index c9f047b0cb8..36c9927e7b8 100644
--- a/chromium/media/base/pipeline_impl_unittest.cc
+++ b/chromium/media/base/pipeline_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/pipeline_metadata.cc b/chromium/media/base/pipeline_metadata.cc
index f8cc6ca985d..828fe238523 100644
--- a/chromium/media/base/pipeline_metadata.cc
+++ b/chromium/media/base/pipeline_metadata.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/pipeline_metadata.h b/chromium/media/base/pipeline_metadata.h
index 4f34ff80061..6f2a351c7ae 100644
--- a/chromium/media/base/pipeline_metadata.h
+++ b/chromium/media/base/pipeline_metadata.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/pipeline_status.cc b/chromium/media/base/pipeline_status.cc
index 0d6dee26406..7b1fcd82079 100644
--- a/chromium/media/base/pipeline_status.cc
+++ b/chromium/media/base/pipeline_status.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/pipeline_status.h b/chromium/media/base/pipeline_status.h
index 2dad3518925..ba6196944d8 100644
--- a/chromium/media/base/pipeline_status.h
+++ b/chromium/media/base/pipeline_status.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/provision_fetcher.h b/chromium/media/base/provision_fetcher.h
index 48135306722..9a073997b0d 100644
--- a/chromium/media/base/provision_fetcher.h
+++ b/chromium/media/base/provision_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/ranges.cc b/chromium/media/base/ranges.cc
index b7b2b55adb8..2f4d81e6c42 100644
--- a/chromium/media/base/ranges.cc
+++ b/chromium/media/base/ranges.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/ranges.h b/chromium/media/base/ranges.h
index d9aa4803d69..0ebea16b310 100644
--- a/chromium/media/base/ranges.h
+++ b/chromium/media/base/ranges.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/ranges_unittest.cc b/chromium/media/base/ranges_unittest.cc
index b76e7fe4543..687a1ae4044 100644
--- a/chromium/media/base/ranges_unittest.cc
+++ b/chromium/media/base/ranges_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/reentrancy_checker.cc b/chromium/media/base/reentrancy_checker.cc
index 296503debd6..98b8f37986c 100644
--- a/chromium/media/base/reentrancy_checker.cc
+++ b/chromium/media/base/reentrancy_checker.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/reentrancy_checker.h b/chromium/media/base/reentrancy_checker.h
index 1519694934e..e84890b6a76 100644
--- a/chromium/media/base/reentrancy_checker.h
+++ b/chromium/media/base/reentrancy_checker.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/reentrancy_checker_unittest.cc b/chromium/media/base/reentrancy_checker_unittest.cc
index 0f0ae67882f..f028067d36d 100644
--- a/chromium/media/base/reentrancy_checker_unittest.cc
+++ b/chromium/media/base/reentrancy_checker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/renderer.cc b/chromium/media/base/renderer.cc
index e2cb8d39e22..232de6cbb36 100644
--- a/chromium/media/base/renderer.cc
+++ b/chromium/media/base/renderer.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/renderer.h b/chromium/media/base/renderer.h
index b7738604fa2..8fdc6080c14 100644
--- a/chromium/media/base/renderer.h
+++ b/chromium/media/base/renderer.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/renderer_client.cc b/chromium/media/base/renderer_client.cc
index ff7c1d57aef..6690bab966e 100644
--- a/chromium/media/base/renderer_client.cc
+++ b/chromium/media/base/renderer_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/renderer_client.h b/chromium/media/base/renderer_client.h
index e8e3de956a8..ad3ffecc307 100644
--- a/chromium/media/base/renderer_client.h
+++ b/chromium/media/base/renderer_client.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/renderer_factory.cc b/chromium/media/base/renderer_factory.cc
index 00998b88c32..1cee7a73f3b 100644
--- a/chromium/media/base/renderer_factory.cc
+++ b/chromium/media/base/renderer_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/renderer_factory.h b/chromium/media/base/renderer_factory.h
index 42e55006f00..c3b417e4a83 100644
--- a/chromium/media/base/renderer_factory.h
+++ b/chromium/media/base/renderer_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/renderer_factory_selector.cc b/chromium/media/base/renderer_factory_selector.cc
index 15c5c2f1953..83249b215b1 100644
--- a/chromium/media/base/renderer_factory_selector.cc
+++ b/chromium/media/base/renderer_factory_selector.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/renderer_factory_selector.h b/chromium/media/base/renderer_factory_selector.h
index 8be6f06500e..96eee86f7e7 100644
--- a/chromium/media/base/renderer_factory_selector.h
+++ b/chromium/media/base/renderer_factory_selector.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/renderer_factory_selector_unittest.cc b/chromium/media/base/renderer_factory_selector_unittest.cc
index 755b07d0742..31b113bdb62 100644
--- a/chromium/media/base/renderer_factory_selector_unittest.cc
+++ b/chromium/media/base/renderer_factory_selector_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/routing_token_callback.h b/chromium/media/base/routing_token_callback.h
index cecff0f6219..6603260531f 100644
--- a/chromium/media/base/routing_token_callback.h
+++ b/chromium/media/base/routing_token_callback.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/run_all_perftests.cc b/chromium/media/base/run_all_perftests.cc
index 435d8060899..ba1663f1121 100644
--- a/chromium/media/base/run_all_perftests.cc
+++ b/chromium/media/base/run_all_perftests.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/sample_format.cc b/chromium/media/base/sample_format.cc
index a87817f4aab..4b973f632e2 100644
--- a/chromium/media/base/sample_format.cc
+++ b/chromium/media/base/sample_format.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,6 +30,7 @@ int SampleFormatToBytesPerChannel(SampleFormat sample_format) {
case kSampleFormatF32:
case kSampleFormatPlanarF32:
case kSampleFormatPlanarS32:
+ case kSampleFormatIECDts:
return 4;
}
@@ -73,6 +74,8 @@ const char* SampleFormatToString(SampleFormat sample_format) {
return "Compressed DTS bitstream";
case kSampleFormatDtsxP2:
return "Compressed DTSXP2 bitstream";
+ case kSampleFormatIECDts:
+ return "IEC-61937 encapsulated DTS bitstream";
}
NOTREACHED() << "Invalid sample format provided: " << sample_format;
return "";
@@ -96,6 +99,7 @@ bool IsPlanar(SampleFormat sample_format) {
case kSampleFormatMpegHAudio:
case kSampleFormatDts:
case kSampleFormatDtsxP2:
+ case kSampleFormatIECDts:
return false;
}
@@ -115,6 +119,7 @@ bool IsInterleaved(SampleFormat sample_format) {
case kSampleFormatMpegHAudio:
case kSampleFormatDts:
case kSampleFormatDtsxP2:
+ case kSampleFormatIECDts:
return true;
case kUnknownSampleFormat:
case kSampleFormatPlanarU8:
@@ -135,6 +140,7 @@ bool IsBitstream(SampleFormat sample_format) {
case kSampleFormatMpegHAudio:
case kSampleFormatDts:
case kSampleFormatDtsxP2:
+ case kSampleFormatIECDts:
// If on-device decoding is required, the sample format will be
// kSampleFormatS16, so it will return false. If bit-stream passthrough
// is required, the sample format would already be
diff --git a/chromium/media/base/sample_format.h b/chromium/media/base/sample_format.h
index 3f9204d0f2d..ed4735a80da 100644
--- a/chromium/media/base/sample_format.h
+++ b/chromium/media/base/sample_format.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -29,9 +29,10 @@ enum SampleFormat {
kSampleFormatPlanarU8, // Unsigned 8-bit w/ bias of 128 planar.
kSampleFormatDts, // Compressed DTS audio bitstream.
kSampleFormatDtsxP2, // Compressed DTSX audio bitstream.
+ kSampleFormatIECDts, // IEC-61937 encapsulated DTS audio bitstream.
// Must always be equal to largest value ever logged.
- kSampleFormatMax = kSampleFormatDtsxP2,
+ kSampleFormatMax = kSampleFormatIECDts,
};
// Returns the number of bytes used per channel for the specified
diff --git a/chromium/media/base/sample_rates.cc b/chromium/media/base/sample_rates.cc
index 9d55ba747e8..8439b2dff88 100644
--- a/chromium/media/base/sample_rates.cc
+++ b/chromium/media/base/sample_rates.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/sample_rates.h b/chromium/media/base/sample_rates.h
index 80aa2ff5ca9..ca6e1849251 100644
--- a/chromium/media/base/sample_rates.h
+++ b/chromium/media/base/sample_rates.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/scoped_async_trace.cc b/chromium/media/base/scoped_async_trace.cc
index 83f6d5f64b0..3bfc07dbf95 100644
--- a/chromium/media/base/scoped_async_trace.cc
+++ b/chromium/media/base/scoped_async_trace.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/scoped_async_trace.h b/chromium/media/base/scoped_async_trace.h
index d6912a7b541..ae0eafeab72 100644
--- a/chromium/media/base/scoped_async_trace.h
+++ b/chromium/media/base/scoped_async_trace.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/scopedfd_helper.cc b/chromium/media/base/scopedfd_helper.cc
index 8dcf3dc1f16..966425e0b2f 100644
--- a/chromium/media/base/scopedfd_helper.cc
+++ b/chromium/media/base/scopedfd_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/scopedfd_helper.h b/chromium/media/base/scopedfd_helper.h
index 68b7880bfcf..cb1a677fe07 100644
--- a/chromium/media/base/scopedfd_helper.h
+++ b/chromium/media/base/scopedfd_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/seekable_buffer.cc b/chromium/media/base/seekable_buffer.cc
index a3766bcc003..ff98e068b5f 100644
--- a/chromium/media/base/seekable_buffer.cc
+++ b/chromium/media/base/seekable_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/seekable_buffer.h b/chromium/media/base/seekable_buffer.h
index 605e196fb0f..70ff4dc8c20 100644
--- a/chromium/media/base/seekable_buffer.h
+++ b/chromium/media/base/seekable_buffer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/seekable_buffer_unittest.cc b/chromium/media/base/seekable_buffer_unittest.cc
index df18af5d516..8e913202627 100644
--- a/chromium/media/base/seekable_buffer_unittest.cc
+++ b/chromium/media/base/seekable_buffer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/serial_runner.cc b/chromium/media/base/serial_runner.cc
index 683974a3b2c..d43a34ece33 100644
--- a/chromium/media/base/serial_runner.cc
+++ b/chromium/media/base/serial_runner.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/serial_runner.h b/chromium/media/base/serial_runner.h
index da9117d9490..959816eb028 100644
--- a/chromium/media/base/serial_runner.h
+++ b/chromium/media/base/serial_runner.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/serial_runner_unittest.cc b/chromium/media/base/serial_runner_unittest.cc
index b37bff497c4..e3e4a40d3a3 100644
--- a/chromium/media/base/serial_runner_unittest.cc
+++ b/chromium/media/base/serial_runner_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/silent_sink_suspender.cc b/chromium/media/base/silent_sink_suspender.cc
index ce424681ab4..d5ab8f5b3cd 100644
--- a/chromium/media/base/silent_sink_suspender.cc
+++ b/chromium/media/base/silent_sink_suspender.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/silent_sink_suspender.h b/chromium/media/base/silent_sink_suspender.h
index 7be7ab3900c..2432e27e077 100644
--- a/chromium/media/base/silent_sink_suspender.h
+++ b/chromium/media/base/silent_sink_suspender.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/silent_sink_suspender_unittest.cc b/chromium/media/base/silent_sink_suspender_unittest.cc
index e9a69e3b318..520cf26c73d 100644
--- a/chromium/media/base/silent_sink_suspender_unittest.cc
+++ b/chromium/media/base/silent_sink_suspender_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,7 +19,10 @@ namespace media {
class SilentSinkSuspenderTest : public testing::Test {
public:
SilentSinkSuspenderTest()
- : params_(AudioParameters::AUDIO_FAKE, CHANNEL_LAYOUT_MONO, 44100, 128),
+ : params_(AudioParameters::AUDIO_FAKE,
+ ChannelLayoutConfig::Mono(),
+ 44100,
+ 128),
mock_sink_(new testing::StrictMock<MockAudioRendererSink>()),
fake_callback_(0.1, params_.sample_rate()),
temp_bus_(AudioBus::Create(params_)),
diff --git a/chromium/media/base/simple_sync_token_client.cc b/chromium/media/base/simple_sync_token_client.cc
index fcd06296ee6..373be4d6757 100644
--- a/chromium/media/base/simple_sync_token_client.cc
+++ b/chromium/media/base/simple_sync_token_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/simple_sync_token_client.h b/chromium/media/base/simple_sync_token_client.h
index 5c8fbb76ebb..c5857793940 100644
--- a/chromium/media/base/simple_sync_token_client.h
+++ b/chromium/media/base/simple_sync_token_client.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/simple_watch_timer.cc b/chromium/media/base/simple_watch_timer.cc
index c9108924709..aa9a39e89de 100644
--- a/chromium/media/base/simple_watch_timer.cc
+++ b/chromium/media/base/simple_watch_timer.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/simple_watch_timer.h b/chromium/media/base/simple_watch_timer.h
index 2963fe02bf5..152ff7dad9c 100644
--- a/chromium/media/base/simple_watch_timer.h
+++ b/chromium/media/base/simple_watch_timer.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/sinc_resampler.cc b/chromium/media/base/sinc_resampler.cc
index 96a032910d7..1a53e84b5c0 100644
--- a/chromium/media/base/sinc_resampler.cc
+++ b/chromium/media/base/sinc_resampler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/base/sinc_resampler.h b/chromium/media/base/sinc_resampler.h
index 6d069fb4d0a..5ba1adab604 100644
--- a/chromium/media/base/sinc_resampler.h
+++ b/chromium/media/base/sinc_resampler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/sinc_resampler_perftest.cc b/chromium/media/base/sinc_resampler_perftest.cc
index 4ac8c8a2941..122e6962031 100644
--- a/chromium/media/base/sinc_resampler_perftest.cc
+++ b/chromium/media/base/sinc_resampler_perftest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/sinc_resampler_unittest.cc b/chromium/media/base/sinc_resampler_unittest.cc
index 2faaade27a7..f77053c6536 100644
--- a/chromium/media/base/sinc_resampler_unittest.cc
+++ b/chromium/media/base/sinc_resampler_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/speech_recognition_client.h b/chromium/media/base/speech_recognition_client.h
index 8103b6a6eca..6182c2e58b1 100644
--- a/chromium/media/base/speech_recognition_client.h
+++ b/chromium/media/base/speech_recognition_client.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/status.cc b/chromium/media/base/status.cc
index 060b46a4ad8..792c38e68c9 100644
--- a/chromium/media/base/status.cc
+++ b/chromium/media/base/status.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/status.h b/chromium/media/base/status.h
index 4d5452c1148..7d80fd598e6 100644
--- a/chromium/media/base/status.h
+++ b/chromium/media/base/status.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/status_unittest.cc b/chromium/media/base/status_unittest.cc
index d77e18258fd..c8a23241fd8 100644
--- a/chromium/media/base/status_unittest.cc
+++ b/chromium/media/base/status_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/stream_parser.cc b/chromium/media/base/stream_parser.cc
index e7cb46769ed..69a45b81da1 100644
--- a/chromium/media/base/stream_parser.cc
+++ b/chromium/media/base/stream_parser.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/stream_parser.h b/chromium/media/base/stream_parser.h
index 4a0b0cae194..86069bbea60 100644
--- a/chromium/media/base/stream_parser.h
+++ b/chromium/media/base/stream_parser.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -119,15 +119,14 @@ class MEDIA_EXPORT StreamParser {
// been parsed to determine the initial stream configurations, presentation
// start time, and duration. If |ignore_text_track| is true, then no text
// buffers should be passed later by the parser to |new_buffers_cb|.
- virtual void Init(
- InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
- bool ignore_text_track,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
- MediaLog* media_log) = 0;
+ virtual void Init(InitCB init_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
+ bool ignore_text_track,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
+ MediaLog* media_log) = 0;
// Called during the reset parser state algorithm. This flushes the current
// parser and puts the parser in a state where it can receive data. This
diff --git a/chromium/media/base/stream_parser_buffer.cc b/chromium/media/base/stream_parser_buffer.cc
index c064da21aae..63bdb31c7e7 100644
--- a/chromium/media/base/stream_parser_buffer.cc
+++ b/chromium/media/base/stream_parser_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/stream_parser_buffer.h b/chromium/media/base/stream_parser_buffer.h
index 9e4462905ff..55390b40e79 100644
--- a/chromium/media/base/stream_parser_buffer.h
+++ b/chromium/media/base/stream_parser_buffer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/stream_parser_unittest.cc b/chromium/media/base/stream_parser_unittest.cc
index 4be5165bd00..9f407047587 100644
--- a/chromium/media/base/stream_parser_unittest.cc
+++ b/chromium/media/base/stream_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/subsample_entry.cc b/chromium/media/base/subsample_entry.cc
index 85975ce2005..c9ee2617b4f 100644
--- a/chromium/media/base/subsample_entry.cc
+++ b/chromium/media/base/subsample_entry.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/subsample_entry.h b/chromium/media/base/subsample_entry.h
index f4117f61c5a..9c5328935d9 100644
--- a/chromium/media/base/subsample_entry.h
+++ b/chromium/media/base/subsample_entry.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/subsample_entry_unittest.cc b/chromium/media/base/subsample_entry_unittest.cc
index 84b0d28c6c0..5622a4e3713 100644
--- a/chromium/media/base/subsample_entry_unittest.cc
+++ b/chromium/media/base/subsample_entry_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/supported_types.cc b/chromium/media/base/supported_types.cc
index c2efcdbb743..c47d83f0c06 100644
--- a/chromium/media/base/supported_types.cc
+++ b/chromium/media/base/supported_types.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -205,7 +205,8 @@ bool IsHevcProfileSupported(const VideoType& type) {
return false;
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \
+ BUILDFLAG(IS_MAC)
#if BUILDFLAG(IS_CHROMEOS_LACROS)
// TODO(b/171813538): For Lacros, the supplemental profile cache will be
// asking lacros-gpu, but we will be doing decoding in ash-gpu. Until the
@@ -217,14 +218,6 @@ bool IsHevcProfileSupported(const VideoType& type) {
}
#endif // BUILDFLAG(IS_CHROMEOS_LACROS)
return GetSupplementalProfileCache()->IsProfileSupported(type.profile);
-#elif BUILDFLAG(IS_MAC)
- if (__builtin_available(macOS 11.0, *))
- return base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport) &&
- (type.profile == HEVCPROFILE_MAIN ||
- type.profile == HEVCPROFILE_MAIN10 ||
- type.profile == HEVCPROFILE_MAIN_STILL_PICTURE ||
- type.profile == HEVCPROFILE_REXT);
- return false;
#elif BUILDFLAG(IS_ANDROID)
// Technically android 5.0 mandates support for only HEVC main profile,
// however some platforms (like chromecast) have had more profiles supported
@@ -232,7 +225,8 @@ bool IsHevcProfileSupported(const VideoType& type) {
return base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport);
#else
return true;
-#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_MAC)
#else
return false;
#endif // BUILDFLAG(ENABLE_PLATFORM_HEVC)
@@ -404,6 +398,28 @@ bool IsDefaultSupportedAudioType(const AudioType& type) {
}
}
+bool IsBuiltInVideoCodec(VideoCodec codec) {
+#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
+ if (codec == VideoCodec::kTheora)
+ return true;
+ if (codec == VideoCodec::kVP8)
+ return true;
+#if BUILDFLAG(USE_PROPRIETARY_CODECS)
+ if (codec == VideoCodec::kH264)
+ return true;
+#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
+#endif // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
+#if BUILDFLAG(ENABLE_LIBVPX)
+ if (codec == VideoCodec::kVP8 || codec == VideoCodec::kVP9)
+ return true;
+#endif // BUILDFLAG(ENABLE_LIBVPX)
+#if BUILDFLAG(ENABLE_AV1_DECODER)
+ if (codec == VideoCodec::kAV1)
+ return true;
+#endif // BUILDFLAG(ENABLE_AV1_DECODER)
+ return false;
+}
+
void UpdateDefaultSupportedVideoProfiles(
const base::flat_set<media::VideoCodecProfile>& profiles) {
GetSupplementalProfileCache()->UpdateCache(profiles);
diff --git a/chromium/media/base/supported_types.h b/chromium/media/base/supported_types.h
index 0bbb6e6cc3f..0e8148e1ab7 100644
--- a/chromium/media/base/supported_types.h
+++ b/chromium/media/base/supported_types.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#define MEDIA_BASE_SUPPORTED_TYPES_H_
#include "base/containers/flat_set.h"
+#include "media/base/media_export.h"
#include "media/base/media_types.h"
namespace media {
@@ -22,6 +23,10 @@ MEDIA_EXPORT bool IsSupportedVideoType(const VideoType& type);
MEDIA_EXPORT bool IsDefaultSupportedAudioType(const AudioType& type);
MEDIA_EXPORT bool IsDefaultSupportedVideoType(const VideoType& type);
+// This function describe if the specific video codec is a built into the binary
+// or not.
+MEDIA_EXPORT bool IsBuiltInVideoCodec(VideoCodec codec);
+
// This function lets the caller add additional codec profiles to those
// supported by default. Used primarily to add hardware codec profiles once
// support is known.
diff --git a/chromium/media/base/supported_types_unittest.cc b/chromium/media/base/supported_types_unittest.cc
index 1d0f12e0bfa..360b591c079 100644
--- a/chromium/media/base/supported_types_unittest.cc
+++ b/chromium/media/base/supported_types_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -52,9 +52,6 @@ TEST(SupportedTypesTest, IsSupportedVideoTypeBasics) {
EXPECT_FALSE(
IsSupportedVideoType({VideoCodec::kMPEG2, VIDEO_CODEC_PROFILE_UNKNOWN,
kUnspecifiedLevel, kColorSpace}));
- EXPECT_FALSE(
- IsSupportedVideoType({VideoCodec::kHEVC, VIDEO_CODEC_PROFILE_UNKNOWN,
- kUnspecifiedLevel, kColorSpace}));
// Expect conditional support for the following.
EXPECT_EQ(kPropCodecsEnabled,
@@ -64,6 +61,16 @@ TEST(SupportedTypesTest, IsSupportedVideoTypeBasics) {
kMpeg4Supported,
IsSupportedVideoType({VideoCodec::kMPEG4, VIDEO_CODEC_PROFILE_UNKNOWN,
kUnspecifiedLevel, kColorSpace}));
+
+#if BUILDFLAG(ENABLE_PLATFORM_HEVC) && BUILDFLAG(IS_ANDROID)
+ EXPECT_TRUE(
+ IsSupportedVideoType({VideoCodec::kHEVC, VIDEO_CODEC_PROFILE_UNKNOWN,
+ kUnspecifiedLevel, kColorSpace}));
+#else
+ EXPECT_FALSE(
+ IsSupportedVideoType({VideoCodec::kHEVC, VIDEO_CODEC_PROFILE_UNKNOWN,
+ kUnspecifiedLevel, kColorSpace}));
+#endif
}
TEST(SupportedTypesTest, IsSupportedVideoType_VP9TransferFunctions) {
@@ -236,14 +243,13 @@ TEST(SupportedTypesTest, IsSupportedAudioTypeWithSpatialRenderingBasics) {
EXPECT_FALSE(IsSupportedAudioType({AudioCodec::kMpegHAudio,
AudioCodecProfile::kUnknown,
is_spatial_rendering}));
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
EXPECT_FALSE(IsSupportedAudioType(
{AudioCodec::kDTS, AudioCodecProfile::kUnknown, is_spatial_rendering}));
EXPECT_FALSE(
IsSupportedAudioType({AudioCodec::kDTSXP2, AudioCodecProfile::kUnknown,
is_spatial_rendering}));
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
EXPECT_FALSE(
IsSupportedAudioType({AudioCodec::kUnknown, AudioCodecProfile::kUnknown,
is_spatial_rendering}));
@@ -317,4 +323,44 @@ TEST(SupportedTypesTest, IsSupportedVideoTypeWithHdrMetadataBasics) {
kUnspecifiedLevel, color_space,
gfx::HdrMetadataType::kSmpteSt2094_40}));
}
+
+TEST(SupportedTypesTest, IsBuiltInVideoCodec) {
+#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
+ EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kH264));
+#else
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kH264));
+#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
+ // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
+
+#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
+ EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kTheora));
+#else
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kTheora));
+#endif // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
+
+#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) || BUILDFLAG(ENABLE_LIBVPX)
+ EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kVP8));
+#else
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kVP8));
+#endif // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) || BUILDFLAG(ENABLE_LIBVPX)
+
+#if BUILDFLAG(ENABLE_LIBVPX)
+ EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kVP9));
+#else
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kVP9));
+#endif // BUILDFLAG(ENABLE_LIBVPX)
+
+#if BUILDFLAG(ENABLE_AV1_DECODER)
+ EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kAV1));
+#else
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kAV1));
+#endif // BUILDFLAG(ENABLE_AV1_DECODER)
+
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kUnknown));
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kMPEG4));
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kVC1));
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kMPEG2));
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kHEVC));
+ EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kDolbyVision));
+}
} // namespace media
diff --git a/chromium/media/base/supported_video_decoder_config.cc b/chromium/media/base/supported_video_decoder_config.cc
index b3966073ee6..89b750bdbc0 100644
--- a/chromium/media/base/supported_video_decoder_config.cc
+++ b/chromium/media/base/supported_video_decoder_config.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/supported_video_decoder_config.h b/chromium/media/base/supported_video_decoder_config.h
index fc899eba76f..19ee80bf848 100644
--- a/chromium/media/base/supported_video_decoder_config.h
+++ b/chromium/media/base/supported_video_decoder_config.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/supported_video_decoder_config_unittest.cc b/chromium/media/base/supported_video_decoder_config_unittest.cc
index 14f0ad9146f..e9356c64c37 100644
--- a/chromium/media/base/supported_video_decoder_config_unittest.cc
+++ b/chromium/media/base/supported_video_decoder_config_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/svc_scalability_mode.cc b/chromium/media/base/svc_scalability_mode.cc
index 13eca157f43..d08fe196eb0 100644
--- a/chromium/media/base/svc_scalability_mode.cc
+++ b/chromium/media/base/svc_scalability_mode.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/svc_scalability_mode.h b/chromium/media/base/svc_scalability_mode.h
index 65ce610af07..cd6cf5a20e1 100644
--- a/chromium/media/base/svc_scalability_mode.h
+++ b/chromium/media/base/svc_scalability_mode.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/test_data_util.cc b/chromium/media/base/test_data_util.cc
index 0858b67d0dc..bdb5b3ecd42 100644
--- a/chromium/media/base/test_data_util.cc
+++ b/chromium/media/base/test_data_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -223,6 +223,13 @@ scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name) {
return buffer;
}
+scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name,
+ base::TimeDelta pts) {
+ auto buffer = ReadTestDataFile(name);
+ buffer->set_timestamp(pts);
+ return buffer;
+}
+
bool LookupTestKeyVector(const std::vector<uint8_t>& key_id,
bool allow_rotation,
std::vector<uint8_t>* key) {
diff --git a/chromium/media/base/test_data_util.h b/chromium/media/base/test_data_util.h
index 79adec7de2e..2b1bb9fe7db 100644
--- a/chromium/media/base/test_data_util.h
+++ b/chromium/media/base/test_data_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_split.h"
+#include "base/time/time.h"
namespace media {
@@ -44,6 +45,11 @@ std::string GetURLQueryString(const base::StringPairs& query_params);
// |buffer| - The contents of the file.
scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name);
+// Reads a decoder buffer from a file as well, but also sets the presentation
+// timestamp on it.
+scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name,
+ base::TimeDelta pts);
+
// If the provided |key_id| is that of a test key, returns true and fills the
// |key|, otherwise returns false. If |allowRotation| is true, then other valid
// values are obtained by rotating the original key_id and key. Two overloads
diff --git a/chromium/media/base/test_helpers.cc b/chromium/media/base/test_helpers.cc
index 3a870c038d0..bb991588440 100644
--- a/chromium/media/base/test_helpers.cc
+++ b/chromium/media/base/test_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -308,7 +308,7 @@ int TestAudioConfig::HighSampleRateValue() {
// static
AudioParameters TestAudioParameters::Normal() {
return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, 48000, 2048);
+ ChannelLayoutConfig::Stereo(), 48000, 2048);
}
template <class T>
diff --git a/chromium/media/base/test_helpers.h b/chromium/media/base/test_helpers.h
index b90bd816e99..f0b5fa30e52 100644
--- a/chromium/media/base/test_helpers.h
+++ b/chromium/media/base/test_helpers.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/test_random.h b/chromium/media/base/test_random.h
index 6c5eb51392b..699372758c7 100644
--- a/chromium/media/base/test_random.h
+++ b/chromium/media/base/test_random.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_cue.cc b/chromium/media/base/text_cue.cc
index 98d7757409a..9a99336e740 100644
--- a/chromium/media/base/text_cue.cc
+++ b/chromium/media/base/text_cue.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_cue.h b/chromium/media/base/text_cue.h
index fb5e8621b04..8cb57fe5df4 100644
--- a/chromium/media/base/text_cue.h
+++ b/chromium/media/base/text_cue.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_ranges.cc b/chromium/media/base/text_ranges.cc
index c57dc65529e..a52ed0d5f5e 100644
--- a/chromium/media/base/text_ranges.cc
+++ b/chromium/media/base/text_ranges.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_ranges.h b/chromium/media/base/text_ranges.h
index 64a384039b5..903c79296a5 100644
--- a/chromium/media/base/text_ranges.h
+++ b/chromium/media/base/text_ranges.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_ranges_unittest.cc b/chromium/media/base/text_ranges_unittest.cc
index 979ec2dd9b3..fd62bca83d9 100644
--- a/chromium/media/base/text_ranges_unittest.cc
+++ b/chromium/media/base/text_ranges_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_renderer.cc b/chromium/media/base/text_renderer.cc
index 93b3dba0861..d57f750f819 100644
--- a/chromium/media/base/text_renderer.cc
+++ b/chromium/media/base/text_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_renderer.h b/chromium/media/base/text_renderer.h
index 8efadcbf238..1494900090e 100644
--- a/chromium/media/base/text_renderer.h
+++ b/chromium/media/base/text_renderer.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_renderer_unittest.cc b/chromium/media/base/text_renderer_unittest.cc
index 68e805b7234..294f42537da 100644
--- a/chromium/media/base/text_renderer_unittest.cc
+++ b/chromium/media/base/text_renderer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_track.h b/chromium/media/base/text_track.h
index 4d594a0bc50..abe49706cf0 100644
--- a/chromium/media/base/text_track.h
+++ b/chromium/media/base/text_track.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_track_config.cc b/chromium/media/base/text_track_config.cc
index a736883b956..33ed51db546 100644
--- a/chromium/media/base/text_track_config.cc
+++ b/chromium/media/base/text_track_config.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/text_track_config.h b/chromium/media/base/text_track_config.h
index 07f604d9fb3..c06226eb90b 100644
--- a/chromium/media/base/text_track_config.h
+++ b/chromium/media/base/text_track_config.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/time_delta_interpolator.cc b/chromium/media/base/time_delta_interpolator.cc
index a6eb4bfad72..06861b5a54a 100644
--- a/chromium/media/base/time_delta_interpolator.cc
+++ b/chromium/media/base/time_delta_interpolator.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/time_delta_interpolator.h b/chromium/media/base/time_delta_interpolator.h
index 80fe94b9b72..95757ca0183 100644
--- a/chromium/media/base/time_delta_interpolator.h
+++ b/chromium/media/base/time_delta_interpolator.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/time_delta_interpolator_unittest.cc b/chromium/media/base/time_delta_interpolator_unittest.cc
index c1c7935ea31..7caa8a193c4 100644
--- a/chromium/media/base/time_delta_interpolator_unittest.cc
+++ b/chromium/media/base/time_delta_interpolator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/time_source.h b/chromium/media/base/time_source.h
index 92d6528d909..3dc2b8a530b 100644
--- a/chromium/media/base/time_source.h
+++ b/chromium/media/base/time_source.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/timestamp_constants.h b/chromium/media/base/timestamp_constants.h
index 1e47f8f0f00..715f54f38fb 100644
--- a/chromium/media/base/timestamp_constants.h
+++ b/chromium/media/base/timestamp_constants.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/tuneable.cc b/chromium/media/base/tuneable.cc
index d018fd6eee1..cc6b3d5e5ff 100644
--- a/chromium/media/base/tuneable.cc
+++ b/chromium/media/base/tuneable.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/tuneable.h b/chromium/media/base/tuneable.h
index bee6e132942..b9808a50424 100644
--- a/chromium/media/base/tuneable.h
+++ b/chromium/media/base/tuneable.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/tuneable_unittest.cc b/chromium/media/base/tuneable_unittest.cc
index f1e5108c1ff..70b6ee56fd1 100644
--- a/chromium/media/base/tuneable_unittest.cc
+++ b/chromium/media/base/tuneable_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/use_after_free_checker.h b/chromium/media/base/use_after_free_checker.h
index b50f704603d..86692309b83 100644
--- a/chromium/media/base/use_after_free_checker.h
+++ b/chromium/media/base/use_after_free_checker.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/user_input_monitor.cc b/chromium/media/base/user_input_monitor.cc
index ecea25e9ea6..6fa9f619f85 100644
--- a/chromium/media/base/user_input_monitor.cc
+++ b/chromium/media/base/user_input_monitor.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/user_input_monitor.h b/chromium/media/base/user_input_monitor.h
index 08c529924e3..ea1eda9ec74 100644
--- a/chromium/media/base/user_input_monitor.h
+++ b/chromium/media/base/user_input_monitor.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/user_input_monitor_linux.cc b/chromium/media/base/user_input_monitor_linux.cc
index 4aabec94662..3fc7a43f0c8 100644
--- a/chromium/media/base/user_input_monitor_linux.cc
+++ b/chromium/media/base/user_input_monitor_linux.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/user_input_monitor_mac.cc b/chromium/media/base/user_input_monitor_mac.cc
index 8cf48912bc3..0c2e3263eb0 100644
--- a/chromium/media/base/user_input_monitor_mac.cc
+++ b/chromium/media/base/user_input_monitor_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/user_input_monitor_unittest.cc b/chromium/media/base/user_input_monitor_unittest.cc
index 58c9d92716a..71990e8c75c 100644
--- a/chromium/media/base/user_input_monitor_unittest.cc
+++ b/chromium/media/base/user_input_monitor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/user_input_monitor_win.cc b/chromium/media/base/user_input_monitor_win.cc
index 9867d33d0b2..56c9f5e5dc0 100644
--- a/chromium/media/base/user_input_monitor_win.cc
+++ b/chromium/media/base/user_input_monitor_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/vector_math.cc b/chromium/media/base/vector_math.cc
index e919bbaa15a..39f29c2a5f9 100644
--- a/chromium/media/base/vector_math.cc
+++ b/chromium/media/base/vector_math.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,33 +8,23 @@
#include <algorithm>
#include "base/check_op.h"
+#include "base/cpu.h"
#include "base/memory/aligned_memory.h"
#include "build/build_config.h"
// NaCl does not allow intrinsics.
#if defined(ARCH_CPU_X86_FAMILY) && !BUILDFLAG(IS_NACL)
-#include <xmmintrin.h>
-// Don't use custom SSE versions where the auto-vectorized C version performs
-// better, which is anywhere clang is used.
+#include <immintrin.h>
+// Including these headers directly should generally be avoided. Since
+// Chrome is compiled with -msse3 (the minimal requirement), we include the
+// headers directly to make the intrinsics available.
+#include <avxintrin.h>
+#include <avx2intrin.h>
+#include <fmaintrin.h>
// TODO(pcc): Linux currently uses ThinLTO which has broken auto-vectorization
// in clang, so use our intrinsic version for now. http://crbug.com/738085
-#if !defined(__clang__) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
-#define FMAC_FUNC FMAC_SSE
-#define FMUL_FUNC FMUL_SSE
-#else
-#define FMAC_FUNC FMAC_C
-#define FMUL_FUNC FMUL_C
-#endif
-#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE
#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
#include <arm_neon.h>
-#define FMAC_FUNC FMAC_NEON
-#define FMUL_FUNC FMUL_NEON
-#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_NEON
-#else
-#define FMAC_FUNC FMAC_C
-#define FMUL_FUNC FMUL_C
-#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_C
#endif
namespace media {
@@ -43,7 +33,20 @@ namespace vector_math {
void FMAC(const float src[], float scale, int len, float dest[]) {
DCHECK(base::IsAligned(src, kRequiredAlignment));
DCHECK(base::IsAligned(dest, kRequiredAlignment));
- return FMAC_FUNC(src, scale, len, dest);
+ static const auto fmac_func = [] {
+#if defined(ARCH_CPU_X86_FAMILY) && !BUILDFLAG(IS_NACL)
+ base::CPU cpu;
+ if (cpu.has_avx2() && cpu.has_fma3())
+ return FMAC_AVX2;
+ return FMAC_SSE;
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
+ return FMAC_NEON;
+#else
+ return FMAC_C;
+#endif
+ }();
+
+ return fmac_func(src, scale, len, dest);
}
void FMAC_C(const float src[], float scale, int len, float dest[]) {
@@ -54,7 +57,20 @@ void FMAC_C(const float src[], float scale, int len, float dest[]) {
void FMUL(const float src[], float scale, int len, float dest[]) {
DCHECK(base::IsAligned(src, kRequiredAlignment));
DCHECK(base::IsAligned(dest, kRequiredAlignment));
- return FMUL_FUNC(src, scale, len, dest);
+ static const auto fmul_func = [] {
+#if defined(ARCH_CPU_X86_FAMILY) && !BUILDFLAG(IS_NACL)
+ base::CPU cpu;
+ if (cpu.has_avx2())
+ return FMUL_AVX2;
+ return FMUL_SSE;
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
+ return FMUL_NEON;
+#else
+ return FMUL_C;
+#endif
+ }();
+
+ return fmul_func(src, scale, len, dest);
}
void FMUL_C(const float src[], float scale, int len, float dest[]) {
@@ -65,7 +81,20 @@ void FMUL_C(const float src[], float scale, int len, float dest[]) {
std::pair<float, float> EWMAAndMaxPower(
float initial_value, const float src[], int len, float smoothing_factor) {
DCHECK(base::IsAligned(src, kRequiredAlignment));
- return EWMAAndMaxPower_FUNC(initial_value, src, len, smoothing_factor);
+ static const auto ewma_and_max_power_func = [] {
+#if defined(ARCH_CPU_X86_FAMILY) && !BUILDFLAG(IS_NACL)
+ base::CPU cpu;
+ if (cpu.has_avx2() && cpu.has_fma3())
+ return EWMAAndMaxPower_AVX2;
+ return EWMAAndMaxPower_SSE;
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
+ return EWMAAndMaxPower_NEON;
+#else
+ return EWMAAndMaxPower_C;
+#endif
+ }();
+
+ return ewma_and_max_power_func(initial_value, src, len, smoothing_factor);
}
std::pair<float, float> EWMAAndMaxPower_C(
@@ -95,6 +124,44 @@ void FMUL_SSE(const float src[], float scale, int len, float dest[]) {
dest[i] = src[i] * scale;
}
+__attribute__((target("avx2"))) void FMUL_AVX2(const float src[],
+ float scale,
+ int len,
+ float dest[]) {
+ const int rem = len % 8;
+ const int last_index = len - rem;
+ __m256 m_scale = _mm256_set1_ps(scale);
+ // TODO(crbug.com/1191301): Remove below alignment conditionals when AudioBus
+ // |kChannelAlignment| updated to 32.
+ bool aligned_src = (reinterpret_cast<uintptr_t>(src) & 0x1F) == 0;
+ bool aligned_dest = (reinterpret_cast<uintptr_t>(dest) & 0x1F) == 0;
+ if (aligned_src) {
+ if (aligned_dest) {
+ for (int i = 0; i < last_index; i += 8)
+ _mm256_store_ps(dest + i,
+ _mm256_mul_ps(_mm256_load_ps(src + i), m_scale));
+ } else {
+ for (int i = 0; i < last_index; i += 8)
+ _mm256_storeu_ps(dest + i,
+ _mm256_mul_ps(_mm256_load_ps(src + i), m_scale));
+ }
+ } else {
+ if (aligned_dest) {
+ for (int i = 0; i < last_index; i += 8)
+ _mm256_store_ps(dest + i,
+ _mm256_mul_ps(_mm256_loadu_ps(src + i), m_scale));
+ } else {
+ for (int i = 0; i < last_index; i += 8)
+ _mm256_storeu_ps(dest + i,
+ _mm256_mul_ps(_mm256_loadu_ps(src + i), m_scale));
+ }
+ }
+
+ // Handle any remaining values that wouldn't fit in an SSE pass.
+ for (int i = last_index; i < len; ++i)
+ dest[i] = src[i] * scale;
+}
+
void FMAC_SSE(const float src[], float scale, int len, float dest[]) {
const int rem = len % 4;
const int last_index = len - rem;
@@ -109,6 +176,48 @@ void FMAC_SSE(const float src[], float scale, int len, float dest[]) {
dest[i] += src[i] * scale;
}
+__attribute__((target("avx2,fma"))) void FMAC_AVX2(const float src[],
+ float scale,
+ int len,
+ float dest[]) {
+ const int rem = len % 8;
+ const int last_index = len - rem;
+ __m256 m_scale = _mm256_set1_ps(scale);
+ // TODO(crbug.com/1191301): Remove below alignment conditionals when AudioBus
+ // |kChannelAlignment| updated to 32.
+ bool aligned_src = (reinterpret_cast<uintptr_t>(src) & 0x1F) == 0;
+ bool aligned_dest = (reinterpret_cast<uintptr_t>(dest) & 0x1F) == 0;
+ if (aligned_src) {
+ if (aligned_dest) {
+ for (int i = 0; i < last_index; i += 8)
+ _mm256_store_ps(dest + i,
+ _mm256_fmadd_ps(_mm256_load_ps(src + i), m_scale,
+ _mm256_load_ps(dest + i)));
+ } else {
+ for (int i = 0; i < last_index; i += 8)
+ _mm256_storeu_ps(dest + i,
+ _mm256_fmadd_ps(_mm256_load_ps(src + i), m_scale,
+ _mm256_loadu_ps(dest + i)));
+ }
+ } else {
+ if (aligned_dest) {
+ for (int i = 0; i < last_index; i += 8)
+ _mm256_store_ps(dest + i,
+ _mm256_fmadd_ps(_mm256_loadu_ps(src + i), m_scale,
+ _mm256_load_ps(dest + i)));
+ } else {
+ for (int i = 0; i < last_index; i += 8)
+ _mm256_storeu_ps(dest + i,
+ _mm256_fmadd_ps(_mm256_loadu_ps(src + i), m_scale,
+ _mm256_loadu_ps(dest + i)));
+ }
+ }
+
+ // Handle any remaining values that wouldn't fit in an SSE pass.
+ for (int i = last_index; i < len; ++i)
+ dest[i] += src[i] * scale;
+}
+
// Convenience macro to extract float 0 through 3 from the vector |a|. This is
// needed because compilers other than clang don't support access via
// operator[]().
@@ -185,6 +294,79 @@ std::pair<float, float> EWMAAndMaxPower_SSE(
return result;
}
+
+__attribute__((target("avx2,fma"))) std::pair<float, float>
+EWMAAndMaxPower_AVX2(float initial_value,
+ const float src[],
+ int len,
+ float smoothing_factor) {
+ const int rem = len % 8;
+ const int last_index = len - rem;
+ const float weight_prev = 1.0f - smoothing_factor;
+
+ // y[7] = a(S[7]^2) + a(1-a)(S[6]^2) + a(1-a)^2(S[5]^2) + a(1-a)^3(S[4]^2) +
+ // a(1-a)^4(S[3]^2) + a(1-a)^5(S[2]^2) + a(1-a)^6(S[1]^2) +
+ // a(1-a)^7(S[0]^2) + (1-a)^8 * y[-1].
+ // = SumS[0-7] + (1-a)^8 * y[-1].
+ // y[15] = SumS[8-15] + (1-a)^8 * y[7].
+ // y[23] = SumS[16-23] + (1-a)^8 * y[15].
+ // ......
+ // So the strategy is to read 8 float data at a time, and then
+ // calculate the average power and the maximum squared element value.
+ const __m256 sum_coeff =
+ !weight_prev
+ ? _mm256_set_ps(smoothing_factor, 0, 0, 0, 0, 0, 0, 0)
+ : _mm256_set_ps(smoothing_factor, smoothing_factor * weight_prev,
+ smoothing_factor * std::pow(weight_prev, 2),
+ smoothing_factor * std::pow(weight_prev, 3),
+ smoothing_factor * std::pow(weight_prev, 4),
+ smoothing_factor * std::pow(weight_prev, 5),
+ smoothing_factor * std::pow(weight_prev, 6),
+ smoothing_factor * std::pow(weight_prev, 7));
+
+ __m256 max = _mm256_setzero_ps();
+ __m256 res = _mm256_set_ps(initial_value, 0, 0, 0, 0, 0, 0, 0);
+ __m256 res_coeff = !weight_prev ? _mm256_set1_ps(0)
+ : _mm256_set1_ps(std::pow(weight_prev, 8));
+ bool aligned_src = (reinterpret_cast<uintptr_t>(src) & 0x1F) == 0;
+ int i = 0;
+ for (; i < last_index; i += 8) {
+ __m256 sample =
+ aligned_src ? _mm256_load_ps(src + i) : _mm256_loadu_ps(src + i);
+ __m256 sample_x2 = _mm256_mul_ps(sample, sample);
+ max = _mm256_max_ps(max, sample_x2);
+ res = _mm256_fmadd_ps(sample_x2, sum_coeff, _mm256_mul_ps(res, res_coeff));
+ }
+
+ std::pair<float, float> result(initial_value, 0);
+ // Sum components together to get the average power.
+ __m128 m128_sums =
+ _mm_add_ps(_mm256_extractf128_ps(res, 0), _mm256_extractf128_ps(res, 1));
+ m128_sums = _mm_add_ps(_mm_movehl_ps(m128_sums, m128_sums), m128_sums);
+ float res_sum;
+ _mm_store_ss(&res_sum,
+ _mm_add_ss(m128_sums, _mm_shuffle_ps(m128_sums, m128_sums, 1)));
+ result.first = res_sum;
+
+ __m128 m128_max = _mm_setzero_ps();
+ m128_max =
+ _mm_max_ps(_mm256_extractf128_ps(max, 0), _mm256_extractf128_ps(max, 1));
+ m128_max = _mm_max_ps(
+ m128_max, _mm_shuffle_ps(m128_max, m128_max, _MM_SHUFFLE(3, 3, 1, 1)));
+ m128_max = _mm_max_ss(m128_max, _mm_shuffle_ps(m128_max, m128_max, 2));
+ result.second = std::max(EXTRACT_FLOAT(m128_max, 0), result.second);
+
+ // Handle remaining values at the end of |src|.
+ for (; i < len; ++i) {
+ result.first *= weight_prev;
+ const float sample = src[i];
+ const float sample_squared = sample * sample;
+ result.first += sample_squared * smoothing_factor;
+ result.second = std::max(result.second, sample_squared);
+ }
+
+ return result;
+}
#endif
#if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
diff --git a/chromium/media/base/vector_math.h b/chromium/media/base/vector_math.h
index 66ca849fa98..edad49cb563 100644
--- a/chromium/media/base/vector_math.h
+++ b/chromium/media/base/vector_math.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/vector_math_perftest.cc b/chromium/media/base/vector_math_perftest.cc
index 690c274a95f..362f32e9ded 100644
--- a/chromium/media/base/vector_math_perftest.cc
+++ b/chromium/media/base/vector_math_perftest.cc
@@ -1,9 +1,10 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
+#include "base/cpu.h"
#include "base/memory/aligned_memory.h"
#include "base/time/time.h"
#include "build/build_config.h"
@@ -86,38 +87,43 @@ class VectorMathPerfTest : public testing::Test {
std::unique_ptr<float, base::AlignedFreeDeleter> output_vector_;
};
-// Define platform dependent function names for SIMD optimized methods.
-#if defined(ARCH_CPU_X86_FAMILY)
-#define FMAC_FUNC FMAC_SSE
-#define FMUL_FUNC FMUL_SSE
-#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE
-#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
-#define FMAC_FUNC FMAC_NEON
-#define FMUL_FUNC FMUL_NEON
-#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_NEON
-#endif
-
// Benchmarks for each optimized vector_math::FMAC() method.
// Benchmark FMAC_C().
TEST_F(VectorMathPerfTest, FMAC_unoptimized) {
RunBenchmark(vector_math::FMAC_C, true, "_fmac", "unoptimized");
}
-#if defined(FMAC_FUNC)
// Benchmark FMAC_FUNC() with unaligned size.
TEST_F(VectorMathPerfTest, FMAC_optimized_unaligned) {
ASSERT_NE((kVectorSize - 1) % (vector_math::kRequiredAlignment /
sizeof(float)), 0U);
- RunBenchmark(vector_math::FMAC_FUNC, false, "_fmac", "optimized_unaligned");
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
+ if (cpu.has_avx2() && cpu.has_fma3()) {
+ RunBenchmark(vector_math::FMAC_AVX2, false, "_fmac", "optimized_unaligned");
+ } else if (cpu.has_sse2()) {
+ RunBenchmark(vector_math::FMAC_SSE, false, "_fmac", "optimized_unaligned");
+ }
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
+ RunBenchmark(vector_math::FMAC_NEON, false, "_fmac", "optimized_unaligned");
+#endif
}
// Benchmark FMAC_FUNC() with aligned size.
TEST_F(VectorMathPerfTest, FMAC_optimized_aligned) {
ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)),
0U);
- RunBenchmark(vector_math::FMAC_FUNC, true, "_fmac", "optimized_aligned");
-}
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
+ if (cpu.has_avx2() && cpu.has_fma3()) {
+ RunBenchmark(vector_math::FMAC_AVX2, true, "_fmac", "optimized_aligned");
+ } else if (cpu.has_sse2()) {
+ RunBenchmark(vector_math::FMAC_SSE, true, "_fmac", "optimized_aligned");
+ }
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
+ RunBenchmark(vector_math::FMAC_NEON, true, "_fmac", "optimized_aligned");
#endif
+}
// Benchmarks for each optimized vector_math::FMUL() method.
// Benchmark FMUL_C().
@@ -125,21 +131,37 @@ TEST_F(VectorMathPerfTest, FMUL_unoptimized) {
RunBenchmark(vector_math::FMUL_C, true, "_fmul", "unoptimized");
}
-#if defined(FMUL_FUNC)
// Benchmark FMUL_FUNC() with unaligned size.
TEST_F(VectorMathPerfTest, FMUL_optimized_unaligned) {
ASSERT_NE((kVectorSize - 1) % (vector_math::kRequiredAlignment /
sizeof(float)), 0U);
- RunBenchmark(vector_math::FMUL_FUNC, false, "_fmul", "optimized_unaligned");
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
+ if (cpu.has_avx2()) {
+ RunBenchmark(vector_math::FMUL_AVX2, false, "_fmul", "optimized_unaligned");
+ } else if (cpu.has_sse2()) {
+ RunBenchmark(vector_math::FMUL_SSE, false, "_fmul", "optimized_unaligned");
+ }
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
+ RunBenchmark(vector_math::FMUL_NEON, false, "_fmul", "optimized_unaligned");
+#endif
}
// Benchmark FMUL_FUNC() with aligned size.
TEST_F(VectorMathPerfTest, FMUL_optimized_aligned) {
ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)),
0U);
- RunBenchmark(vector_math::FMUL_FUNC, true, "_fmul", "optimized_aligned");
-}
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
+ if (cpu.has_avx2()) {
+ RunBenchmark(vector_math::FMUL_AVX2, true, "_fmul", "optimized_aligned");
+ } else if (cpu.has_sse2()) {
+ RunBenchmark(vector_math::FMUL_SSE, true, "_fmul", "optimized_aligned");
+ }
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
+ RunBenchmark(vector_math::FMUL_NEON, true, "_fmul", "optimized_aligned");
#endif
+}
// Benchmarks for each optimized vector_math::EWMAAndMaxPower() method.
// Benchmark EWMAAndMaxPower_C().
@@ -148,22 +170,42 @@ TEST_F(VectorMathPerfTest, EWMAAndMaxPower_unoptimized) {
"_ewma_and_max_power", "unoptimized");
}
-#if defined(EWMAAndMaxPower_FUNC)
// Benchmark EWMAAndMaxPower_FUNC() with unaligned size.
TEST_F(VectorMathPerfTest, EWMAAndMaxPower_optimized_unaligned) {
ASSERT_NE((kVectorSize - 1) % (vector_math::kRequiredAlignment /
sizeof(float)), 0U);
- RunBenchmark(vector_math::EWMAAndMaxPower_FUNC, kVectorSize - 1,
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
+ if (cpu.has_avx2() && cpu.has_fma3()) {
+ RunBenchmark(vector_math::EWMAAndMaxPower_AVX2, kVectorSize - 1,
+ "_ewma_and_max_power", "optimized_unaligned");
+ } else if (cpu.has_sse2()) {
+ RunBenchmark(vector_math::EWMAAndMaxPower_SSE, kVectorSize - 1,
+ "_ewma_and_max_power", "optimized_unaligned");
+ }
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
+ RunBenchmark(vector_math::EWMAAndMaxPower_NEON, kVectorSize - 1,
"_ewma_and_max_power", "optimized_unaligned");
+#endif
}
// Benchmark EWMAAndMaxPower_FUNC() with aligned size.
TEST_F(VectorMathPerfTest, EWMAAndMaxPower_optimized_aligned) {
ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)),
0U);
- RunBenchmark(vector_math::EWMAAndMaxPower_FUNC, kVectorSize,
+#if defined(ARCH_CPU_X86_FAMILY)
+ base::CPU cpu;
+ if (cpu.has_avx2() && cpu.has_fma3()) {
+ RunBenchmark(vector_math::EWMAAndMaxPower_AVX2, kVectorSize,
+ "_ewma_and_max_power", "optimized_aligned");
+ } else if (cpu.has_sse2()) {
+ RunBenchmark(vector_math::EWMAAndMaxPower_SSE, kVectorSize,
+ "_ewma_and_max_power", "optimized_aligned");
+ }
+#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
+ RunBenchmark(vector_math::EWMAAndMaxPower_NEON, kVectorSize,
"_ewma_and_max_power", "optimized_aligned");
-}
#endif
+}
} // namespace media
diff --git a/chromium/media/base/vector_math_testing.h b/chromium/media/base/vector_math_testing.h
index ca7db161310..87441e032d9 100644
--- a/chromium/media/base/vector_math_testing.h
+++ b/chromium/media/base/vector_math_testing.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -42,6 +42,19 @@ MEDIA_SHMEM_EXPORT std::pair<float, float> EWMAAndMaxPower_SSE(
const float src[],
int len,
float smoothing_factor);
+MEDIA_SHMEM_EXPORT void FMAC_AVX2(const float src[],
+ float scale,
+ int len,
+ float dest[]);
+MEDIA_SHMEM_EXPORT void FMUL_AVX2(const float src[],
+ float scale,
+ int len,
+ float dest[]);
+MEDIA_SHMEM_EXPORT std::pair<float, float> EWMAAndMaxPower_AVX2(
+ float initial_value,
+ const float src[],
+ int len,
+ float smoothing_factor);
#endif
#if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
diff --git a/chromium/media/base/vector_math_unittest.cc b/chromium/media/base/vector_math_unittest.cc
index 8b24360ba75..b6a2abd2b11 100644
--- a/chromium/media/base/vector_math_unittest.cc
+++ b/chromium/media/base/vector_math_unittest.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <cmath>
#include <memory>
+#include "base/cpu.h"
#include "base/memory/aligned_memory.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringize_macros.h"
@@ -80,6 +81,16 @@ TEST_F(VectorMathTest, FMAC) {
input_vector_.get(), kScale, kVectorSize, output_vector_.get());
VerifyOutput(kResult);
}
+ {
+ base::CPU cpu;
+ if (cpu.has_avx2() && cpu.has_fma3()) {
+ SCOPED_TRACE("FMAC_AVX2");
+ FillTestVectors(kInputFillValue, kOutputFillValue);
+ vector_math::FMAC_AVX2(input_vector_.get(), kScale, kVectorSize,
+ output_vector_.get());
+ VerifyOutput(kResult);
+ }
+ }
#endif
#if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
@@ -121,6 +132,16 @@ TEST_F(VectorMathTest, FMUL) {
input_vector_.get(), kScale, kVectorSize, output_vector_.get());
VerifyOutput(kResult);
}
+ {
+ base::CPU cpu;
+ if (cpu.has_avx2()) {
+ SCOPED_TRACE("FMUL_AVX2");
+ FillTestVectors(kInputFillValue, kOutputFillValue);
+ vector_math::FMUL_AVX2(input_vector_.get(), kScale, kVectorSize,
+ output_vector_.get());
+ VerifyOutput(kResult);
+ }
+ }
#endif
#if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
@@ -219,6 +240,17 @@ class EWMATestScenario {
EXPECT_NEAR(expected_final_avg_, result.first, 0.0000001f);
EXPECT_NEAR(expected_max_, result.second, 0.0000001f);
}
+ {
+ base::CPU cpu;
+ if (cpu.has_avx2() && cpu.has_fma3()) {
+ SCOPED_TRACE("EWMAAndMaxPower_AVX2");
+ const std::pair<float, float>& result =
+ vector_math::EWMAAndMaxPower_AVX2(initial_value_, data_.get(),
+ data_len_, smoothing_factor_);
+ EXPECT_NEAR(expected_final_avg_, result.first, 0.0000001f);
+ EXPECT_NEAR(expected_max_, result.second, 0.0000001f);
+ }
+ }
#endif
#if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON)
diff --git a/chromium/media/base/video_aspect_ratio.cc b/chromium/media/base/video_aspect_ratio.cc
index d5a9d882377..dac01e2cad7 100644
--- a/chromium/media/base/video_aspect_ratio.cc
+++ b/chromium/media/base/video_aspect_ratio.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_aspect_ratio.h b/chromium/media/base/video_aspect_ratio.h
index 246f15be5a1..b001fcf1e06 100644
--- a/chromium/media/base/video_aspect_ratio.h
+++ b/chromium/media/base/video_aspect_ratio.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_aspect_ratio_unittest.cc b/chromium/media/base/video_aspect_ratio_unittest.cc
index ce466661146..67d94fef9f6 100644
--- a/chromium/media/base/video_aspect_ratio_unittest.cc
+++ b/chromium/media/base/video_aspect_ratio_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_bitrate_allocation.cc b/chromium/media/base/video_bitrate_allocation.cc
index 8c66ffb3288..99506147ba4 100644
--- a/chromium/media/base/video_bitrate_allocation.cc
+++ b/chromium/media/base/video_bitrate_allocation.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_bitrate_allocation.h b/chromium/media/base/video_bitrate_allocation.h
index 18c3f193c4c..7a8b5b359c1 100644
--- a/chromium/media/base/video_bitrate_allocation.h
+++ b/chromium/media/base/video_bitrate_allocation.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_bitrate_allocation_unittest.cc b/chromium/media/base/video_bitrate_allocation_unittest.cc
index 7606827d195..e38342b9321 100644
--- a/chromium/media/base/video_bitrate_allocation_unittest.cc
+++ b/chromium/media/base/video_bitrate_allocation_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_codecs.cc b/chromium/media/base/video_codecs.cc
index 4af7ed4684b..1df9c4b0c4c 100644
--- a/chromium/media/base/video_codecs.cc
+++ b/chromium/media/base/video_codecs.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -16,6 +17,8 @@
namespace media {
// The names come from src/third_party/ffmpeg/libavcodec/codec_desc.c
+// TODO(crbug.com/1357080): The returned strings are used by ChunkDemuxer in
+// the code logic as well in tests. Merge with GetCodecNameForUMA() if possible.
std::string GetCodecName(VideoCodec codec) {
switch (codec) {
case VideoCodec::kUnknown:
@@ -45,6 +48,36 @@ std::string GetCodecName(VideoCodec codec) {
return "";
}
+// Reported as part of some UMA names. NEVER change existing strings!
+std::string GetCodecNameForUMA(VideoCodec codec) {
+ switch (codec) {
+ case VideoCodec::kUnknown:
+ return "Unknown";
+ case VideoCodec::kH264:
+ return "H264";
+ case VideoCodec::kHEVC:
+ return "HEVC";
+ case VideoCodec::kDolbyVision:
+ return "DolbyVision";
+ case VideoCodec::kVC1:
+ return "VC1";
+ case VideoCodec::kMPEG2:
+ return "MPEG2Video";
+ case VideoCodec::kMPEG4:
+ return "MPEG4";
+ case VideoCodec::kTheora:
+ return "Theora";
+ case VideoCodec::kVP8:
+ return "VP8";
+ case VideoCodec::kVP9:
+ return "VP9";
+ case VideoCodec::kAV1:
+ return "AV1";
+ }
+ NOTREACHED();
+ return "";
+}
+
std::string GetProfileName(VideoCodecProfile profile) {
switch (profile) {
case VIDEO_CODEC_PROFILE_UNKNOWN:
@@ -172,7 +205,7 @@ std::string BuildH264MimeSuffix(media::VideoCodecProfile profile,
return base::StringPrintf(".%s%04x", profile_str.c_str(), level);
}
-bool ParseNewStyleVp9CodecID(const std::string& codec_id,
+bool ParseNewStyleVp9CodecID(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc,
VideoColorSpace* color_space) {
@@ -310,7 +343,7 @@ bool ParseNewStyleVp9CodecID(const std::string& codec_id,
return true;
}
-bool ParseLegacyVp9CodecID(const std::string& codec_id,
+bool ParseLegacyVp9CodecID(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc) {
if (codec_id == "vp9" || codec_id == "vp9.0") {
@@ -326,7 +359,7 @@ bool ParseLegacyVp9CodecID(const std::string& codec_id,
}
#if BUILDFLAG(ENABLE_AV1_DECODER)
-bool ParseAv1CodecId(const std::string& codec_id,
+bool ParseAv1CodecId(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc,
VideoColorSpace* color_space) {
@@ -528,7 +561,7 @@ bool ParseAv1CodecId(const std::string& codec_id,
}
#endif // BUILDFLAG(ENABLE_AV1_DECODER)
-bool ParseAVCCodecId(const std::string& codec_id,
+bool ParseAVCCodecId(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc) {
// Make sure we have avc1.xxxxxx or avc3.xxxxxx , where xxxxxx are hex digits
@@ -627,7 +660,7 @@ static char IntToHex(int i) {
return kHexString[i];
}
-std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id) {
+std::string TranslateLegacyAvc1CodecIds(base::StringPiece codec_id) {
// Special handling for old, pre-RFC 6381 format avc1 strings, which are still
// being used by some HLS apps to preserve backward compatibility with older
// iOS devices. The old format was avc1.<profile>.<level>
@@ -664,14 +697,14 @@ std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id) {
}
// This is not a valid legacy avc1 codec id - return the original codec id.
- return codec_id;
+ return std::string(codec_id);
}
#endif
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
// The specification for HEVC codec id strings can be found in ISO IEC 14496-15
// dated 2012 or newer in the Annex E.3
-bool ParseHEVCCodecId(const std::string& codec_id,
+bool ParseHEVCCodecId(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc) {
if (!base::StartsWith(codec_id, "hev1.", base::CompareCase::SENSITIVE) &&
@@ -829,19 +862,20 @@ bool ParseHEVCCodecId(const std::string& codec_id,
#endif
#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
-bool IsDolbyVisionAVCCodecId(const std::string& codec_id) {
+bool IsDolbyVisionAVCCodecId(base::StringPiece codec_id) {
return base::StartsWith(codec_id, "dva1.", base::CompareCase::SENSITIVE) ||
base::StartsWith(codec_id, "dvav.", base::CompareCase::SENSITIVE);
}
-bool IsDolbyVisionHEVCCodecId(const std::string& codec_id) {
+bool IsDolbyVisionHEVCCodecId(base::StringPiece codec_id) {
return base::StartsWith(codec_id, "dvh1.", base::CompareCase::SENSITIVE) ||
base::StartsWith(codec_id, "dvhe.", base::CompareCase::SENSITIVE);
}
// The specification for Dolby Vision codec id strings can be found in Dolby
-// Vision streams within the MPEG-DASH format.
-bool ParseDolbyVisionCodecId(const std::string& codec_id,
+// Vision streams within the MPEG-DASH format:
+// https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolbyvisioninmpegdashspecification_v2_0_public_20190107.pdf
+bool ParseDolbyVisionCodecId(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc) {
if (!IsDolbyVisionAVCCodecId(codec_id) &&
@@ -922,7 +956,7 @@ bool ParseDolbyVisionCodecId(const std::string& codec_id,
// Level string should be two digits.
unsigned level_id = 0;
if (elem[2].size() != 2 || !base::StringToUint(elem[2], &level_id) ||
- level_id > 9 || level_id < 1) {
+ level_id > 13 || level_id < 1) {
DVLOG(4) << __func__ << ": invalid format level_id=" << elem[2];
return false;
}
@@ -933,7 +967,7 @@ bool ParseDolbyVisionCodecId(const std::string& codec_id,
}
#endif
-VideoCodec StringToVideoCodec(const std::string& codec_id) {
+VideoCodec StringToVideoCodec(base::StringPiece codec_id) {
VideoCodec codec = VideoCodec::kUnknown;
VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
uint8_t level = 0;
@@ -942,7 +976,7 @@ VideoCodec StringToVideoCodec(const std::string& codec_id) {
return codec;
}
-void ParseCodec(const std::string& codec_id,
+void ParseCodec(base::StringPiece codec_id,
VideoCodec& codec,
VideoCodecProfile& profile,
uint8_t& level,
diff --git a/chromium/media/base/video_codecs.h b/chromium/media/base/video_codecs.h
index c5222568255..fe68796d084 100644
--- a/chromium/media/base/video_codecs.h
+++ b/chromium/media/base/video_codecs.h
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,8 @@
#include <stdint.h>
#include <string>
+
+#include "base/strings/string_piece_forward.h"
#include "media/base/media_export.h"
#include "media/media_buildflags.h"
@@ -114,7 +116,12 @@ struct CodecProfileLevel {
VideoCodecLevel level;
};
+// Returns a name for `codec` for logging and display purposes.
std::string MEDIA_EXPORT GetCodecName(VideoCodec codec);
+
+// Returns a name for `codec` to be used for UMA reporting.
+std::string MEDIA_EXPORT GetCodecNameForUMA(VideoCodec codec);
+
std::string MEDIA_EXPORT GetProfileName(VideoCodecProfile profile);
std::string MEDIA_EXPORT BuildH264MimeSuffix(VideoCodecProfile profile,
uint8_t level);
@@ -125,45 +132,45 @@ std::string MEDIA_EXPORT BuildH264MimeSuffix(VideoCodecProfile profile,
// ParseLegacyVp9CodecID handles parsing of legacy VP9 codec strings defined
// for WebM.
// TODO(kqyang): Consolidate the two functions once we address crbug.com/667834
-MEDIA_EXPORT bool ParseNewStyleVp9CodecID(const std::string& codec_id,
+MEDIA_EXPORT bool ParseNewStyleVp9CodecID(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc,
VideoColorSpace* color_space);
-MEDIA_EXPORT bool ParseLegacyVp9CodecID(const std::string& codec_id,
+MEDIA_EXPORT bool ParseLegacyVp9CodecID(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc);
#if BUILDFLAG(ENABLE_AV1_DECODER)
-MEDIA_EXPORT bool ParseAv1CodecId(const std::string& codec_id,
+MEDIA_EXPORT bool ParseAv1CodecId(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc,
VideoColorSpace* color_space);
#endif
// Handle parsing AVC/H.264 codec ids as outlined in RFC 6381 and ISO-14496-10.
-MEDIA_EXPORT bool ParseAVCCodecId(const std::string& codec_id,
+MEDIA_EXPORT bool ParseAVCCodecId(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc);
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
-MEDIA_EXPORT bool ParseHEVCCodecId(const std::string& codec_id,
+MEDIA_EXPORT bool ParseHEVCCodecId(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_idc);
#endif
#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION)
-MEDIA_EXPORT bool ParseDolbyVisionCodecId(const std::string& codec_id,
+MEDIA_EXPORT bool ParseDolbyVisionCodecId(base::StringPiece codec_id,
VideoCodecProfile* profile,
uint8_t* level_id);
#endif
-MEDIA_EXPORT void ParseCodec(const std::string& codec_id,
+MEDIA_EXPORT void ParseCodec(base::StringPiece codec_id,
VideoCodec& codec,
VideoCodecProfile& profile,
uint8_t& level,
VideoColorSpace& color_space);
-MEDIA_EXPORT VideoCodec StringToVideoCodec(const std::string& codec_id);
+MEDIA_EXPORT VideoCodec StringToVideoCodec(base::StringPiece codec_id);
MEDIA_EXPORT VideoCodec
VideoCodecProfileToVideoCodec(VideoCodecProfile profile);
@@ -172,7 +179,7 @@ VideoCodecProfileToVideoCodec(VideoCodecProfile profile);
// Translate legacy avc1 codec ids (like avc1.66.30 or avc1.77.31) into a new
// style standard avc1 codec ids like avc1.4D002F. If the input codec is not
// recognized as a legacy codec id, then returns the input string unchanged.
-std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id);
+std::string TranslateLegacyAvc1CodecIds(base::StringPiece codec_id);
#endif
MEDIA_EXPORT std::ostream& operator<<(std::ostream& os,
diff --git a/chromium/media/base/video_codecs_unittest.cc b/chromium/media/base/video_codecs_unittest.cc
index 0fd5f63c739..9e4d7a4e217 100644
--- a/chromium/media/base/video_codecs_unittest.cc
+++ b/chromium/media/base/video_codecs_unittest.cc
@@ -1,9 +1,10 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <set>
+#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "media/base/video_codecs.h"
#include "media/base/video_color_space.h"
@@ -705,9 +706,17 @@ TEST(ParseDolbyVisionCodecIdTest, InvalidDolbyVisionCodecIds) {
EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.03.07", &profile, &level_id));
EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.06.07", &profile, &level_id));
- // Level should be numbers between 1 and 9.
+ // Level should be two digit number and in the range [01, 13].
EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.00", &profile, &level_id));
- EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.10", &profile, &level_id));
+ EXPECT_TRUE(ParseDolbyVisionCodecId("dvhe.04.01", &profile, &level_id));
+ EXPECT_EQ(level_id, 1);
+ EXPECT_TRUE(ParseDolbyVisionCodecId("dvhe.04.09", &profile, &level_id));
+ EXPECT_EQ(level_id, 9);
+ EXPECT_TRUE(ParseDolbyVisionCodecId("dvhe.04.10", &profile, &level_id));
+ EXPECT_EQ(level_id, 10);
+ EXPECT_TRUE(ParseDolbyVisionCodecId("dvhe.04.13", &profile, &level_id));
+ EXPECT_EQ(level_id, 13);
+ EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.14", &profile, &level_id));
EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.20", &profile, &level_id));
EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.99", &profile, &level_id));
@@ -725,6 +734,8 @@ TEST(ParseDolbyVisionCodecIdTest, InvalidDolbyVisionCodecIds) {
EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.5.7.", &profile, &level_id));
EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.5.7..", &profile, &level_id));
EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.5.7...", &profile, &level_id));
+ EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.05.7", &profile, &level_id));
+ EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.05.007", &profile, &level_id));
EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe..5", &profile, &level_id));
#endif
}
diff --git a/chromium/media/base/video_color_space.cc b/chromium/media/base/video_color_space.cc
index 6d7dbaa8c2b..bd49a23fc2f 100644
--- a/chromium/media/base/video_color_space.cc
+++ b/chromium/media/base/video_color_space.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_color_space.h b/chromium/media/base/video_color_space.h
index c6107755467..25911b56a84 100644
--- a/chromium/media/base/video_color_space.h
+++ b/chromium/media/base/video_color_space.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_color_space_unittest.cc b/chromium/media/base/video_color_space_unittest.cc
index 71986269858..fcc703ed0c5 100644
--- a/chromium/media/base/video_color_space_unittest.cc
+++ b/chromium/media/base/video_color_space_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_decoder.cc b/chromium/media/base/video_decoder.cc
index ac3e05da39e..2c5a67f78c7 100644
--- a/chromium/media/base/video_decoder.cc
+++ b/chromium/media/base/video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_decoder.h b/chromium/media/base/video_decoder.h
index 36f314f9a46..455f43b5ba7 100644
--- a/chromium/media/base/video_decoder.h
+++ b/chromium/media/base/video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,6 +20,10 @@ class DecoderBuffer;
class VideoDecoderConfig;
class VideoFrame;
+// Interface for all video decoders.
+//
+// VideoDecoders may be constructed on any thread, after which all calls must
+// occur on a single sequence (which may differ from the construction sequence).
class MEDIA_EXPORT VideoDecoder : public Decoder {
public:
// Callback for Decoder initialization.
diff --git a/chromium/media/base/video_decoder_config.cc b/chromium/media/base/video_decoder_config.cc
index b28a2239029..94a841033a7 100644
--- a/chromium/media/base/video_decoder_config.cc
+++ b/chromium/media/base/video_decoder_config.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_decoder_config.h b/chromium/media/base/video_decoder_config.h
index f891848485e..2cdcc8a57e7 100644
--- a/chromium/media/base/video_decoder_config.h
+++ b/chromium/media/base/video_decoder_config.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_decoder_config_unittest.cc b/chromium/media/base/video_decoder_config_unittest.cc
index 6bfa5b94889..1bdc38d5f1b 100644
--- a/chromium/media/base/video_decoder_config_unittest.cc
+++ b/chromium/media/base/video_decoder_config_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_encoder.cc b/chromium/media/base/video_encoder.cc
index dffeaa0b3a7..f8b05fe7135 100644
--- a/chromium/media/base/video_encoder.cc
+++ b/chromium/media/base/video_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_encoder.h b/chromium/media/base/video_encoder.h
index dee21d5d8a5..cba5f44e0ca 100644
--- a/chromium/media/base/video_encoder.h
+++ b/chromium/media/base/video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_facing.h b/chromium/media/base/video_facing.h
index ecd84835002..202a3072e42 100644
--- a/chromium/media/base/video_facing.h
+++ b/chromium/media/base/video_facing.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_frame.cc b/chromium/media/base/video_frame.cc
index 921dbbd68bf..4aa077a5678 100644
--- a/chromium/media/base/video_frame.cc
+++ b/chromium/media/base/video_frame.cc
@@ -1,9 +1,12 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/video_frame.h"
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
#include <algorithm>
#include <climits>
#include <numeric>
@@ -76,8 +79,6 @@ std::string VideoFrame::StorageTypeToString(
case VideoFrame::STORAGE_DMABUFS:
return "DMABUFS";
#endif
- case VideoFrame::STORAGE_MOJO_SHARED_BUFFER:
- return "MOJO_SHARED_BUFFER";
case VideoFrame::STORAGE_GPU_MEMORY_BUFFER:
return "GPU_MEMORY_BUFFER";
}
@@ -100,8 +101,7 @@ bool VideoFrame::IsStorageTypeMappable(VideoFrame::StorageType storage_type) {
// GetGpuMemoryBuffer() and call gfx::GpuMemoryBuffer::Map().
(storage_type == VideoFrame::STORAGE_UNOWNED_MEMORY ||
storage_type == VideoFrame::STORAGE_OWNED_MEMORY ||
- storage_type == VideoFrame::STORAGE_SHMEM ||
- storage_type == VideoFrame::STORAGE_MOJO_SHARED_BUFFER);
+ storage_type == VideoFrame::STORAGE_SHMEM);
}
// static
@@ -366,7 +366,8 @@ scoped_refptr<VideoFrame> VideoFrame::WrapNativeTextures(
format != PIXEL_FORMAT_NV12 && format != PIXEL_FORMAT_I420 &&
format != PIXEL_FORMAT_ABGR && format != PIXEL_FORMAT_XBGR &&
format != PIXEL_FORMAT_XR30 && format != PIXEL_FORMAT_XB30 &&
- format != PIXEL_FORMAT_P016LE && format != PIXEL_FORMAT_RGBAF16) {
+ format != PIXEL_FORMAT_P016LE && format != PIXEL_FORMAT_RGBAF16 &&
+ format != PIXEL_FORMAT_YV12) {
DLOG(ERROR) << "Unsupported pixel format: "
<< VideoPixelFormatToString(format);
return nullptr;
@@ -836,13 +837,6 @@ scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame(
const gfx::Size& natural_size) {
DCHECK(frame->visible_rect().Contains(visible_rect));
- // The following storage type should not be wrapped as the shared region
- // cannot be owned by both the wrapped frame and the wrapping frame.
- //
- // TODO: We can support this now since we have a reference to the wrapped
- // frame through |wrapped_frame_|.
- DCHECK(frame->storage_type() != STORAGE_MOJO_SHARED_BUFFER);
-
if (!AreValidPixelFormatsForWrap(frame->format(), format)) {
DLOG(ERROR) << __func__ << " Invalid format conversion."
<< VideoPixelFormatToString(frame->format()) << " to "
@@ -1144,12 +1138,12 @@ void VideoFrame::HashFrameForTesting(base::MD5Context* context,
}
void VideoFrame::BackWithSharedMemory(
- const base::UnsafeSharedMemoryRegion* region) {
+ const base::ReadOnlySharedMemoryRegion* region) {
DCHECK(!shm_region_);
DCHECK(!owned_shm_region_.IsValid());
// Either we should be backing a frame created with WrapExternal*, or we are
- // wrapping an existing STORAGE_SHMEM, in which case the storage
- // type has already been set to STORAGE_SHMEM.
+ // wrapping an existing STORAGE_SHMEM, in which case the storage type has
+ // already been set to STORAGE_SHMEM.
DCHECK(storage_type_ == STORAGE_UNOWNED_MEMORY ||
storage_type_ == STORAGE_SHMEM);
DCHECK(region && region->IsValid());
@@ -1158,8 +1152,8 @@ void VideoFrame::BackWithSharedMemory(
}
void VideoFrame::BackWithOwnedSharedMemory(
- base::UnsafeSharedMemoryRegion region,
- base::WritableSharedMemoryMapping mapping) {
+ base::ReadOnlySharedMemoryRegion region,
+ base::ReadOnlySharedMemoryMapping mapping) {
DCHECK(!shm_region_);
DCHECK(!owned_shm_region_.IsValid());
// We should be backing a frame created with WrapExternal*. We cannot be
@@ -1221,6 +1215,18 @@ gfx::ColorSpace VideoFrame::ColorSpace() const {
return color_space_;
}
+bool VideoFrame::RequiresExternalSampler() const {
+ const bool result =
+ (format() == PIXEL_FORMAT_NV12 || format() == PIXEL_FORMAT_YV12 ||
+ format() == PIXEL_FORMAT_P016LE) &&
+ NumTextures() == 1;
+ // The texture target can be 0 for Fuchsia.
+ DCHECK(!result ||
+ (mailbox_holder(0).texture_target == GL_TEXTURE_EXTERNAL_OES ||
+ mailbox_holder(0).texture_target == 0u));
+ return result;
+}
+
int VideoFrame::row_bytes(size_t plane) const {
return RowBytes(plane, format(), coded_size().width());
}
@@ -1233,7 +1239,8 @@ int VideoFrame::columns(size_t plane) const {
return Columns(plane, format(), coded_size().width());
}
-const uint8_t* VideoFrame::visible_data(size_t plane) const {
+template <typename T>
+T VideoFrame::GetVisibleDataInternal(T data, size_t plane) const {
DCHECK(IsValidPlane(format(), plane));
DCHECK(IsMappable());
@@ -1246,15 +1253,18 @@ const uint8_t* VideoFrame::visible_data(size_t plane) const {
const gfx::Size subsample = SampleSize(format(), plane);
DCHECK(offset.x() % subsample.width() == 0);
DCHECK(offset.y() % subsample.height() == 0);
- return data(plane) +
+ return data +
stride(plane) * (offset.y() / subsample.height()) + // Row offset.
BytesPerElement(format(), plane) * // Column offset.
(offset.x() / subsample.width());
}
-uint8_t* VideoFrame::visible_data(size_t plane) {
- return const_cast<uint8_t*>(
- static_cast<const VideoFrame*>(this)->visible_data(plane));
+const uint8_t* VideoFrame::visible_data(size_t plane) const {
+ return GetVisibleDataInternal<const uint8_t*>(data(plane), plane);
+}
+
+uint8_t* VideoFrame::GetWritableVisibleData(size_t plane) {
+ return GetVisibleDataInternal<uint8_t*>(writable_data(plane), plane);
}
const gpu::MailboxHolder& VideoFrame::mailbox_holder(
diff --git a/chromium/media/base/video_frame.h b/chromium/media/base/video_frame.h
index ed16de268c5..8c6d8738915 100644
--- a/chromium/media/base/video_frame.h
+++ b/chromium/media/base/video_frame.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,8 +18,8 @@
#include "base/hash/md5.h"
#include "base/memory/free_deleter.h"
#include "base/memory/raw_ptr.h"
+#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/unsafe_shared_memory_region.h"
#include "base/synchronization/lock.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
@@ -71,6 +71,8 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
kAPlane = 3,
};
+ // These values are persisted to logs. Entries should not be renumbered and
+ // numeric values should never be reused.
// Defines the pixel storage type. Differentiates between directly accessible
// |data_| and pixels that are only indirectly accessible and not via mappable
// memory.
@@ -81,7 +83,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
STORAGE_OPAQUE = 1, // We don't know how VideoFrame's pixels are stored.
STORAGE_UNOWNED_MEMORY = 2, // External, non owned data pointers.
STORAGE_OWNED_MEMORY = 3, // VideoFrame has allocated its own data buffer.
- STORAGE_SHMEM = 4, // Backed by unsafe (writable) shared memory.
+ STORAGE_SHMEM = 4, // Backed by read-only shared memory.
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
// TODO(mcasas): Consider turning this type into STORAGE_NATIVE
// based on the idea of using this same enum value for both DMA
@@ -89,11 +91,8 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// STORAGE_UNOWNED_MEMORY) and handle it appropriately in all cases.
STORAGE_DMABUFS = 5, // Each plane is stored into a DmaBuf.
#endif
- // Backed by a mojo shared buffer. This should only be used by the
- // MojoSharedBufferVideoFrame subclass.
- STORAGE_MOJO_SHARED_BUFFER = 6,
- STORAGE_GPU_MEMORY_BUFFER = 7,
- STORAGE_LAST = STORAGE_GPU_MEMORY_BUFFER,
+ STORAGE_GPU_MEMORY_BUFFER = 6,
+ STORAGE_MAX = STORAGE_GPU_MEMORY_BUFFER,
};
// CB to be called on the mailbox backing this frame and its GpuMemoryBuffers
@@ -417,23 +416,23 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// Returns a human readable string of StorageType.
static std::string StorageTypeToString(VideoFrame::StorageType storage_type);
- // A video frame wrapping external data may be backed by an unsafe shared
+ // A video frame wrapping external data may be backed by a read-only shared
// memory region. These methods are used to appropriately transform a
// VideoFrame created with WrapExternalData, WrapExternalYuvaData, etc. The
- // storage type of the Video Frame will be changed to STORAGE_SHM. Once the
- // backing of a VideoFrame is set, it cannot be changed.
+ // storage type of the Video Frame will be changed to STORAGE_READ_ONLY_SHMEM.
+ // Once the backing of a VideoFrame is set, it cannot be changed.
//
// The region is NOT owned by the video frame. Both the region and its
// associated mapping must outlive this instance.
- void BackWithSharedMemory(const base::UnsafeSharedMemoryRegion* region);
+ void BackWithSharedMemory(const base::ReadOnlySharedMemoryRegion* region);
// As above, but the VideoFrame owns the shared memory region as well as the
// mapping. They will be destroyed with their VideoFrame.
- void BackWithOwnedSharedMemory(base::UnsafeSharedMemoryRegion region,
- base::WritableSharedMemoryMapping mapping);
+ void BackWithOwnedSharedMemory(base::ReadOnlySharedMemoryRegion region,
+ base::ReadOnlySharedMemoryMapping mapping);
// Valid for shared memory backed VideoFrames.
- const base::UnsafeSharedMemoryRegion* shm_region() {
+ const base::ReadOnlySharedMemoryRegion* shm_region() const {
DCHECK(IsValidSharedMemoryFrame());
DCHECK(storage_type_ == STORAGE_SHMEM);
return shm_region_;
@@ -482,6 +481,16 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
VideoPixelFormat format() const { return layout_.format(); }
StorageType storage_type() const { return storage_type_; }
+ // Returns true if the video frame's contents should be accessed by sampling
+ // its one texture using an external sampler. Returns false if the video
+ // frame's planes should be accessed separately or if it's unknown whether an
+ // external sampler should be used.
+ //
+ // If this method returns true, VideoPixelFormatToGfxBufferFormat(format()) is
+ // guaranteed to not return nullopt.
+ // TODO(andrescj): enforce this with a test.
+ bool RequiresExternalSampler() const;
+
// The full dimensions of the video frame data.
const gfx::Size& coded_size() const { return layout_.coded_size(); }
// A subsection of [0, 0, coded_size().width(), coded_size.height()]. This
@@ -517,7 +526,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
DCHECK(IsMappable());
return data_[plane];
}
- uint8_t* data(size_t plane) {
+ uint8_t* writable_data(size_t plane) {
DCHECK(IsValidPlane(format(), plane));
DCHECK(IsMappable());
return data_[plane];
@@ -532,7 +541,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// plane buffer specified by visible_rect().origin(). Memory is owned by
// VideoFrame object and must not be freed by the caller.
const uint8_t* visible_data(size_t plane) const;
- uint8_t* visible_data(size_t plane);
+ uint8_t* GetWritableVisibleData(size_t plane);
// Returns a mailbox holder for a given texture.
// Only valid to call if this is a NATIVE_TEXTURE frame. Before using the
@@ -702,6 +711,9 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// associated regions are valid.
bool IsValidSharedMemoryFrame() const;
+ template <typename T>
+ T GetVisibleDataInternal(T data, size_t plane) const;
+
// VideFrameLayout (includes format, coded_size, and strides).
const VideoFrameLayout layout_;
@@ -733,12 +745,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// Shared memory handle, if this frame is STORAGE_SHMEM. The region pointed
// to is unowned.
- raw_ptr<const base::UnsafeSharedMemoryRegion> shm_region_ = nullptr;
+ raw_ptr<const base::ReadOnlySharedMemoryRegion> shm_region_ = nullptr;
- // Used if this is a STORAGE_SHMEM frame with owned shared memory. In that
- // case, shm_region_ will refer to this region.
- base::UnsafeSharedMemoryRegion owned_shm_region_;
- base::WritableSharedMemoryMapping owned_shm_mapping_;
+ // Used if this is a STORAGE_SHMEM frame with owned shared memory.
+ // In that case, shm_region_ will refer to this region.
+ base::ReadOnlySharedMemoryRegion owned_shm_region_;
+ base::ReadOnlySharedMemoryMapping owned_shm_mapping_;
// GPU memory buffer, if this frame is STORAGE_GPU_MEMORY_BUFFER.
std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_;
diff --git a/chromium/media/base/video_frame_layout.cc b/chromium/media/base/video_frame_layout.cc
index b3d666289e4..b3307c302bf 100644
--- a/chromium/media/base/video_frame_layout.cc
+++ b/chromium/media/base/video_frame_layout.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_frame_layout.h b/chromium/media/base/video_frame_layout.h
index b1f40eae649..d899c15d2d3 100644
--- a/chromium/media/base/video_frame_layout.h
+++ b/chromium/media/base/video_frame_layout.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_frame_layout_unittest.cc b/chromium/media/base/video_frame_layout_unittest.cc
index 4ac87af1ffa..71ef5d11d75 100644
--- a/chromium/media/base/video_frame_layout_unittest.cc
+++ b/chromium/media/base/video_frame_layout_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_frame_metadata.cc b/chromium/media/base/video_frame_metadata.cc
index 26214645019..2f6c08c4185 100644
--- a/chromium/media/base/video_frame_metadata.cc
+++ b/chromium/media/base/video_frame_metadata.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -75,4 +75,10 @@ void VideoFrameMetadata::MergeMetadataFrom(
#undef MERGE_OPTIONAL_FIELD
}
+void VideoFrameMetadata::ClearTextureFrameMedatada() {
+ is_webgpu_compatible = false;
+ texture_origin_is_top_left = true;
+ read_lock_fences_enabled = false;
+}
+
} // namespace media
diff --git a/chromium/media/base/video_frame_metadata.h b/chromium/media/base/video_frame_metadata.h
index de5b134f13b..dc64006c665 100644
--- a/chromium/media/base/video_frame_metadata.h
+++ b/chromium/media/base/video_frame_metadata.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -27,6 +27,9 @@ struct MEDIA_EXPORT VideoFrameMetadata {
// Merges internal values from |metadata_source|.
void MergeMetadataFrom(const VideoFrameMetadata& metadata_source);
+ // CLear metadata fields that only make sense for texture backed frames.
+ void ClearTextureFrameMedatada();
+
// Sources of VideoFrames use this marker to indicate that the associated
// VideoFrame can be overlaid, case in which its contents do not need to be
// further composited but displayed directly.
diff --git a/chromium/media/base/video_frame_pool.cc b/chromium/media/base/video_frame_pool.cc
index 8f6a0489fde..ec53badd74b 100644
--- a/chromium/media/base/video_frame_pool.cc
+++ b/chromium/media/base/video_frame_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_frame_pool.h b/chromium/media/base/video_frame_pool.h
index 88cac326086..e6967810d6c 100644
--- a/chromium/media/base/video_frame_pool.h
+++ b/chromium/media/base/video_frame_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_frame_pool_unittest.cc b/chromium/media/base/video_frame_pool_unittest.cc
index a52ba7eb833..4b659630702 100644
--- a/chromium/media/base/video_frame_pool_unittest.cc
+++ b/chromium/media/base/video_frame_pool_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -120,7 +120,7 @@ TEST_F(VideoFramePoolTest, FrameValidAfterPoolDestruction) {
// Write to the Y plane. The memory tools should detect a
// use-after-free if the storage was actually removed by pool destruction.
- memset(frame->data(VideoFrame::kYPlane), 0xff,
+ memset(frame->writable_data(VideoFrame::kYPlane), 0xff,
frame->rows(VideoFrame::kYPlane) * frame->stride(VideoFrame::kYPlane));
}
diff --git a/chromium/media/base/video_frame_unittest.cc b/chromium/media/base/video_frame_unittest.cc
index f1265c11ff8..2fb254e8315 100644
--- a/chromium/media/base/video_frame_unittest.cc
+++ b/chromium/media/base/video_frame_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,7 +13,7 @@
#include "base/callback_helpers.h"
#include "base/format_macros.h"
#include "base/memory/aligned_memory.h"
-#include "base/memory/unsafe_shared_memory_region.h"
+#include "base/memory/read_only_shared_memory_region.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
@@ -150,14 +150,14 @@ void InitializeYV12Frame(VideoFrame* frame, double white_to_black) {
EXPECT_EQ(PIXEL_FORMAT_YV12, frame->format());
const int first_black_row =
static_cast<int>(frame->coded_size().height() * white_to_black);
- uint8_t* y_plane = frame->data(VideoFrame::kYPlane);
+ uint8_t* y_plane = frame->writable_data(VideoFrame::kYPlane);
for (int row = 0; row < frame->coded_size().height(); ++row) {
int color = (row < first_black_row) ? 0xFF : 0x00;
memset(y_plane, color, frame->stride(VideoFrame::kYPlane));
y_plane += frame->stride(VideoFrame::kYPlane);
}
- uint8_t* u_plane = frame->data(VideoFrame::kUPlane);
- uint8_t* v_plane = frame->data(VideoFrame::kVPlane);
+ uint8_t* u_plane = frame->writable_data(VideoFrame::kUPlane);
+ uint8_t* v_plane = frame->writable_data(VideoFrame::kVPlane);
for (int row = 0; row < frame->coded_size().height(); row += 2) {
memset(u_plane, 0x80, frame->stride(VideoFrame::kUPlane));
memset(v_plane, 0x80, frame->stride(VideoFrame::kVPlane));
@@ -229,7 +229,7 @@ void ExpectFrameExtents(VideoPixelFormat format, const char* expected_hash) {
EXPECT_TRUE(frame->row_bytes(plane));
EXPECT_TRUE(frame->columns(plane));
- memset(frame->data(plane), kFillByte,
+ memset(frame->writable_data(plane), kFillByte,
frame->stride(plane) * frame->rows(plane));
}
@@ -336,14 +336,14 @@ TEST(VideoFrame, CreateBlackFrame) {
EXPECT_EQ(kHeight, frame->coded_size().height());
// Test frames themselves.
- uint8_t* y_plane = frame->data(VideoFrame::kYPlane);
+ uint8_t* y_plane = frame->writable_data(VideoFrame::kYPlane);
for (int y = 0; y < frame->coded_size().height(); ++y) {
EXPECT_EQ(0, memcmp(kExpectedYRow, y_plane, std::size(kExpectedYRow)));
y_plane += frame->stride(VideoFrame::kYPlane);
}
- uint8_t* u_plane = frame->data(VideoFrame::kUPlane);
- uint8_t* v_plane = frame->data(VideoFrame::kVPlane);
+ uint8_t* u_plane = frame->writable_data(VideoFrame::kUPlane);
+ uint8_t* v_plane = frame->writable_data(VideoFrame::kVPlane);
for (int y = 0; y < frame->coded_size().height() / 2; ++y) {
EXPECT_EQ(0, memcmp(kExpectedUVRow, u_plane, std::size(kExpectedUVRow)));
EXPECT_EQ(0, memcmp(kExpectedUVRow, v_plane, std::size(kExpectedUVRow)));
@@ -441,20 +441,21 @@ TEST(VideoFrame, WrapExternalData) {
// Create a frame that wraps read-only shared memory.
TEST(VideoFrame, WrapSharedMemory) {
const size_t kDataSize = 2 * 256 * 256;
- base::UnsafeSharedMemoryRegion region =
- base::UnsafeSharedMemoryRegion::Create(kDataSize);
- ASSERT_TRUE(region.IsValid());
- base::WritableSharedMemoryMapping mapping = region.Map();
- ASSERT_TRUE(mapping.IsValid());
+ base::MappedReadOnlyRegion mapped_region =
+ base::ReadOnlySharedMemoryRegion::Create(kDataSize);
+ ASSERT_TRUE(mapped_region.IsValid());
gfx::Size coded_size(256, 256);
gfx::Rect visible_rect(coded_size);
- CreateTestY16Frame(coded_size, visible_rect, mapping.memory());
+ CreateTestY16Frame(coded_size, visible_rect, mapped_region.mapping.memory());
auto timestamp = base::Milliseconds(1);
auto frame = VideoFrame::WrapExternalData(
PIXEL_FORMAT_Y16, coded_size, visible_rect, visible_rect.size(),
- mapping.GetMemoryAsSpan<uint8_t>().data(), kDataSize, timestamp);
- frame->BackWithSharedMemory(&region);
+ mapped_region.mapping.GetMemoryAsSpan<uint8_t>().data(), kDataSize,
+ timestamp);
+ EXPECT_EQ(frame->storage_type(), VideoFrame::STORAGE_UNOWNED_MEMORY);
+ frame->BackWithSharedMemory(&mapped_region.region);
+ EXPECT_EQ(frame->storage_type(), VideoFrame::STORAGE_SHMEM);
EXPECT_EQ(frame->coded_size(), coded_size);
EXPECT_EQ(frame->visible_rect(), visible_rect);
EXPECT_EQ(frame->timestamp(), timestamp);
@@ -783,6 +784,26 @@ TEST(VideoFrameMetadata, MergeMetadata) {
VerifyVideoFrameMetadataEquality(empty_metadata, reference_metadata);
}
+TEST(VideoFrameMetadata, ClearTextureMetadata) {
+ VideoFrameMetadata reference_md = GetFullVideoFrameMetadata();
+ reference_md.is_webgpu_compatible = true;
+ reference_md.texture_origin_is_top_left = false;
+ reference_md.read_lock_fences_enabled = true;
+
+ VideoFrameMetadata copy_md;
+ copy_md.MergeMetadataFrom(reference_md);
+
+ copy_md.ClearTextureFrameMedatada();
+ EXPECT_FALSE(copy_md.is_webgpu_compatible);
+ EXPECT_TRUE(copy_md.texture_origin_is_top_left);
+ EXPECT_FALSE(copy_md.read_lock_fences_enabled);
+
+ reference_md.is_webgpu_compatible = false;
+ reference_md.texture_origin_is_top_left = true;
+ reference_md.read_lock_fences_enabled = false;
+ VerifyVideoFrameMetadataEquality(copy_md, reference_md);
+}
+
TEST(VideoFrameMetadata, PartialMergeMetadata) {
VideoFrameMetadata full_metadata = GetFullVideoFrameMetadata();
diff --git a/chromium/media/base/video_renderer.cc b/chromium/media/base/video_renderer.cc
index 006f04bea61..acaeada36b0 100644
--- a/chromium/media/base/video_renderer.cc
+++ b/chromium/media/base/video_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_renderer.h b/chromium/media/base/video_renderer.h
index 6e5611886f2..1a5a9faa31b 100644
--- a/chromium/media/base/video_renderer.h
+++ b/chromium/media/base/video_renderer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_renderer_sink.h b/chromium/media/base/video_renderer_sink.h
index b7b034cdd02..6d9a77f208c 100644
--- a/chromium/media/base/video_renderer_sink.h
+++ b/chromium/media/base/video_renderer_sink.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_thumbnail_decoder.cc b/chromium/media/base/video_thumbnail_decoder.cc
index 11cd0cac32b..a6d8e0961da 100644
--- a/chromium/media/base/video_thumbnail_decoder.cc
+++ b/chromium/media/base/video_thumbnail_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_thumbnail_decoder.h b/chromium/media/base/video_thumbnail_decoder.h
index 4d83e7681d4..64358824f85 100644
--- a/chromium/media/base/video_thumbnail_decoder.h
+++ b/chromium/media/base/video_thumbnail_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_thumbnail_decoder_unittest.cc b/chromium/media/base/video_thumbnail_decoder_unittest.cc
index ed7b4ef0b8c..e68568605eb 100644
--- a/chromium/media/base/video_thumbnail_decoder_unittest.cc
+++ b/chromium/media/base/video_thumbnail_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_transformation.cc b/chromium/media/base/video_transformation.cc
index a293bb2ed09..65529a880a3 100644
--- a/chromium/media/base/video_transformation.cc
+++ b/chromium/media/base/video_transformation.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_transformation.h b/chromium/media/base/video_transformation.h
index ca83c59caef..ee8005925a7 100644
--- a/chromium/media/base/video_transformation.h
+++ b/chromium/media/base/video_transformation.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_transformation_unittest.cc b/chromium/media/base/video_transformation_unittest.cc
index d0435e72f70..0de872d4662 100644
--- a/chromium/media/base/video_transformation_unittest.cc
+++ b/chromium/media/base/video_transformation_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/base/video_transformation.h"
diff --git a/chromium/media/base/video_types.cc b/chromium/media/base/video_types.cc
index 06315166fc0..ea148df9ec1 100644
--- a/chromium/media/base/video_types.cc
+++ b/chromium/media/base/video_types.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -166,6 +166,51 @@ bool IsYuvPlanar(VideoPixelFormat format) {
return false;
}
+bool IsRGB(VideoPixelFormat format) {
+ switch (format) {
+ case PIXEL_FORMAT_ARGB:
+ case PIXEL_FORMAT_XRGB:
+ case PIXEL_FORMAT_RGB24:
+ case PIXEL_FORMAT_ABGR:
+ case PIXEL_FORMAT_XBGR:
+ case PIXEL_FORMAT_XR30:
+ case PIXEL_FORMAT_XB30:
+ case PIXEL_FORMAT_BGRA:
+ case PIXEL_FORMAT_RGBAF16:
+ return true;
+
+ case PIXEL_FORMAT_UNKNOWN:
+ case PIXEL_FORMAT_I420:
+ case PIXEL_FORMAT_YV12:
+ case PIXEL_FORMAT_I422:
+ case PIXEL_FORMAT_I420A:
+ case PIXEL_FORMAT_I444:
+ case PIXEL_FORMAT_NV12:
+ case PIXEL_FORMAT_NV21:
+ case PIXEL_FORMAT_UYVY:
+ case PIXEL_FORMAT_YUY2:
+ case PIXEL_FORMAT_MJPEG:
+ case PIXEL_FORMAT_YUV420P9:
+ case PIXEL_FORMAT_YUV420P10:
+ case PIXEL_FORMAT_YUV422P9:
+ case PIXEL_FORMAT_YUV422P10:
+ case PIXEL_FORMAT_YUV444P9:
+ case PIXEL_FORMAT_YUV444P10:
+ case PIXEL_FORMAT_YUV420P12:
+ case PIXEL_FORMAT_YUV422P12:
+ case PIXEL_FORMAT_YUV444P12:
+ case PIXEL_FORMAT_Y16:
+ case PIXEL_FORMAT_P016LE:
+ case PIXEL_FORMAT_I422A:
+ case PIXEL_FORMAT_I444A:
+ case PIXEL_FORMAT_YUV420AP10:
+ case PIXEL_FORMAT_YUV422AP10:
+ case PIXEL_FORMAT_YUV444AP10:
+ return false;
+ }
+ return false;
+}
+
bool IsOpaque(VideoPixelFormat format) {
switch (format) {
case PIXEL_FORMAT_UNKNOWN:
diff --git a/chromium/media/base/video_types.h b/chromium/media/base/video_types.h
index 2ac3fb5aeb7..7f44dbf232d 100644
--- a/chromium/media/base/video_types.h
+++ b/chromium/media/base/video_types.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -127,6 +127,9 @@ MEDIA_SHMEM_EXPORT std::string FourccToString(uint32_t fourcc);
// Returns true if |format| is a YUV format with multiple planes.
MEDIA_SHMEM_EXPORT bool IsYuvPlanar(VideoPixelFormat format);
+// Returns true if |format| is an RGB format.
+MEDIA_SHMEM_EXPORT bool IsRGB(VideoPixelFormat format);
+
// Returns true if |format| has no Alpha channel (hence is always opaque).
MEDIA_SHMEM_EXPORT bool IsOpaque(VideoPixelFormat format);
diff --git a/chromium/media/base/video_types_unittest.cc b/chromium/media/base/video_types_unittest.cc
index b306308156c..a79134fb3ab 100644
--- a/chromium/media/base/video_types_unittest.cc
+++ b/chromium/media/base/video_types_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/video_util.cc b/chromium/media/base/video_util.cc
index 56a4a9a614b..85e5ee4400f 100644
--- a/chromium/media/base/video_util.cc
+++ b/chromium/media/base/video_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,6 +22,7 @@
#include "media/base/video_frame.h"
#include "media/base/video_frame_pool.h"
#include "media/base/video_types.h"
+#include "media/base/wait_and_replace_sync_token_client.h"
#include "third_party/libyuv/include/libyuv.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkImage.h"
@@ -66,6 +67,11 @@ void FillRegionOutsideVisibleRect(uint8_t* data,
}
VideoPixelFormat ReadbackFormat(const VideoFrame& frame) {
+ // The |frame|.BitDepth() restriction is to avoid treating a P016LE frame as a
+ // low-bit depth frame.
+ if (frame.RequiresExternalSampler() && frame.BitDepth() == 8u)
+ return PIXEL_FORMAT_XRGB;
+
switch (frame.format()) {
case PIXEL_FORMAT_I420:
case PIXEL_FORMAT_I420A:
@@ -75,11 +81,8 @@ VideoPixelFormat ReadbackFormat(const VideoFrame& frame) {
case PIXEL_FORMAT_XRGB:
case PIXEL_FORMAT_ABGR:
case PIXEL_FORMAT_XBGR:
- return frame.format();
case PIXEL_FORMAT_NV12:
- // |frame| may be backed by a graphics buffer that is NV12, but sampled as
- // a single RGB texture.
- return frame.NumTextures() == 1 ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_NV12;
+ return frame.format();
default:
// Currently unsupported.
return PIXEL_FORMAT_UNKNOWN;
@@ -100,6 +103,9 @@ SkColorType SkColorTypeForPlane(VideoPixelFormat format, size_t plane) {
case PIXEL_FORMAT_NV12:
return plane == VideoFrame::kYPlane ? kAlpha_8_SkColorType
: kR8G8_unorm_SkColorType;
+ case PIXEL_FORMAT_P016LE:
+ return plane == VideoFrame::kYPlane ? kA16_unorm_SkColorType
+ : kR16G16_unorm_SkColorType;
case PIXEL_FORMAT_XBGR:
case PIXEL_FORMAT_ABGR:
return kRGBA_8888_SkColorType;
@@ -138,6 +144,12 @@ bool ReadbackTexturePlaneToMemorySyncSkImage(const VideoFrame& src_frame,
DCHECK(gr_context);
VideoPixelFormat format = ReadbackFormat(src_frame);
+ if (format == PIXEL_FORMAT_UNKNOWN) {
+ DLOG(ERROR) << "Readback is not possible for this frame: "
+ << src_frame.AsHumanReadableString();
+ return false;
+ }
+
int width = src_frame.columns(src_plane);
int height = src_frame.rows(src_plane);
bool has_alpha = !IsOpaque(format) && src_frame.NumTextures() == 1;
@@ -202,6 +214,12 @@ bool ReadbackTexturePlaneToMemorySyncOOP(const VideoFrame& src_frame,
size_t dest_stride,
gpu::raster::RasterInterface* ri) {
VideoPixelFormat format = ReadbackFormat(src_frame);
+ if (format == PIXEL_FORMAT_UNKNOWN) {
+ DLOG(ERROR) << "Readback is not possible for this frame: "
+ << src_frame.AsHumanReadableString();
+ return false;
+ }
+
bool has_alpha = !IsOpaque(format) && src_frame.NumTextures() == 1;
const gpu::MailboxHolder& holder = src_frame.mailbox_holder(src_plane);
@@ -291,7 +309,7 @@ void LetterboxPlane(VideoFrame* frame,
uint8_t fill_byte) {
uint8_t* ptr = nullptr;
if (frame->IsMappable()) {
- ptr = frame->data(plane);
+ ptr = frame->writable_data(plane);
} else if (frame->HasGpuMemoryBuffer()) {
ptr = static_cast<uint8_t*>(frame->GetGpuMemoryBuffer()->memory(plane));
}
@@ -304,11 +322,14 @@ void LetterboxPlane(VideoFrame* frame,
} // namespace
void FillYUV(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v) {
- libyuv::I420Rect(
- frame->data(VideoFrame::kYPlane), frame->stride(VideoFrame::kYPlane),
- frame->data(VideoFrame::kUPlane), frame->stride(VideoFrame::kUPlane),
- frame->data(VideoFrame::kVPlane), frame->stride(VideoFrame::kVPlane), 0,
- 0, frame->coded_size().width(), frame->coded_size().height(), y, u, v);
+ libyuv::I420Rect(frame->writable_data(VideoFrame::kYPlane),
+ frame->stride(VideoFrame::kYPlane),
+ frame->writable_data(VideoFrame::kUPlane),
+ frame->stride(VideoFrame::kUPlane),
+ frame->writable_data(VideoFrame::kVPlane),
+ frame->stride(VideoFrame::kVPlane), 0, 0,
+ frame->coded_size().width(), frame->coded_size().height(), y,
+ u, v);
}
void FillYUVA(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v, uint8_t a) {
@@ -316,7 +337,7 @@ void FillYUVA(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v, uint8_t a) {
FillYUV(frame, y, u, v);
// Fill the A plane.
- libyuv::SetPlane(frame->data(VideoFrame::kAPlane),
+ libyuv::SetPlane(frame->writable_data(VideoFrame::kAPlane),
frame->stride(VideoFrame::kAPlane),
frame->row_bytes(VideoFrame::kAPlane),
frame->rows(VideoFrame::kAPlane), a);
@@ -673,11 +694,11 @@ bool I420CopyWithPadding(const VideoFrame& src_frame, VideoFrame* dst_frame) {
src_frame.stride(VideoFrame::kUPlane),
src_frame.visible_data(VideoFrame::kVPlane),
src_frame.stride(VideoFrame::kVPlane),
- dst_frame->data(VideoFrame::kYPlane),
+ dst_frame->writable_data(VideoFrame::kYPlane),
dst_frame->stride(VideoFrame::kYPlane),
- dst_frame->data(VideoFrame::kUPlane),
+ dst_frame->writable_data(VideoFrame::kUPlane),
dst_frame->stride(VideoFrame::kUPlane),
- dst_frame->data(VideoFrame::kVPlane),
+ dst_frame->writable_data(VideoFrame::kVPlane),
dst_frame->stride(VideoFrame::kVPlane),
src_frame.visible_rect().width(),
src_frame.visible_rect().height()))
@@ -685,19 +706,19 @@ bool I420CopyWithPadding(const VideoFrame& src_frame, VideoFrame* dst_frame) {
// Padding the region outside the visible rect with the repeated last
// column / row of the visible rect. This can improve the coding efficiency.
- FillRegionOutsideVisibleRect(dst_frame->data(VideoFrame::kYPlane),
+ FillRegionOutsideVisibleRect(dst_frame->writable_data(VideoFrame::kYPlane),
dst_frame->stride(VideoFrame::kYPlane),
dst_frame->coded_size(),
src_frame.visible_rect().size());
FillRegionOutsideVisibleRect(
- dst_frame->data(VideoFrame::kUPlane),
+ dst_frame->writable_data(VideoFrame::kUPlane),
dst_frame->stride(VideoFrame::kUPlane),
VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kUPlane,
dst_frame->coded_size()),
VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kUPlane,
src_frame.visible_rect().size()));
FillRegionOutsideVisibleRect(
- dst_frame->data(VideoFrame::kVPlane),
+ dst_frame->writable_data(VideoFrame::kVPlane),
dst_frame->stride(VideoFrame::kVPlane),
VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kVPlane,
dst_frame->coded_size()),
@@ -708,7 +729,7 @@ bool I420CopyWithPadding(const VideoFrame& src_frame, VideoFrame* dst_frame) {
}
scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySync(
- const VideoFrame& txt_frame,
+ VideoFrame& txt_frame,
gpu::raster::RasterInterface* ri,
GrDirectContext* gr_context,
VideoFramePool* pool) {
@@ -732,21 +753,21 @@ scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySync(
txt_frame.natural_size(), txt_frame.timestamp());
result->set_color_space(txt_frame.ColorSpace());
result->metadata().MergeMetadataFrom(txt_frame.metadata());
+ result->metadata().ClearTextureFrameMedatada();
size_t planes = VideoFrame::NumPlanes(format);
for (size_t plane = 0; plane < planes; plane++) {
gfx::Rect src_rect(0, 0, txt_frame.columns(plane), txt_frame.rows(plane));
if (!ReadbackTexturePlaneToMemorySync(
- txt_frame, plane, src_rect, result->data(plane),
+ txt_frame, plane, src_rect, result->writable_data(plane),
result->stride(plane), ri, gr_context)) {
return nullptr;
}
}
-
return result;
}
-bool ReadbackTexturePlaneToMemorySync(const VideoFrame& src_frame,
+bool ReadbackTexturePlaneToMemorySync(VideoFrame& src_frame,
size_t src_plane,
gfx::Rect& src_rect,
uint8_t* dest_pixels,
@@ -755,14 +776,18 @@ bool ReadbackTexturePlaneToMemorySync(const VideoFrame& src_frame,
GrDirectContext* gr_context) {
DCHECK(ri);
+ bool result;
if (gr_context) {
- return ReadbackTexturePlaneToMemorySyncSkImage(src_frame, src_plane,
- src_rect, dest_pixels,
- dest_stride, ri, gr_context);
+ result = ReadbackTexturePlaneToMemorySyncSkImage(
+ src_frame, src_plane, src_rect, dest_pixels, dest_stride, ri,
+ gr_context);
+ } else {
+ result = ReadbackTexturePlaneToMemorySyncOOP(src_frame, src_plane, src_rect,
+ dest_pixels, dest_stride, ri);
}
-
- return ReadbackTexturePlaneToMemorySyncOOP(src_frame, src_plane, src_rect,
- dest_pixels, dest_stride, ri);
+ WaitAndReplaceSyncTokenClient client(ri);
+ src_frame.UpdateReleaseSyncToken(&client);
+ return result;
}
EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
@@ -820,11 +845,12 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
? libyuv::ABGRToI420
: libyuv::ARGBToI420;
int error = convert_fn(
- src_data, src_stride, dst_frame.visible_data(VideoFrame::kYPlane),
+ src_data, src_stride,
+ dst_frame.GetWritableVisibleData(VideoFrame::kYPlane),
dst_frame.stride(VideoFrame::kYPlane),
- dst_frame.visible_data(VideoFrame::kUPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kUPlane),
dst_frame.stride(VideoFrame::kUPlane),
- dst_frame.visible_data(VideoFrame::kVPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kVPlane),
dst_frame.stride(VideoFrame::kVPlane),
dst_frame.visible_rect().width(), dst_frame.visible_rect().height());
if (error)
@@ -834,7 +860,7 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
// Convert alpha channel separately
libyuv::ARGBExtractAlpha(
src_data, src_stride,
- dst_frame.visible_data(media::VideoFrame::kAPlane),
+ dst_frame.GetWritableVisibleData(media::VideoFrame::kAPlane),
dst_frame.stride(media::VideoFrame::kAPlane),
dst_frame.visible_rect().width(),
dst_frame.visible_rect().height());
@@ -848,9 +874,10 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
? libyuv::ABGRToNV12
: libyuv::ARGBToNV12;
int error = convert_fn(
- src_data, src_stride, dst_frame.visible_data(VideoFrame::kYPlane),
+ src_data, src_stride,
+ dst_frame.GetWritableVisibleData(VideoFrame::kYPlane),
dst_frame.stride(VideoFrame::kYPlane),
- dst_frame.visible_data(VideoFrame::kUVPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kUVPlane),
dst_frame.stride(VideoFrame::kUVPlane),
dst_frame.visible_rect().width(), dst_frame.visible_rect().height());
if (error)
@@ -871,7 +898,7 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
src_frame.visible_data(VideoFrame::kAPlane),
src_frame.stride(VideoFrame::kAPlane),
src_frame.visible_rect().width(), src_frame.visible_rect().height(),
- dst_frame.data(VideoFrame::kAPlane),
+ dst_frame.writable_data(VideoFrame::kAPlane), // TODO: Is this right?
dst_frame.stride(VideoFrame::kAPlane), dst_frame.coded_size().width(),
dst_frame.coded_size().height(), kDefaultFiltering);
}
@@ -883,11 +910,11 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
src_frame.visible_data(VideoFrame::kVPlane),
src_frame.stride(VideoFrame::kVPlane), src_frame.visible_rect().width(),
src_frame.visible_rect().height(),
- dst_frame.visible_data(VideoFrame::kYPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kYPlane),
dst_frame.stride(VideoFrame::kYPlane),
- dst_frame.visible_data(VideoFrame::kUPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kUPlane),
dst_frame.stride(VideoFrame::kUPlane),
- dst_frame.visible_data(VideoFrame::kVPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kVPlane),
dst_frame.stride(VideoFrame::kVPlane), dst_frame.visible_rect().width(),
dst_frame.visible_rect().height(), kDefaultFiltering);
if (error)
@@ -904,9 +931,9 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
src_frame.visible_data(VideoFrame::kUVPlane),
src_frame.stride(VideoFrame::kUVPlane),
src_frame.visible_rect().width(), src_frame.visible_rect().height(),
- dst_frame.visible_data(VideoFrame::kYPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kYPlane),
dst_frame.stride(VideoFrame::kYPlane),
- dst_frame.visible_data(VideoFrame::kUVPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kUVPlane),
dst_frame.stride(VideoFrame::kUVPlane),
dst_frame.visible_rect().width(), dst_frame.visible_rect().height(),
kDefaultFiltering);
@@ -925,11 +952,11 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
src_frame.stride(VideoFrame::kYPlane),
src_frame.visible_data(VideoFrame::kUVPlane),
src_frame.stride(VideoFrame::kUVPlane),
- dst_frame.visible_data(VideoFrame::kYPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kYPlane),
dst_frame.stride(VideoFrame::kYPlane),
- dst_frame.visible_data(VideoFrame::kUPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kUPlane),
dst_frame.stride(VideoFrame::kUPlane),
- dst_frame.visible_data(VideoFrame::kVPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kVPlane),
dst_frame.stride(VideoFrame::kVPlane),
dst_frame.visible_rect().width(), dst_frame.visible_rect().height());
if (error)
@@ -962,11 +989,11 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
tmp_v, // Temporary V-plane for src UV-plane.
tmp_uv_width, src_frame.visible_rect().width(),
src_frame.visible_rect().height(),
- dst_frame.visible_data(VideoFrame::kYPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kYPlane),
dst_frame.stride(VideoFrame::kYPlane),
- dst_frame.visible_data(VideoFrame::kUPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kUPlane),
dst_frame.stride(VideoFrame::kUPlane),
- dst_frame.visible_data(VideoFrame::kVPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kVPlane),
dst_frame.stride(VideoFrame::kVPlane),
dst_frame.visible_rect().width(), dst_frame.visible_rect().height(),
kDefaultFiltering);
@@ -988,9 +1015,9 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
src_frame.stride(VideoFrame::kUPlane),
src_frame.visible_data(VideoFrame::kVPlane),
src_frame.stride(VideoFrame::kVPlane),
- dst_frame.visible_data(VideoFrame::kYPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kYPlane),
dst_frame.stride(VideoFrame::kYPlane),
- dst_frame.visible_data(VideoFrame::kUVPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kUVPlane),
dst_frame.stride(VideoFrame::kUVPlane),
dst_frame.visible_rect().width(), dst_frame.visible_rect().height());
if (error)
@@ -1022,9 +1049,9 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame,
tmp_uv, // Temporary for merged UV-plane
stride_uv, // Temporary stride
src_frame.visible_rect().width(), src_frame.visible_rect().height(),
- dst_frame.visible_data(VideoFrame::kYPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kYPlane),
dst_frame.stride(VideoFrame::kYPlane),
- dst_frame.visible_data(VideoFrame::kUVPlane),
+ dst_frame.GetWritableVisibleData(VideoFrame::kUVPlane),
dst_frame.stride(VideoFrame::kUVPlane),
dst_frame.visible_rect().width(), dst_frame.visible_rect().height(),
kDefaultFiltering);
diff --git a/chromium/media/base/video_util.h b/chromium/media/base/video_util.h
index c451a57a7d4..d46355a6fc2 100644
--- a/chromium/media/base/video_util.h
+++ b/chromium/media/base/video_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -156,7 +156,7 @@ MEDIA_EXPORT scoped_refptr<VideoFrame> ConvertToMemoryMappedFrame(
// media::ConvertAndScaleFrame and put it into a new class
// media:FrameSizeAndFormatConverter.
MEDIA_EXPORT scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySync(
- const VideoFrame& txt_frame,
+ VideoFrame& txt_frame,
gpu::raster::RasterInterface* ri,
GrDirectContext* gr_context,
VideoFramePool* pool = nullptr);
@@ -164,7 +164,7 @@ MEDIA_EXPORT scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySync(
// Synchronously reads a single plane. |src_rect| is relative to the plane,
// which may be smaller than |frame| due to subsampling.
MEDIA_EXPORT bool ReadbackTexturePlaneToMemorySync(
- const VideoFrame& src_frame,
+ VideoFrame& src_frame,
size_t src_plane,
gfx::Rect& src_rect,
uint8_t* dest_pixels,
diff --git a/chromium/media/base/video_util_unittest.cc b/chromium/media/base/video_util_unittest.cc
index 64dc83e4b9b..e303dc71c0e 100644
--- a/chromium/media/base/video_util_unittest.cc
+++ b/chromium/media/base/video_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -44,16 +44,16 @@ scoped_refptr<media::VideoFrame> CreateFrameWithPatternFilled(
scoped_refptr<media::VideoFrame> frame(media::VideoFrame::CreateFrame(
format, coded_size, visible_rect, natural_size, timestamp));
- FillPlaneWithPattern(frame->data(media::VideoFrame::kYPlane),
+ FillPlaneWithPattern(frame->writable_data(media::VideoFrame::kYPlane),
frame->stride(media::VideoFrame::kYPlane),
frame->visible_rect().size());
FillPlaneWithPattern(
- frame->data(media::VideoFrame::kUPlane),
+ frame->writable_data(media::VideoFrame::kUPlane),
frame->stride(media::VideoFrame::kUPlane),
media::VideoFrame::PlaneSize(format, media::VideoFrame::kUPlane,
frame->visible_rect().size()));
FillPlaneWithPattern(
- frame->data(media::VideoFrame::kVPlane),
+ frame->writable_data(media::VideoFrame::kVPlane),
frame->stride(media::VideoFrame::kVPlane),
media::VideoFrame::PlaneSize(format, media::VideoFrame::kVPlane,
frame->visible_rect().size()));
@@ -637,7 +637,7 @@ TEST_F(VideoUtilTest, WrapAsI420VideoFrame) {
// ASAN.
src_frame.reset();
for (auto plane : planes)
- memset(dst_frame->data(plane), 1, dst_frame->stride(plane));
+ memset(dst_frame->writable_data(plane), 1, dst_frame->stride(plane));
}
} // namespace media
diff --git a/chromium/media/base/wait_and_replace_sync_token_client.cc b/chromium/media/base/wait_and_replace_sync_token_client.cc
index b78a6b0eb02..6c24795bdad 100644
--- a/chromium/media/base/wait_and_replace_sync_token_client.cc
+++ b/chromium/media/base/wait_and_replace_sync_token_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/wait_and_replace_sync_token_client.h b/chromium/media/base/wait_and_replace_sync_token_client.h
index 5a7ad527a41..8eec5897d3f 100644
--- a/chromium/media/base/wait_and_replace_sync_token_client.h
+++ b/chromium/media/base/wait_and_replace_sync_token_client.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/waiting.h b/chromium/media/base/waiting.h
index 93d1889be56..ec09d828eba 100644
--- a/chromium/media/base/waiting.h
+++ b/chromium/media/base/waiting.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/wall_clock_time_source.cc b/chromium/media/base/wall_clock_time_source.cc
index cdfcc687993..7feca1f7016 100644
--- a/chromium/media/base/wall_clock_time_source.cc
+++ b/chromium/media/base/wall_clock_time_source.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/wall_clock_time_source.h b/chromium/media/base/wall_clock_time_source.h
index 8a6674243dc..bfe13c3ba69 100644
--- a/chromium/media/base/wall_clock_time_source.h
+++ b/chromium/media/base/wall_clock_time_source.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/wall_clock_time_source_unittest.cc b/chromium/media/base/wall_clock_time_source_unittest.cc
index 20b701a336a..7335ffceab7 100644
--- a/chromium/media/base/wall_clock_time_source_unittest.cc
+++ b/chromium/media/base/wall_clock_time_source_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/watch_time_keys.cc b/chromium/media/base/watch_time_keys.cc
index c0480b51303..f482e687c60 100644
--- a/chromium/media/base/watch_time_keys.cc
+++ b/chromium/media/base/watch_time_keys.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/watch_time_keys.h b/chromium/media/base/watch_time_keys.h
index b22eb6c22a1..b6073001be2 100644
--- a/chromium/media/base/watch_time_keys.h
+++ b/chromium/media/base/watch_time_keys.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/webvtt_util.h b/chromium/media/base/webvtt_util.h
index a5c78477e1c..b368d43067a 100644
--- a/chromium/media/base/webvtt_util.h
+++ b/chromium/media/base/webvtt_util.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/BUILD.gn b/chromium/media/base/win/BUILD.gn
index 973ed768b42..6b0da6eeb0d 100644
--- a/chromium/media/base/win/BUILD.gn
+++ b/chromium/media/base/win/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
+# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/base/win/d3d11_mocks.cc b/chromium/media/base/win/d3d11_mocks.cc
index 326fe4bde33..a57f97079a5 100644
--- a/chromium/media/base/win/d3d11_mocks.cc
+++ b/chromium/media/base/win/d3d11_mocks.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/d3d11_mocks.h b/chromium/media/base/win/d3d11_mocks.h
index 91c611913fe..4b2ac345a90 100644
--- a/chromium/media/base/win/d3d11_mocks.h
+++ b/chromium/media/base/win/d3d11_mocks.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/dcomp_texture_wrapper.h b/chromium/media/base/win/dcomp_texture_wrapper.h
index 7944024f900..511621c8bb1 100644
--- a/chromium/media/base/win/dcomp_texture_wrapper.h
+++ b/chromium/media/base/win/dcomp_texture_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/dxgi_device_manager.cc b/chromium/media/base/win/dxgi_device_manager.cc
index b83e31c1c2a..1e953a4e40e 100644
--- a/chromium/media/base/win/dxgi_device_manager.cc
+++ b/chromium/media/base/win/dxgi_device_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/dxgi_device_manager.h b/chromium/media/base/win/dxgi_device_manager.h
index 8cc3b454d2e..66c581fa025 100644
--- a/chromium/media/base/win/dxgi_device_manager.h
+++ b/chromium/media/base/win/dxgi_device_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/dxgi_device_scope_handle_unittest.cc b/chromium/media/base/win/dxgi_device_scope_handle_unittest.cc
index 6e98c00436b..64716c161a6 100644
--- a/chromium/media/base/win/dxgi_device_scope_handle_unittest.cc
+++ b/chromium/media/base/win/dxgi_device_scope_handle_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/hresults.h b/chromium/media/base/win/hresults.h
index c35505289c9..6e5399aab61 100644
--- a/chromium/media/base/win/hresults.h
+++ b/chromium/media/base/win/hresults.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,6 +21,14 @@ constexpr HRESULT kErrorInitializeVideoWindowClass =
MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA02);
constexpr HRESULT kErrorCdmProxyReceivedInInvalidState =
MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA03);
+constexpr HRESULT kErrorResolveCoreWinRTStringDelayload =
+ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA04);
+constexpr HRESULT kErrorZeroProtectionSystemId =
+ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA05);
+constexpr HRESULT kErrorLoadLibrary =
+ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA06);
+constexpr HRESULT kErrorGetFunctionPointer =
+ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA07);
} // namespace media
diff --git a/chromium/media/base/win/media_foundation_cdm_proxy.h b/chromium/media/base/win/media_foundation_cdm_proxy.h
index d56a1e79b31..7e6488b0e3e 100644
--- a/chromium/media/base/win/media_foundation_cdm_proxy.h
+++ b/chromium/media/base/win/media_foundation_cdm_proxy.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/mf_feature_checks.cc b/chromium/media/base/win/mf_feature_checks.cc
index 7189f440f68..4f96939abb4 100644
--- a/chromium/media/base/win/mf_feature_checks.cc
+++ b/chromium/media/base/win/mf_feature_checks.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/mf_feature_checks.h b/chromium/media/base/win/mf_feature_checks.h
index 2a5ea3b58fe..11ba17a77ce 100644
--- a/chromium/media/base/win/mf_feature_checks.h
+++ b/chromium/media/base/win/mf_feature_checks.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/mf_helpers.cc b/chromium/media/base/win/mf_helpers.cc
index b04462857d4..0d558a61779 100644
--- a/chromium/media/base/win/mf_helpers.cc
+++ b/chromium/media/base/win/mf_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/mf_helpers.h b/chromium/media/base/win/mf_helpers.h
index 5a446739d1c..70b9907f62a 100644
--- a/chromium/media/base/win/mf_helpers.h
+++ b/chromium/media/base/win/mf_helpers.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/mf_initializer.cc b/chromium/media/base/win/mf_initializer.cc
index eb585cad0c1..8fa6d65c337 100644
--- a/chromium/media/base/win/mf_initializer.cc
+++ b/chromium/media/base/win/mf_initializer.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/mf_initializer.h b/chromium/media/base/win/mf_initializer.h
index 1c5077c2871..7a8014a10ee 100644
--- a/chromium/media/base/win/mf_initializer.h
+++ b/chromium/media/base/win/mf_initializer.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/mf_mocks.cc b/chromium/media/base/win/mf_mocks.cc
index 5c0d068f8ef..b03cb59b70e 100644
--- a/chromium/media/base/win/mf_mocks.cc
+++ b/chromium/media/base/win/mf_mocks.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/mf_mocks.h b/chromium/media/base/win/mf_mocks.h
index 6f8bc4c1986..8f325e32ef5 100644
--- a/chromium/media/base/win/mf_mocks.h
+++ b/chromium/media/base/win/mf_mocks.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/mf_util_export.h b/chromium/media/base/win/mf_util_export.h
index 87900230a52..d761b6b16d8 100644
--- a/chromium/media/base/win/mf_util_export.h
+++ b/chromium/media/base/win/mf_util_export.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/overlay_state_observer_subscription.h b/chromium/media/base/win/overlay_state_observer_subscription.h
index 16ca0870074..2a9ce8d347f 100644
--- a/chromium/media/base/win/overlay_state_observer_subscription.h
+++ b/chromium/media/base/win/overlay_state_observer_subscription.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/base/win/test_utils.h b/chromium/media/base/win/test_utils.h
index 8c7243af34a..a5e3752a083 100644
--- a/chromium/media/base/win/test_utils.h
+++ b/chromium/media/base/win/test_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/BUILD.gn b/chromium/media/capabilities/BUILD.gn
index 794dda86d03..08ba117c91c 100644
--- a/chromium/media/capabilities/BUILD.gn
+++ b/chromium/media/capabilities/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/capabilities/bucket_utility.cc b/chromium/media/capabilities/bucket_utility.cc
index facefcac8e8..8dd9e3a23a8 100644
--- a/chromium/media/capabilities/bucket_utility.cc
+++ b/chromium/media/capabilities/bucket_utility.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/bucket_utility.h b/chromium/media/capabilities/bucket_utility.h
index 8bcdbe2aad0..b51619e8bce 100644
--- a/chromium/media/capabilities/bucket_utility.h
+++ b/chromium/media/capabilities/bucket_utility.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/in_memory_video_decode_stats_db_impl.cc b/chromium/media/capabilities/in_memory_video_decode_stats_db_impl.cc
index 8f85d2553f5..6ba99b5a18d 100644
--- a/chromium/media/capabilities/in_memory_video_decode_stats_db_impl.cc
+++ b/chromium/media/capabilities/in_memory_video_decode_stats_db_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/in_memory_video_decode_stats_db_impl.h b/chromium/media/capabilities/in_memory_video_decode_stats_db_impl.h
index 20658bd65ba..ab406376084 100644
--- a/chromium/media/capabilities/in_memory_video_decode_stats_db_impl.h
+++ b/chromium/media/capabilities/in_memory_video_decode_stats_db_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/in_memory_video_decode_stats_db_unittest.cc b/chromium/media/capabilities/in_memory_video_decode_stats_db_unittest.cc
index 7899c78a8c8..745863e043b 100644
--- a/chromium/media/capabilities/in_memory_video_decode_stats_db_unittest.cc
+++ b/chromium/media/capabilities/in_memory_video_decode_stats_db_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/learning_helper.cc b/chromium/media/capabilities/learning_helper.cc
index c88e0d4eade..12549b94cdf 100644
--- a/chromium/media/capabilities/learning_helper.cc
+++ b/chromium/media/capabilities/learning_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/learning_helper.h b/chromium/media/capabilities/learning_helper.h
index 30c0f7ba3c1..96480e10351 100644
--- a/chromium/media/capabilities/learning_helper.h
+++ b/chromium/media/capabilities/learning_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/pending_operations.cc b/chromium/media/capabilities/pending_operations.cc
index c2060088f40..624d833e590 100644
--- a/chromium/media/capabilities/pending_operations.cc
+++ b/chromium/media/capabilities/pending_operations.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/pending_operations.h b/chromium/media/capabilities/pending_operations.h
index f775335e59e..07f0db4a441 100644
--- a/chromium/media/capabilities/pending_operations.h
+++ b/chromium/media/capabilities/pending_operations.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/pending_operations_unittest.cc b/chromium/media/capabilities/pending_operations_unittest.cc
index 5a9ce027e15..2af3fdb3a18 100644
--- a/chromium/media/capabilities/pending_operations_unittest.cc
+++ b/chromium/media/capabilities/pending_operations_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/video_decode_stats.proto b/chromium/media/capabilities/video_decode_stats.proto
index 4298adc0263..9c8918d4a0f 100644
--- a/chromium/media/capabilities/video_decode_stats.proto
+++ b/chromium/media/capabilities/video_decode_stats.proto
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/video_decode_stats_db.cc b/chromium/media/capabilities/video_decode_stats_db.cc
index b4356183101..e331dacdeb1 100644
--- a/chromium/media/capabilities/video_decode_stats_db.cc
+++ b/chromium/media/capabilities/video_decode_stats_db.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/video_decode_stats_db.h b/chromium/media/capabilities/video_decode_stats_db.h
index 78407078e60..5df12e6d12d 100644
--- a/chromium/media/capabilities/video_decode_stats_db.h
+++ b/chromium/media/capabilities/video_decode_stats_db.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/video_decode_stats_db_impl.cc b/chromium/media/capabilities/video_decode_stats_db_impl.cc
index 929fed2147d..0638f60183c 100644
--- a/chromium/media/capabilities/video_decode_stats_db_impl.cc
+++ b/chromium/media/capabilities/video_decode_stats_db_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/video_decode_stats_db_impl.h b/chromium/media/capabilities/video_decode_stats_db_impl.h
index 328b7c789f7..c4389e8d99f 100644
--- a/chromium/media/capabilities/video_decode_stats_db_impl.h
+++ b/chromium/media/capabilities/video_decode_stats_db_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/video_decode_stats_db_impl_unittest.cc b/chromium/media/capabilities/video_decode_stats_db_impl_unittest.cc
index ab075f6fa3d..cd33fcff2b8 100644
--- a/chromium/media/capabilities/video_decode_stats_db_impl_unittest.cc
+++ b/chromium/media/capabilities/video_decode_stats_db_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/video_decode_stats_db_provider.cc b/chromium/media/capabilities/video_decode_stats_db_provider.cc
index b58e44c7a26..ad0d4bd9dbf 100644
--- a/chromium/media/capabilities/video_decode_stats_db_provider.cc
+++ b/chromium/media/capabilities/video_decode_stats_db_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/video_decode_stats_db_provider.h b/chromium/media/capabilities/video_decode_stats_db_provider.h
index 6e56d9c6415..649541bcd37 100644
--- a/chromium/media/capabilities/video_decode_stats_db_provider.h
+++ b/chromium/media/capabilities/video_decode_stats_db_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/video_decode_stats_db_unittest.cc b/chromium/media/capabilities/video_decode_stats_db_unittest.cc
index ab56203ba53..c7922666caf 100644
--- a/chromium/media/capabilities/video_decode_stats_db_unittest.cc
+++ b/chromium/media/capabilities/video_decode_stats_db_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/webrtc_video_stats.proto b/chromium/media/capabilities/webrtc_video_stats.proto
index 157952dad41..33c39b1a456 100644
--- a/chromium/media/capabilities/webrtc_video_stats.proto
+++ b/chromium/media/capabilities/webrtc_video_stats.proto
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/webrtc_video_stats_db.cc b/chromium/media/capabilities/webrtc_video_stats_db.cc
index eaf25c63d6a..9b46948c885 100644
--- a/chromium/media/capabilities/webrtc_video_stats_db.cc
+++ b/chromium/media/capabilities/webrtc_video_stats_db.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/webrtc_video_stats_db.h b/chromium/media/capabilities/webrtc_video_stats_db.h
index 0e8653bd340..e9687cf4044 100644
--- a/chromium/media/capabilities/webrtc_video_stats_db.h
+++ b/chromium/media/capabilities/webrtc_video_stats_db.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/webrtc_video_stats_db_impl.cc b/chromium/media/capabilities/webrtc_video_stats_db_impl.cc
index 6dbf9309361..2fd1b7d5c43 100644
--- a/chromium/media/capabilities/webrtc_video_stats_db_impl.cc
+++ b/chromium/media/capabilities/webrtc_video_stats_db_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/webrtc_video_stats_db_impl.h b/chromium/media/capabilities/webrtc_video_stats_db_impl.h
index a41284a930e..91c9a749986 100644
--- a/chromium/media/capabilities/webrtc_video_stats_db_impl.h
+++ b/chromium/media/capabilities/webrtc_video_stats_db_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/webrtc_video_stats_db_impl_unittest.cc b/chromium/media/capabilities/webrtc_video_stats_db_impl_unittest.cc
index e1ba54696f5..babb4b03aa9 100644
--- a/chromium/media/capabilities/webrtc_video_stats_db_impl_unittest.cc
+++ b/chromium/media/capabilities/webrtc_video_stats_db_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/webrtc_video_stats_db_provider.cc b/chromium/media/capabilities/webrtc_video_stats_db_provider.cc
index d2616cf959b..bf1a3d937a4 100644
--- a/chromium/media/capabilities/webrtc_video_stats_db_provider.cc
+++ b/chromium/media/capabilities/webrtc_video_stats_db_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/webrtc_video_stats_db_provider.h b/chromium/media/capabilities/webrtc_video_stats_db_provider.h
index 1bc3db8ab09..d1927d511bb 100644
--- a/chromium/media/capabilities/webrtc_video_stats_db_provider.h
+++ b/chromium/media/capabilities/webrtc_video_stats_db_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capabilities/webrtc_video_stats_db_unittest.cc b/chromium/media/capabilities/webrtc_video_stats_db_unittest.cc
index a93c33427eb..5f161433926 100644
--- a/chromium/media/capabilities/webrtc_video_stats_db_unittest.cc
+++ b/chromium/media/capabilities/webrtc_video_stats_db_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/BUILD.gn b/chromium/media/capture/BUILD.gn
index f1a7988e4dd..27afc021354 100644
--- a/chromium/media/capture/BUILD.gn
+++ b/chromium/media/capture/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -477,7 +477,6 @@ test("capture_unittests") {
"video/fuchsia/video_capture_device_factory_fuchsia_test.cc",
"video/fuchsia/video_capture_device_fuchsia_test.cc",
]
- use_cfv1 = false
additional_manifest_fragments =
[ "//media/fuchsia/test_support.shard.test-cml" ]
}
diff --git a/chromium/media/capture/capture_export.h b/chromium/media/capture/capture_export.h
index 93c6511f4d0..980fd103f9c 100644
--- a/chromium/media/capture/capture_export.h
+++ b/chromium/media/capture/capture_export.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/capture_switches.cc b/chromium/media/capture/capture_switches.cc
index f6ac00cdc05..219b9870873 100644
--- a/chromium/media/capture/capture_switches.cc
+++ b/chromium/media/capture/capture_switches.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,3 +30,13 @@ CAPTURE_EXPORT bool IsVideoCaptureUseGpuMemoryBufferEnabled() {
}
} // namespace switches
+
+namespace features {
+
+#if BUILDFLAG(IS_CHROMEOS_LACROS)
+BASE_FEATURE(kLacrosAuraCapture,
+ "LacrosAuraCapture",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+#endif
+
+} // namespace features
diff --git a/chromium/media/capture/capture_switches.h b/chromium/media/capture/capture_switches.h
index 7dc17da3774..aee58a4c1d0 100644
--- a/chromium/media/capture/capture_switches.h
+++ b/chromium/media/capture/capture_switches.h
@@ -1,10 +1,13 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_CAPTURE_CAPTURE_SWITCHES_H_
#define MEDIA_CAPTURE_CAPTURE_SWITCHES_H_
+#include "base/feature_list.h"
+#include "build/build_config.h"
+#include "build/chromeos_buildflags.h"
#include "media/capture/capture_export.h"
namespace switches {
@@ -16,4 +19,12 @@ CAPTURE_EXPORT bool IsVideoCaptureUseGpuMemoryBufferEnabled();
} // namespace switches
+namespace features {
+
+#if BUILDFLAG(IS_CHROMEOS_LACROS)
+CAPTURE_EXPORT BASE_DECLARE_FEATURE(kLacrosAuraCapture);
+#endif
+
+} // namespace features
+
#endif // MEDIA_CAPTURE_CAPTURE_SWITCHES_H_
diff --git a/chromium/media/capture/content/android/BUILD.gn b/chromium/media/capture/content/android/BUILD.gn
index 01c5e88c958..29b3a94ed05 100644
--- a/chromium/media/capture/content/android/BUILD.gn
+++ b/chromium/media/capture/content/android/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/capture/content/android/screen_capture_machine_android.cc b/chromium/media/capture/content/android/screen_capture_machine_android.cc
index d8d417fa1ec..7578df5b6a5 100644
--- a/chromium/media/capture/content/android/screen_capture_machine_android.cc
+++ b/chromium/media/capture/content/android/screen_capture_machine_android.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -76,14 +76,15 @@ void ScreenCaptureMachineAndroid::OnRGBAFrameAvailable(
const int offset = top * row_stride + left * 4;
// ABGR little endian (rgba in memory) to I420.
- libyuv::ABGRToI420(
- src + offset, row_stride, temp_frame->visible_data(VideoFrame::kYPlane),
- temp_frame->stride(VideoFrame::kYPlane),
- temp_frame->visible_data(VideoFrame::kUPlane),
- temp_frame->stride(VideoFrame::kUPlane),
- temp_frame->visible_data(VideoFrame::kVPlane),
- temp_frame->stride(VideoFrame::kVPlane),
- temp_frame->visible_rect().width(), temp_frame->visible_rect().height());
+ libyuv::ABGRToI420(src + offset, row_stride,
+ temp_frame->GetWritableVisibleData(VideoFrame::kYPlane),
+ temp_frame->stride(VideoFrame::kYPlane),
+ temp_frame->GetWritableVisibleData(VideoFrame::kUPlane),
+ temp_frame->stride(VideoFrame::kUPlane),
+ temp_frame->GetWritableVisibleData(VideoFrame::kVPlane),
+ temp_frame->stride(VideoFrame::kVPlane),
+ temp_frame->visible_rect().width(),
+ temp_frame->visible_rect().height());
if (temp_frame != frame) {
libyuv::I420Scale(
@@ -94,11 +95,11 @@ void ScreenCaptureMachineAndroid::OnRGBAFrameAvailable(
temp_frame->visible_data(VideoFrame::kVPlane),
temp_frame->stride(VideoFrame::kVPlane),
temp_frame->visible_rect().width(), temp_frame->visible_rect().height(),
- frame->visible_data(VideoFrame::kYPlane),
+ frame->GetWritableVisibleData(VideoFrame::kYPlane),
frame->stride(VideoFrame::kYPlane),
- frame->visible_data(VideoFrame::kUPlane),
+ frame->GetWritableVisibleData(VideoFrame::kUPlane),
frame->stride(VideoFrame::kUPlane),
- frame->visible_data(VideoFrame::kVPlane),
+ frame->GetWritableVisibleData(VideoFrame::kVPlane),
frame->stride(VideoFrame::kVPlane), frame->visible_rect().width(),
frame->visible_rect().height(), libyuv::kFilterBilinear);
}
@@ -160,11 +161,11 @@ void ScreenCaptureMachineAndroid::OnI420FrameAvailable(
libyuv::Android420ToI420(
y_src + y_offset, y_stride, u_src + uv_offset, uv_row_stride,
v_src + uv_offset, uv_row_stride, uv_pixel_stride,
- temp_frame->visible_data(VideoFrame::kYPlane),
+ temp_frame->GetWritableVisibleData(VideoFrame::kYPlane),
temp_frame->stride(VideoFrame::kYPlane),
- temp_frame->visible_data(VideoFrame::kUPlane),
+ temp_frame->GetWritableVisibleData(VideoFrame::kUPlane),
temp_frame->stride(VideoFrame::kUPlane),
- temp_frame->visible_data(VideoFrame::kVPlane),
+ temp_frame->GetWritableVisibleData(VideoFrame::kVPlane),
temp_frame->stride(VideoFrame::kVPlane),
temp_frame->visible_rect().width(), temp_frame->visible_rect().height());
@@ -177,11 +178,11 @@ void ScreenCaptureMachineAndroid::OnI420FrameAvailable(
temp_frame->visible_data(VideoFrame::kVPlane),
temp_frame->stride(VideoFrame::kVPlane),
temp_frame->visible_rect().width(), temp_frame->visible_rect().height(),
- frame->visible_data(VideoFrame::kYPlane),
+ frame->GetWritableVisibleData(VideoFrame::kYPlane),
frame->stride(VideoFrame::kYPlane),
- frame->visible_data(VideoFrame::kUPlane),
+ frame->GetWritableVisibleData(VideoFrame::kUPlane),
frame->stride(VideoFrame::kUPlane),
- frame->visible_data(VideoFrame::kVPlane),
+ frame->GetWritableVisibleData(VideoFrame::kVPlane),
frame->stride(VideoFrame::kVPlane), frame->visible_rect().width(),
frame->visible_rect().height(), libyuv::kFilterBilinear);
}
@@ -304,11 +305,11 @@ void ScreenCaptureMachineAndroid::MaybeCaptureForRefresh() {
lastFrame_->visible_data(VideoFrame::kVPlane),
lastFrame_->stride(VideoFrame::kVPlane),
lastFrame_->visible_rect().width(), lastFrame_->visible_rect().height(),
- frame->visible_data(VideoFrame::kYPlane),
+ frame->GetWritableVisibleData(VideoFrame::kYPlane),
frame->stride(VideoFrame::kYPlane),
- frame->visible_data(VideoFrame::kUPlane),
+ frame->GetWritableVisibleData(VideoFrame::kUPlane),
frame->stride(VideoFrame::kUPlane),
- frame->visible_data(VideoFrame::kVPlane),
+ frame->GetWritableVisibleData(VideoFrame::kVPlane),
frame->stride(VideoFrame::kVPlane), frame->visible_rect().width(),
frame->visible_rect().height(), libyuv::kFilterBilinear);
diff --git a/chromium/media/capture/content/android/screen_capture_machine_android.h b/chromium/media/capture/content/android/screen_capture_machine_android.h
index c195ec17dc4..aed4bc39843 100644
--- a/chromium/media/capture/content/android/screen_capture_machine_android.h
+++ b/chromium/media/capture/content/android/screen_capture_machine_android.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/android/thread_safe_capture_oracle.cc b/chromium/media/capture/content/android/thread_safe_capture_oracle.cc
index 3284a9a91e0..cbbbd367dc8 100644
--- a/chromium/media/capture/content/android/thread_safe_capture_oracle.cc
+++ b/chromium/media/capture/content/android/thread_safe_capture_oracle.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/android/thread_safe_capture_oracle.h b/chromium/media/capture/content/android/thread_safe_capture_oracle.h
index ae5ff87fd9f..1ea30202cf2 100644
--- a/chromium/media/capture/content/android/thread_safe_capture_oracle.h
+++ b/chromium/media/capture/content/android/thread_safe_capture_oracle.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/animated_content_sampler.cc b/chromium/media/capture/content/animated_content_sampler.cc
index 11653afc7f6..6fe67268c1d 100644
--- a/chromium/media/capture/content/animated_content_sampler.cc
+++ b/chromium/media/capture/content/animated_content_sampler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/animated_content_sampler.h b/chromium/media/capture/content/animated_content_sampler.h
index 90b2b51da8a..89d11829ac0 100644
--- a/chromium/media/capture/content/animated_content_sampler.h
+++ b/chromium/media/capture/content/animated_content_sampler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/animated_content_sampler_unittest.cc b/chromium/media/capture/content/animated_content_sampler_unittest.cc
index 48b02cd1c5f..918b8fa4ee2 100644
--- a/chromium/media/capture/content/animated_content_sampler_unittest.cc
+++ b/chromium/media/capture/content/animated_content_sampler_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/capture_resolution_chooser.cc b/chromium/media/capture/content/capture_resolution_chooser.cc
index 496ae311fa9..4ca36f4c717 100644
--- a/chromium/media/capture/content/capture_resolution_chooser.cc
+++ b/chromium/media/capture/content/capture_resolution_chooser.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/capture_resolution_chooser.h b/chromium/media/capture/content/capture_resolution_chooser.h
index a31045368a8..68c3fef9609 100644
--- a/chromium/media/capture/content/capture_resolution_chooser.h
+++ b/chromium/media/capture/content/capture_resolution_chooser.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/capture_resolution_chooser_unittest.cc b/chromium/media/capture/content/capture_resolution_chooser_unittest.cc
index 3d249068f86..57817da56b6 100644
--- a/chromium/media/capture/content/capture_resolution_chooser_unittest.cc
+++ b/chromium/media/capture/content/capture_resolution_chooser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/screen_enumerator.h b/chromium/media/capture/content/screen_enumerator.h
index e115e4ff572..69d7b2db2db 100644
--- a/chromium/media/capture/content/screen_enumerator.h
+++ b/chromium/media/capture/content/screen_enumerator.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/smooth_event_sampler.cc b/chromium/media/capture/content/smooth_event_sampler.cc
index e614949cd24..cdf6a46f4c3 100644
--- a/chromium/media/capture/content/smooth_event_sampler.cc
+++ b/chromium/media/capture/content/smooth_event_sampler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/smooth_event_sampler.h b/chromium/media/capture/content/smooth_event_sampler.h
index 29623c826dd..f9ea9f58dad 100644
--- a/chromium/media/capture/content/smooth_event_sampler.h
+++ b/chromium/media/capture/content/smooth_event_sampler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/smooth_event_sampler_unittest.cc b/chromium/media/capture/content/smooth_event_sampler_unittest.cc
index fb18539bc83..d4600f3686a 100644
--- a/chromium/media/capture/content/smooth_event_sampler_unittest.cc
+++ b/chromium/media/capture/content/smooth_event_sampler_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/video_capture_oracle.cc b/chromium/media/capture/content/video_capture_oracle.cc
index 44906bc3e26..1e9cd2deeb1 100644
--- a/chromium/media/capture/content/video_capture_oracle.cc
+++ b/chromium/media/capture/content/video_capture_oracle.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/video_capture_oracle.h b/chromium/media/capture/content/video_capture_oracle.h
index f3c17c4237a..78d87014174 100644
--- a/chromium/media/capture/content/video_capture_oracle.h
+++ b/chromium/media/capture/content/video_capture_oracle.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/content/video_capture_oracle_unittest.cc b/chromium/media/capture/content/video_capture_oracle_unittest.cc
index eb0f4de1aff..94d2e1f7bf1 100644
--- a/chromium/media/capture/content/video_capture_oracle_unittest.cc
+++ b/chromium/media/capture/content/video_capture_oracle_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/mojom/BUILD.gn b/chromium/media/capture/mojom/BUILD.gn
index 81b5703a525..db44033ad12 100644
--- a/chromium/media/capture/mojom/BUILD.gn
+++ b/chromium/media/capture/mojom/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/capture/mojom/image_capture.mojom b/chromium/media/capture/mojom/image_capture.mojom
index 5a624e1a78c..a1c8698c17c 100644
--- a/chromium/media/capture/mojom/image_capture.mojom
+++ b/chromium/media/capture/mojom/image_capture.mojom
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/mojom/image_capture_types.cc b/chromium/media/capture/mojom/image_capture_types.cc
index efb486a12a1..7e45686a0c5 100644
--- a/chromium/media/capture/mojom/image_capture_types.cc
+++ b/chromium/media/capture/mojom/image_capture_types.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/mojom/image_capture_types.h b/chromium/media/capture/mojom/image_capture_types.h
index af83ff596e8..0cefd6ff24e 100644
--- a/chromium/media/capture/mojom/image_capture_types.h
+++ b/chromium/media/capture/mojom/image_capture_types.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/mojom/video_capture.mojom b/chromium/media/capture/mojom/video_capture.mojom
index fbbb8577242..bcd403b92e4 100644
--- a/chromium/media/capture/mojom/video_capture.mojom
+++ b/chromium/media/capture/mojom/video_capture.mojom
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,6 @@ module media.mojom;
import "media/capture/mojom/video_capture_buffer.mojom";
import "media/capture/mojom/video_capture_types.mojom";
-import "ui/gfx/geometry/mojom/geometry.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
// This file decribes the communication between a given Renderer Host interface
diff --git a/chromium/media/capture/mojom/video_capture_buffer.mojom b/chromium/media/capture/mojom/video_capture_buffer.mojom
index 8177c36365c..5eba8a12c6a 100644
--- a/chromium/media/capture/mojom/video_capture_buffer.mojom
+++ b/chromium/media/capture/mojom/video_capture_buffer.mojom
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -46,11 +46,6 @@ struct MailboxBufferHandleSet {
array<gpu.mojom.MailboxHolder, 4> mailbox_holder;
};
-struct SharedMemoryViaRawFileDescriptor {
- handle<platform> file_descriptor_handle;
- uint32 shared_memory_size_in_bytes;
-};
-
union VideoBufferHandle {
// TODO(https://crbug.com/1316808): It is extremely confusing that this union
// has both an unsafe and a read-only shmem region subtype. This is probably
@@ -58,9 +53,6 @@ union VideoBufferHandle {
// into more distinct types.
mojo_base.mojom.UnsafeSharedMemoryRegion unsafe_shmem_region;
mojo_base.mojom.ReadOnlySharedMemoryRegion read_only_shmem_region;
- // TODO(https://crbug.com/857537): remove this field; it was only needed for
- // compatibility with older versions of Mojo on ChromeOS.
- SharedMemoryViaRawFileDescriptor shared_memory_via_raw_file_descriptor;
MailboxBufferHandleSet mailbox_handles;
gfx.mojom.GpuMemoryBufferHandle gpu_memory_buffer_handle;
};
diff --git a/chromium/media/capture/mojom/video_capture_types.mojom b/chromium/media/capture/mojom/video_capture_types.mojom
index d9be2ad42e3..d8814af6faf 100644
--- a/chromium/media/capture/mojom/video_capture_types.mojom
+++ b/chromium/media/capture/mojom/video_capture_types.mojom
@@ -1,10 +1,9 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
-import "mojo/public/mojom/base/time.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
[Stable, Extensible]
@@ -95,15 +94,8 @@ enum VideoCaptureTransportType {
[Stable, Extensible]
enum VideoCaptureBufferType {
kSharedMemory,
-
- // Warning: This case is a workaround for compatibility with an older version
- // of Mojo only and will be deleted as soon as the Mojo version of ChromiumOS
- // becomes compatible with the |kSharedMemory|.
- // TODO(chfremer): Remove this when https://crbug.com/857537 is resolved.
- kSharedMemoryViaRawFileDescriptor,
-
+ kSharedMemoryViaRawFileDescriptor_DEPRECATED, // DEPRECATED, DO NOT USE
kMailboxHolder,
-
kGpuMemoryBuffer
};
@@ -282,7 +274,8 @@ enum VideoCaptureFrameDropReason {
kResolutionAdapterFrameRateIsHigherThanRequested,
kResolutionAdapterHasNoCallbacks,
kVideoTrackFrameDelivererNotEnabledReplacingWithBlackFrame,
- kRendererSinkFrameDelivererIsNotStarted
+ kRendererSinkFrameDelivererIsNotStarted,
+ [MinVersion=1] kCropVersionNotCurrent
};
[Stable]
@@ -379,7 +372,7 @@ struct VideoCaptureDeviceInfo {
};
// The result of an attempt by the client to start/stop cropping.
-// TODO(crbug.com/1247761): Remove kNotImplemented.
+// TODO(crbug.com/1264849): Remove kNotImplemented.
enum CropRequestResult {
kSuccess,
kErrorGeneric,
diff --git a/chromium/media/capture/mojom/video_capture_types_mojom_traits.cc b/chromium/media/capture/mojom/video_capture_types_mojom_traits.cc
index b0abd8a1402..2dd70140c40 100644
--- a/chromium/media/capture/mojom/video_capture_types_mojom_traits.cc
+++ b/chromium/media/capture/mojom/video_capture_types_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -291,9 +291,6 @@ EnumTraits<media::mojom::VideoCaptureBufferType,
switch (input) {
case media::VideoCaptureBufferType::kSharedMemory:
return media::mojom::VideoCaptureBufferType::kSharedMemory;
- case media::VideoCaptureBufferType::kSharedMemoryViaRawFileDescriptor:
- return media::mojom::VideoCaptureBufferType::
- kSharedMemoryViaRawFileDescriptor;
case media::VideoCaptureBufferType::kMailboxHolder:
return media::mojom::VideoCaptureBufferType::kMailboxHolder;
case media::VideoCaptureBufferType::kGpuMemoryBuffer:
@@ -313,10 +310,9 @@ bool EnumTraits<media::mojom::VideoCaptureBufferType,
*output = media::VideoCaptureBufferType::kSharedMemory;
return true;
case media::mojom::VideoCaptureBufferType::
- kSharedMemoryViaRawFileDescriptor:
- *output =
- media::VideoCaptureBufferType::kSharedMemoryViaRawFileDescriptor;
- return true;
+ kSharedMemoryViaRawFileDescriptor_DEPRECATED:
+ NOTREACHED();
+ return false;
case media::mojom::VideoCaptureBufferType::kMailboxHolder:
*output = media::VideoCaptureBufferType::kMailboxHolder;
return true;
@@ -1478,6 +1474,8 @@ EnumTraits<media::mojom::VideoCaptureFrameDropReason,
kRendererSinkFrameDelivererIsNotStarted:
return media::mojom::VideoCaptureFrameDropReason::
kRendererSinkFrameDelivererIsNotStarted;
+ case media::VideoCaptureFrameDropReason::kCropVersionNotCurrent:
+ return media::mojom::VideoCaptureFrameDropReason::kCropVersionNotCurrent;
}
NOTREACHED();
return media::mojom::VideoCaptureFrameDropReason::kNone;
@@ -1613,6 +1611,9 @@ bool EnumTraits<media::mojom::VideoCaptureFrameDropReason,
*output = media::VideoCaptureFrameDropReason::
kRendererSinkFrameDelivererIsNotStarted;
return true;
+ case media::mojom::VideoCaptureFrameDropReason::kCropVersionNotCurrent:
+ *output = media::VideoCaptureFrameDropReason::kCropVersionNotCurrent;
+ return true;
}
NOTREACHED();
return false;
diff --git a/chromium/media/capture/mojom/video_capture_types_mojom_traits.h b/chromium/media/capture/mojom/video_capture_types_mojom_traits.h
index d6cad61f9c0..b0e4c824937 100644
--- a/chromium/media/capture/mojom/video_capture_types_mojom_traits.h
+++ b/chromium/media/capture/mojom/video_capture_types_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/run_all_unittests.cc b/chromium/media/capture/run_all_unittests.cc
index 6b69c1cc883..1a09d26b60e 100644
--- a/chromium/media/capture/run_all_unittests.cc
+++ b/chromium/media/capture/run_all_unittests.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/android/BUILD.gn b/chromium/media/capture/video/android/BUILD.gn
index 3ff17dbedc2..6ac5958ded4 100644
--- a/chromium/media/capture/video/android/BUILD.gn
+++ b/chromium/media/capture/video/android/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/capture/video/android/photo_capabilities.cc b/chromium/media/capture/video/android/photo_capabilities.cc
index 8f6598c8f61..65e3b508297 100644
--- a/chromium/media/capture/video/android/photo_capabilities.cc
+++ b/chromium/media/capture/video/android/photo_capabilities.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/android/photo_capabilities.h b/chromium/media/capture/video/android/photo_capabilities.h
index d2c47f10aed..47fb9276346 100644
--- a/chromium/media/capture/video/android/photo_capabilities.h
+++ b/chromium/media/capture/video/android/photo_capabilities.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/android/video_capture_device_android.cc b/chromium/media/capture/video/android/video_capture_device_android.cc
index 04aa8e979e8..137d720ffc8 100644
--- a/chromium/media/capture/video/android/video_capture_device_android.cc
+++ b/chromium/media/capture/video/android/video_capture_device_android.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "base/android/jni_string.h"
#include "base/bind.h"
#include "base/numerics/safe_conversions.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
@@ -391,11 +392,9 @@ void VideoCaptureDeviceAndroid::OnGetPhotoCapabilitiesReply(
GetPhotoStateCallback* const cb =
reinterpret_cast<GetPhotoStateCallback*>(callback_id);
// Search for the pointer |cb| in the list of |take_photo_callbacks_|.
- const auto reference_it = std::find_if(
- get_photo_state_callbacks_.begin(), get_photo_state_callbacks_.end(),
- [cb](const std::unique_ptr<GetPhotoStateCallback>& callback) {
- return callback.get() == cb;
- });
+ const auto reference_it =
+ base::ranges::find(get_photo_state_callbacks_, cb,
+ &std::unique_ptr<GetPhotoStateCallback>::get);
if (reference_it == get_photo_state_callbacks_.end()) {
NOTREACHED() << "|callback_id| not found.";
return;
@@ -557,11 +556,8 @@ void VideoCaptureDeviceAndroid::OnPhotoTaken(
TakePhotoCallback* const cb =
reinterpret_cast<TakePhotoCallback*>(callback_id);
// Search for the pointer |cb| in the list of |take_photo_callbacks_|.
- const auto reference_it =
- std::find_if(take_photo_callbacks_.begin(), take_photo_callbacks_.end(),
- [cb](const std::unique_ptr<TakePhotoCallback>& callback) {
- return callback.get() == cb;
- });
+ const auto reference_it = base::ranges::find(
+ take_photo_callbacks_, cb, &std::unique_ptr<TakePhotoCallback>::get);
if (reference_it == take_photo_callbacks_.end()) {
NOTREACHED() << "|callback_id| not found.";
return;
diff --git a/chromium/media/capture/video/android/video_capture_device_android.h b/chromium/media/capture/video/android/video_capture_device_android.h
index ffe0a6a9769..99610d75e1e 100644
--- a/chromium/media/capture/video/android/video_capture_device_android.h
+++ b/chromium/media/capture/video/android/video_capture_device_android.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/android/video_capture_device_factory_android.cc b/chromium/media/capture/video/android/video_capture_device_factory_android.cc
index a9a8aa4132b..c259ef03b2b 100644
--- a/chromium/media/capture/video/android/video_capture_device_factory_android.cc
+++ b/chromium/media/capture/video/android/video_capture_device_factory_android.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/android/video_capture_device_factory_android.h b/chromium/media/capture/video/android/video_capture_device_factory_android.h
index 3eef79c97ac..73af6f86b5b 100644
--- a/chromium/media/capture/video/android/video_capture_device_factory_android.h
+++ b/chromium/media/capture/video/android/video_capture_device_factory_android.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/blob_utils.cc b/chromium/media/capture/video/blob_utils.cc
index 79b436fdb84..b3ec8862ff1 100644
--- a/chromium/media/capture/video/blob_utils.cc
+++ b/chromium/media/capture/video/blob_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/blob_utils.h b/chromium/media/capture/video/blob_utils.h
index 1fd89428fa6..930b62d41be 100644
--- a/chromium/media/capture/video/blob_utils.h
+++ b/chromium/media/capture/video/blob_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_3a_controller.cc b/chromium/media/capture/video/chromeos/camera_3a_controller.cc
index ee4b9710d81..3b807f3cfa8 100644
--- a/chromium/media/capture/video/chromeos/camera_3a_controller.cc
+++ b/chromium/media/capture/video/chromeos/camera_3a_controller.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -108,11 +108,10 @@ Camera3AController::Camera3AController(
if (available_modes.empty()) {
return false;
}
- if (std::find(
- available_modes.begin(), available_modes.end(),
+ if (!base::Contains(
+ available_modes,
base::checked_cast<uint8_t>(
- cros::mojom::AndroidControlMode::ANDROID_CONTROL_MODE_AUTO)) ==
- available_modes.end()) {
+ cros::mojom::AndroidControlMode::ANDROID_CONTROL_MODE_AUTO))) {
return false;
}
if (!available_ae_modes_.count(
diff --git a/chromium/media/capture/video/chromeos/camera_3a_controller.h b/chromium/media/capture/video/chromeos/camera_3a_controller.h
index f55ded1b9c7..af5848b530b 100644
--- a/chromium/media/capture/video/chromeos/camera_3a_controller.h
+++ b/chromium/media/capture/video/chromeos/camera_3a_controller.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_3a_controller_unittest.cc b/chromium/media/capture/video/chromeos/camera_3a_controller_unittest.cc
index c3ef25bc773..ccc5b7b7e81 100644
--- a/chromium/media/capture/video/chromeos/camera_3a_controller_unittest.cc
+++ b/chromium/media/capture/video/chromeos/camera_3a_controller_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.cc b/chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.cc
index 25b1c31f64c..b544626d41a 100644
--- a/chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.cc
+++ b/chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.h b/chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.h
index 42f70a79128..a11df376cab 100644
--- a/chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.h
+++ b/chromium/media/capture/video/chromeos/camera_app_device_bridge_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_app_device_impl.cc b/chromium/media/capture/video/chromeos/camera_app_device_impl.cc
index 6ffc6ca9e88..df88bbb223b 100644
--- a/chromium/media/capture/video/chromeos/camera_app_device_impl.cc
+++ b/chromium/media/capture/video/chromeos/camera_app_device_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_app_device_impl.h b/chromium/media/capture/video/chromeos/camera_app_device_impl.h
index 302d6ea211f..26efbf0c980 100644
--- a/chromium/media/capture/video/chromeos/camera_app_device_impl.h
+++ b/chromium/media/capture/video/chromeos/camera_app_device_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_app_device_provider_impl.cc b/chromium/media/capture/video/chromeos/camera_app_device_provider_impl.cc
index e48a537190c..390a1d1183b 100644
--- a/chromium/media/capture/video/chromeos/camera_app_device_provider_impl.cc
+++ b/chromium/media/capture/video/chromeos/camera_app_device_provider_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_app_device_provider_impl.h b/chromium/media/capture/video/chromeos/camera_app_device_provider_impl.h
index e5a58c6d3a8..179110ac5f2 100644
--- a/chromium/media/capture/video/chromeos/camera_app_device_provider_impl.h
+++ b/chromium/media/capture/video/chromeos/camera_app_device_provider_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "media/capture/capture_export.h"
#include "media/capture/video/chromeos/mojom/camera_app.mojom.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
namespace media {
diff --git a/chromium/media/capture/video/chromeos/camera_buffer_factory.cc b/chromium/media/capture/video/chromeos/camera_buffer_factory.cc
index a4e3b5eb88f..af427372c91 100644
--- a/chromium/media/capture/video/chromeos/camera_buffer_factory.cc
+++ b/chromium/media/capture/video/chromeos/camera_buffer_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_buffer_factory.h b/chromium/media/capture/video/chromeos/camera_buffer_factory.h
index a2c2a2cb015..c9efd204a1e 100644
--- a/chromium/media/capture/video/chromeos/camera_buffer_factory.h
+++ b/chromium/media/capture/video/chromeos/camera_buffer_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_device_context.cc b/chromium/media/capture/video/chromeos/camera_device_context.cc
index ffc648f13f6..7204ce9b1e3 100644
--- a/chromium/media/capture/video/chromeos/camera_device_context.cc
+++ b/chromium/media/capture/video/chromeos/camera_device_context.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_device_context.h b/chromium/media/capture/video/chromeos/camera_device_context.h
index a85d7f58243..c8ca8eb1eee 100644
--- a/chromium/media/capture/video/chromeos/camera_device_context.h
+++ b/chromium/media/capture/video/chromeos/camera_device_context.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_device_delegate.cc b/chromium/media/capture/video/chromeos/camera_device_delegate.cc
index 8ce1aa3dda3..469abbfabc8 100644
--- a/chromium/media/capture/video/chromeos/camera_device_delegate.cc
+++ b/chromium/media/capture/video/chromeos/camera_device_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -971,7 +971,12 @@ void CameraDeviceDelegate::ConfigureStreams(
stream_config->streams.push_back(std::move(still_capture_stream));
int32_t max_yuv_width = 0, max_yuv_height = 0;
- if (IsYUVReprocessingSupported(&max_yuv_width, &max_yuv_height)) {
+ bool is_recording_multi_stream =
+ camera_app_device->GetCaptureIntent() ==
+ cros::mojom::CaptureIntent::VIDEO_RECORD &&
+ camera_app_device->IsMultipleStreamsEnabled();
+ if (IsYUVReprocessingSupported(&max_yuv_width, &max_yuv_height) &&
+ !is_recording_multi_stream) {
auto reprocessing_stream_input = cros::mojom::Camera3Stream::New();
reprocessing_stream_input->id =
static_cast<uint64_t>(StreamType::kYUVInput);
diff --git a/chromium/media/capture/video/chromeos/camera_device_delegate.h b/chromium/media/capture/video/chromeos/camera_device_delegate.h
index 4d495ae3aff..47d99ecd0b1 100644
--- a/chromium/media/capture/video/chromeos/camera_device_delegate.h
+++ b/chromium/media/capture/video/chromeos/camera_device_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_device_delegate_unittest.cc b/chromium/media/capture/video/chromeos/camera_device_delegate_unittest.cc
index 42ede887a32..6631f889088 100644
--- a/chromium/media/capture/video/chromeos/camera_device_delegate_unittest.cc
+++ b/chromium/media/capture/video/chromeos/camera_device_delegate_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -50,7 +50,7 @@ class MockCameraDevice : public cros::mojom::Camera3DeviceOps {
MockCameraDevice(const MockCameraDevice&) = delete;
MockCameraDevice& operator=(const MockCameraDevice&) = delete;
- ~MockCameraDevice() = default;
+ ~MockCameraDevice() override = default;
void Initialize(
mojo::PendingRemote<cros::mojom::Camera3CallbackOps> callback_ops,
diff --git a/chromium/media/capture/video/chromeos/camera_hal_delegate.cc b/chromium/media/capture/video/chromeos/camera_hal_delegate.cc
index 2387a3998e4..1f753fdc16f 100644
--- a/chromium/media/capture/video/chromeos/camera_hal_delegate.cc
+++ b/chromium/media/capture/video/chromeos/camera_hal_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,7 +7,6 @@
#include <fcntl.h>
#include <sys/uio.h>
-#include <algorithm>
#include <utility>
#include "base/bind.h"
@@ -15,6 +14,7 @@
#include "base/containers/flat_set.h"
#include "base/posix/safe_strerror.h"
#include "base/process/launch.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
@@ -83,7 +83,7 @@ bool IsVividLoaded() {
std::vector<base::StringPiece> lines = base::SplitStringPieceUsingSubstr(
output, "\n", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
- return std::any_of(lines.begin(), lines.end(), [](const auto& line) {
+ return base::ranges::any_of(lines, [](const auto& line) {
return base::StartsWith(line, "vivid", base::CompareCase::SENSITIVE);
});
}
diff --git a/chromium/media/capture/video/chromeos/camera_hal_delegate.h b/chromium/media/capture/video/chromeos/camera_hal_delegate.h
index 69d7d841b28..9942dc1e11f 100644
--- a/chromium/media/capture/video/chromeos/camera_hal_delegate.h
+++ b/chromium/media/capture/video/chromeos/camera_hal_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_hal_delegate_unittest.cc b/chromium/media/capture/video/chromeos/camera_hal_delegate_unittest.cc
index c6c97756bdf..8b806ec8d71 100644
--- a/chromium/media/capture/video/chromeos/camera_hal_delegate_unittest.cc
+++ b/chromium/media/capture/video/chromeos/camera_hal_delegate_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc b/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
index f9ba75e0b21..7c64ff694c6 100644
--- a/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
+++ b/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -59,6 +59,10 @@ const base::FilePath::CharType kForceEnableAutoFramingPath[] =
"/run/camera/force_enable_auto_framing";
const base::FilePath::CharType kForceDisableAutoFramingPath[] =
"/run/camera/force_disable_auto_framing";
+const base::FilePath::CharType kForceEnableEffectsPath[] =
+ "/run/camera/force_enable_effects";
+const base::FilePath::CharType kForceDisableEffectsPath[] =
+ "/run/camera/force_disable_effects";
std::string GenerateRandomToken() {
char random_bytes[16];
@@ -266,6 +270,32 @@ bool CameraHalDispatcherImpl::Start(
}
}
+ {
+ base::FilePath enable_file_path(kForceEnableEffectsPath);
+ base::FilePath disable_file_path(kForceDisableEffectsPath);
+ if (!base::DeleteFile(enable_file_path)) {
+ LOG(WARNING) << "Could not delete " << kForceEnableEffectsPath;
+ }
+ if (!base::DeleteFile(disable_file_path)) {
+ LOG(WARNING) << "Could not delete " << kForceDisableEffectsPath;
+ }
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(media::switches::kEffectsOverride)) {
+ std::string value =
+ command_line->GetSwitchValueASCII(switches::kEffectsOverride);
+ if (value == switches::kEffectsForceEnabled) {
+ base::File file(enable_file_path, base::File::FLAG_CREATE_ALWAYS |
+ base::File::FLAG_WRITE);
+ file.Close();
+ } else if (value == switches::kEffectsForceDisabled) {
+ base::File file(disable_file_path, base::File::FLAG_CREATE_ALWAYS |
+ base::File::FLAG_WRITE);
+ file.Close();
+ }
+ }
+ }
+
jda_factory_ = std::move(jda_factory);
jea_factory_ = std::move(jea_factory);
base::WaitableEvent started;
diff --git a/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.h b/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.h
index ad5292f1af2..1af88532e45 100644
--- a/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.h
+++ b/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,6 +30,7 @@
#include "media/capture/video/video_capture_device_factory.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/platform/platform_channel_server_endpoint.h"
diff --git a/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc b/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc
index e5599aac987..71c350d44f7 100644
--- a/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc
+++ b/chromium/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -35,7 +35,7 @@ class MockCameraHalServer : public cros::mojom::CameraHalServer {
MockCameraHalServer(const MockCameraHalServer&) = delete;
MockCameraHalServer& operator=(const MockCameraHalServer&) = delete;
- ~MockCameraHalServer() = default;
+ ~MockCameraHalServer() override = default;
void CreateChannel(
mojo::PendingReceiver<cros::mojom::CameraModule> camera_module_receiver,
@@ -74,7 +74,7 @@ class MockCameraHalClient : public cros::mojom::CameraHalClient {
MockCameraHalClient(const MockCameraHalClient&) = delete;
MockCameraHalClient& operator=(const MockCameraHalClient&) = delete;
- ~MockCameraHalClient() = default;
+ ~MockCameraHalClient() override = default;
void SetUpChannel(
mojo::PendingRemote<cros::mojom::CameraModule> camera_module) override {
diff --git a/chromium/media/capture/video/chromeos/camera_metadata_utils.cc b/chromium/media/capture/video/chromeos/camera_metadata_utils.cc
index 8b309353e85..b03f5ba5478 100644
--- a/chromium/media/capture/video/chromeos/camera_metadata_utils.cc
+++ b/chromium/media/capture/video/chromeos/camera_metadata_utils.cc
@@ -1,13 +1,13 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/capture/video/chromeos/camera_metadata_utils.h"
-#include <algorithm>
#include <unordered_set>
#include "base/containers/span.h"
+#include "base/ranges/algorithm.h"
namespace media {
@@ -48,11 +48,8 @@ cros::mojom::CameraMetadataEntryPtr* GetMetadataEntry(
return nullptr;
}
// We assume the metadata entries are sorted.
- auto iter = std::find_if(camera_metadata->entries.value().begin(),
- camera_metadata->entries.value().end(),
- [tag](const cros::mojom::CameraMetadataEntryPtr& e) {
- return e->tag == tag;
- });
+ auto iter = base::ranges::find(camera_metadata->entries.value(), tag,
+ &cros::mojom::CameraMetadataEntry::tag);
if (iter == camera_metadata->entries.value().end()) {
return nullptr;
}
diff --git a/chromium/media/capture/video/chromeos/camera_metadata_utils.h b/chromium/media/capture/video/chromeos/camera_metadata_utils.h
index d6b4a30b9f8..7f04722cdf6 100644
--- a/chromium/media/capture/video/chromeos/camera_metadata_utils.h
+++ b/chromium/media/capture/video/chromeos/camera_metadata_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_trace_utils.cc b/chromium/media/capture/video/chromeos/camera_trace_utils.cc
index f73de62a8bf..0e6f194e27d 100644
--- a/chromium/media/capture/video/chromeos/camera_trace_utils.cc
+++ b/chromium/media/capture/video/chromeos/camera_trace_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/camera_trace_utils.h b/chromium/media/capture/video/chromeos/camera_trace_utils.h
index 47ae1e9721b..cabb9d9ba05 100644
--- a/chromium/media/capture/video/chromeos/camera_trace_utils.h
+++ b/chromium/media/capture/video/chromeos/camera_trace_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/capture_metadata_dispatcher.h b/chromium/media/capture/video/chromeos/capture_metadata_dispatcher.h
index 40be85e5414..8de63ee9a17 100644
--- a/chromium/media/capture/video/chromeos/capture_metadata_dispatcher.h
+++ b/chromium/media/capture/video/chromeos/capture_metadata_dispatcher.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/capture/video/chromeos/display_rotation_observer.cc b/chromium/media/capture/video/chromeos/display_rotation_observer.cc
index 5b47b88e832..7590b77a0e7 100644
--- a/chromium/media/capture/video/chromeos/display_rotation_observer.cc
+++ b/chromium/media/capture/video/chromeos/display_rotation_observer.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/display_rotation_observer.h b/chromium/media/capture/video/chromeos/display_rotation_observer.h
index 87716e299d4..a0047d68c56 100644
--- a/chromium/media/capture/video/chromeos/display_rotation_observer.h
+++ b/chromium/media/capture/video/chromeos/display_rotation_observer.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.cc b/chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.cc
index 235e38204b7..3a91c336e68 100644
--- a/chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.cc
+++ b/chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.h b/chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.h
index 4ed216c42eb..6de245b2c5f 100644
--- a/chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.h
+++ b/chromium/media/capture/video/chromeos/gpu_memory_buffer_tracker.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mock_camera_module.cc b/chromium/media/capture/video/chromeos/mock_camera_module.cc
index 120cc6f1613..c22a7ce8775 100644
--- a/chromium/media/capture/video/chromeos/mock_camera_module.cc
+++ b/chromium/media/capture/video/chromeos/mock_camera_module.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mock_camera_module.h b/chromium/media/capture/video/chromeos/mock_camera_module.h
index bdb6545d86f..ef6edb9d3fa 100644
--- a/chromium/media/capture/video/chromeos/mock_camera_module.h
+++ b/chromium/media/capture/video/chromeos/mock_camera_module.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -29,7 +29,7 @@ class MockCameraModule : public cros::mojom::CameraModule {
MockCameraModule(const MockCameraModule&) = delete;
MockCameraModule& operator=(const MockCameraModule&) = delete;
- ~MockCameraModule();
+ ~MockCameraModule() override;
void OpenDevice(
int32_t camera_id,
diff --git a/chromium/media/capture/video/chromeos/mock_vendor_tag_ops.cc b/chromium/media/capture/video/chromeos/mock_vendor_tag_ops.cc
index 07529a63bbe..0a74d16b446 100644
--- a/chromium/media/capture/video/chromeos/mock_vendor_tag_ops.cc
+++ b/chromium/media/capture/video/chromeos/mock_vendor_tag_ops.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mock_vendor_tag_ops.h b/chromium/media/capture/video/chromeos/mock_vendor_tag_ops.h
index 91eb4120d77..0daaff76ff8 100644
--- a/chromium/media/capture/video/chromeos/mock_vendor_tag_ops.h
+++ b/chromium/media/capture/video/chromeos/mock_vendor_tag_ops.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,24 +22,24 @@ namespace unittest_internal {
class MockVendorTagOps : public cros::mojom::VendorTagOps {
public:
MockVendorTagOps();
- ~MockVendorTagOps();
+ ~MockVendorTagOps() override;
void Bind(mojo::PendingReceiver<cros::mojom::VendorTagOps> receiver);
MOCK_METHOD0(DoGetTagCount, int32_t());
- void GetTagCount(GetTagCountCallback callback);
+ void GetTagCount(GetTagCountCallback callback) override;
MOCK_METHOD0(DoGetAllTags, std::vector<uint32_t>());
- void GetAllTags(GetAllTagsCallback callback);
+ void GetAllTags(GetAllTagsCallback callback) override;
MOCK_METHOD1(DoGetSectionName, absl::optional<std::string>(uint32_t tag));
- void GetSectionName(uint32_t tag, GetSectionNameCallback callback);
+ void GetSectionName(uint32_t tag, GetSectionNameCallback callback) override;
MOCK_METHOD1(DoGetTagName, absl::optional<std::string>(uint32_t tag));
- void GetTagName(uint32_t tag, GetTagNameCallback callback);
+ void GetTagName(uint32_t tag, GetTagNameCallback callback) override;
MOCK_METHOD1(DoGetTagType, int32_t(uint32_t tag));
- void GetTagType(uint32_t tag, GetTagTypeCallback callback) {
+ void GetTagType(uint32_t tag, GetTagTypeCallback callback) override {
std::move(callback).Run(DoGetTagType(tag));
}
diff --git a/chromium/media/capture/video/chromeos/mock_video_capture_client.cc b/chromium/media/capture/video/chromeos/mock_video_capture_client.cc
index be1371a2e95..7c295fa4daa 100644
--- a/chromium/media/capture/video/chromeos/mock_video_capture_client.cc
+++ b/chromium/media/capture/video/chromeos/mock_video_capture_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mock_video_capture_client.h b/chromium/media/capture/video/chromeos/mock_video_capture_client.h
index 3c59b8033fa..c4a3fba3805 100644
--- a/chromium/media/capture/video/chromeos/mock_video_capture_client.h
+++ b/chromium/media/capture/video/chromeos/mock_video_capture_client.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -29,7 +29,7 @@ class MockVideoCaptureClient : public VideoCaptureDevice::Client {
explicit MockVideoCaptureClient();
- ~MockVideoCaptureClient();
+ ~MockVideoCaptureClient() override;
void SetFrameCb(base::OnceClosure frame_cb);
diff --git a/chromium/media/capture/video/chromeos/mojom/BUILD.gn b/chromium/media/capture/video/chromeos/mojom/BUILD.gn
index c2f2fe4f670..8fbc22f4b4a 100644
--- a/chromium/media/capture/video/chromeos/mojom/BUILD.gn
+++ b/chromium/media/capture/video/chromeos/mojom/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mojom/camera3.mojom b/chromium/media/capture/video/chromeos/mojom/camera3.mojom
index e0976bac90f..f8957e808b2 100644
--- a/chromium/media/capture/video/chromeos/mojom/camera3.mojom
+++ b/chromium/media/capture/video/chromeos/mojom/camera3.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mojom/camera_app.mojom b/chromium/media/capture/video/chromeos/mojom/camera_app.mojom
index 2c5708c42ff..e3de047dcb6 100644
--- a/chromium/media/capture/video/chromeos/mojom/camera_app.mojom
+++ b/chromium/media/capture/video/chromeos/mojom/camera_app.mojom
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mojom/camera_common.mojom b/chromium/media/capture/video/chromeos/mojom/camera_common.mojom
index 74263e98341..f9900eec298 100644
--- a/chromium/media/capture/video/chromeos/mojom/camera_common.mojom
+++ b/chromium/media/capture/video/chromeos/mojom/camera_common.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mojom/camera_metadata.mojom b/chromium/media/capture/video/chromeos/mojom/camera_metadata.mojom
index 269dcc9d2c5..0dde434215a 100644
--- a/chromium/media/capture/video/chromeos/mojom/camera_metadata.mojom
+++ b/chromium/media/capture/video/chromeos/mojom/camera_metadata.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mojom/camera_metadata_tags.mojom b/chromium/media/capture/video/chromeos/mojom/camera_metadata_tags.mojom
index 1fc0eeb5ee0..14e1a3d1af3 100644
--- a/chromium/media/capture/video/chromeos/mojom/camera_metadata_tags.mojom
+++ b/chromium/media/capture/video/chromeos/mojom/camera_metadata_tags.mojom
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mojom/cros_camera_client.mojom b/chromium/media/capture/video/chromeos/mojom/cros_camera_client.mojom
index 674b9bff613..f4eb46def6c 100644
--- a/chromium/media/capture/video/chromeos/mojom/cros_camera_client.mojom
+++ b/chromium/media/capture/video/chromeos/mojom/cros_camera_client.mojom
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/mojom/cros_camera_service.mojom b/chromium/media/capture/video/chromeos/mojom/cros_camera_service.mojom
index 7035a4945b9..d497d30286e 100644
--- a/chromium/media/capture/video/chromeos/mojom/cros_camera_service.mojom
+++ b/chromium/media/capture/video/chromeos/mojom/cros_camera_service.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/pixel_format_utils.cc b/chromium/media/capture/video/chromeos/pixel_format_utils.cc
index 73237bc7569..6f9d4819e18 100644
--- a/chromium/media/capture/video/chromeos/pixel_format_utils.cc
+++ b/chromium/media/capture/video/chromeos/pixel_format_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/pixel_format_utils.h b/chromium/media/capture/video/chromeos/pixel_format_utils.h
index f2ba1af221f..afed38adc4e 100644
--- a/chromium/media/capture/video/chromeos/pixel_format_utils.h
+++ b/chromium/media/capture/video/chromeos/pixel_format_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/public/BUILD.gn b/chromium/media/capture/video/chromeos/public/BUILD.gn
index 4db6be62bd2..8e03c45fc4d 100644
--- a/chromium/media/capture/video/chromeos/public/BUILD.gn
+++ b/chromium/media/capture/video/chromeos/public/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/public/cros_features.cc b/chromium/media/capture/video/chromeos/public/cros_features.cc
index 4658f93134c..6f33a8c6f49 100644
--- a/chromium/media/capture/video/chromeos/public/cros_features.cc
+++ b/chromium/media/capture/video/chromeos/public/cros_features.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/public/cros_features.h b/chromium/media/capture/video/chromeos/public/cros_features.h
index 94797d4d8a5..85f402805c8 100644
--- a/chromium/media/capture/video/chromeos/public/cros_features.h
+++ b/chromium/media/capture/video/chromeos/public/cros_features.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/request_builder.cc b/chromium/media/capture/video/chromeos/request_builder.cc
index b82fa2b60bd..226fbd9eda2 100644
--- a/chromium/media/capture/video/chromeos/request_builder.cc
+++ b/chromium/media/capture/video/chromeos/request_builder.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/request_builder.h b/chromium/media/capture/video/chromeos/request_builder.h
index 90d4207d526..007d7c39b12 100644
--- a/chromium/media/capture/video/chromeos/request_builder.h
+++ b/chromium/media/capture/video/chromeos/request_builder.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/request_manager.cc b/chromium/media/capture/video/chromeos/request_manager.cc
index 9f15aa28715..be160c3023f 100644
--- a/chromium/media/capture/video/chromeos/request_manager.cc
+++ b/chromium/media/capture/video/chromeos/request_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/request_manager.h b/chromium/media/capture/video/chromeos/request_manager.h
index 2beab7e3c17..ff9f0fe5d56 100644
--- a/chromium/media/capture/video/chromeos/request_manager.h
+++ b/chromium/media/capture/video/chromeos/request_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/request_manager_unittest.cc b/chromium/media/capture/video/chromeos/request_manager_unittest.cc
index 32e0d4be17d..101364f2525 100644
--- a/chromium/media/capture/video/chromeos/request_manager_unittest.cc
+++ b/chromium/media/capture/video/chromeos/request_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -38,15 +38,18 @@ namespace {
class MockStreamCaptureInterface : public StreamCaptureInterface {
public:
- void ProcessCaptureRequest(cros::mojom::Camera3CaptureRequestPtr request,
- base::OnceCallback<void(int32_t)> callback) {
+ void ProcessCaptureRequest(
+ cros::mojom::Camera3CaptureRequestPtr request,
+ base::OnceCallback<void(int32_t)> callback) override {
DoProcessCaptureRequest(request, callback);
}
MOCK_METHOD2(DoProcessCaptureRequest,
void(cros::mojom::Camera3CaptureRequestPtr& request,
base::OnceCallback<void(int32_t)>& callback));
- void Flush(base::OnceCallback<void(int32_t)> callback) { DoFlush(callback); }
+ void Flush(base::OnceCallback<void(int32_t)> callback) override {
+ DoFlush(callback);
+ }
MOCK_METHOD1(DoFlush, void(base::OnceCallback<void(int32_t)>& callback));
};
diff --git a/chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.cc b/chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.cc
index 6597bf323bc..1c0164a80c5 100644
--- a/chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.cc
+++ b/chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.h b/chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.h
index a29892ecc73..f0a7890fe66 100644
--- a/chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.h
+++ b/chromium/media/capture/video/chromeos/scoped_video_capture_jpeg_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/stream_buffer_manager.cc b/chromium/media/capture/video/chromeos/stream_buffer_manager.cc
index b2e52175d48..109a28f6b99 100644
--- a/chromium/media/capture/video/chromeos/stream_buffer_manager.cc
+++ b/chromium/media/capture/video/chromeos/stream_buffer_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -90,7 +90,7 @@ StreamBufferManager::AcquireBufferForClientById(StreamType stream_type,
gfx::Size(format->frame_size.height(), format->frame_size.width());
}
- absl::optional<gfx::BufferFormat> gfx_format =
+ const absl::optional<gfx::BufferFormat> gfx_format =
PixFormatVideoToGfx(format->pixel_format);
DCHECK(gfx_format);
const auto& original_gmb = buffer_pair.gmb;
@@ -140,45 +140,42 @@ StreamBufferManager::AcquireBufferForClientById(StreamType stream_type,
temp_uv_height);
original_gmb->Unmap();
return std::move(buffer_pair.vcd_buffer);
- } else {
- // We have to reserve a new buffer because the size is different.
- Buffer rotated_buffer;
- auto client_type = kStreamClientTypeMap[static_cast<int>(stream_type)];
- if (!device_context_->ReserveVideoCaptureBufferFromPool(
- client_type, format->frame_size, format->pixel_format,
- &rotated_buffer)) {
- DLOG(WARNING) << "Failed to reserve video capture buffer";
- original_gmb->Unmap();
- return std::move(buffer_pair.vcd_buffer);
- }
+ }
- absl::optional<gfx::BufferFormat> gfx_format =
- PixFormatVideoToGfx(format->pixel_format);
- DCHECK(gfx_format);
- auto rotated_gmb = gmb_support_->CreateGpuMemoryBufferImplFromHandle(
- rotated_buffer.handle_provider->GetGpuMemoryBufferHandle(),
- format->frame_size, *gfx_format, stream_context->buffer_usage,
- base::NullCallback());
-
- if (!rotated_gmb || !rotated_gmb->Map()) {
- DLOG(WARNING) << "Failed to map rotated buffer";
- original_gmb->Unmap();
- return std::move(buffer_pair.vcd_buffer);
- }
+ // We have to reserve a new buffer because the size is different.
+ Buffer rotated_buffer;
+ auto client_type = kStreamClientTypeMap[static_cast<int>(stream_type)];
+ if (!device_context_->ReserveVideoCaptureBufferFromPool(
+ client_type, format->frame_size, format->pixel_format,
+ &rotated_buffer)) {
+ DLOG(WARNING) << "Failed to reserve video capture buffer";
+ original_gmb->Unmap();
+ return std::move(buffer_pair.vcd_buffer);
+ }
- libyuv::NV12ToI420Rotate(
- static_cast<uint8_t*>(original_gmb->memory(0)), original_gmb->stride(0),
- static_cast<uint8_t*>(original_gmb->memory(1)), original_gmb->stride(1),
- static_cast<uint8_t*>(rotated_gmb->memory(0)), rotated_gmb->stride(0),
- temp_u, temp_uv_height, temp_v, temp_uv_height, original_width,
- original_height, translate_rotation(rotation));
- libyuv::MergeUVPlane(temp_u, temp_uv_height, temp_v, temp_uv_height,
- static_cast<uint8_t*>(rotated_gmb->memory(1)),
- rotated_gmb->stride(1), temp_uv_height, temp_uv_width);
- rotated_gmb->Unmap();
+ auto rotated_gmb = gmb_support_->CreateGpuMemoryBufferImplFromHandle(
+ rotated_buffer.handle_provider->GetGpuMemoryBufferHandle(),
+ format->frame_size, *gfx_format, stream_context->buffer_usage,
+ base::NullCallback());
+
+ if (!rotated_gmb || !rotated_gmb->Map()) {
+ DLOG(WARNING) << "Failed to map rotated buffer";
original_gmb->Unmap();
- return std::move(rotated_buffer);
+ return std::move(buffer_pair.vcd_buffer);
}
+
+ libyuv::NV12ToI420Rotate(
+ static_cast<uint8_t*>(original_gmb->memory(0)), original_gmb->stride(0),
+ static_cast<uint8_t*>(original_gmb->memory(1)), original_gmb->stride(1),
+ static_cast<uint8_t*>(rotated_gmb->memory(0)), rotated_gmb->stride(0),
+ temp_u, temp_uv_height, temp_v, temp_uv_height, original_width,
+ original_height, translate_rotation(rotation));
+ libyuv::MergeUVPlane(temp_u, temp_uv_height, temp_v, temp_uv_height,
+ static_cast<uint8_t*>(rotated_gmb->memory(1)),
+ rotated_gmb->stride(1), temp_uv_height, temp_uv_width);
+ rotated_gmb->Unmap();
+ original_gmb->Unmap();
+ return std::move(rotated_buffer);
}
VideoCaptureFormat StreamBufferManager::GetStreamCaptureFormat(
diff --git a/chromium/media/capture/video/chromeos/stream_buffer_manager.h b/chromium/media/capture/video/chromeos/stream_buffer_manager.h
index 20563f30f81..7927e32f5d1 100644
--- a/chromium/media/capture/video/chromeos/stream_buffer_manager.h
+++ b/chromium/media/capture/video/chromeos/stream_buffer_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/token_manager.cc b/chromium/media/capture/video/chromeos/token_manager.cc
index d57d42f4c54..fcc2fce4886 100644
--- a/chromium/media/capture/video/chromeos/token_manager.cc
+++ b/chromium/media/capture/video/chromeos/token_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,8 +7,10 @@
#include <grp.h>
#include <sys/types.h>
#include <unistd.h>
+
#include <string>
+#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/strings/string_number_conversions.h"
@@ -99,8 +101,7 @@ bool TokenManager::GenerateTestClientToken() {
base::UnguessableToken TokenManager::GetTokenForTrustedClient(
cros::mojom::CameraClientType type) {
base::AutoLock l(client_token_map_lock_);
- if (std::find(kTrustedClientTypes.begin(), kTrustedClientTypes.end(), type) ==
- kTrustedClientTypes.end()) {
+ if (!base::Contains(kTrustedClientTypes, type)) {
return base::UnguessableToken();
}
auto& token_set = client_token_map_[type];
diff --git a/chromium/media/capture/video/chromeos/token_manager.h b/chromium/media/capture/video/chromeos/token_manager.h
index 0508aae905c..6161acb21e6 100644
--- a/chromium/media/capture/video/chromeos/token_manager.h
+++ b/chromium/media/capture/video/chromeos/token_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/token_manager_unittest.cc b/chromium/media/capture/video/chromeos/token_manager_unittest.cc
index 1cc351b590d..cf5a737c317 100644
--- a/chromium/media/capture/video/chromeos/token_manager_unittest.cc
+++ b/chromium/media/capture/video/chromeos/token_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.cc b/chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.cc
index 0f36b69eb6c..4a586f5f444 100644
--- a/chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.cc
+++ b/chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.h b/chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.h
index a31122d73a3..1d49b2d54e7 100644
--- a/chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.h
+++ b/chromium/media/capture/video/chromeos/vendor_tag_ops_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.cc b/chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.cc
index 387f0bc56f1..6343051f868 100644
--- a/chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.cc
+++ b/chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.h b/chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.h
index 302f12c2ff7..c2fce509f42 100644
--- a/chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.h
+++ b/chromium/media/capture/video/chromeos/video_capture_device_chromeos_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.cc b/chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.cc
index d7dc818b102..bf4d8d87e2c 100644
--- a/chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.cc
+++ b/chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.h b/chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.h
index 04ccfd07ea5..302dcd1b3b2 100644
--- a/chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.h
+++ b/chromium/media/capture/video/chromeos/video_capture_device_chromeos_halv3.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc b/chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc
index 5959058e0fb..9002b0ddef2 100644
--- a/chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc
+++ b/chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.h b/chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.h
index 0abb4df64ab..bdf997b25b9 100644
--- a/chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.h
+++ b/chromium/media/capture/video/chromeos/video_capture_device_factory_chromeos.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/video_capture_features_chromeos.cc b/chromium/media/capture/video/chromeos/video_capture_features_chromeos.cc
index 1d0ec3db433..1375ac5a59d 100644
--- a/chromium/media/capture/video/chromeos/video_capture_features_chromeos.cc
+++ b/chromium/media/capture/video/chromeos/video_capture_features_chromeos.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@ namespace switches {
const char kForceControlFaceAe[] = "force-control-face-ae";
const char kHdrNetOverride[] = "hdrnet-override";
const char kAutoFramingOverride[] = "auto-framing-override";
+const char kEffectsOverride[] = "effects-override";
} // namespace switches
@@ -20,8 +21,9 @@ namespace features {
// Controls if the camera frame is rotated to the upright display orientation in
// the Chrome OS VideoCaptureDevice implementation.
-const base::Feature kDisableCameraFrameRotationAtSource{
- "DisableCameraFrameRotationAtSource", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kDisableCameraFrameRotationAtSource,
+ "DisableCameraFrameRotationAtSource",
+ base::FEATURE_DISABLED_BY_DEFAULT);
} // namespace features
@@ -32,7 +34,7 @@ bool ShouldEnableAutoFraming() {
// TODO(pihsun): Migrate the flag to use base::Feature.
std::string value =
command_line->GetSwitchValueASCII(media::switches::kAutoFramingOverride);
- return value == media::switches::kAutoFramingForceEnabled;
+ return value != media::switches::kAutoFramingForceDisabled;
}
} // namespace media
diff --git a/chromium/media/capture/video/chromeos/video_capture_features_chromeos.h b/chromium/media/capture/video/chromeos/video_capture_features_chromeos.h
index 31abfae21f9..8f3609880a5 100644
--- a/chromium/media/capture/video/chromeos/video_capture_features_chromeos.h
+++ b/chromium/media/capture/video/chromeos/video_capture_features_chromeos.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,11 +22,15 @@ CAPTURE_EXPORT extern const char kAutoFramingOverride[];
constexpr char kAutoFramingForceEnabled[] = "force-enabled";
constexpr char kAutoFramingForceDisabled[] = "force-disabled";
+CAPTURE_EXPORT extern const char kEffectsOverride[];
+constexpr char kEffectsForceEnabled[] = "force-enabled";
+constexpr char kEffectsForceDisabled[] = "force-disabled";
+
} // namespace switches
namespace features {
-CAPTURE_EXPORT extern const base::Feature kDisableCameraFrameRotationAtSource;
+CAPTURE_EXPORT BASE_DECLARE_FEATURE(kDisableCameraFrameRotationAtSource);
} // namespace features
diff --git a/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder.h b/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder.h
index 21a51d09df2..f5948d4b0d9 100644
--- a/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder.h
+++ b/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.cc b/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.cc
index ba9ed18db2f..094f497d324 100644
--- a/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.cc
+++ b/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -110,33 +110,19 @@ void VideoCaptureJpegDecoderImpl::DecodeCapturedData(
// Mask against 30 bits, to avoid (undefined) wraparound on signed integer.
next_task_id_ = (next_task_id_ + 1) & 0x3FFFFFFF;
- // The API of |decoder_| requires us to wrap the |out_buffer| in a VideoFrame.
const gfx::Size dimensions = frame_format.frame_size;
- base::UnsafeSharedMemoryRegion out_region =
- out_buffer.handle_provider->DuplicateAsUnsafeRegion();
- DCHECK(out_region.IsValid());
- base::WritableSharedMemoryMapping out_mapping = out_region.Map();
- DCHECK(out_mapping.IsValid());
- scoped_refptr<media::VideoFrame> out_frame =
- media::VideoFrame::WrapExternalData(
- media::PIXEL_FORMAT_I420, // format
- dimensions, // coded_size
- gfx::Rect(dimensions), // visible_rect
- dimensions, // natural_size
- out_mapping.GetMemoryAsSpan<uint8_t>().data(), // data
- out_mapping.size(), // data_size
- timestamp); // timestamp
- if (!out_frame) {
+ if (!VideoFrame::IsValidConfig(PIXEL_FORMAT_I420,
+ VideoFrame::STORAGE_UNOWNED_MEMORY, dimensions,
+ gfx::Rect(dimensions), dimensions)) {
base::AutoLock lock(lock_);
decoder_status_ = FAILED;
- LOG(ERROR) << "DecodeCapturedData: WrapExternalSharedMemory failed";
+ LOG(ERROR) << "DecodeCapturedData: VideoFrame::IsValidConfig() failed";
return;
}
- out_frame->BackWithOwnedSharedMemory(std::move(out_region),
- std::move(out_mapping));
- out_frame->metadata().frame_rate = frame_format.frame_rate;
- out_frame->metadata().reference_time = reference_time;
+ base::UnsafeSharedMemoryRegion out_region =
+ out_buffer.handle_provider->DuplicateAsUnsafeRegion();
+ DCHECK(out_region.IsValid());
media::mojom::VideoFrameInfoPtr out_frame_info =
media::mojom::VideoFrameInfo::New();
@@ -144,8 +130,10 @@ void VideoCaptureJpegDecoderImpl::DecodeCapturedData(
out_frame_info->pixel_format = media::PIXEL_FORMAT_I420;
out_frame_info->coded_size = dimensions;
out_frame_info->visible_rect = gfx::Rect(dimensions);
- out_frame_info->metadata = out_frame->metadata();
- out_frame_info->color_space = out_frame->ColorSpace();
+ out_frame_info->metadata = VideoFrameMetadata();
+ out_frame_info->metadata.frame_rate = frame_format.frame_rate;
+ out_frame_info->metadata.reference_time = reference_time;
+ out_frame_info->color_space = gfx::ColorSpace();
{
base::AutoLock lock(lock_);
@@ -162,12 +150,14 @@ void VideoCaptureJpegDecoderImpl::DecodeCapturedData(
decoder_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(
- [](chromeos_camera::MjpegDecodeAccelerator* decoder,
- BitstreamBuffer in_buffer, scoped_refptr<VideoFrame> out_frame) {
- decoder->Decode(std::move(in_buffer), std::move(out_frame));
+ [](chromeos_camera::MojoMjpegDecodeAccelerator* decoder,
+ BitstreamBuffer in_buffer, VideoPixelFormat format,
+ gfx::Size coded_size, base::UnsafeSharedMemoryRegion out_region) {
+ decoder->Decode(std::move(in_buffer), format, coded_size,
+ std::move(out_region));
},
base::Unretained(decoder_.get()), std::move(in_buffer),
- std::move(out_frame)));
+ media::PIXEL_FORMAT_I420, dimensions, std::move(out_region)));
}
void VideoCaptureJpegDecoderImpl::VideoFrameReady(int32_t task_id) {
diff --git a/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.h b/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.h
index 700b3f0c6a9..bbd0e41f7c0 100644
--- a/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.h
+++ b/chromium/media/capture/video/chromeos/video_capture_jpeg_decoder_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -83,7 +83,7 @@ class CAPTURE_EXPORT VideoCaptureJpegDecoderImpl
scoped_refptr<base::SequencedTaskRunner> decoder_task_runner_;
// The underlying JPEG decode accelerator.
- std::unique_ptr<chromeos_camera::MjpegDecodeAccelerator> decoder_;
+ std::unique_ptr<chromeos_camera::MojoMjpegDecodeAccelerator> decoder_;
// The callback to run when decode succeeds.
const DecodeDoneCB decode_done_cb_;
diff --git a/chromium/media/capture/video/create_video_capture_device_factory.cc b/chromium/media/capture/video/create_video_capture_device_factory.cc
index c0e5ff30e16..b4abd2b3a02 100644
--- a/chromium/media/capture/video/create_video_capture_device_factory.cc
+++ b/chromium/media/capture/video/create_video_capture_device_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/create_video_capture_device_factory.h b/chromium/media/capture/video/create_video_capture_device_factory.h
index 36872c17e44..df8161fee66 100644
--- a/chromium/media/capture/video/create_video_capture_device_factory.h
+++ b/chromium/media/capture/video/create_video_capture_device_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fake_video_capture_device.cc b/chromium/media/capture/video/fake_video_capture_device.cc
index 623578fbf1e..1b6fe1a9b69 100644
--- a/chromium/media/capture/video/fake_video_capture_device.cc
+++ b/chromium/media/capture/video/fake_video_capture_device.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fake_video_capture_device.h b/chromium/media/capture/video/fake_video_capture_device.h
index 23a3e2d2fda..8e7ff0d85d1 100644
--- a/chromium/media/capture/video/fake_video_capture_device.h
+++ b/chromium/media/capture/video/fake_video_capture_device.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fake_video_capture_device_factory.cc b/chromium/media/capture/video/fake_video_capture_device_factory.cc
index 5c0d63d0ea2..41429a30bec 100644
--- a/chromium/media/capture/video/fake_video_capture_device_factory.cc
+++ b/chromium/media/capture/video/fake_video_capture_device_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fake_video_capture_device_factory.h b/chromium/media/capture/video/fake_video_capture_device_factory.h
index 95003bea1cf..4785d62a5fc 100644
--- a/chromium/media/capture/video/fake_video_capture_device_factory.h
+++ b/chromium/media/capture/video/fake_video_capture_device_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fake_video_capture_device_unittest.cc b/chromium/media/capture/video/fake_video_capture_device_unittest.cc
index 5188b82a098..88263dc98b2 100644
--- a/chromium/media/capture/video/fake_video_capture_device_unittest.cc
+++ b/chromium/media/capture/video/fake_video_capture_device_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/file_video_capture_device.cc b/chromium/media/capture/video/file_video_capture_device.cc
index ad5a43b0399..6d6c8733b57 100644
--- a/chromium/media/capture/video/file_video_capture_device.cc
+++ b/chromium/media/capture/video/file_video_capture_device.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/file_video_capture_device.h b/chromium/media/capture/video/file_video_capture_device.h
index 74d8723a8ac..6d9262bf73a 100644
--- a/chromium/media/capture/video/file_video_capture_device.h
+++ b/chromium/media/capture/video/file_video_capture_device.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/file_video_capture_device_factory.cc b/chromium/media/capture/video/file_video_capture_device_factory.cc
index 3619a679806..8ff7ea04358 100644
--- a/chromium/media/capture/video/file_video_capture_device_factory.cc
+++ b/chromium/media/capture/video/file_video_capture_device_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/file_video_capture_device_factory.h b/chromium/media/capture/video/file_video_capture_device_factory.h
index 503dc594270..b439812d69d 100644
--- a/chromium/media/capture/video/file_video_capture_device_factory.h
+++ b/chromium/media/capture/video/file_video_capture_device_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/file_video_capture_device_unittest.cc b/chromium/media/capture/video/file_video_capture_device_unittest.cc
index 5712cbca709..9a8c848fd78 100644
--- a/chromium/media/capture/video/file_video_capture_device_unittest.cc
+++ b/chromium/media/capture/video/file_video_capture_device_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc b/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc
index b41314befe4..0d863e107de 100644
--- a/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc
+++ b/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h b/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h
index 72a38096721..06f515bb5bf 100644
--- a/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h
+++ b/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia_test.cc b/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia_test.cc
index 8527d732d61..2a5c3cfb100 100644
--- a/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia_test.cc
+++ b/chromium/media/capture/video/fuchsia/video_capture_device_factory_fuchsia_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -107,7 +107,7 @@ class TestDeviceChangeObserver
++num_events_;
}
- size_t num_events() { return num_events_; };
+ size_t num_events() { return num_events_; }
private:
size_t num_events_ = 0;
diff --git a/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.cc b/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.cc
index faba35d96aa..4c978eb0b28 100644
--- a/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.cc
+++ b/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.h b/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.h
index 5998b5b111e..85cf96d8fbc 100644
--- a/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.h
+++ b/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc b/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc
index 8cb98fa3638..3039594560a 100644
--- a/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc
+++ b/chromium/media/capture/video/fuchsia/video_capture_device_fuchsia_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/gpu_memory_buffer_utils.cc b/chromium/media/capture/video/gpu_memory_buffer_utils.cc
index 2cc0655ff76..2328ed7c514 100644
--- a/chromium/media/capture/video/gpu_memory_buffer_utils.cc
+++ b/chromium/media/capture/video/gpu_memory_buffer_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/gpu_memory_buffer_utils.h b/chromium/media/capture/video/gpu_memory_buffer_utils.h
index b5891fe1b64..0212c93dd3e 100644
--- a/chromium/media/capture/video/gpu_memory_buffer_utils.h
+++ b/chromium/media/capture/video/gpu_memory_buffer_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/fake_device_provider.cc b/chromium/media/capture/video/linux/fake_device_provider.cc
index 581c260a399..9df8ab4dd6d 100644
--- a/chromium/media/capture/video/linux/fake_device_provider.cc
+++ b/chromium/media/capture/video/linux/fake_device_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include <string>
#include <vector>
+#include "base/ranges/algorithm.h"
#include "media/capture/video/video_capture_device_descriptor.h"
#include "media/capture/video_capture_types.h"
@@ -28,11 +29,8 @@ void FakeDeviceProvider::GetDeviceIds(
}
std::string FakeDeviceProvider::GetDeviceModelId(const std::string& device_id) {
- auto iter =
- std::find_if(descriptors_.begin(), descriptors_.end(),
- [&device_id](const VideoCaptureDeviceDescriptor& val) {
- return val.device_id == device_id;
- });
+ auto iter = base::ranges::find(descriptors_, device_id,
+ &VideoCaptureDeviceDescriptor::device_id);
if (iter == descriptors_.end())
CHECK(false) << "Unknown device_id " << device_id;
@@ -41,11 +39,8 @@ std::string FakeDeviceProvider::GetDeviceModelId(const std::string& device_id) {
std::string FakeDeviceProvider::GetDeviceDisplayName(
const std::string& device_id) {
- auto iter =
- std::find_if(descriptors_.begin(), descriptors_.end(),
- [&device_id](const VideoCaptureDeviceDescriptor& val) {
- return val.device_id == device_id;
- });
+ auto iter = base::ranges::find(descriptors_, device_id,
+ &VideoCaptureDeviceDescriptor::device_id);
if (iter == descriptors_.end())
CHECK(false) << "Unknown device_id " << device_id;
diff --git a/chromium/media/capture/video/linux/fake_device_provider.h b/chromium/media/capture/video/linux/fake_device_provider.h
index a98648eb356..ad08bce49c5 100644
--- a/chromium/media/capture/video/linux/fake_device_provider.h
+++ b/chromium/media/capture/video/linux/fake_device_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/fake_v4l2_impl.cc b/chromium/media/capture/video/linux/fake_v4l2_impl.cc
index da4d77141c2..80d38e765b0 100644
--- a/chromium/media/capture/video/linux/fake_v4l2_impl.cc
+++ b/chromium/media/capture/video/linux/fake_v4l2_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,10 +8,12 @@
#include <sys/mman.h>
#include <sys/time.h>
#include <unistd.h>
+
#include <queue>
#include "base/bind.h"
#include "base/bits.h"
+#include "base/ranges/algorithm.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
@@ -88,10 +90,7 @@ class FakeV4L2Impl::OpenedDevice {
FakeV4L2Buffer* LookupBufferFromOffset(off_t offset) {
auto buffer_iter =
- std::find_if(device_buffers_.begin(), device_buffers_.end(),
- [offset](const FakeV4L2Buffer& buffer) {
- return buffer.offset == offset;
- });
+ base::ranges::find(device_buffers_, offset, &FakeV4L2Buffer::offset);
if (buffer_iter == device_buffers_.end())
return nullptr;
return &(*buffer_iter);
diff --git a/chromium/media/capture/video/linux/fake_v4l2_impl.h b/chromium/media/capture/video/linux/fake_v4l2_impl.h
index ae7167f9516..6d2f5fd60ed 100644
--- a/chromium/media/capture/video/linux/fake_v4l2_impl.h
+++ b/chromium/media/capture/video/linux/fake_v4l2_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/scoped_v4l2_device_fd.cc b/chromium/media/capture/video/linux/scoped_v4l2_device_fd.cc
index 76de9b00ded..792a79457a3 100644
--- a/chromium/media/capture/video/linux/scoped_v4l2_device_fd.cc
+++ b/chromium/media/capture/video/linux/scoped_v4l2_device_fd.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/scoped_v4l2_device_fd.h b/chromium/media/capture/video/linux/scoped_v4l2_device_fd.h
index 66aeccc1ce7..48be22016cc 100644
--- a/chromium/media/capture/video/linux/scoped_v4l2_device_fd.h
+++ b/chromium/media/capture/video/linux/scoped_v4l2_device_fd.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/v4l2_capture_delegate.cc b/chromium/media/capture/video/linux/v4l2_capture_delegate.cc
index 6c8c5d18e39..8ee347e47d6 100644
--- a/chromium/media/capture/video/linux/v4l2_capture_delegate.cc
+++ b/chromium/media/capture/video/linux/v4l2_capture_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <algorithm>
#include <utility>
#include "base/bind.h"
diff --git a/chromium/media/capture/video/linux/v4l2_capture_delegate.h b/chromium/media/capture/video/linux/v4l2_capture_delegate.h
index 0e7c2264356..7e4ea1d1d34 100644
--- a/chromium/media/capture/video/linux/v4l2_capture_delegate.h
+++ b/chromium/media/capture/video/linux/v4l2_capture_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/v4l2_capture_delegate_unittest.cc b/chromium/media/capture/video/linux/v4l2_capture_delegate_unittest.cc
index 87bef849ac8..b4772264080 100644
--- a/chromium/media/capture/video/linux/v4l2_capture_delegate_unittest.cc
+++ b/chromium/media/capture/video/linux/v4l2_capture_delegate_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/v4l2_capture_device.h b/chromium/media/capture/video/linux/v4l2_capture_device.h
index 1c38be7c96d..520a4520326 100644
--- a/chromium/media/capture/video/linux/v4l2_capture_device.h
+++ b/chromium/media/capture/video/linux/v4l2_capture_device.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/v4l2_capture_device_impl.cc b/chromium/media/capture/video/linux/v4l2_capture_device_impl.cc
index c9040f5dee6..c8a49b3f086 100644
--- a/chromium/media/capture/video/linux/v4l2_capture_device_impl.cc
+++ b/chromium/media/capture/video/linux/v4l2_capture_device_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/v4l2_capture_device_impl.h b/chromium/media/capture/video/linux/v4l2_capture_device_impl.h
index 936c8b0938b..7bfc98414c4 100644
--- a/chromium/media/capture/video/linux/v4l2_capture_device_impl.h
+++ b/chromium/media/capture/video/linux/v4l2_capture_device_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/video_capture_device_factory_linux.cc b/chromium/media/capture/video/linux/video_capture_device_factory_linux.cc
index 7c90f5c46a2..bca33521059 100644
--- a/chromium/media/capture/video/linux/video_capture_device_factory_linux.cc
+++ b/chromium/media/capture/video/linux/video_capture_device_factory_linux.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/video_capture_device_factory_linux.h b/chromium/media/capture/video/linux/video_capture_device_factory_linux.h
index c80fae457c2..c1ae1433bae 100644
--- a/chromium/media/capture/video/linux/video_capture_device_factory_linux.h
+++ b/chromium/media/capture/video/linux/video_capture_device_factory_linux.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc b/chromium/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc
index c303e7c229d..dbe2795e37f 100644
--- a/chromium/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc
+++ b/chromium/media/capture/video/linux/video_capture_device_factory_linux_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/video_capture_device_linux.cc b/chromium/media/capture/video/linux/video_capture_device_linux.cc
index ff485047ac9..234dc74db7c 100644
--- a/chromium/media/capture/video/linux/video_capture_device_linux.cc
+++ b/chromium/media/capture/video/linux/video_capture_device_linux.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/linux/video_capture_device_linux.h b/chromium/media/capture/video/linux/video_capture_device_linux.h
index 1d24f59f5bd..8b314762dba 100644
--- a/chromium/media/capture/video/linux/video_capture_device_linux.h
+++ b/chromium/media/capture/video/linux/video_capture_device_linux.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.cc b/chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.cc
index 6e4e063942b..7239ed51f7b 100644
--- a/chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.cc
+++ b/chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.h b/chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.h
index b95e0570262..28b9f901a85 100644
--- a/chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.h
+++ b/chromium/media/capture/video/mac/gpu_memory_buffer_tracker_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/pixel_buffer_pool_mac.cc b/chromium/media/capture/video/mac/pixel_buffer_pool_mac.cc
index b25bb385da7..38a0bfc8148 100644
--- a/chromium/media/capture/video/mac/pixel_buffer_pool_mac.cc
+++ b/chromium/media/capture/video/mac/pixel_buffer_pool_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/pixel_buffer_pool_mac.h b/chromium/media/capture/video/mac/pixel_buffer_pool_mac.h
index 06c31a4f240..3deafcbd358 100644
--- a/chromium/media/capture/video/mac/pixel_buffer_pool_mac.h
+++ b/chromium/media/capture/video/mac/pixel_buffer_pool_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/pixel_buffer_pool_mac_unittest.mm b/chromium/media/capture/video/mac/pixel_buffer_pool_mac_unittest.mm
index 9cad540d016..7e2e8a10685 100644
--- a/chromium/media/capture/video/mac/pixel_buffer_pool_mac_unittest.mm
+++ b/chromium/media/capture/video/mac/pixel_buffer_pool_mac_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/pixel_buffer_transferer_mac.cc b/chromium/media/capture/video/mac/pixel_buffer_transferer_mac.cc
index e6509a930ec..6a482619dfa 100644
--- a/chromium/media/capture/video/mac/pixel_buffer_transferer_mac.cc
+++ b/chromium/media/capture/video/mac/pixel_buffer_transferer_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/pixel_buffer_transferer_mac.h b/chromium/media/capture/video/mac/pixel_buffer_transferer_mac.h
index e201deb73be..839168f421b 100644
--- a/chromium/media/capture/video/mac/pixel_buffer_transferer_mac.h
+++ b/chromium/media/capture/video/mac/pixel_buffer_transferer_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/pixel_buffer_transferer_mac_unittest.mm b/chromium/media/capture/video/mac/pixel_buffer_transferer_mac_unittest.mm
index 09fed68c0d1..daabd4dcb77 100644
--- a/chromium/media/capture/video/mac/pixel_buffer_transferer_mac_unittest.mm
+++ b/chromium/media/capture/video/mac/pixel_buffer_transferer_mac_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/sample_buffer_transformer_mac.cc b/chromium/media/capture/video/mac/sample_buffer_transformer_mac.cc
index 0d98d68189d..b0600b3bad0 100644
--- a/chromium/media/capture/video/mac/sample_buffer_transformer_mac.cc
+++ b/chromium/media/capture/video/mac/sample_buffer_transformer_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/sample_buffer_transformer_mac.h b/chromium/media/capture/video/mac/sample_buffer_transformer_mac.h
index d8b66605dcf..294a096d215 100644
--- a/chromium/media/capture/video/mac/sample_buffer_transformer_mac.h
+++ b/chromium/media/capture/video/mac/sample_buffer_transformer_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/sample_buffer_transformer_mac_unittest.mm b/chromium/media/capture/video/mac/sample_buffer_transformer_mac_unittest.mm
index ada0a909f88..dfcb3bb53fb 100644
--- a/chromium/media/capture/video/mac/sample_buffer_transformer_mac_unittest.mm
+++ b/chromium/media/capture/video/mac/sample_buffer_transformer_mac_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -396,14 +396,7 @@ TEST_P(SampleBufferTransformerPixelTransferTest, CanConvertFullScale) {
PixelBufferIsSingleColor(output_pixel_buffer, kColorR, kColorG, kColorB));
}
-#if defined(ARCH_CPU_ARM64)
-// Bulk-disabled for arm64 bot stabilization: https://crbug.com/1154345
-#define MAYBE_CanConvertAndScaleDown DISABLED_CanConvertAndScaleDown
-#else
-#define MAYBE_CanConvertAndScaleDown CanConvertAndScaleDown
-#endif
-
-TEST_P(SampleBufferTransformerPixelTransferTest, MAYBE_CanConvertAndScaleDown) {
+TEST_P(SampleBufferTransformerPixelTransferTest, CanConvertAndScaleDown) {
auto [input_pixel_format, output_pixel_format] = GetParam();
base::ScopedCFTypeRef<CMSampleBufferRef> input_sample_buffer =
@@ -534,7 +527,7 @@ TEST_P(SampleBufferTransformerLibyuvTest, CanConvertFullScale) {
PixelBufferIsSingleColor(output_pixel_buffer, kColorR, kColorG, kColorB));
}
-TEST_P(SampleBufferTransformerLibyuvTest, MAYBE_CanConvertAndScaleDown) {
+TEST_P(SampleBufferTransformerLibyuvTest, CanConvertAndScaleDown) {
auto [input_pixel_format, output_pixel_format] = GetParam();
base::ScopedCFTypeRef<CMSampleBufferRef> input_sample_buffer =
@@ -656,6 +649,12 @@ TEST_P(SampleBufferTransformerMjpegTest, CanConvertFullScale) {
PixelBufferIsSingleColor(output_pixel_buffer, kColorR, kColorG, kColorB));
}
+#if defined(ARCH_CPU_ARM64)
+// Disabled, see https://crbug.com/1354691
+#define MAYBE_CanConvertAndScaleDown DISABLED_CanConvertAndScaleDown
+#else
+#define MAYBE_CanConvertAndScaleDown CanConvertAndScaleDown
+#endif
TEST_P(SampleBufferTransformerMjpegTest, MAYBE_CanConvertAndScaleDown) {
OSType output_pixel_format = GetParam();
diff --git a/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.h b/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.h
index 25a7a200b92..ec48e67227f 100644
--- a/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.h
+++ b/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -65,7 +65,7 @@ class CAPTURE_EXPORT VideoCaptureDeviceAVFoundationFrameReceiver {
// the capturer. These are available either when the camera supports it and
// kAVFoundationCaptureV2ZeroCopy is enabled or when kInCaptureConvertToNv12 is
// used to convert frames to NV12.
-CAPTURE_EXPORT extern const base::Feature kInCapturerScaling;
+CAPTURE_EXPORT BASE_DECLARE_FEATURE(kInCapturerScaling);
// Find the best capture format from |formats| for the specified dimensions and
// frame rate. Returns an element of |formats|, or nil.
diff --git a/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.mm b/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
index 428caf0d1a3..910a346fc33 100644
--- a/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
+++ b/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -71,12 +71,14 @@ constexpr size_t kPixelBufferPoolSize = 10;
namespace media {
-const base::Feature kInCapturerScaling{"InCapturerScaling",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kInCapturerScaling,
+ "InCapturerScaling",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Uses the most recent advice from Apple for configuring and starting.
-const base::Feature kConfigureCaptureBeforeStart{
- "ConfigureCaptureBeforeStart", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kConfigureCaptureBeforeStart,
+ "ConfigureCaptureBeforeStart",
+ base::FEATURE_ENABLED_BY_DEFAULT);
AVCaptureDeviceFormat* FindBestCaptureFormat(
NSArray<AVCaptureDeviceFormat*>* formats,
diff --git a/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac_unittest.mm b/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac_unittest.mm
index 444b78af01f..aeac926f7be 100644
--- a/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac_unittest.mm
+++ b/chromium/media/capture/video/mac/video_capture_device_avfoundation_mac_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.h b/chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.h
index 17d900b1e2b..26dffabbeb2 100644
--- a/chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.h
+++ b/chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.mm b/chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.mm
index 8420e7641f9..3adbd82cf0d 100644
--- a/chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.mm
+++ b/chromium/media/capture/video/mac/video_capture_device_avfoundation_utils_mac.mm
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_device_decklink_mac.h b/chromium/media/capture/video/mac/video_capture_device_decklink_mac.h
index 9fe6f842e12..eb679b3165b 100644
--- a/chromium/media/capture/video/mac/video_capture_device_decklink_mac.h
+++ b/chromium/media/capture/video/mac/video_capture_device_decklink_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_device_decklink_mac.mm b/chromium/media/capture/video/mac/video_capture_device_decklink_mac.mm
index 271f3b0201f..8d840498044 100644
--- a/chromium/media/capture/video/mac/video_capture_device_decklink_mac.mm
+++ b/chromium/media/capture/video/mac/video_capture_device_decklink_mac.mm
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_device_factory_mac.h b/chromium/media/capture/video/mac/video_capture_device_factory_mac.h
index 1f6dda8cd3c..5727607152a 100644
--- a/chromium/media/capture/video/mac/video_capture_device_factory_mac.h
+++ b/chromium/media/capture/video/mac/video_capture_device_factory_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_device_factory_mac.mm b/chromium/media/capture/video/mac/video_capture_device_factory_mac.mm
index b3501b82bfb..f608da37d34 100644
--- a/chromium/media/capture/video/mac/video_capture_device_factory_mac.mm
+++ b/chromium/media/capture/video/mac/video_capture_device_factory_mac.mm
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,7 +15,6 @@
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
-#include "base/task/task_runner_util.h"
#import "media/capture/video/mac/video_capture_device_avfoundation_mac.h"
#import "media/capture/video/mac/video_capture_device_avfoundation_utils_mac.h"
#import "media/capture/video/mac/video_capture_device_decklink_mac.h"
@@ -47,18 +46,18 @@ media::VideoCaptureFormats GetDeviceSupportedFormats(
}
if (device == nil)
return media::VideoCaptureFormats();
- for (AVCaptureDeviceFormat* format in device.formats) {
+ for (AVCaptureDeviceFormat* device_format in device.formats) {
// MediaSubType is a CMPixelFormatType but can be used as CVPixelFormatType
// as well according to CMFormatDescription.h
const media::VideoPixelFormat pixelFormat = [VideoCaptureDeviceAVFoundation
FourCCToChromiumPixelFormat:CMFormatDescriptionGetMediaSubType(
- [format formatDescription])];
+ [device_format formatDescription])];
- CMVideoDimensions dimensions =
- CMVideoFormatDescriptionGetDimensions([format formatDescription]);
+ CMVideoDimensions dimensions = CMVideoFormatDescriptionGetDimensions(
+ [device_format formatDescription]);
for (AVFrameRateRange* frameRate in
- [format videoSupportedFrameRateRanges]) {
+ [device_format videoSupportedFrameRateRanges]) {
media::VideoCaptureFormat format(
gfx::Size(dimensions.width, dimensions.height),
frameRate.maxFrameRate, pixelFormat);
diff --git a/chromium/media/capture/video/mac/video_capture_device_factory_mac_unittest.mm b/chromium/media/capture/video/mac/video_capture_device_factory_mac_unittest.mm
index b1d1471ee5c..b8fc999b9ef 100644
--- a/chromium/media/capture/video/mac/video_capture_device_factory_mac_unittest.mm
+++ b/chromium/media/capture/video/mac/video_capture_device_factory_mac_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/capture/video/mac/video_capture_device_factory_mac.h"
diff --git a/chromium/media/capture/video/mac/video_capture_device_mac.h b/chromium/media/capture/video/mac/video_capture_device_mac.h
index 698dbbda4d5..76d5e1d5736 100644
--- a/chromium/media/capture/video/mac/video_capture_device_mac.h
+++ b/chromium/media/capture/video/mac/video_capture_device_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_device_mac.mm b/chromium/media/capture/video/mac/video_capture_device_mac.mm
index a9782a8e018..3fd0e0794c7 100644
--- a/chromium/media/capture/video/mac/video_capture_device_mac.mm
+++ b/chromium/media/capture/video/mac/video_capture_device_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_device_mac_unittest.mm b/chromium/media/capture/video/mac/video_capture_device_mac_unittest.mm
index 3556f550f39..a22923f2637 100644
--- a/chromium/media/capture/video/mac/video_capture_device_mac_unittest.mm
+++ b/chromium/media/capture/video/mac/video_capture_device_mac_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_metrics_mac.h b/chromium/media/capture/video/mac/video_capture_metrics_mac.h
index c56789a5b22..adda5af5ad9 100644
--- a/chromium/media/capture/video/mac/video_capture_metrics_mac.h
+++ b/chromium/media/capture/video/mac/video_capture_metrics_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_metrics_mac.mm b/chromium/media/capture/video/mac/video_capture_metrics_mac.mm
index 9c6a64dd643..5cc7df379b5 100644
--- a/chromium/media/capture/video/mac/video_capture_metrics_mac.mm
+++ b/chromium/media/capture/video/mac/video_capture_metrics_mac.mm
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mac/video_capture_metrics_mac_unittest.mm b/chromium/media/capture/video/mac/video_capture_metrics_mac_unittest.mm
index 205b20ec9bc..a22f905f469 100644
--- a/chromium/media/capture/video/mac/video_capture_metrics_mac_unittest.mm
+++ b/chromium/media/capture/video/mac/video_capture_metrics_mac_unittest.mm
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_device.cc b/chromium/media/capture/video/mock_device.cc
index 58628eba7ff..73f32b01c29 100644
--- a/chromium/media/capture/video/mock_device.cc
+++ b/chromium/media/capture/video/mock_device.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_device.h b/chromium/media/capture/video/mock_device.h
index 7acf3760a9b..c8139648a94 100644
--- a/chromium/media/capture/video/mock_device.h
+++ b/chromium/media/capture/video/mock_device.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_device_factory.cc b/chromium/media/capture/video/mock_device_factory.cc
index 258829bdcba..58bd23b6203 100644
--- a/chromium/media/capture/video/mock_device_factory.cc
+++ b/chromium/media/capture/video/mock_device_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_device_factory.h b/chromium/media/capture/video/mock_device_factory.h
index 2cacc0e4fa8..fa5657592e4 100644
--- a/chromium/media/capture/video/mock_device_factory.h
+++ b/chromium/media/capture/video/mock_device_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_gpu_memory_buffer_manager.cc b/chromium/media/capture/video/mock_gpu_memory_buffer_manager.cc
index 8d1e5f9d4c8..5a4755ef769 100644
--- a/chromium/media/capture/video/mock_gpu_memory_buffer_manager.cc
+++ b/chromium/media/capture/video/mock_gpu_memory_buffer_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_gpu_memory_buffer_manager.h b/chromium/media/capture/video/mock_gpu_memory_buffer_manager.h
index 9371f93f664..ffee10b3c9e 100644
--- a/chromium/media/capture/video/mock_gpu_memory_buffer_manager.h
+++ b/chromium/media/capture/video/mock_gpu_memory_buffer_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_video_capture_device_client.cc b/chromium/media/capture/video/mock_video_capture_device_client.cc
index 9eabb5fe41a..03a353cd304 100644
--- a/chromium/media/capture/video/mock_video_capture_device_client.cc
+++ b/chromium/media/capture/video/mock_video_capture_device_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_video_capture_device_client.h b/chromium/media/capture/video/mock_video_capture_device_client.h
index fd0ed66b802..49c2399f6d4 100644
--- a/chromium/media/capture/video/mock_video_capture_device_client.h
+++ b/chromium/media/capture/video/mock_video_capture_device_client.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_video_frame_receiver.cc b/chromium/media/capture/video/mock_video_frame_receiver.cc
index fcd6199c014..b6bceabdd4e 100644
--- a/chromium/media/capture/video/mock_video_frame_receiver.cc
+++ b/chromium/media/capture/video/mock_video_frame_receiver.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/mock_video_frame_receiver.h b/chromium/media/capture/video/mock_video_frame_receiver.h
index 6582fc0dfbc..13fed245787 100644
--- a/chromium/media/capture/video/mock_video_frame_receiver.h
+++ b/chromium/media/capture/video/mock_video_frame_receiver.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/scoped_buffer_pool_reservation.h b/chromium/media/capture/video/scoped_buffer_pool_reservation.h
index 1a74e605f65..80a9ad99a17 100644
--- a/chromium/media/capture/video/scoped_buffer_pool_reservation.h
+++ b/chromium/media/capture/video/scoped_buffer_pool_reservation.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/shared_memory_buffer_tracker.cc b/chromium/media/capture/video/shared_memory_buffer_tracker.cc
index 7a372b14b81..0bba9e530b4 100644
--- a/chromium/media/capture/video/shared_memory_buffer_tracker.cc
+++ b/chromium/media/capture/video/shared_memory_buffer_tracker.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -58,7 +58,7 @@ size_t CalculateRequiredBufferSize(
namespace media {
SharedMemoryBufferTracker::SharedMemoryBufferTracker(bool strict_pixel_format)
- : strict_pixel_format_(strict_pixel_format){};
+ : strict_pixel_format_(strict_pixel_format) {}
SharedMemoryBufferTracker::~SharedMemoryBufferTracker() = default;
diff --git a/chromium/media/capture/video/shared_memory_buffer_tracker.h b/chromium/media/capture/video/shared_memory_buffer_tracker.h
index c35a34e6f4f..0e09fb17d19 100644
--- a/chromium/media/capture/video/shared_memory_buffer_tracker.h
+++ b/chromium/media/capture/video/shared_memory_buffer_tracker.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_buffer_handle.cc b/chromium/media/capture/video/video_capture_buffer_handle.cc
index 40f8c92c331..9a545ead336 100644
--- a/chromium/media/capture/video/video_capture_buffer_handle.cc
+++ b/chromium/media/capture/video/video_capture_buffer_handle.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_buffer_handle.h b/chromium/media/capture/video/video_capture_buffer_handle.h
index 617135931fc..4cf34bad825 100644
--- a/chromium/media/capture/video/video_capture_buffer_handle.h
+++ b/chromium/media/capture/video/video_capture_buffer_handle.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_buffer_pool.h b/chromium/media/capture/video/video_capture_buffer_pool.h
index ec2088f6512..130066800a3 100644
--- a/chromium/media/capture/video/video_capture_buffer_pool.h
+++ b/chromium/media/capture/video/video_capture_buffer_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -53,9 +53,6 @@ class CAPTURE_EXPORT VideoCaptureBufferPool
virtual mojo::ScopedSharedBufferHandle DuplicateAsMojoBuffer(
int buffer_id) = 0;
- virtual mojom::SharedMemoryViaRawFileDescriptorPtr
- CreateSharedMemoryViaRawFileDescriptorStruct(int buffer_id) = 0;
-
// Try and obtain a read/write access to the buffer.
virtual std::unique_ptr<VideoCaptureBufferHandle> GetHandleForInProcessAccess(
int buffer_id) = 0;
diff --git a/chromium/media/capture/video/video_capture_buffer_pool_impl.cc b/chromium/media/capture/video/video_capture_buffer_pool_impl.cc
index 341fc94f451..3fc260b357f 100644
--- a/chromium/media/capture/video/video_capture_buffer_pool_impl.cc
+++ b/chromium/media/capture/video/video_capture_buffer_pool_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,39 +69,6 @@ VideoCaptureBufferPoolImpl::DuplicateAsMojoBuffer(int buffer_id) {
return tracker->DuplicateAsMojoBuffer();
}
-mojom::SharedMemoryViaRawFileDescriptorPtr
-VideoCaptureBufferPoolImpl::CreateSharedMemoryViaRawFileDescriptorStruct(
- int buffer_id) {
-// This requires platforms where base::SharedMemoryHandle is backed by a
-// file descriptor.
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
- base::AutoLock lock(lock_);
-
- VideoCaptureBufferTracker* tracker = GetTracker(buffer_id);
- if (!tracker) {
- NOTREACHED() << "Invalid buffer_id.";
- return 0u;
- }
-
- // Convert the mojo::ScopedSharedBufferHandle to a PlatformSharedMemoryRegion
- // in order to extract the platform file descriptor.
- base::subtle::PlatformSharedMemoryRegion platform_region =
- mojo::UnwrapPlatformSharedMemoryRegion(tracker->DuplicateAsMojoBuffer());
- if (!platform_region.IsValid()) {
- NOTREACHED();
- return 0u;
- }
- base::subtle::ScopedFDPair fds = platform_region.PassPlatformHandle();
- auto result = mojom::SharedMemoryViaRawFileDescriptor::New();
- result->file_descriptor_handle = mojo::PlatformHandle(std::move(fds.fd));
- result->shared_memory_size_in_bytes = tracker->GetMemorySizeInBytes();
- return result;
-#else
- NOTREACHED();
- return mojom::SharedMemoryViaRawFileDescriptorPtr();
-#endif
-}
-
std::unique_ptr<VideoCaptureBufferHandle>
VideoCaptureBufferPoolImpl::GetHandleForInProcessAccess(int buffer_id) {
base::AutoLock lock(lock_);
diff --git a/chromium/media/capture/video/video_capture_buffer_pool_impl.h b/chromium/media/capture/video/video_capture_buffer_pool_impl.h
index 85eeb4698f9..215c9df6949 100644
--- a/chromium/media/capture/video/video_capture_buffer_pool_impl.h
+++ b/chromium/media/capture/video/video_capture_buffer_pool_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -48,8 +48,6 @@ class CAPTURE_EXPORT VideoCaptureBufferPoolImpl
base::UnsafeSharedMemoryRegion DuplicateAsUnsafeRegion(
int buffer_id) override;
mojo::ScopedSharedBufferHandle DuplicateAsMojoBuffer(int buffer_id) override;
- mojom::SharedMemoryViaRawFileDescriptorPtr
- CreateSharedMemoryViaRawFileDescriptorStruct(int buffer_id) override;
std::unique_ptr<VideoCaptureBufferHandle> GetHandleForInProcessAccess(
int buffer_id) override;
gfx::GpuMemoryBufferHandle GetGpuMemoryBufferHandle(int buffer_id) override;
diff --git a/chromium/media/capture/video/video_capture_buffer_pool_util.cc b/chromium/media/capture/video/video_capture_buffer_pool_util.cc
index 26363105214..5904dec7fd5 100644
--- a/chromium/media/capture/video/video_capture_buffer_pool_util.cc
+++ b/chromium/media/capture/video/video_capture_buffer_pool_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_buffer_pool_util.h b/chromium/media/capture/video/video_capture_buffer_pool_util.h
index 61a12c645f3..46eeb3edacc 100644
--- a/chromium/media/capture/video/video_capture_buffer_pool_util.h
+++ b/chromium/media/capture/video/video_capture_buffer_pool_util.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_buffer_tracker.cc b/chromium/media/capture/video/video_capture_buffer_tracker.cc
index 9e68a534c65..6d3585712a3 100644
--- a/chromium/media/capture/video/video_capture_buffer_tracker.cc
+++ b/chromium/media/capture/video/video_capture_buffer_tracker.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_buffer_tracker.h b/chromium/media/capture/video/video_capture_buffer_tracker.h
index e2bbec38a22..05a925d0635 100644
--- a/chromium/media/capture/video/video_capture_buffer_tracker.h
+++ b/chromium/media/capture/video/video_capture_buffer_tracker.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_buffer_tracker_factory.h b/chromium/media/capture/video/video_capture_buffer_tracker_factory.h
index 92b1674b462..c9cb9fd12cd 100644
--- a/chromium/media/capture/video/video_capture_buffer_tracker_factory.h
+++ b/chromium/media/capture/video/video_capture_buffer_tracker_factory.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.cc b/chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.cc
index 963b6e659fd..1756e1d283f 100644
--- a/chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.cc
+++ b/chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.h b/chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.h
index 9702074feb1..1dd7ca73639 100644
--- a/chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.h
+++ b/chromium/media/capture/video/video_capture_buffer_tracker_factory_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_device.cc b/chromium/media/capture/video/video_capture_device.cc
index 3539a747f3c..b26304b0e49 100644
--- a/chromium/media/capture/video/video_capture_device.cc
+++ b/chromium/media/capture/video/video_capture_device.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "base/callback.h"
#include "base/command_line.h"
+#include "base/containers/contains.h"
#include "base/i18n/timezone.h"
#include "base/strings/string_util.h"
#include "base/token.h"
@@ -88,10 +89,7 @@ PowerLineFrequency VideoCaptureDevice::GetPowerLineFrequencyForLocation() {
"CR", "CU", "DO", "EC", "FM", "GT", "GU", "GY", "HN", "HT", "JP",
"KN", "KR", "KY", "MS", "MX", "NI", "PA", "PE", "PF", "PH", "PR",
"PW", "SA", "SR", "SV", "TT", "TW", "UM", "US", "VG", "VI", "VE"};
- const char** countries_using_60Hz_end =
- countries_using_60Hz + std::size(countries_using_60Hz);
- if (std::find(countries_using_60Hz, countries_using_60Hz_end,
- current_country) == countries_using_60Hz_end) {
+ if (!base::Contains(countries_using_60Hz, current_country)) {
return PowerLineFrequency::FREQUENCY_50HZ;
}
return PowerLineFrequency::FREQUENCY_60HZ;
diff --git a/chromium/media/capture/video/video_capture_device.h b/chromium/media/capture/video/video_capture_device.h
index 480d8d744ea..76c0a61b372 100644
--- a/chromium/media/capture/video/video_capture_device.h
+++ b/chromium/media/capture/video/video_capture_device.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/capture/video/video_capture_device_client.cc b/chromium/media/capture/video/video_capture_device_client.cc
index a96765c137e..efa175865f5 100644
--- a/chromium/media/capture/video/video_capture_device_client.cc
+++ b/chromium/media/capture/video/video_capture_device_client.cc
@@ -1,10 +1,9 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/capture/video/video_capture_device_client.h"
-#include <algorithm>
#include <memory>
#include <utility>
@@ -12,6 +11,7 @@
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/location.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
@@ -494,8 +494,7 @@ ReadyFrameInBuffer VideoCaptureDeviceClient::CreateReadyFrameFromExternalBuffer(
// If a buffer to retire was specified, retire one.
if (buffer_id_to_drop != VideoCaptureBufferPool::kInvalidId) {
auto entry_iter =
- std::find(buffer_ids_known_by_receiver_.begin(),
- buffer_ids_known_by_receiver_.end(), buffer_id_to_drop);
+ base::ranges::find(buffer_ids_known_by_receiver_, buffer_id_to_drop);
if (entry_iter != buffer_ids_known_by_receiver_.end()) {
buffer_ids_known_by_receiver_.erase(entry_iter);
receiver_->OnBufferRetired(buffer_id_to_drop);
@@ -551,8 +550,7 @@ VideoCaptureDeviceClient::ReserveOutputBuffer(const gfx::Size& frame_size,
// |buffer_pool_| has decided to release a buffer. Notify receiver in case
// the buffer has already been shared with it.
auto entry_iter =
- std::find(buffer_ids_known_by_receiver_.begin(),
- buffer_ids_known_by_receiver_.end(), buffer_id_to_drop);
+ base::ranges::find(buffer_ids_known_by_receiver_, buffer_id_to_drop);
if (entry_iter != buffer_ids_known_by_receiver_.end()) {
buffer_ids_known_by_receiver_.erase(entry_iter);
receiver_->OnBufferRetired(buffer_id_to_drop);
@@ -581,12 +579,6 @@ VideoCaptureDeviceClient::ReserveOutputBuffer(const gfx::Size& frame_size,
buffer_handle = media::mojom::VideoBufferHandle::NewUnsafeShmemRegion(
buffer_pool_->DuplicateAsUnsafeRegion(buffer_id));
break;
- case VideoCaptureBufferType::kSharedMemoryViaRawFileDescriptor:
- buffer_handle = media::mojom::VideoBufferHandle::
- NewSharedMemoryViaRawFileDescriptor(
- buffer_pool_->CreateSharedMemoryViaRawFileDescriptorStruct(
- buffer_id));
- break;
case VideoCaptureBufferType::kMailboxHolder:
NOTREACHED();
break;
diff --git a/chromium/media/capture/video/video_capture_device_client.h b/chromium/media/capture/video/video_capture_device_client.h
index 26f299d0486..d1c5b3db855 100644
--- a/chromium/media/capture/video/video_capture_device_client.h
+++ b/chromium/media/capture/video/video_capture_device_client.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_device_client_unittest.cc b/chromium/media/capture/video/video_capture_device_client_unittest.cc
index c5b6973ac1a..8cca1ac5375 100644
--- a/chromium/media/capture/video/video_capture_device_client_unittest.cc
+++ b/chromium/media/capture/video/video_capture_device_client_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_device_descriptor.cc b/chromium/media/capture/video/video_capture_device_descriptor.cc
index e044b4ea476..78ec4f7b14e 100644
--- a/chromium/media/capture/video/video_capture_device_descriptor.cc
+++ b/chromium/media/capture/video/video_capture_device_descriptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_device_descriptor.h b/chromium/media/capture/video/video_capture_device_descriptor.h
index c96afd771f5..721d93018a5 100644
--- a/chromium/media/capture/video/video_capture_device_descriptor.h
+++ b/chromium/media/capture/video/video_capture_device_descriptor.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_device_factory.cc b/chromium/media/capture/video/video_capture_device_factory.cc
index ad91178ae7d..2423d5ca0ca 100644
--- a/chromium/media/capture/video/video_capture_device_factory.cc
+++ b/chromium/media/capture/video/video_capture_device_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -50,7 +50,7 @@ VideoCaptureDeviceFactory::GetDxgiDeviceManager() {
return nullptr;
}
-void VideoCaptureDeviceFactory::OnGpuInfoUpdate(const CHROME_LUID& luid){};
+void VideoCaptureDeviceFactory::OnGpuInfoUpdate(const CHROME_LUID& luid) {}
#endif
} // namespace media
diff --git a/chromium/media/capture/video/video_capture_device_factory.h b/chromium/media/capture/video/video_capture_device_factory.h
index 33574c9039d..854c7318d69 100644
--- a/chromium/media/capture/video/video_capture_device_factory.h
+++ b/chromium/media/capture/video/video_capture_device_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_device_info.cc b/chromium/media/capture/video/video_capture_device_info.cc
index 90a097fd66b..7d98ea999bf 100644
--- a/chromium/media/capture/video/video_capture_device_info.cc
+++ b/chromium/media/capture/video/video_capture_device_info.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_device_info.h b/chromium/media/capture/video/video_capture_device_info.h
index 88445cb90be..93c49f9e0a0 100644
--- a/chromium/media/capture/video/video_capture_device_info.h
+++ b/chromium/media/capture/video/video_capture_device_info.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_device_unittest.cc b/chromium/media/capture/video/video_capture_device_unittest.cc
index fb75b046383..24a4d380ca5 100644
--- a/chromium/media/capture/video/video_capture_device_unittest.cc
+++ b/chromium/media/capture/video/video_capture_device_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/containers/contains.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
@@ -436,10 +437,8 @@ class VideoCaptureDeviceTest
bool IsCaptureSizeSupported(const VideoCaptureDeviceInfo& device_info,
const gfx::Size& size) {
auto& supported_formats = device_info.supported_formats;
- const auto it = std::find_if(
- supported_formats.begin(), supported_formats.end(),
- [&size](VideoCaptureFormat const& f) { return f.frame_size == size; });
- if (it == supported_formats.end()) {
+ if (!base::Contains(supported_formats, size,
+ &VideoCaptureFormat::frame_size)) {
DVLOG(1) << "Size " << size.ToString() << " is not supported.";
return false;
}
diff --git a/chromium/media/capture/video/video_capture_feedback.cc b/chromium/media/capture/video/video_capture_feedback.cc
index 3c072970548..aa41bd0fcc2 100644
--- a/chromium/media/capture/video/video_capture_feedback.cc
+++ b/chromium/media/capture/video/video_capture_feedback.cc
@@ -1,12 +1,12 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/capture/video/video_capture_feedback.h"
-#include <algorithm>
#include <cmath>
+#include "base/containers/contains.h"
#include "base/logging.h"
namespace media {
@@ -63,8 +63,7 @@ void VideoCaptureFeedback::Combine(const VideoCaptureFeedback& other) {
// Merge mapped sizes for all consumers.
for (const gfx::Size& mapped_size : other.mapped_sizes) {
// Skip duplicates.
- if (std::find(mapped_sizes.begin(), mapped_sizes.end(), mapped_size) !=
- mapped_sizes.end()) {
+ if (base::Contains(mapped_sizes, mapped_size)) {
continue;
}
// As a safety measure, limit the number of sizes that can be asked for.
diff --git a/chromium/media/capture/video/video_capture_feedback.h b/chromium/media/capture/video/video_capture_feedback.h
index fcb120d44c5..511bdb1700c 100644
--- a/chromium/media/capture/video/video_capture_feedback.h
+++ b/chromium/media/capture/video/video_capture_feedback.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_metrics.cc b/chromium/media/capture/video/video_capture_metrics.cc
index 23e222bca44..65f97b9427d 100644
--- a/chromium/media/capture/video/video_capture_metrics.cc
+++ b/chromium/media/capture/video/video_capture_metrics.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_metrics.h b/chromium/media/capture/video/video_capture_metrics.h
index f9a963c5a65..eb74d2f8643 100644
--- a/chromium/media/capture/video/video_capture_metrics.h
+++ b/chromium/media/capture/video/video_capture_metrics.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_metrics_unittest.cc b/chromium/media/capture/video/video_capture_metrics_unittest.cc
index d259f2098f2..ff7a4202a02 100644
--- a/chromium/media/capture/video/video_capture_metrics_unittest.cc
+++ b/chromium/media/capture/video/video_capture_metrics_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_system.h b/chromium/media/capture/video/video_capture_system.h
index 7876ec19072..3e80217e3d1 100644
--- a/chromium/media/capture/video/video_capture_system.h
+++ b/chromium/media/capture/video/video_capture_system.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_capture_system_impl.cc b/chromium/media/capture/video/video_capture_system_impl.cc
index a409fa108d9..eefd5c5c15b 100644
--- a/chromium/media/capture/video/video_capture_system_impl.cc
+++ b/chromium/media/capture/video/video_capture_system_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/ranges/algorithm.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "media/base/bind_to_current_loop.h"
@@ -116,11 +117,10 @@ VideoCaptureErrorOrDevice VideoCaptureSystemImpl::CreateDevice(
const VideoCaptureDeviceInfo* VideoCaptureSystemImpl::LookupDeviceInfoFromId(
const std::string& device_id) {
DCHECK(thread_checker_.CalledOnValidThread());
- auto iter =
- std::find_if(devices_info_cache_.begin(), devices_info_cache_.end(),
- [&device_id](const VideoCaptureDeviceInfo& device_info) {
- return device_info.descriptor.device_id == device_id;
- });
+ auto iter = base::ranges::find(devices_info_cache_, device_id,
+ [](const VideoCaptureDeviceInfo& device_info) {
+ return device_info.descriptor.device_id;
+ });
if (iter == devices_info_cache_.end())
return nullptr;
return &(*iter);
diff --git a/chromium/media/capture/video/video_capture_system_impl.h b/chromium/media/capture/video/video_capture_system_impl.h
index 8a081ed59e0..5256373b51b 100644
--- a/chromium/media/capture/video/video_capture_system_impl.h
+++ b/chromium/media/capture/video/video_capture_system_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_frame_receiver.cc b/chromium/media/capture/video/video_frame_receiver.cc
index 44b3b6b3d0a..13dbd52e7f3 100644
--- a/chromium/media/capture/video/video_frame_receiver.cc
+++ b/chromium/media/capture/video/video_frame_receiver.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_frame_receiver.h b/chromium/media/capture/video/video_frame_receiver.h
index 1268beb5b6c..993bc9bf1e4 100644
--- a/chromium/media/capture/video/video_frame_receiver.h
+++ b/chromium/media/capture/video/video_frame_receiver.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_frame_receiver_on_task_runner.cc b/chromium/media/capture/video/video_frame_receiver_on_task_runner.cc
index 37605ab5817..8f0fe8fe81c 100644
--- a/chromium/media/capture/video/video_frame_receiver_on_task_runner.cc
+++ b/chromium/media/capture/video/video_frame_receiver_on_task_runner.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/video_frame_receiver_on_task_runner.h b/chromium/media/capture/video/video_frame_receiver_on_task_runner.h
index 8204bf97acc..7a77e6e6116 100644
--- a/chromium/media/capture/video/video_frame_receiver_on_task_runner.h
+++ b/chromium/media/capture/video/video_frame_receiver_on_task_runner.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/capability_list_win.cc b/chromium/media/capture/video/win/capability_list_win.cc
index dfdc3fa5003..161d40d2b24 100644
--- a/chromium/media/capture/video/win/capability_list_win.cc
+++ b/chromium/media/capture/video/win/capability_list_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/capability_list_win.h b/chromium/media/capture/video/win/capability_list_win.h
index 9d5ac1c00ab..274c0167962 100644
--- a/chromium/media/capture/video/win/capability_list_win.h
+++ b/chromium/media/capture/video/win/capability_list_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/d3d_capture_test_utils.cc b/chromium/media/capture/video/win/d3d_capture_test_utils.cc
index ed7522181df..e7e7827a406 100644
--- a/chromium/media/capture/video/win/d3d_capture_test_utils.cc
+++ b/chromium/media/capture/video/win/d3d_capture_test_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/d3d_capture_test_utils.h b/chromium/media/capture/video/win/d3d_capture_test_utils.h
index 9d4bb751bfc..26612ab360a 100644
--- a/chromium/media/capture/video/win/d3d_capture_test_utils.h
+++ b/chromium/media/capture/video/win/d3d_capture_test_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -676,7 +676,7 @@ class MockD3D11Device final : public MockInterface<ID3D11Device1> {
Microsoft::WRL::ComPtr<MockD3D11DeviceContext> mock_immediate_context_;
private:
- ~MockD3D11Device();
+ ~MockD3D11Device() override;
};
class MockDXGIResource final
diff --git a/chromium/media/capture/video/win/filter_base_win.cc b/chromium/media/capture/video/win/filter_base_win.cc
index f014afff6b0..d6393845187 100644
--- a/chromium/media/capture/video/win/filter_base_win.cc
+++ b/chromium/media/capture/video/win/filter_base_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/filter_base_win.h b/chromium/media/capture/video/win/filter_base_win.h
index 70f783013b6..07af8336e02 100644
--- a/chromium/media/capture/video/win/filter_base_win.h
+++ b/chromium/media/capture/video/win/filter_base_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/gpu_memory_buffer_tracker.cc b/chromium/media/capture/video/win/gpu_memory_buffer_tracker.cc
index 91ac2af43e9..56f7aa84d17 100644
--- a/chromium/media/capture/video/win/gpu_memory_buffer_tracker.cc
+++ b/chromium/media/capture/video/win/gpu_memory_buffer_tracker.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/gpu_memory_buffer_tracker.h b/chromium/media/capture/video/win/gpu_memory_buffer_tracker.h
index 43287a11031..9e2f47c226b 100644
--- a/chromium/media/capture/video/win/gpu_memory_buffer_tracker.h
+++ b/chromium/media/capture/video/win/gpu_memory_buffer_tracker.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/gpu_memory_buffer_tracker_unittest.cc b/chromium/media/capture/video/win/gpu_memory_buffer_tracker_unittest.cc
index 7b3184b862f..2a927154252 100644
--- a/chromium/media/capture/video/win/gpu_memory_buffer_tracker_unittest.cc
+++ b/chromium/media/capture/video/win/gpu_memory_buffer_tracker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/metrics.cc b/chromium/media/capture/video/win/metrics.cc
index 812030168d5..a08666957b7 100644
--- a/chromium/media/capture/video/win/metrics.cc
+++ b/chromium/media/capture/video/win/metrics.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/metrics.h b/chromium/media/capture/video/win/metrics.h
index 5b3163523f3..d4b51ead212 100644
--- a/chromium/media/capture/video/win/metrics.h
+++ b/chromium/media/capture/video/win/metrics.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/pin_base_win.cc b/chromium/media/capture/video/win/pin_base_win.cc
index a2e840ff98f..9ab67bebae2 100644
--- a/chromium/media/capture/video/win/pin_base_win.cc
+++ b/chromium/media/capture/video/win/pin_base_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,7 +11,7 @@ namespace media {
// Implement IEnumPins.
class TypeEnumerator final : public IEnumMediaTypes,
- public base::RefCounted<TypeEnumerator> {
+ public base::RefCountedThreadSafe<TypeEnumerator> {
public:
explicit TypeEnumerator(PinBase* pin) : pin_(pin), index_(0) {}
@@ -26,12 +26,12 @@ class TypeEnumerator final : public IEnumMediaTypes,
}
IFACEMETHODIMP_(ULONG) AddRef() override {
- base::RefCounted<TypeEnumerator>::AddRef();
+ base::RefCountedThreadSafe<TypeEnumerator>::AddRef();
return 1;
}
IFACEMETHODIMP_(ULONG) Release() override {
- base::RefCounted<TypeEnumerator>::Release();
+ base::RefCountedThreadSafe<TypeEnumerator>::Release();
return 1;
}
@@ -96,7 +96,7 @@ class TypeEnumerator final : public IEnumMediaTypes,
}
private:
- friend class base::RefCounted<TypeEnumerator>;
+ friend class base::RefCountedThreadSafe<TypeEnumerator>;
~TypeEnumerator() {}
void FreeAllocatedMediaTypes(ULONG allocated, AM_MEDIA_TYPE** types) {
@@ -270,12 +270,12 @@ HRESULT PinBase::QueryInterface(REFIID id, void** object_ptr) {
}
ULONG PinBase::AddRef() {
- base::RefCounted<PinBase>::AddRef();
+ base::RefCountedThreadSafe<PinBase>::AddRef();
return 1;
}
ULONG PinBase::Release() {
- base::RefCounted<PinBase>::Release();
+ base::RefCountedThreadSafe<PinBase>::Release();
return 1;
}
diff --git a/chromium/media/capture/video/win/pin_base_win.h b/chromium/media/capture/video/win/pin_base_win.h
index 1a6b2ff6069..2ba316c860d 100644
--- a/chromium/media/capture/video/win/pin_base_win.h
+++ b/chromium/media/capture/video/win/pin_base_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,7 +21,7 @@ namespace media {
class PinBase : public IPin,
public IMemInputPin,
- public base::RefCounted<PinBase> {
+ public base::RefCountedThreadSafe<PinBase> {
public:
explicit PinBase(IBaseFilter* owner);
@@ -98,7 +98,7 @@ class PinBase : public IPin,
IFACEMETHODIMP_(ULONG) Release() override;
protected:
- friend class base::RefCounted<PinBase>;
+ friend class base::RefCountedThreadSafe<PinBase>;
virtual ~PinBase();
private:
diff --git a/chromium/media/capture/video/win/sink_filter_observer_win.h b/chromium/media/capture/video/win/sink_filter_observer_win.h
index 646c443e722..44a2df54901 100644
--- a/chromium/media/capture/video/win/sink_filter_observer_win.h
+++ b/chromium/media/capture/video/win/sink_filter_observer_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/sink_filter_win.cc b/chromium/media/capture/video/win/sink_filter_win.cc
index 90ad4ac4486..382e8254f93 100644
--- a/chromium/media/capture/video/win/sink_filter_win.cc
+++ b/chromium/media/capture/video/win/sink_filter_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/sink_filter_win.h b/chromium/media/capture/video/win/sink_filter_win.h
index 88373bd705d..2f753abe750 100644
--- a/chromium/media/capture/video/win/sink_filter_win.h
+++ b/chromium/media/capture/video/win/sink_filter_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/sink_input_pin_win.cc b/chromium/media/capture/video/win/sink_input_pin_win.cc
index fe194c078eb..70c05d9d420 100644
--- a/chromium/media/capture/video/win/sink_input_pin_win.cc
+++ b/chromium/media/capture/video/win/sink_input_pin_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/sink_input_pin_win.h b/chromium/media/capture/video/win/sink_input_pin_win.h
index 7df06bb33ce..c8e2893037c 100644
--- a/chromium/media/capture/video/win/sink_input_pin_win.h
+++ b/chromium/media/capture/video/win/sink_input_pin_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.cc b/chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.cc
index e08722111bf..c89e7390b2d 100644
--- a/chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.cc
+++ b/chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.h b/chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.h
index 090f6881b33..db8fdcd668e 100644
--- a/chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.h
+++ b/chromium/media/capture/video/win/video_capture_buffer_tracker_factory_win.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/video_capture_device_factory_win.cc b/chromium/media/capture/video/win/video_capture_device_factory_win.cc
index 0008fd14d1d..c77478b49d5 100644
--- a/chromium/media/capture/video/win/video_capture_device_factory_win.cc
+++ b/chromium/media/capture/video/win/video_capture_device_factory_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,6 +21,7 @@
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
@@ -258,10 +259,10 @@ std::string GetDeviceModelId(const std::string& device_id) {
bool DevicesInfoContainsDeviceId(const DevicesInfo& devices_info,
const std::string& device_id) {
- return std::find_if(devices_info.begin(), devices_info.end(),
- [device_id](const VideoCaptureDeviceInfo& device_info) {
- return device_id == device_info.descriptor.device_id;
- }) != devices_info.end();
+ return base::Contains(devices_info, device_id,
+ [](const VideoCaptureDeviceInfo& device_info) {
+ return device_info.descriptor.device_id;
+ });
}
// Returns a non DirectShow descriptor DevicesInfo with the provided name and
@@ -269,8 +270,8 @@ bool DevicesInfoContainsDeviceId(const DevicesInfo& devices_info,
DevicesInfo::const_iterator FindNonDirectShowDeviceInfoByNameAndModel(
const DevicesInfo& devices_info,
const std::string& name_and_model) {
- return std::find_if(
- devices_info.begin(), devices_info.end(),
+ return base::ranges::find_if(
+ devices_info,
[name_and_model](const VideoCaptureDeviceInfo& device_info) {
return device_info.descriptor.capture_api !=
VideoCaptureApi::WIN_DIRECT_SHOW &&
diff --git a/chromium/media/capture/video/win/video_capture_device_factory_win.h b/chromium/media/capture/video/win/video_capture_device_factory_win.h
index 047e3f8b109..1b526659af6 100644
--- a/chromium/media/capture/video/win/video_capture_device_factory_win.h
+++ b/chromium/media/capture/video/win/video_capture_device_factory_win.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/video_capture_device_factory_win_unittest.cc b/chromium/media/capture/video/win/video_capture_device_factory_win_unittest.cc
index 9e560c47aa7..be82fdb9fc6 100644
--- a/chromium/media/capture/video/win/video_capture_device_factory_win_unittest.cc
+++ b/chromium/media/capture/video/win/video_capture_device_factory_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,6 +16,7 @@
#include "base/bind.h"
#include "base/memory/scoped_refptr.h"
+#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/strings/sys_string_conversions.h"
#include "base/test/bind.h"
@@ -74,10 +75,10 @@ using iterator = std::vector<VideoCaptureDeviceInfo>::const_iterator;
iterator FindDeviceInRange(iterator begin,
iterator end,
const std::string& device_id) {
- return std::find_if(begin, end,
- [device_id](const VideoCaptureDeviceInfo& device_info) {
- return device_id == device_info.descriptor.device_id;
- });
+ return base::ranges::find(begin, end, device_id,
+ [](const VideoCaptureDeviceInfo& device_info) {
+ return device_info.descriptor.device_id;
+ });
}
template <class Interface>
diff --git a/chromium/media/capture/video/win/video_capture_device_mf_win.cc b/chromium/media/capture/video/win/video_capture_device_mf_win.cc
index 526d3c1d2d9..2ba8d917850 100644
--- a/chromium/media/capture/video/win/video_capture_device_mf_win.cc
+++ b/chromium/media/capture/video/win/video_capture_device_mf_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -1408,7 +1408,7 @@ void VideoCaptureDeviceMFWin::GetPhotoState(GetPhotoStateCallback callback) {
// support optional shallow focus capability (according to
// https://docs.microsoft.com/en-us/windows-hardware/drivers/stream/ksproperty-cameracontrol-extended-backgroundsegmentation)
// but that support is not needed here.
- HRESULT hr = extended_camera_controller_->GetExtendedCameraControl(
+ hr = extended_camera_controller_->GetExtendedCameraControl(
MF_CAPTURE_ENGINE_MEDIASOURCE,
KSPROPERTY_CAMERACONTROL_EXTENDED_BACKGROUNDSEGMENTATION,
&extended_camera_control);
@@ -1604,7 +1604,7 @@ void VideoCaptureDeviceMFWin::SetPhotoOptions(
if (extended_camera_controller_) {
ComPtr<IMFExtendedCameraControl> extended_camera_control;
if (settings->has_background_blur_mode) {
- HRESULT hr = extended_camera_controller_->GetExtendedCameraControl(
+ hr = extended_camera_controller_->GetExtendedCameraControl(
MF_CAPTURE_ENGINE_MEDIASOURCE,
KSPROPERTY_CAMERACONTROL_EXTENDED_BACKGROUNDSEGMENTATION,
&extended_camera_control);
diff --git a/chromium/media/capture/video/win/video_capture_device_mf_win.h b/chromium/media/capture/video/win/video_capture_device_mf_win.h
index 7f45ec63c98..f324427c63a 100644
--- a/chromium/media/capture/video/win/video_capture_device_mf_win.h
+++ b/chromium/media/capture/video/win/video_capture_device_mf_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/video_capture_device_mf_win_unittest.cc b/chromium/media/capture/video/win/video_capture_device_mf_win_unittest.cc
index d763ae896c1..1cffb468c33 100644
--- a/chromium/media/capture/video/win/video_capture_device_mf_win_unittest.cc
+++ b/chromium/media/capture/video/win/video_capture_device_mf_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -723,7 +723,7 @@ class MockDXGIDeviceManager : public DXGIDeviceManager {
});
}
- virtual HRESULT ResetDevice(
+ HRESULT ResetDevice(
Microsoft::WRL::ComPtr<ID3D11Device>& d3d_device) override {
return DoResetDevice(&d3d_device);
}
diff --git a/chromium/media/capture/video/win/video_capture_device_utils_win.cc b/chromium/media/capture/video/win/video_capture_device_utils_win.cc
index ee58fbc383e..e2fd2b0c14f 100644
--- a/chromium/media/capture/video/win/video_capture_device_utils_win.cc
+++ b/chromium/media/capture/video/win/video_capture_device_utils_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/video_capture_device_utils_win.h b/chromium/media/capture/video/win/video_capture_device_utils_win.h
index b1bc0750b4f..8d15e98b8c8 100644
--- a/chromium/media/capture/video/win/video_capture_device_utils_win.h
+++ b/chromium/media/capture/video/win/video_capture_device_utils_win.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video/win/video_capture_device_win.cc b/chromium/media/capture/video/win/video_capture_device_win.cc
index f2380053969..040aad1cf67 100644
--- a/chromium/media/capture/video/win/video_capture_device_win.cc
+++ b/chromium/media/capture/video/win/video_capture_device_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -872,34 +872,35 @@ void VideoCaptureDeviceWin::FrameReceived(const uint8_t* buffer,
const VideoCaptureFormat& format,
base::TimeDelta timestamp,
bool flip_y) {
+ // We always calculate camera rotation for the first frame. We also cache
+ // the latest value to use when AutoRotation is turned off.
+ // To avoid potential deadlock, do this without holding a lock.
+ if (!camera_rotation_.has_value() || IsAutoRotationEnabled())
+ camera_rotation_ = GetCameraRotation(device_descriptor_.facing);
+
{
base::AutoLock lock(lock_);
if (state_ != kCapturing)
return;
- }
- if (first_ref_time_.is_null())
- first_ref_time_ = base::TimeTicks::Now();
+ if (first_ref_time_.is_null())
+ first_ref_time_ = base::TimeTicks::Now();
- // There is a chance that the platform does not provide us with the timestamp,
- // in which case, we use reference time to calculate a timestamp.
- if (timestamp == kNoTimestamp)
- timestamp = base::TimeTicks::Now() - first_ref_time_;
+ // There is a chance that the platform does not provide us with the
+ // timestamp, in which case, we use reference time to calculate a timestamp.
+ if (timestamp == kNoTimestamp)
+ timestamp = base::TimeTicks::Now() - first_ref_time_;
- // We always calculate camera rotation for the first frame. We also cache the
- // latest value to use when AutoRotation is turned off.
- if (!camera_rotation_.has_value() || IsAutoRotationEnabled())
- camera_rotation_ = GetCameraRotation(device_descriptor_.facing);
-
- // TODO(julien.isorce): retrieve the color space information using the
- // DirectShow api, AM_MEDIA_TYPE::VIDEOINFOHEADER2::dwControlFlags. If
- // AMCONTROL_COLORINFO_PRESENT, then reinterpret dwControlFlags as a
- // DXVA_ExtendedFormat. Then use its fields DXVA_VideoPrimaries,
- // DXVA_VideoTransferMatrix, DXVA_VideoTransferFunction and
- // DXVA_NominalRangeto build a gfx::ColorSpace. See http://crbug.com/959992.
- client_->OnIncomingCapturedData(buffer, length, format, gfx::ColorSpace(),
- camera_rotation_.value(), flip_y,
- base::TimeTicks::Now(), timestamp);
+ // TODO(julien.isorce): retrieve the color space information using the
+ // DirectShow api, AM_MEDIA_TYPE::VIDEOINFOHEADER2::dwControlFlags. If
+ // AMCONTROL_COLORINFO_PRESENT, then reinterpret dwControlFlags as a
+ // DXVA_ExtendedFormat. Then use its fields DXVA_VideoPrimaries,
+ // DXVA_VideoTransferMatrix, DXVA_VideoTransferFunction and
+ // DXVA_NominalRangeto build a gfx::ColorSpace. See http://crbug.com/959992.
+ client_->OnIncomingCapturedData(buffer, length, format, gfx::ColorSpace(),
+ camera_rotation_.value(), flip_y,
+ base::TimeTicks::Now(), timestamp);
+ }
while (!take_photo_callbacks_.empty()) {
TakePhotoCallback cb = std::move(take_photo_callbacks_.front());
diff --git a/chromium/media/capture/video/win/video_capture_device_win.h b/chromium/media/capture/video/win/video_capture_device_win.h
index 7d7b0d694e8..1b6ee0236ae 100644
--- a/chromium/media/capture/video/win/video_capture_device_win.h
+++ b/chromium/media/capture/video/win/video_capture_device_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/capture/video_capture_types.cc b/chromium/media/capture/video_capture_types.cc
index f5cb9b19c2a..2e6a85f32bc 100644
--- a/chromium/media/capture/video_capture_types.cc
+++ b/chromium/media/capture/video_capture_types.cc
@@ -1,10 +1,11 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/capture/video_capture_types.h"
#include "base/check.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "media/base/limits.h"
@@ -51,14 +52,8 @@ std::string VideoCaptureFormat::ToString(const VideoCaptureFormat& format) {
bool VideoCaptureFormat::ComparePixelFormatPreference(
const VideoPixelFormat& lhs,
const VideoPixelFormat& rhs) {
- auto* format_lhs = std::find(
- kSupportedCapturePixelFormats,
- kSupportedCapturePixelFormats + std::size(kSupportedCapturePixelFormats),
- lhs);
- auto* format_rhs = std::find(
- kSupportedCapturePixelFormats,
- kSupportedCapturePixelFormats + std::size(kSupportedCapturePixelFormats),
- rhs);
+ auto* format_lhs = base::ranges::find(kSupportedCapturePixelFormats, lhs);
+ auto* format_rhs = base::ranges::find(kSupportedCapturePixelFormats, rhs);
return format_lhs < format_rhs;
}
diff --git a/chromium/media/capture/video_capture_types.h b/chromium/media/capture/video_capture_types.h
index a485ec3f05a..e6d8961db64 100644
--- a/chromium/media/capture/video_capture_types.h
+++ b/chromium/media/capture/video_capture_types.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -57,7 +57,6 @@ enum class PowerLineFrequency {
enum class VideoCaptureBufferType {
kSharedMemory,
- kSharedMemoryViaRawFileDescriptor,
kMailboxHolder,
kGpuMemoryBuffer
};
@@ -234,7 +233,8 @@ enum class VideoCaptureFrameDropReason {
kResolutionAdapterHasNoCallbacks = 24,
kVideoTrackFrameDelivererNotEnabledReplacingWithBlackFrame = 25,
kRendererSinkFrameDelivererIsNotStarted = 26,
- kMaxValue = 26
+ kCropVersionNotCurrent = 27,
+ kMaxValue = 27
};
// Assert that the int:frequency mapping is correct.
@@ -287,11 +287,17 @@ typedef std::vector<VideoCaptureFormat> VideoCaptureFormats;
// format of frames in which the client would like to have captured frames
// returned.
struct CAPTURE_EXPORT VideoCaptureParams {
- // Result struct for SuggestContraints() method.
+ // Result struct for SuggestConstraints() method.
struct SuggestedConstraints {
gfx::Size min_frame_size;
gfx::Size max_frame_size;
bool fixed_aspect_ratio;
+
+ bool operator==(const SuggestedConstraints& other) const {
+ return min_frame_size == other.min_frame_size &&
+ max_frame_size == other.max_frame_size &&
+ fixed_aspect_ratio == other.fixed_aspect_ratio;
+ }
};
VideoCaptureParams();
diff --git a/chromium/media/capture/video_capture_types_unittest.cc b/chromium/media/capture/video_capture_types_unittest.cc
index 05bfc980618..850c7e2d121 100644
--- a/chromium/media/capture/video_capture_types_unittest.cc
+++ b/chromium/media/capture/video_capture_types_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/BUILD.gn b/chromium/media/cast/BUILD.gn
index 7107ce875ef..83605423d87 100644
--- a/chromium/media/cast/BUILD.gn
+++ b/chromium/media/cast/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -70,7 +70,7 @@ source_set("common") {
# The generated headers reference headers within protobuf_lite, so
# dependencies must be able to find those headers too.
":logging_proto",
- "//components/openscreen_platform:openscreen_platform_network_service",
+ "//components/openscreen_platform",
"//third_party/openscreen/src/cast/streaming:common",
"//third_party/openscreen/src/cast/streaming:sender",
]
@@ -183,10 +183,6 @@ source_set("encoding") {
deps += [ "//third_party/libaom" ]
}
-
- if (is_chromeos) {
- deps += [ "//third_party/re2" ]
- }
}
# TODO(https://crbug.com/1327074): should be split into multiple source sets
@@ -217,7 +213,7 @@ source_set("sender") {
":encoding",
":net",
"//base",
- "//components/openscreen_platform:openscreen_platform_network_service",
+ "//components/openscreen_platform",
"//media",
"//media/capture:capture_base",
"//third_party/openscreen/src/cast/streaming:sender",
@@ -384,7 +380,7 @@ test("cast_unittests") {
"//base",
"//base:cfi_buildflags",
"//base/test:test_support",
- "//components/openscreen_platform:openscreen_platform_network_service",
+ "//components/openscreen_platform",
"//media:test_support",
"//media/test:run_all_unittests",
"//mojo/public/cpp/bindings",
diff --git a/chromium/media/cast/cast_callbacks.h b/chromium/media/cast/cast_callbacks.h
index 03ce4fe2a90..0fa4637a74e 100644
--- a/chromium/media/cast/cast_callbacks.h
+++ b/chromium/media/cast/cast_callbacks.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/cast_config.cc b/chromium/media/cast/cast_config.cc
index 5cde0f48a2a..68373c0ba70 100644
--- a/chromium/media/cast/cast_config.cc
+++ b/chromium/media/cast/cast_config.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,56 +7,32 @@
namespace media {
namespace cast {
-VideoCodecParams::VideoCodecParams()
- : max_qp(kDefaultMaxQp),
- min_qp(kDefaultMinQp),
- max_cpu_saver_qp(kDefaultMaxCpuSaverQp),
- max_number_of_video_buffers_used(kDefaultNumberOfVideoBuffers),
- number_of_encode_threads(1) {}
-
+VideoCodecParams::VideoCodecParams() = default;
VideoCodecParams::VideoCodecParams(const VideoCodecParams& other) = default;
-
+VideoCodecParams::VideoCodecParams(VideoCodecParams&& other) = default;
+VideoCodecParams& VideoCodecParams::operator=(const VideoCodecParams& other) =
+ default;
+VideoCodecParams& VideoCodecParams::operator=(VideoCodecParams&& other) =
+ default;
VideoCodecParams::~VideoCodecParams() = default;
-FrameSenderConfig::FrameSenderConfig()
- : sender_ssrc(0),
- receiver_ssrc(0),
- // In production, these values are overridden by the mirror settings
- // and potentially the mirroring session parameters, however we provide
- // a reasonable default here for some use cases, such as tests.
- // All three delays are set to the same value due to adaptive latency
- // being disabled in Chrome. This will be fixed as part of the migration
- // to libcast.
- min_playout_delay(kDefaultTargetPlayoutDelay),
- max_playout_delay(kDefaultTargetPlayoutDelay),
- animated_playout_delay(min_playout_delay),
- rtp_payload_type(RtpPayloadType::UNKNOWN),
- use_external_encoder(false),
- rtp_timebase(0),
- channels(0),
- max_bitrate(0),
- min_bitrate(0),
- start_bitrate(0),
- max_frame_rate(kDefaultMaxFrameRate),
- codec(CODEC_UNKNOWN) {}
-
+FrameSenderConfig::FrameSenderConfig() = default;
FrameSenderConfig::FrameSenderConfig(const FrameSenderConfig& other) = default;
-
+FrameSenderConfig::FrameSenderConfig(FrameSenderConfig&& other) = default;
+FrameSenderConfig& FrameSenderConfig::operator=(
+ const FrameSenderConfig& other) = default;
+FrameSenderConfig& FrameSenderConfig::operator=(FrameSenderConfig&& other) =
+ default;
FrameSenderConfig::~FrameSenderConfig() = default;
-FrameReceiverConfig::FrameReceiverConfig()
- : receiver_ssrc(0),
- sender_ssrc(0),
- rtp_max_delay_ms(kDefaultTargetPlayoutDelay.InMilliseconds()),
- rtp_payload_type(RtpPayloadType::UNKNOWN),
- rtp_timebase(0),
- channels(0),
- target_frame_rate(0),
- codec(CODEC_UNKNOWN) {}
-
+FrameReceiverConfig::FrameReceiverConfig() = default;
FrameReceiverConfig::FrameReceiverConfig(const FrameReceiverConfig& other) =
default;
-
+FrameReceiverConfig::FrameReceiverConfig(FrameReceiverConfig&& other) = default;
+FrameReceiverConfig& FrameReceiverConfig::operator=(
+ const FrameReceiverConfig& other) = default;
+FrameReceiverConfig& FrameReceiverConfig::operator=(
+ FrameReceiverConfig&& other) = default;
FrameReceiverConfig::~FrameReceiverConfig() = default;
} // namespace cast
diff --git a/chromium/media/cast/cast_config.h b/chromium/media/cast/cast_config.h
index 39f6a1208f0..cf04c312ac6 100644
--- a/chromium/media/cast/cast_config.h
+++ b/chromium/media/cast/cast_config.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,6 +21,8 @@ class VideoEncodeAccelerator;
namespace cast {
+// TODO(https://crbug.com/1363514): should be removed in favor of
+// media::VideoCodec, media::AudioCodec.
enum Codec {
CODEC_UNKNOWN,
CODEC_AUDIO_OPUS,
@@ -108,10 +110,13 @@ enum SuggestedDefaults {
struct VideoCodecParams {
VideoCodecParams();
VideoCodecParams(const VideoCodecParams& other);
+ VideoCodecParams(VideoCodecParams&& other);
+ VideoCodecParams& operator=(const VideoCodecParams& other);
+ VideoCodecParams& operator=(VideoCodecParams&& other);
~VideoCodecParams();
- int max_qp;
- int min_qp;
+ int max_qp = kDefaultMaxQp;
+ int min_qp = kDefaultMinQp;
// The maximum |min_quantizer| set to the encoder when CPU is constrained.
// This is a trade-off between higher resolution with lower encoding quality
@@ -120,7 +125,7 @@ struct VideoCodecParams {
// at this resolution than lowering resolution with similar CPU usage and
// smaller quantizer. The set value has to be between |min_qp| and |max_qp|.
// Suggested value range: [4, 30]. It is only used by software VP8 codec.
- int max_cpu_saver_qp;
+ int max_cpu_saver_qp = kDefaultMaxCpuSaverQp;
// This field is used differently by various encoders.
//
@@ -132,21 +137,24 @@ struct VideoCodecParams {
// may hold before emitting a frame. A larger window may allow higher encoding
// efficiency at the cost of latency and memory. Set to 0 to let the encoder
// choose a suitable value for the platform and other encoding settings.
- int max_number_of_video_buffers_used;
+ int max_number_of_video_buffers_used = kDefaultNumberOfVideoBuffers;
- int number_of_encode_threads;
+ int number_of_encode_threads = 1;
};
struct FrameSenderConfig {
FrameSenderConfig();
FrameSenderConfig(const FrameSenderConfig& other);
+ FrameSenderConfig(FrameSenderConfig&& other);
+ FrameSenderConfig& operator=(const FrameSenderConfig& other);
+ FrameSenderConfig& operator=(FrameSenderConfig&& other);
~FrameSenderConfig();
// The sender's SSRC identifier.
- uint32_t sender_ssrc;
+ uint32_t sender_ssrc = 0;
// The receiver's SSRC identifier.
- uint32_t receiver_ssrc;
+ uint32_t receiver_ssrc = 0;
// The total amount of time between a frame's capture/recording on the sender
// and its playback on the receiver (i.e., shown to a user). This should be
@@ -154,38 +162,39 @@ struct FrameSenderConfig {
// transmit/retransmit, receive, decode, and render; given its run-time
// environment (sender/receiver hardware performance, network conditions,
// etc.).
- base::TimeDelta min_playout_delay;
- base::TimeDelta max_playout_delay;
-
- // Starting playout delay when streaming animated content.
- base::TimeDelta animated_playout_delay;
+ //
+ // All three delays are set to the same value due to adaptive latency
+ // being disabled in Chrome.
+ // TODO(https://crbug.com/1363017): re-enable adaptive playout dleay.
+ base::TimeDelta min_playout_delay = kDefaultTargetPlayoutDelay;
+ base::TimeDelta max_playout_delay = kDefaultTargetPlayoutDelay;
// RTP payload type enum: Specifies the type/encoding of frame data.
- RtpPayloadType rtp_payload_type;
+ RtpPayloadType rtp_payload_type = RtpPayloadType::UNKNOWN;
// If true, use an external HW encoder rather than the built-in
// software-based one.
- bool use_external_encoder;
+ bool use_external_encoder = false;
// RTP timebase: The number of RTP units advanced per one second. For audio,
// this is the sampling rate. For video, by convention, this is 90 kHz.
- int rtp_timebase;
+ int rtp_timebase = 0;
// Number of channels. For audio, this is normally 2. For video, this must
// be 1 as Cast does not have support for stereoscopic video.
- int channels;
+ int channels = 0;
// For now, only fixed bitrate is used for audio encoding. So for audio,
// |max_bitrate| is used, and the other two will be overriden if they are not
// equal to |max_bitrate|.
- int max_bitrate;
- int min_bitrate;
- int start_bitrate;
+ int max_bitrate = 0;
+ int min_bitrate = 0;
+ int start_bitrate = 0;
- double max_frame_rate;
+ double max_frame_rate = kDefaultMaxFrameRate;
// Codec used for the compression of signal data.
- Codec codec;
+ Codec codec = CODEC_UNKNOWN;
// The AES crypto key and initialization vector. Each of these strings
// contains the data in binary form, of size kAesKeySize. If they are empty
@@ -195,7 +204,7 @@ struct FrameSenderConfig {
// When true, allows use of CODEC_VIDEO_FAKE. When false, CODEC_VIDEO_FAKE is
// not supported.
- bool enable_fake_codec_for_tests{false};
+ bool enable_fake_codec_for_tests = false;
// These are codec specific parameters for video streams only.
VideoCodecParams video_codec_params;
@@ -204,13 +213,16 @@ struct FrameSenderConfig {
struct FrameReceiverConfig {
FrameReceiverConfig();
FrameReceiverConfig(const FrameReceiverConfig& other);
+ FrameReceiverConfig(FrameReceiverConfig&& other);
+ FrameReceiverConfig& operator=(const FrameReceiverConfig& other);
+ FrameReceiverConfig& operator=(FrameReceiverConfig&& other);
~FrameReceiverConfig();
// The receiver's SSRC identifier.
- uint32_t receiver_ssrc;
+ uint32_t receiver_ssrc = 0;
// The sender's SSRC identifier.
- uint32_t sender_ssrc;
+ uint32_t sender_ssrc = 0;
// The total amount of time between a frame's capture/recording on the sender
// and its playback on the receiver (i.e., shown to a user). This is fixed as
@@ -218,26 +230,26 @@ struct FrameReceiverConfig {
// transmit/retransmit, receive, decode, and render; given its run-time
// environment (sender/receiver hardware performance, network conditions,
// etc.).
- int rtp_max_delay_ms;
+ int rtp_max_delay_ms = kDefaultTargetPlayoutDelay.InMilliseconds();
// RTP payload type enum: Specifies the type/encoding of frame data.
- RtpPayloadType rtp_payload_type;
+ RtpPayloadType rtp_payload_type = RtpPayloadType::UNKNOWN;
// RTP timebase: The number of RTP units advanced per one second. For audio,
// this is the sampling rate. For video, by convention, this is 90 kHz.
- int rtp_timebase;
+ int rtp_timebase = 0;
// Number of channels. For audio, this is normally 2. For video, this must
// be 1 as Cast does not have support for stereoscopic video.
- int channels;
+ int channels = 0;
// The target frame rate. For audio, this is normally 100 (i.e., frames have
// a duration of 10ms each). For video, this is normally 30, but any frame
// rate is supported.
- double target_frame_rate;
+ double target_frame_rate = 0;
// Codec used for the compression of signal data.
- Codec codec;
+ Codec codec = CODEC_UNKNOWN;
// The AES crypto key and initialization vector. Each of these strings
// contains the data in binary form, of size kAesKeySize. If they are empty
diff --git a/chromium/media/cast/cast_environment.cc b/chromium/media/cast/cast_environment.cc
index 0f9b4ca896f..ce6d55e720d 100644
--- a/chromium/media/cast/cast_environment.cc
+++ b/chromium/media/cast/cast_environment.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/cast_environment.h b/chromium/media/cast/cast_environment.h
index 35d22f3e019..8a9b7fd9caf 100644
--- a/chromium/media/cast/cast_environment.h
+++ b/chromium/media/cast/cast_environment.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/cast_sender.h b/chromium/media/cast/cast_sender.h
index 902a8c6c3dd..cb686453347 100644
--- a/chromium/media/cast/cast_sender.h
+++ b/chromium/media/cast/cast_sender.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/cast/cast_sender_impl.cc b/chromium/media/cast/cast_sender_impl.cc
index 64fa3ac5f36..4145339f30e 100644
--- a/chromium/media/cast/cast_sender_impl.cc
+++ b/chromium/media/cast/cast_sender_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/cast_sender_impl.h b/chromium/media/cast/cast_sender_impl.h
index 6a732d2fc2e..3b3a07183e3 100644
--- a/chromium/media/cast/cast_sender_impl.h
+++ b/chromium/media/cast/cast_sender_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_CAST_CAST_SENDER_IMPL_H_
diff --git a/chromium/media/cast/common/clock_drift_smoother.cc b/chromium/media/cast/common/clock_drift_smoother.cc
index be3ce23e40e..e25774bf2d7 100644
--- a/chromium/media/cast/common/clock_drift_smoother.cc
+++ b/chromium/media/cast/common/clock_drift_smoother.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/clock_drift_smoother.h b/chromium/media/cast/common/clock_drift_smoother.h
index 0511da9f3d9..87b60705ec0 100644
--- a/chromium/media/cast/common/clock_drift_smoother.h
+++ b/chromium/media/cast/common/clock_drift_smoother.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/encoded_frame.cc b/chromium/media/cast/common/encoded_frame.cc
index 6fc5c764576..835688cee25 100644
--- a/chromium/media/cast/common/encoded_frame.cc
+++ b/chromium/media/cast/common/encoded_frame.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,9 +9,7 @@
namespace media {
namespace cast {
-EncodedFrame::EncodedFrame()
- : dependency(UNKNOWN_DEPENDENCY), new_playout_delay_ms(0) {}
-
+EncodedFrame::EncodedFrame() = default;
EncodedFrame::~EncodedFrame() = default;
void EncodedFrame::CopyMetadataTo(EncodedFrame* dest) const {
diff --git a/chromium/media/cast/common/encoded_frame.h b/chromium/media/cast/common/encoded_frame.h
index f5897da2915..fceb02e9bdf 100644
--- a/chromium/media/cast/common/encoded_frame.h
+++ b/chromium/media/cast/common/encoded_frame.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "media/cast/cast_config.h"
#include "media/cast/common/frame_id.h"
#include "media/cast/common/rtp_time.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
namespace media {
namespace cast {
@@ -19,24 +20,6 @@ namespace cast {
// A combination of metadata and data for one encoded frame. This can contain
// audio data or video data or other.
struct EncodedFrame {
- enum Dependency {
- // "null" value, used to indicate whether |dependency| has been set.
- UNKNOWN_DEPENDENCY,
-
- // Not decodable without the reference frame indicated by
- // |referenced_frame_id|.
- DEPENDENT,
-
- // Independently decodable.
- INDEPENDENT,
-
- // Independently decodable, and no future frames will depend on any frames
- // before this one.
- KEY,
-
- DEPENDENCY_LAST = KEY
- };
-
EncodedFrame();
virtual ~EncodedFrame();
@@ -53,7 +36,8 @@ struct EncodedFrame {
void CopyMetadataTo(EncodedFrame* dest) const;
// This frame's dependency relationship with respect to other frames.
- Dependency dependency;
+ openscreen::cast::EncodedFrame::Dependency dependency =
+ openscreen::cast::EncodedFrame::Dependency::kUnknown;
// The label associated with this frame. Implies an ordering relative to
// other frames in the same stream.
@@ -82,7 +66,7 @@ struct EncodedFrame {
// Playout delay for this and all future frames. Used by the Adaptive
// Playout delay extension. Zero means no change.
- uint16_t new_playout_delay_ms;
+ uint16_t new_playout_delay_ms = 0;
// The encoded signal data.
std::string data;
diff --git a/chromium/media/cast/common/expanded_value_base.h b/chromium/media/cast/common/expanded_value_base.h
index 4902e0168eb..eefda4a522c 100644
--- a/chromium/media/cast/common/expanded_value_base.h
+++ b/chromium/media/cast/common/expanded_value_base.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/expanded_value_base_unittest.cc b/chromium/media/cast/common/expanded_value_base_unittest.cc
index 587f682b5d8..1f7152310d7 100644
--- a/chromium/media/cast/common/expanded_value_base_unittest.cc
+++ b/chromium/media/cast/common/expanded_value_base_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/frame_id.h b/chromium/media/cast/common/frame_id.h
index 398f3fab81c..9451b91f90b 100644
--- a/chromium/media/cast/common/frame_id.h
+++ b/chromium/media/cast/common/frame_id.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/mod_util.h b/chromium/media/cast/common/mod_util.h
index 2761df66d0b..ff91d64fd08 100644
--- a/chromium/media/cast/common/mod_util.h
+++ b/chromium/media/cast/common/mod_util.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/openscreen_conversion_helpers.cc b/chromium/media/cast/common/openscreen_conversion_helpers.cc
index 4c34f4b96ba..b2d720dd268 100644
--- a/chromium/media/cast/common/openscreen_conversion_helpers.cc
+++ b/chromium/media/cast/common/openscreen_conversion_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -49,27 +49,10 @@ base::TimeDelta ToTimeDelta(openscreen::Clock::duration tp) {
std::chrono::duration_cast<std::chrono::microseconds>(tp).count());
}
-openscreen::cast::EncodedFrame::Dependency ToOpenscreenDependency(
- media::cast::EncodedFrame::Dependency dependency) {
- switch (dependency) {
- case media::cast::EncodedFrame::Dependency::UNKNOWN_DEPENDENCY:
- return openscreen::cast::EncodedFrame::Dependency::UNKNOWN_DEPENDENCY;
- case media::cast::EncodedFrame::Dependency::DEPENDENT:
- return openscreen::cast::EncodedFrame::Dependency::DEPENDS_ON_ANOTHER;
- case media::cast::EncodedFrame::Dependency::INDEPENDENT:
- return openscreen::cast::EncodedFrame::Dependency::
- INDEPENDENTLY_DECODABLE;
- case media::cast::EncodedFrame::Dependency::KEY:
- return openscreen::cast::EncodedFrame::Dependency::KEY_FRAME;
- default:
- NOTREACHED();
- break;
- }
-}
const openscreen::cast::EncodedFrame ToOpenscreenEncodedFrame(
const SenderEncodedFrame& encoded_frame) {
return openscreen::cast::EncodedFrame(
- ToOpenscreenDependency(encoded_frame.dependency), encoded_frame.frame_id,
+ encoded_frame.dependency, encoded_frame.frame_id,
encoded_frame.referenced_frame_id, encoded_frame.rtp_timestamp,
ToOpenscreenTimePoint(encoded_frame.reference_time),
std::chrono::milliseconds(encoded_frame.new_playout_delay_ms),
@@ -79,4 +62,105 @@ const openscreen::cast::EncodedFrame ToOpenscreenEncodedFrame(
encoded_frame.data.size()));
}
+openscreen::cast::AudioCodec ToOpenscreenAudioCodec(media::cast::Codec codec) {
+ switch (codec) {
+ case CODEC_AUDIO_REMOTE:
+ return openscreen::cast::AudioCodec::kNotSpecified;
+ case CODEC_AUDIO_OPUS:
+ return openscreen::cast::AudioCodec::kOpus;
+ case CODEC_AUDIO_AAC:
+ return openscreen::cast::AudioCodec::kAac;
+ default:
+ NOTREACHED();
+ return openscreen::cast::AudioCodec::kNotSpecified;
+ }
+}
+
+openscreen::cast::VideoCodec ToOpenscreenVideoCodec(media::cast::Codec codec) {
+ switch (codec) {
+ case CODEC_VIDEO_REMOTE:
+ return openscreen::cast::VideoCodec::kNotSpecified;
+ case CODEC_VIDEO_VP8:
+ return openscreen::cast::VideoCodec::kVp8;
+ case CODEC_VIDEO_H264:
+ return openscreen::cast::VideoCodec::kH264;
+ case CODEC_VIDEO_VP9:
+ return openscreen::cast::VideoCodec::kVp9;
+ case CODEC_VIDEO_AV1:
+ return openscreen::cast::VideoCodec::kAv1;
+ default:
+ NOTREACHED();
+ return openscreen::cast::VideoCodec::kNotSpecified;
+ }
+}
+media::cast::Codec ToCodec(openscreen::cast::AudioCodec codec) {
+ switch (codec) {
+ case openscreen::cast::AudioCodec::kNotSpecified:
+ return CODEC_AUDIO_REMOTE;
+ case openscreen::cast::AudioCodec::kOpus:
+ return CODEC_AUDIO_OPUS;
+ case openscreen::cast::AudioCodec::kAac:
+ return CODEC_AUDIO_AAC;
+ }
+ NOTREACHED();
+ return CODEC_UNKNOWN;
+}
+
+media::cast::Codec ToCodec(openscreen::cast::VideoCodec codec) {
+ switch (codec) {
+ case openscreen::cast::VideoCodec::kNotSpecified:
+ return CODEC_VIDEO_REMOTE;
+ case openscreen::cast::VideoCodec::kVp8:
+ return CODEC_VIDEO_VP8;
+ case openscreen::cast::VideoCodec::kH264:
+ return CODEC_VIDEO_H264;
+ case openscreen::cast::VideoCodec::kVp9:
+ return CODEC_VIDEO_VP9;
+ case openscreen::cast::VideoCodec::kAv1:
+ return CODEC_VIDEO_AV1;
+ case openscreen::cast::VideoCodec::kHevc:
+ return CODEC_UNKNOWN;
+ }
+ NOTREACHED();
+ return CODEC_UNKNOWN;
+}
+
+openscreen::IPAddress ToOpenscreenIPAddress(const net::IPAddress& address) {
+ const auto version = address.IsIPv6() ? openscreen::IPAddress::Version::kV6
+ : openscreen::IPAddress::Version::kV4;
+ return openscreen::IPAddress(version, address.bytes().data());
+}
+
+openscreen::cast::AudioCaptureConfig ToOpenscreenAudioConfig(
+ const FrameSenderConfig& config) {
+ return openscreen::cast::AudioCaptureConfig{
+ .codec = media::cast::ToOpenscreenAudioCodec(config.codec),
+ .channels = config.channels,
+ .bit_rate = config.max_bitrate,
+ .sample_rate = config.rtp_timebase,
+ .target_playout_delay =
+ std::chrono::milliseconds(config.max_playout_delay.InMilliseconds()),
+ .codec_parameter = std::string()};
+}
+
+openscreen::cast::VideoCaptureConfig ToOpenscreenVideoConfig(
+ const FrameSenderConfig& config) {
+ // Currently we just hardcode 1080P as the resolution.
+ static constexpr openscreen::cast::Resolution kResolutions[] = {{1920, 1080}};
+
+ // NOTE: currently we only support a frame rate of 30FPS, so casting
+ // directly to an integer is fine.
+ return openscreen::cast::VideoCaptureConfig{
+ .codec = media::cast::ToOpenscreenVideoCodec(config.codec),
+ .max_frame_rate =
+ openscreen::SimpleFraction{static_cast<int>(config.max_frame_rate),
+ 1},
+ .max_bit_rate = config.max_bitrate,
+ .resolutions =
+ std::vector(std::begin(kResolutions), std::end(kResolutions)),
+ .target_playout_delay =
+ std::chrono::milliseconds(config.max_playout_delay.InMilliseconds()),
+ .codec_parameter = std::string()};
+}
+
} // namespace media::cast
diff --git a/chromium/media/cast/common/openscreen_conversion_helpers.h b/chromium/media/cast/common/openscreen_conversion_helpers.h
index 3eb3475f3a4..cd14f24313d 100644
--- a/chromium/media/cast/common/openscreen_conversion_helpers.h
+++ b/chromium/media/cast/common/openscreen_conversion_helpers.h
@@ -1,14 +1,21 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_CAST_COMMON_OPENSCREEN_CONVERSION_HELPERS_H_
#define MEDIA_CAST_COMMON_OPENSCREEN_CONVERSION_HELPERS_H_
+#include "media/cast/cast_config.h"
#include "media/cast/common/sender_encoded_frame.h"
+#include "net/base/ip_address.h"
+#include "third_party/openscreen/src/cast/streaming/capture_configs.h"
+#include "third_party/openscreen/src/cast/streaming/constants.h"
+#include "third_party/openscreen/src/cast/streaming/offer_messages.h"
#include "third_party/openscreen/src/cast/streaming/rtp_time.h"
#include "third_party/openscreen/src/cast/streaming/sender.h"
+#include "third_party/openscreen/src/cast/streaming/sender_message.h"
#include "third_party/openscreen/src/platform/api/time.h"
+#include "ui/gfx/geometry/size.h"
// Conversion methods for common Open Screen media cast types. Note that many
// of these types are nearly identical in implementation.
@@ -28,15 +35,21 @@ base::TimeDelta ToTimeDelta(openscreen::cast::RtpTimeTicks rtp_ticks,
int timebase);
base::TimeDelta ToTimeDelta(openscreen::Clock::duration tp);
-// TODO(https://crbug.com/1343116): as part of libcast implementation, we
-// should remove media::cast::EncodedFrame::Dependency in favor of using
-// the openscreen type throughout.
-openscreen::cast::EncodedFrame::Dependency ToOpenscreenDependency(
- media::cast::EncodedFrame::Dependency dependency);
-
const openscreen::cast::EncodedFrame ToOpenscreenEncodedFrame(
const SenderEncodedFrame& encoded_frame);
+openscreen::cast::AudioCodec ToOpenscreenAudioCodec(media::cast::Codec codec);
+openscreen::cast::VideoCodec ToOpenscreenVideoCodec(media::cast::Codec codec);
+media::cast::Codec ToCodec(openscreen::cast::AudioCodec codec);
+media::cast::Codec ToCodec(openscreen::cast::VideoCodec codec);
+
+openscreen::IPAddress ToOpenscreenIPAddress(const net::IPAddress& address);
+
+openscreen::cast::AudioCaptureConfig ToOpenscreenAudioConfig(
+ const FrameSenderConfig& config);
+openscreen::cast::VideoCaptureConfig ToOpenscreenVideoConfig(
+ const FrameSenderConfig& config);
+
} // namespace media::cast
#endif // MEDIA_CAST_COMMON_OPENSCREEN_CONVERSION_HELPERS_H_
diff --git a/chromium/media/cast/common/openscreen_conversion_helpers_unittest.cc b/chromium/media/cast/common/openscreen_conversion_helpers_unittest.cc
index fe61ca7ccf9..014051f2683 100644
--- a/chromium/media/cast/common/openscreen_conversion_helpers_unittest.cc
+++ b/chromium/media/cast/common/openscreen_conversion_helpers_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,7 +22,8 @@ TEST(OpenscreenConversionHelpersTest, EncodedFrameConversions) {
original.lossiness = 0.5f;
original.encode_completion_time =
base::TimeTicks() + base::Milliseconds(1337);
- original.dependency = EncodedFrame::Dependency::INDEPENDENT;
+ original.dependency =
+ openscreen::cast::EncodedFrame::Dependency::kIndependent;
original.frame_id = FrameId::first();
original.rtp_timestamp = ToRtpTimeTicks(base::Seconds(3), 9000);
original.reference_time = base::TimeTicks() + base::Milliseconds(1338);
@@ -31,7 +32,7 @@ TEST(OpenscreenConversionHelpersTest, EncodedFrameConversions) {
const openscreen::cast::EncodedFrame converted =
ToOpenscreenEncodedFrame(original);
- EXPECT_EQ(openscreen::cast::EncodedFrame::Dependency::INDEPENDENTLY_DECODABLE,
+ EXPECT_EQ(openscreen::cast::EncodedFrame::Dependency::kIndependent,
converted.dependency);
EXPECT_EQ(openscreen::cast::FrameId(0), converted.frame_id);
EXPECT_EQ(openscreen::cast::RtpTimeTicks(27000), converted.rtp_timestamp);
diff --git a/chromium/media/cast/common/rtp_time.h b/chromium/media/cast/common/rtp_time.h
index 88beee8dcb9..f790bb8e212 100644
--- a/chromium/media/cast/common/rtp_time.h
+++ b/chromium/media/cast/common/rtp_time.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/sender_encoded_frame.cc b/chromium/media/cast/common/sender_encoded_frame.cc
index 2828f7d553c..2a78530d371 100644
--- a/chromium/media/cast/common/sender_encoded_frame.cc
+++ b/chromium/media/cast/common/sender_encoded_frame.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/sender_encoded_frame.h b/chromium/media/cast/common/sender_encoded_frame.h
index 2f859bda07a..48928ec3ce6 100644
--- a/chromium/media/cast/common/sender_encoded_frame.h
+++ b/chromium/media/cast/common/sender_encoded_frame.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/transport_encryption_handler.cc b/chromium/media/cast/common/transport_encryption_handler.cc
index 9def64c6b4d..7af5b8cfa3e 100644
--- a/chromium/media/cast/common/transport_encryption_handler.cc
+++ b/chromium/media/cast/common/transport_encryption_handler.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/transport_encryption_handler.h b/chromium/media/cast/common/transport_encryption_handler.h
index 6920bcd5fa5..2693ddf4439 100644
--- a/chromium/media/cast/common/transport_encryption_handler.h
+++ b/chromium/media/cast/common/transport_encryption_handler.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/common/video_frame_factory.h b/chromium/media/cast/common/video_frame_factory.h
index b294581eb05..ed61946bd15 100644
--- a/chromium/media/cast/common/video_frame_factory.h
+++ b/chromium/media/cast/common/video_frame_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/constants.h b/chromium/media/cast/constants.h
index 8b1a10df2d4..73b5823a52a 100644
--- a/chromium/media/cast/constants.h
+++ b/chromium/media/cast/constants.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/audio_encoder.cc b/chromium/media/cast/encoding/audio_encoder.cc
index 57c17773a2e..280f59a021d 100644
--- a/chromium/media/cast/encoding/audio_encoder.cc
+++ b/chromium/media/cast/encoding/audio_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,6 +24,7 @@
#include "media/cast/common/rtp_time.h"
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/constants.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
#if !BUILDFLAG(IS_IOS)
#include "third_party/opus/src/include/opus.h"
@@ -89,6 +90,10 @@ class AudioEncoder::ImplBase
base::TimeDelta frame_duration() const { return frame_duration_; }
+ // Returns the current bitrate that the audio encoder is configured to use. If
+ // the encoder doesn't support getting the bitrate, returns 0.
+ virtual int GetBitrate() const { return 0; }
+
void EncodeAudio(std::unique_ptr<AudioBus> audio_bus,
const base::TimeTicks recorded_time) {
DCHECK_EQ(operational_status_, STATUS_INITIALIZED);
@@ -143,7 +148,8 @@ class AudioEncoder::ImplBase
break;
std::unique_ptr<SenderEncodedFrame> audio_frame(new SenderEncodedFrame());
- audio_frame->dependency = EncodedFrame::KEY;
+ audio_frame->dependency =
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame;
audio_frame->frame_id = frame_id_;
audio_frame->referenced_frame_id = frame_id_;
audio_frame->rtp_timestamp = frame_rtp_timestamp_;
@@ -275,6 +281,13 @@ class AudioEncoder::OpusImpl final : public AudioEncoder::ImplBase {
OpusImpl(const OpusImpl&) = delete;
OpusImpl& operator=(const OpusImpl&) = delete;
+ int GetBitrate() const override {
+ int bitrate = 0;
+ CHECK_EQ(opus_encoder_ctl(opus_encoder_.get(), OPUS_GET_BITRATE(&bitrate)),
+ OPUS_OK);
+ return bitrate;
+ }
+
private:
~OpusImpl() final = default;
@@ -798,6 +811,14 @@ base::TimeDelta AudioEncoder::GetFrameDuration() const {
return impl_->frame_duration();
}
+int AudioEncoder::GetBitrate() const {
+ DCHECK_CALLED_ON_VALID_THREAD(insert_thread_checker_);
+ if (InitializationResult() != STATUS_INITIALIZED) {
+ return 0;
+ }
+ return impl_->GetBitrate();
+}
+
void AudioEncoder::InsertAudio(std::unique_ptr<AudioBus> audio_bus,
const base::TimeTicks recorded_time) {
DCHECK_CALLED_ON_VALID_THREAD(insert_thread_checker_);
diff --git a/chromium/media/cast/encoding/audio_encoder.h b/chromium/media/cast/encoding/audio_encoder.h
index 1e6f009c437..738a383446f 100644
--- a/chromium/media/cast/encoding/audio_encoder.h
+++ b/chromium/media/cast/encoding/audio_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -44,7 +44,7 @@ class AudioEncoder {
int GetSamplesPerFrame() const;
base::TimeDelta GetFrameDuration() const;
-
+ int GetBitrate() const;
void InsertAudio(std::unique_ptr<AudioBus> audio_bus,
base::TimeTicks recorded_time);
diff --git a/chromium/media/cast/encoding/audio_encoder_unittest.cc b/chromium/media/cast/encoding/audio_encoder_unittest.cc
index 32802666ad8..b36b4dd4e4b 100644
--- a/chromium/media/cast/encoding/audio_encoder_unittest.cc
+++ b/chromium/media/cast/encoding/audio_encoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,6 +25,7 @@
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/test/utility/audio_utility.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
namespace media {
namespace cast {
@@ -57,7 +58,8 @@ class TestEncodedAudioFrameReceiver {
void FrameEncoded(std::unique_ptr<SenderEncodedFrame> encoded_frame,
int samples_skipped) {
- EXPECT_EQ(encoded_frame->dependency, EncodedFrame::KEY);
+ EXPECT_EQ(encoded_frame->dependency,
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame);
EXPECT_EQ(frames_received_, encoded_frame->frame_id - FrameId::first());
EXPECT_EQ(encoded_frame->frame_id, encoded_frame->referenced_frame_id);
// RTP timestamps should be monotonically increasing and integer multiples
@@ -148,6 +150,18 @@ class AudioEncoderTest : public ::testing::TestWithParam<TestScenario> {
task_runner_->RunTasks();
testing_clock_.Advance(duration);
}
+
+ if (codec == CODEC_AUDIO_OPUS) {
+ const int bitrate = audio_encoder_->GetBitrate();
+ EXPECT_GT(bitrate, 0);
+ // Typically Opus has a max of 120000, but this may change if the
+ // library gets rolled. It would be very surprising for it to
+ // surpass this value and getting a test failure is reasonable.
+ EXPECT_LT(bitrate, 256000);
+ } else {
+ // Bit rate is only implemented for opus.
+ EXPECT_EQ(0, audio_encoder_->GetBitrate());
+ }
}
DVLOG(1) << "Received " << receiver_->frames_received()
diff --git a/chromium/media/cast/encoding/av1_encoder.cc b/chromium/media/cast/encoding/av1_encoder.cc
index 0ce764c3a86..9b82a3e2da0 100644
--- a/chromium/media/cast/encoding/av1_encoder.cc
+++ b/chromium/media/cast/encoding/av1_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/constants.h"
#include "third_party/libaom/source/libaom/aom/aomcx.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
namespace media {
namespace cast {
@@ -191,15 +192,15 @@ void Av1Encoder::Encode(scoped_refptr<media::VideoFrame> video_frame,
aom_image_t aom_image;
aom_image_t* const result = aom_img_wrap(
&aom_image, aom_format, frame_size.width(), frame_size.height(), 1,
- video_frame->data(VideoFrame::kYPlane));
+ video_frame->writable_data(VideoFrame::kYPlane));
DCHECK_EQ(result, &aom_image);
aom_image.planes[AOM_PLANE_Y] =
- video_frame->visible_data(VideoFrame::kYPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kYPlane);
aom_image.planes[AOM_PLANE_U] =
- video_frame->visible_data(VideoFrame::kUPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kUPlane);
aom_image.planes[AOM_PLANE_V] =
- video_frame->visible_data(VideoFrame::kVPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kVPlane);
aom_image.stride[AOM_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane);
aom_image.stride[AOM_PLANE_U] = video_frame->stride(VideoFrame::kUPlane);
aom_image.stride[AOM_PLANE_V] = video_frame->stride(VideoFrame::kVPlane);
@@ -245,10 +246,12 @@ void Av1Encoder::Encode(scoped_refptr<media::VideoFrame> video_frame,
continue;
if (pkt->data.frame.flags & AOM_FRAME_IS_KEY) {
// TODO(hubbe): Replace "dependency" with a "bool is_key_frame".
- encoded_frame->dependency = EncodedFrame::KEY;
+ encoded_frame->dependency =
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame;
encoded_frame->referenced_frame_id = encoded_frame->frame_id;
} else {
- encoded_frame->dependency = EncodedFrame::DEPENDENT;
+ encoded_frame->dependency =
+ openscreen::cast::EncodedFrame::Dependency::kDependent;
// Frame dependencies could theoretically be relaxed by looking for the
// AOM_FRAME_IS_DROPPABLE flag, but in recent testing (Oct 2014), this
// flag never seems to be set.
@@ -297,7 +300,8 @@ void Av1Encoder::Encode(scoped_refptr<media::VideoFrame> video_frame,
<< ", lossiness: " << encoded_frame->lossiness
<< " (quantizer chosen by the encoder was " << quantizer << ')';
- if (encoded_frame->dependency == EncodedFrame::KEY) {
+ if (encoded_frame->dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame) {
key_frame_requested_ = false;
encoding_speed_acc_.Reset(kHighestEncodingSpeed, video_frame->timestamp());
} else {
diff --git a/chromium/media/cast/encoding/av1_encoder.h b/chromium/media/cast/encoding/av1_encoder.h
index 0b175eac15d..00628c2022b 100644
--- a/chromium/media/cast/encoding/av1_encoder.h
+++ b/chromium/media/cast/encoding/av1_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/external_video_encoder.cc b/chromium/media/cast/encoding/external_video_encoder.cc
index e1e1377219f..2d6dfc3c90c 100644
--- a/chromium/media/cast/encoding/external_video_encoder.cc
+++ b/chromium/media/cast/encoding/external_video_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,18 +13,17 @@
#if BUILDFLAG(IS_CHROMEOS)
#include "base/cpu.h" // nogncheck
#include "base/no_destructor.h" // nogncheck
-#include "third_party/re2/src/re2/re2.h" // nogncheck
#endif
#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/shared_memory_mapping.h"
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
@@ -75,26 +74,16 @@ bool IsHardwareVP8EncodingSupported(
base::StringPiece receiver_model_name,
const std::vector<media::VideoEncodeAccelerator::SupportedProfile>&
profiles) {
-#if BUILDFLAG(IS_CHROMEOS)
- // NOTE: the hardware encoder on some Chrome OS devices does not play well
- // with Vizio TVs. See https://crbug.com/1238774 for more information.
- // Vizio uses the TV model string for the receiver model name.
- const char* kVizioRegex =
- R"(^(?i)(([DEMPV]|OLED)\d\d\w*-[A-Z]\w*)|(.*Vizio.*)$)";
-
- if (RE2::FullMatch(re2::StringPiece(receiver_model_name.data(),
- receiver_model_name.size()),
- RE2(kVizioRegex))) {
- return false;
- }
-#endif
-
+// The hardware encoder on ChromeOS has major issues when connecting to a
+// variety of first and third party devices. See https://crbug.com/1382591.
+#if !BUILDFLAG(IS_CHROMEOS)
for (const auto& vea_profile : profiles) {
if (vea_profile.profile >= media::VP8PROFILE_MIN &&
vea_profile.profile <= media::VP8PROFILE_MAX) {
return true;
}
}
+#endif
return false;
} // namespace
@@ -293,22 +282,19 @@ class ExternalVideoEncoder::VEAClientImpl final
video_frame->storage_type() !=
media::VideoFrame::StorageType::STORAGE_SHMEM) {
const int index = free_input_buffer_index_.back();
- std::pair<base::UnsafeSharedMemoryRegion,
- base::WritableSharedMemoryMapping>* input_buffer =
- input_buffers_[index].get();
- DCHECK(input_buffer->first.IsValid());
- DCHECK(input_buffer->second.IsValid());
+ auto& mapped_region = input_buffers_[index];
+ DCHECK(mapped_region.IsValid());
frame = VideoFrame::WrapExternalData(
video_frame->format(), frame_coded_size_, video_frame->visible_rect(),
video_frame->visible_rect().size(),
- input_buffer->second.GetMemoryAsSpan<uint8_t>().data(),
- input_buffer->second.size(), video_frame->timestamp());
+ static_cast<uint8_t*>(mapped_region.mapping.memory()),
+ mapped_region.mapping.size(), video_frame->timestamp());
if (!frame || !media::I420CopyWithPadding(*video_frame, frame.get())) {
LOG(DFATAL) << "Error: ExternalVideoEncoder: copy failed.";
AbortLatestEncodeAttemptDueToErrors();
return;
}
- frame->BackWithSharedMemory(&input_buffer->first);
+ frame->BackWithSharedMemory(&mapped_region.region);
frame->AddDestructionObserver(media::BindToCurrentLoop(base::BindOnce(
&ExternalVideoEncoder::VEAClientImpl::ReturnInputBufferToPool, this,
@@ -340,14 +326,9 @@ class ExternalVideoEncoder::VEAClientImpl final
void AllocateInputBuffer(size_t size) {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
- auto memory = base::UnsafeSharedMemoryRegion::Create(size);
- if (memory.IsValid()) {
- base::WritableSharedMemoryMapping mapping = memory.Map();
- DCHECK(mapping.IsValid());
- input_buffers_.push_back(
- std::make_unique<std::pair<base::UnsafeSharedMemoryRegion,
- base::WritableSharedMemoryMapping>>(
- std::move(memory), std::move(mapping)));
+ auto mapped_region = base::ReadOnlySharedMemoryRegion::Create(size);
+ if (mapped_region.IsValid()) {
+ input_buffers_.push_back(std::move(mapped_region));
free_input_buffer_index_.push_back(input_buffers_.size() - 1);
}
allocate_input_buffer_in_progress_ = false;
@@ -422,7 +403,11 @@ class ExternalVideoEncoder::VEAClientImpl final
auto encoded_frame = std::make_unique<SenderEncodedFrame>();
encoded_frame->dependency =
- metadata.key_frame ? EncodedFrame::KEY : EncodedFrame::DEPENDENT;
+ metadata.key_frame
+ ?
+
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame
+ : openscreen::cast::EncodedFrame::Dependency::kDependent;
encoded_frame->frame_id = next_frame_id_++;
if (metadata.key_frame) {
encoded_frame->referenced_frame_id = encoded_frame->frame_id;
@@ -661,9 +646,7 @@ class ExternalVideoEncoder::VEAClientImpl final
// |max_allowed_input_buffers_|. A VideoFrame wrapping the region will point
// to it, so std::unique_ptr is used to ensure the region has a stable address
// even if the vector grows or shrinks.
- std::vector<std::unique_ptr<std::pair<base::UnsafeSharedMemoryRegion,
- base::WritableSharedMemoryMapping>>>
- input_buffers_;
+ std::vector<base::MappedReadOnlyRegion> input_buffers_;
// Available input buffer index. These buffers are used in FILO order.
std::vector<int> free_input_buffer_index_;
diff --git a/chromium/media/cast/encoding/external_video_encoder.h b/chromium/media/cast/encoding/external_video_encoder.h
index 4f81e16d4a4..19fd9b834ef 100644
--- a/chromium/media/cast/encoding/external_video_encoder.h
+++ b/chromium/media/cast/encoding/external_video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/external_video_encoder_unittest.cc b/chromium/media/cast/encoding/external_video_encoder_unittest.cc
index 7a9ad3873a2..3f5070c9708 100644
--- a/chromium/media/cast/encoding/external_video_encoder_unittest.cc
+++ b/chromium/media/cast/encoding/external_video_encoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,7 +24,7 @@ scoped_refptr<VideoFrame> CreateFrame(const uint8_t* y_plane_data,
scoped_refptr<VideoFrame> result = VideoFrame::CreateFrame(
PIXEL_FORMAT_I420, size, gfx::Rect(size), size, base::TimeDelta());
for (int y = 0, y_end = size.height(); y < y_end; ++y) {
- memcpy(result->visible_data(VideoFrame::kYPlane) +
+ memcpy(result->GetWritableVisibleData(VideoFrame::kYPlane) +
y * result->stride(VideoFrame::kYPlane),
y_plane_data + y * size.width(), size.width());
}
@@ -114,10 +114,21 @@ TEST(ExternalVideoEncoderTest,
}
TEST(ExternalVideoEncoderTest, RecommendsExternalVp8EncoderForChromecast) {
+#if BUILDFLAG(IS_CHROMEOS)
+ EXPECT_FALSE(ExternalVideoEncoder::IsRecommended(
+ CODEC_VIDEO_VP8, "Eureka Dongle", kValidVeaProfiles));
+ EXPECT_FALSE(ExternalVideoEncoder::IsRecommended(
+ CODEC_VIDEO_VP8, "Chromecast", kValidVeaProfiles));
+ EXPECT_FALSE(ExternalVideoEncoder::IsRecommended(
+ CODEC_VIDEO_VP8, "Chromecast Ultra", kValidVeaProfiles));
+ EXPECT_FALSE(ExternalVideoEncoder::IsRecommended(
+ CODEC_VIDEO_VP8, "Google Home", kValidVeaProfiles));
+#else
for (const char* model_name : kFirstPartyModelNames) {
EXPECT_TRUE(ExternalVideoEncoder::IsRecommended(
CODEC_VIDEO_VP8, std::string(model_name), kValidVeaProfiles));
}
+#endif
}
TEST(ExternalVideoEncoderTest, RecommendsH264HardwareEncoderProperly) {
diff --git a/chromium/media/cast/encoding/fake_software_video_encoder.cc b/chromium/media/cast/encoding/fake_software_video_encoder.cc
index ef7219e249e..1b7de3c8b80 100644
--- a/chromium/media/cast/encoding/fake_software_video_encoder.cc
+++ b/chromium/media/cast/encoding/fake_software_video_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,6 +15,9 @@
#include "media/cast/common/rtp_time.h"
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/constants.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
+
+using Dependency = openscreen::cast::EncodedFrame::Dependency;
namespace media {
namespace cast {
@@ -45,11 +48,11 @@ void FakeSoftwareVideoEncoder::Encode(
encoded_frame->frame_id = frame_id_++;
if (next_frame_is_key_) {
- encoded_frame->dependency = EncodedFrame::KEY;
+ encoded_frame->dependency = Dependency::kKeyFrame;
encoded_frame->referenced_frame_id = encoded_frame->frame_id;
next_frame_is_key_ = false;
} else {
- encoded_frame->dependency = EncodedFrame::DEPENDENT;
+ encoded_frame->dependency = Dependency::kDependent;
encoded_frame->referenced_frame_id = encoded_frame->frame_id - 1;
}
encoded_frame->rtp_timestamp =
@@ -57,7 +60,7 @@ void FakeSoftwareVideoEncoder::Encode(
encoded_frame->reference_time = reference_time;
base::Value values(base::Value::Type::DICTIONARY);
- values.SetBoolKey("key", encoded_frame->dependency == EncodedFrame::KEY);
+ values.SetBoolKey("key", encoded_frame->dependency == Dependency::kKeyFrame);
values.SetIntKey("ref", encoded_frame->referenced_frame_id.lower_32_bits());
values.SetIntKey("id", encoded_frame->frame_id.lower_32_bits());
values.SetIntKey("size", frame_size_);
@@ -65,7 +68,7 @@ void FakeSoftwareVideoEncoder::Encode(
encoded_frame->data.resize(
std::max<size_t>(encoded_frame->data.size(), frame_size_), ' ');
- if (encoded_frame->dependency == EncodedFrame::KEY) {
+ if (encoded_frame->dependency == Dependency::kKeyFrame) {
encoded_frame->encoder_utilization = 1.0;
encoded_frame->lossiness = 6.0;
} else {
diff --git a/chromium/media/cast/encoding/fake_software_video_encoder.h b/chromium/media/cast/encoding/fake_software_video_encoder.h
index c1c26c06bdf..e7572276ebf 100644
--- a/chromium/media/cast/encoding/fake_software_video_encoder.h
+++ b/chromium/media/cast/encoding/fake_software_video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/h264_vt_encoder.cc b/chromium/media/cast/encoding/h264_vt_encoder.cc
index 3e7b84f1eb9..6d0621594b5 100644
--- a/chromium/media/cast/encoding/h264_vt_encoder.cc
+++ b/chromium/media/cast/encoding/h264_vt_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -26,6 +26,9 @@
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/common/video_frame_factory.h"
#include "media/cast/constants.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
+
+using Dependency = openscreen::cast::EncodedFrame::Dependency;
namespace media {
namespace cast {
@@ -377,7 +380,7 @@ bool H264VideoToolboxEncoder::EncodeVideoFrame(
// compression session's pixel buffer pool. This will eliminate a copy of the
// frame into memory visible by the hardware encoder. The VideoFrame's
// lifetime is extended for the lifetime of the returned CVPixelBuffer.
- auto pixel_buffer = media::WrapVideoFrameInCVPixelBuffer(*video_frame);
+ auto pixel_buffer = media::WrapVideoFrameInCVPixelBuffer(video_frame);
if (!pixel_buffer) {
DLOG(ERROR) << "WrapVideoFrameInCVPixelBuffer failed.";
return false;
@@ -531,10 +534,10 @@ void H264VideoToolboxEncoder::CompressionCallback(void* encoder_opaque,
encoded_frame->reference_time = request->reference_time;
encoded_frame->rtp_timestamp = request->rtp_timestamp;
if (is_keyframe) {
- encoded_frame->dependency = EncodedFrame::KEY;
+ encoded_frame->dependency = Dependency::kKeyFrame;
encoded_frame->referenced_frame_id = frame_id;
} else {
- encoded_frame->dependency = EncodedFrame::DEPENDENT;
+ encoded_frame->dependency = Dependency::kDependent;
// H.264 supports complex frame reference schemes (multiple reference
// frames, slice references, backward and forward references, etc). Cast
// doesn't support the concept of forward-referencing frame dependencies or
diff --git a/chromium/media/cast/encoding/h264_vt_encoder.h b/chromium/media/cast/encoding/h264_vt_encoder.h
index aa05756f77f..08c7f5471b3 100644
--- a/chromium/media/cast/encoding/h264_vt_encoder.h
+++ b/chromium/media/cast/encoding/h264_vt_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/h264_vt_encoder_unittest.cc b/chromium/media/cast/encoding/h264_vt_encoder_unittest.cc
index f7b42b59ba4..8e08af08b61 100644
--- a/chromium/media/cast/encoding/h264_vt_encoder_unittest.cc
+++ b/chromium/media/cast/encoding/h264_vt_encoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -36,6 +36,8 @@
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
+using Dependency = openscreen::cast::EncodedFrame::Dependency;
+
namespace {
const int kVideoWidth = 1280;
@@ -96,9 +98,9 @@ class MetadataRecorder : public base::RefCountedThreadSafe<MetadataRecorder> {
auto e = expectations_.front();
expectations_.pop();
if (e.expected_frame_id != e.expected_last_referenced_frame_id) {
- EXPECT_EQ(EncodedFrame::DEPENDENT, encoded_frame->dependency);
+ EXPECT_EQ(Dependency::kDependent, encoded_frame->dependency);
} else {
- EXPECT_EQ(EncodedFrame::KEY, encoded_frame->dependency);
+ EXPECT_EQ(Dependency::kKeyFrame, encoded_frame->dependency);
}
EXPECT_EQ(e.expected_frame_id, encoded_frame->frame_id);
EXPECT_EQ(e.expected_last_referenced_frame_id,
diff --git a/chromium/media/cast/encoding/size_adaptable_video_encoder_base.cc b/chromium/media/cast/encoding/size_adaptable_video_encoder_base.cc
index 40234d9351b..0f05aef5e7e 100644
--- a/chromium/media/cast/encoding/size_adaptable_video_encoder_base.cc
+++ b/chromium/media/cast/encoding/size_adaptable_video_encoder_base.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/size_adaptable_video_encoder_base.h b/chromium/media/cast/encoding/size_adaptable_video_encoder_base.h
index 3e7543c1af5..9546991836c 100644
--- a/chromium/media/cast/encoding/size_adaptable_video_encoder_base.h
+++ b/chromium/media/cast/encoding/size_adaptable_video_encoder_base.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/software_video_encoder.h b/chromium/media/cast/encoding/software_video_encoder.h
index e2232b3722d..ded51d7b1b7 100644
--- a/chromium/media/cast/encoding/software_video_encoder.h
+++ b/chromium/media/cast/encoding/software_video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/video_encoder.cc b/chromium/media/cast/encoding/video_encoder.cc
index 24e2de942cf..71d05fd7b45 100644
--- a/chromium/media/cast/encoding/video_encoder.cc
+++ b/chromium/media/cast/encoding/video_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/video_encoder.h b/chromium/media/cast/encoding/video_encoder.h
index 57c13c629ae..8e1fec041d6 100644
--- a/chromium/media/cast/encoding/video_encoder.h
+++ b/chromium/media/cast/encoding/video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/video_encoder_impl.cc b/chromium/media/cast/encoding/video_encoder_impl.cc
index 4c3b3bf8912..5a4f6859cdb 100644
--- a/chromium/media/cast/encoding/video_encoder_impl.cc
+++ b/chromium/media/cast/encoding/video_encoder_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/video_encoder_impl.h b/chromium/media/cast/encoding/video_encoder_impl.h
index 2e5563e154f..f4a9b123f1c 100644
--- a/chromium/media/cast/encoding/video_encoder_impl.h
+++ b/chromium/media/cast/encoding/video_encoder_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/video_encoder_unittest.cc b/chromium/media/cast/encoding/video_encoder_unittest.cc
index 41e681334ca..3b5e9833272 100644
--- a/chromium/media/cast/encoding/video_encoder_unittest.cc
+++ b/chromium/media/cast/encoding/video_encoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -29,6 +29,7 @@
#include "media/cast/test/utility/default_config.h"
#include "media/cast/test/utility/video_utility.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
#if BUILDFLAG(IS_MAC)
#include "base/threading/platform_thread.h"
@@ -295,11 +296,13 @@ TEST_P(VideoEncoderTest, EncodesVariedFrameSizes) {
continue;
}
- if (encoded_frame->dependency == EncodedFrame::KEY) {
+ if (encoded_frame->dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame) {
EXPECT_EQ(encoded_frame->frame_id, encoded_frame->referenced_frame_id);
last_key_frame_id = encoded_frame->frame_id;
} else {
- EXPECT_EQ(EncodedFrame::DEPENDENT, encoded_frame->dependency);
+ EXPECT_EQ(openscreen::cast::EncodedFrame::Dependency::kDependent,
+ encoded_frame->dependency);
EXPECT_GT(encoded_frame->frame_id, encoded_frame->referenced_frame_id);
// There must always be a KEY frame before any DEPENDENT ones.
ASSERT_FALSE(last_key_frame_id.is_null());
diff --git a/chromium/media/cast/encoding/vpx_encoder.cc b/chromium/media/cast/encoding/vpx_encoder.cc
index 0ad738f47c5..2de5bd6c728 100644
--- a/chromium/media/cast/encoding/vpx_encoder.cc
+++ b/chromium/media/cast/encoding/vpx_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,9 @@
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/constants.h"
#include "third_party/libvpx/source/libvpx/vpx/vp8cx.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
+
+using Dependency = openscreen::cast::EncodedFrame::Dependency;
namespace media {
namespace cast {
@@ -212,27 +215,27 @@ void VpxEncoder::Encode(scoped_refptr<media::VideoFrame> video_frame,
vpx_image_t vpx_image;
vpx_image_t* const result = vpx_img_wrap(
&vpx_image, vpx_format, frame_size.width(), frame_size.height(), 1,
- video_frame->data(VideoFrame::kYPlane));
+ video_frame->writable_data(VideoFrame::kYPlane));
DCHECK_EQ(result, &vpx_image);
switch (vpx_format) {
case VPX_IMG_FMT_I420:
vpx_image.planes[VPX_PLANE_Y] =
- video_frame->visible_data(VideoFrame::kYPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kYPlane);
vpx_image.planes[VPX_PLANE_U] =
- video_frame->visible_data(VideoFrame::kUPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kUPlane);
vpx_image.planes[VPX_PLANE_V] =
- video_frame->visible_data(VideoFrame::kVPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kVPlane);
vpx_image.stride[VPX_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane);
vpx_image.stride[VPX_PLANE_U] = video_frame->stride(VideoFrame::kUPlane);
vpx_image.stride[VPX_PLANE_V] = video_frame->stride(VideoFrame::kVPlane);
break;
case VPX_IMG_FMT_NV12:
vpx_image.planes[VPX_PLANE_Y] =
- video_frame->visible_data(VideoFrame::kYPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kYPlane);
// In libvpx, the UV plane of NV12 frames is represented by two planes
// with the same stride, shifted by one byte.
vpx_image.planes[VPX_PLANE_U] =
- video_frame->visible_data(VideoFrame::kUVPlane);
+ video_frame->GetWritableVisibleData(VideoFrame::kUVPlane);
vpx_image.planes[VPX_PLANE_V] = vpx_image.planes[VPX_PLANE_U] + 1;
vpx_image.stride[VPX_PLANE_Y] = video_frame->stride(VideoFrame::kYPlane);
vpx_image.stride[VPX_PLANE_U] = video_frame->stride(VideoFrame::kUVPlane);
@@ -285,10 +288,10 @@ void VpxEncoder::Encode(scoped_refptr<media::VideoFrame> video_frame,
continue;
if (pkt->data.frame.flags & VPX_FRAME_IS_KEY) {
// TODO(hubbe): Replace "dependency" with a "bool is_key_frame".
- encoded_frame->dependency = EncodedFrame::KEY;
+ encoded_frame->dependency = Dependency::kKeyFrame;
encoded_frame->referenced_frame_id = encoded_frame->frame_id;
} else {
- encoded_frame->dependency = EncodedFrame::DEPENDENT;
+ encoded_frame->dependency = Dependency::kDependent;
// Frame dependencies could theoretically be relaxed by looking for the
// VPX_FRAME_IS_DROPPABLE flag, but in recent testing (Oct 2014), this
// flag never seems to be set.
@@ -338,10 +341,10 @@ void VpxEncoder::Encode(scoped_refptr<media::VideoFrame> video_frame,
<< ", lossiness: " << encoded_frame->lossiness
<< " (quantizer chosen by the encoder was " << quantizer << ')';
- if (encoded_frame->dependency == EncodedFrame::KEY) {
+ if (encoded_frame->dependency == Dependency::kKeyFrame) {
key_frame_requested_ = false;
}
- if (encoded_frame->dependency == EncodedFrame::KEY) {
+ if (encoded_frame->dependency == Dependency::kKeyFrame) {
encoding_speed_acc_.Reset(kHighestEncodingSpeed, video_frame->timestamp());
} else {
// Equivalent encoding speed considering both cpu_used setting and
diff --git a/chromium/media/cast/encoding/vpx_encoder.h b/chromium/media/cast/encoding/vpx_encoder.h
index 514c1bdd996..563bdbf8426 100644
--- a/chromium/media/cast/encoding/vpx_encoder.h
+++ b/chromium/media/cast/encoding/vpx_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/vpx_quantizer_parser.cc b/chromium/media/cast/encoding/vpx_quantizer_parser.cc
index 8ace8b1a1e4..e133b7771b4 100644
--- a/chromium/media/cast/encoding/vpx_quantizer_parser.cc
+++ b/chromium/media/cast/encoding/vpx_quantizer_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/vpx_quantizer_parser.h b/chromium/media/cast/encoding/vpx_quantizer_parser.h
index 901f758c98a..0add62d0509 100644
--- a/chromium/media/cast/encoding/vpx_quantizer_parser.h
+++ b/chromium/media/cast/encoding/vpx_quantizer_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/encoding/vpx_quantizer_parser_unittest.cc b/chromium/media/cast/encoding/vpx_quantizer_parser_unittest.cc
index b154e455b3f..e8accbb0837 100644
--- a/chromium/media/cast/encoding/vpx_quantizer_parser_unittest.cc
+++ b/chromium/media/cast/encoding/vpx_quantizer_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,6 +16,7 @@
#include "media/cast/test/utility/default_config.h"
#include "media/cast/test/utility/video_utility.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
namespace media {
namespace cast {
@@ -104,7 +105,8 @@ TEST_F(VpxQuantizerParserTest, InsufficientData) {
unsigned int first_partition_size =
(encoded_data[0] | (encoded_data[1] << 8) | (encoded_data[2] << 16)) >>
5;
- if (encoded_frame->dependency == EncodedFrame::KEY) {
+ if (encoded_frame->dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame) {
// Ten bytes should not be enough to decode the quanitizer value
// for a Key frame.
decoded_quantizer = ParseVpxHeaderQuantizer(encoded_data, 10);
diff --git a/chromium/media/cast/logging/encoding_event_subscriber.cc b/chromium/media/cast/logging/encoding_event_subscriber.cc
index 9a8905d402d..3c0e868e567 100644
--- a/chromium/media/cast/logging/encoding_event_subscriber.cc
+++ b/chromium/media/cast/logging/encoding_event_subscriber.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/encoding_event_subscriber.h b/chromium/media/cast/logging/encoding_event_subscriber.h
index 88bc1e58d92..48eb8c667b0 100644
--- a/chromium/media/cast/logging/encoding_event_subscriber.h
+++ b/chromium/media/cast/logging/encoding_event_subscriber.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/encoding_event_subscriber_unittest.cc b/chromium/media/cast/logging/encoding_event_subscriber_unittest.cc
index 62bd46881e1..48d2e8030f6 100644
--- a/chromium/media/cast/logging/encoding_event_subscriber_unittest.cc
+++ b/chromium/media/cast/logging/encoding_event_subscriber_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/log_event_dispatcher.cc b/chromium/media/cast/logging/log_event_dispatcher.cc
index 554685ebaf3..418b55f74ae 100644
--- a/chromium/media/cast/logging/log_event_dispatcher.cc
+++ b/chromium/media/cast/logging/log_event_dispatcher.cc
@@ -1,15 +1,16 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/cast/logging/log_event_dispatcher.h"
-#include <algorithm>
#include <utility>
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/containers/contains.h"
#include "base/location.h"
+#include "base/ranges/algorithm.h"
#include "base/synchronization/waitable_event.h"
#include "media/cast/cast_environment.h"
@@ -125,14 +126,12 @@ void LogEventDispatcher::Impl::DispatchBatchOfEvents(
}
void LogEventDispatcher::Impl::Subscribe(RawEventSubscriber* subscriber) {
- DCHECK(std::find(subscribers_.begin(), subscribers_.end(), subscriber) ==
- subscribers_.end());
+ DCHECK(!base::Contains(subscribers_, subscriber));
subscribers_.push_back(subscriber);
}
void LogEventDispatcher::Impl::Unsubscribe(RawEventSubscriber* subscriber) {
- const auto it =
- std::find(subscribers_.begin(), subscribers_.end(), subscriber);
+ const auto it = base::ranges::find(subscribers_, subscriber);
DCHECK(it != subscribers_.end());
subscribers_.erase(it);
}
diff --git a/chromium/media/cast/logging/log_event_dispatcher.h b/chromium/media/cast/logging/log_event_dispatcher.h
index c6b499da7ca..812628d805f 100644
--- a/chromium/media/cast/logging/log_event_dispatcher.h
+++ b/chromium/media/cast/logging/log_event_dispatcher.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/logging_defines.cc b/chromium/media/cast/logging/logging_defines.cc
index b492c0a18ac..ce475f848fc 100644
--- a/chromium/media/cast/logging/logging_defines.cc
+++ b/chromium/media/cast/logging/logging_defines.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/logging_defines.h b/chromium/media/cast/logging/logging_defines.h
index aa73cfd6bdf..b61bbf17673 100644
--- a/chromium/media/cast/logging/logging_defines.h
+++ b/chromium/media/cast/logging/logging_defines.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/proto/proto_utils.cc b/chromium/media/cast/logging/proto/proto_utils.cc
index 63eb55717d0..c3b2c2fde6e 100644
--- a/chromium/media/cast/logging/proto/proto_utils.cc
+++ b/chromium/media/cast/logging/proto/proto_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/proto/proto_utils.h b/chromium/media/cast/logging/proto/proto_utils.h
index 51232fdb964..bff8541fd1e 100644
--- a/chromium/media/cast/logging/proto/proto_utils.h
+++ b/chromium/media/cast/logging/proto/proto_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/proto/raw_events.proto b/chromium/media/cast/logging/proto/raw_events.proto
index 34639986998..e6f98a3a73b 100644
--- a/chromium/media/cast/logging/proto/raw_events.proto
+++ b/chromium/media/cast/logging/proto/raw_events.proto
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/raw_event_subscriber.h b/chromium/media/cast/logging/raw_event_subscriber.h
index b8ebe8c0cde..f048b6b1edb 100644
--- a/chromium/media/cast/logging/raw_event_subscriber.h
+++ b/chromium/media/cast/logging/raw_event_subscriber.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/raw_event_subscriber_bundle.cc b/chromium/media/cast/logging/raw_event_subscriber_bundle.cc
index 319f3686274..5459bfae810 100644
--- a/chromium/media/cast/logging/raw_event_subscriber_bundle.cc
+++ b/chromium/media/cast/logging/raw_event_subscriber_bundle.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/raw_event_subscriber_bundle.h b/chromium/media/cast/logging/raw_event_subscriber_bundle.h
index 7f6bcbe8be2..8aa948bbd6a 100644
--- a/chromium/media/cast/logging/raw_event_subscriber_bundle.h
+++ b/chromium/media/cast/logging/raw_event_subscriber_bundle.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/receiver_time_offset_estimator.h b/chromium/media/cast/logging/receiver_time_offset_estimator.h
index 6fb5f677699..babe2ea7df5 100644
--- a/chromium/media/cast/logging/receiver_time_offset_estimator.h
+++ b/chromium/media/cast/logging/receiver_time_offset_estimator.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/receiver_time_offset_estimator_impl.cc b/chromium/media/cast/logging/receiver_time_offset_estimator_impl.cc
index b401ead8d9d..3af9deea420 100644
--- a/chromium/media/cast/logging/receiver_time_offset_estimator_impl.cc
+++ b/chromium/media/cast/logging/receiver_time_offset_estimator_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/receiver_time_offset_estimator_impl.h b/chromium/media/cast/logging/receiver_time_offset_estimator_impl.h
index cbc0ed87620..b592d34f713 100644
--- a/chromium/media/cast/logging/receiver_time_offset_estimator_impl.h
+++ b/chromium/media/cast/logging/receiver_time_offset_estimator_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc b/chromium/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
index 12e9f5f643e..a222a815aa4 100644
--- a/chromium/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
+++ b/chromium/media/cast/logging/receiver_time_offset_estimator_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/simple_event_subscriber.cc b/chromium/media/cast/logging/simple_event_subscriber.cc
index 86901a82e4a..01d5a50cb98 100644
--- a/chromium/media/cast/logging/simple_event_subscriber.cc
+++ b/chromium/media/cast/logging/simple_event_subscriber.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/simple_event_subscriber.h b/chromium/media/cast/logging/simple_event_subscriber.h
index 71a364cd4f7..fc68ffcd5bb 100644
--- a/chromium/media/cast/logging/simple_event_subscriber.h
+++ b/chromium/media/cast/logging/simple_event_subscriber.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/simple_event_subscriber_unittest.cc b/chromium/media/cast/logging/simple_event_subscriber_unittest.cc
index a637b968289..8d832fbd2fb 100644
--- a/chromium/media/cast/logging/simple_event_subscriber_unittest.cc
+++ b/chromium/media/cast/logging/simple_event_subscriber_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/stats_event_subscriber.cc b/chromium/media/cast/logging/stats_event_subscriber.cc
index b58892218ba..3a6dd99dfad 100644
--- a/chromium/media/cast/logging/stats_event_subscriber.cc
+++ b/chromium/media/cast/logging/stats_event_subscriber.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/stats_event_subscriber.h b/chromium/media/cast/logging/stats_event_subscriber.h
index 89300f91688..fd095b35713 100644
--- a/chromium/media/cast/logging/stats_event_subscriber.h
+++ b/chromium/media/cast/logging/stats_event_subscriber.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/logging/stats_event_subscriber_unittest.cc b/chromium/media/cast/logging/stats_event_subscriber_unittest.cc
index c37424b5639..0e54de98fff 100644
--- a/chromium/media/cast/logging/stats_event_subscriber_unittest.cc
+++ b/chromium/media/cast/logging/stats_event_subscriber_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/cast_transport.h b/chromium/media/cast/net/cast_transport.h
index 9ee9e8b7ede..8a912d6f362 100644
--- a/chromium/media/cast/net/cast_transport.h
+++ b/chromium/media/cast/net/cast_transport.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/cast_transport_config.cc b/chromium/media/cast/net/cast_transport_config.cc
index 6351977d47f..8057300a6b9 100644
--- a/chromium/media/cast/net/cast_transport_config.cc
+++ b/chromium/media/cast/net/cast_transport_config.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/cast_transport_config.h b/chromium/media/cast/net/cast_transport_config.h
index f8907caa7d0..998609224df 100644
--- a/chromium/media/cast/net/cast_transport_config.h
+++ b/chromium/media/cast/net/cast_transport_config.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/cast_transport_defines.h b/chromium/media/cast/net/cast_transport_defines.h
index fee8f57cc13..6e83e27a14a 100644
--- a/chromium/media/cast/net/cast_transport_defines.h
+++ b/chromium/media/cast/net/cast_transport_defines.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/cast_transport_impl.cc b/chromium/media/cast/net/cast_transport_impl.cc
index ef2365e63e8..70136aade9b 100644
--- a/chromium/media/cast/net/cast_transport_impl.cc
+++ b/chromium/media/cast/net/cast_transport_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/cast_transport_impl.h b/chromium/media/cast/net/cast_transport_impl.h
index 60531d837c8..5e5a038bd10 100644
--- a/chromium/media/cast/net/cast_transport_impl.h
+++ b/chromium/media/cast/net/cast_transport_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/cast_transport_impl_unittest.cc b/chromium/media/cast/net/cast_transport_impl_unittest.cc
index 7b02748a637..6e9df49d2db 100644
--- a/chromium/media/cast/net/cast_transport_impl_unittest.cc
+++ b/chromium/media/cast/net/cast_transport_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,6 +22,9 @@
#include "media/cast/net/cast_transport_config.h"
#include "media/cast/net/rtcp/rtcp_defines.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
+
+using Dependency = openscreen::cast::EncodedFrame::Dependency;
namespace media {
namespace cast {
@@ -211,7 +214,7 @@ TEST_F(CastTransportImplTest, NacksCancelRetransmits) {
fake_frame.frame_id = FrameId::first() + 1;
fake_frame.referenced_frame_id = FrameId::first() + 1;
fake_frame.rtp_timestamp = RtpTimeTicks().Expand(UINT32_C(1));
- fake_frame.dependency = EncodedFrame::KEY;
+ fake_frame.dependency = Dependency::kKeyFrame;
fake_frame.data.resize(5000, ' ');
transport_sender_->InsertFrame(kVideoSsrc, fake_frame);
@@ -259,7 +262,7 @@ TEST_F(CastTransportImplTest, CancelRetransmits) {
fake_frame.frame_id = FrameId::first() + 1;
fake_frame.referenced_frame_id = FrameId::first() + 1;
fake_frame.rtp_timestamp = RtpTimeTicks().Expand(UINT32_C(1));
- fake_frame.dependency = EncodedFrame::KEY;
+ fake_frame.dependency = Dependency::kKeyFrame;
fake_frame.data.resize(5000, ' ');
transport_sender_->InsertFrame(kVideoSsrc, fake_frame);
@@ -302,7 +305,7 @@ TEST_F(CastTransportImplTest, Kickstart) {
fake_frame.frame_id = FrameId::first() + 1;
fake_frame.referenced_frame_id = FrameId::first() + 1;
fake_frame.rtp_timestamp = RtpTimeTicks().Expand(UINT32_C(1));
- fake_frame.dependency = EncodedFrame::KEY;
+ fake_frame.dependency = Dependency::kKeyFrame;
fake_frame.data.resize(5000, ' ');
transport_->SetPaused(true);
@@ -345,7 +348,7 @@ TEST_F(CastTransportImplTest, DedupRetransmissionWithAudio) {
fake_audio.frame_id = FrameId::first() + 1;
fake_audio.referenced_frame_id = FrameId::first() + 1;
fake_audio.reference_time = testing_clock_.NowTicks();
- fake_audio.dependency = EncodedFrame::KEY;
+ fake_audio.dependency = Dependency::kKeyFrame;
fake_audio.data.resize(100, ' ');
transport_sender_->InsertFrame(kAudioSsrc, fake_audio);
task_runner_->Sleep(base::Milliseconds(2));
@@ -368,7 +371,7 @@ TEST_F(CastTransportImplTest, DedupRetransmissionWithAudio) {
EncodedFrame fake_video;
fake_video.frame_id = FrameId::first() + 1;
fake_video.referenced_frame_id = FrameId::first() + 1;
- fake_video.dependency = EncodedFrame::KEY;
+ fake_video.dependency = Dependency::kKeyFrame;
fake_video.data.resize(5000, ' ');
transport_sender_->InsertFrame(kVideoSsrc, fake_video);
task_runner_->RunTasks();
diff --git a/chromium/media/cast/net/pacing/paced_sender.cc b/chromium/media/cast/net/pacing/paced_sender.cc
index 536c17e4f0d..63f698493c1 100644
--- a/chromium/media/cast/net/pacing/paced_sender.cc
+++ b/chromium/media/cast/net/pacing/paced_sender.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "base/big_endian.h"
#include "base/bind.h"
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
@@ -299,8 +300,7 @@ PacketRef PacedSender::PopNextPacket(PacketType* packet_type,
}
bool PacedSender::IsHighPriority(const PacketKey& packet_key) const {
- return std::find(priority_ssrcs_.begin(), priority_ssrcs_.end(),
- packet_key.ssrc) != priority_ssrcs_.end();
+ return base::Contains(priority_ssrcs_, packet_key.ssrc);
}
bool PacedSender::empty() const {
diff --git a/chromium/media/cast/net/pacing/paced_sender.h b/chromium/media/cast/net/pacing/paced_sender.h
index 5c2ecaf8f14..60bdf025aad 100644
--- a/chromium/media/cast/net/pacing/paced_sender.h
+++ b/chromium/media/cast/net/pacing/paced_sender.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/pacing/paced_sender_unittest.cc b/chromium/media/cast/net/pacing/paced_sender_unittest.cc
index fbfa0e74fc4..34f5951511c 100644
--- a/chromium/media/cast/net/pacing/paced_sender_unittest.cc
+++ b/chromium/media/cast/net/pacing/paced_sender_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc b/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc
index 1e7a800d162..b1849e0e9d8 100644
--- a/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc
+++ b/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h b/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h
index dc65e0b0ab0..f697ad106f3 100644
--- a/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h
+++ b/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc b/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc
index dfc4cbe5d93..7c8399dde03 100644
--- a/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc
+++ b/chromium/media/cast/net/rtcp/receiver_rtcp_event_subscriber_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/receiver_rtcp_session.cc b/chromium/media/cast/net/rtcp/receiver_rtcp_session.cc
index 1d526814846..fed1ac5a134 100644
--- a/chromium/media/cast/net/rtcp/receiver_rtcp_session.cc
+++ b/chromium/media/cast/net/rtcp/receiver_rtcp_session.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/receiver_rtcp_session.h b/chromium/media/cast/net/rtcp/receiver_rtcp_session.h
index 1e9e8493751..41a63cb0287 100644
--- a/chromium/media/cast/net/rtcp/receiver_rtcp_session.h
+++ b/chromium/media/cast/net/rtcp/receiver_rtcp_session.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/rtcp_builder.cc b/chromium/media/cast/net/rtcp/rtcp_builder.cc
index 8c3995596e7..0abe4ea4320 100644
--- a/chromium/media/cast/net/rtcp/rtcp_builder.cc
+++ b/chromium/media/cast/net/rtcp/rtcp_builder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -115,7 +115,7 @@ class NackStringBuilder {
} // namespace
RtcpBuilder::RtcpBuilder(uint32_t sending_ssrc)
- : writer_(nullptr, 0), local_ssrc_(sending_ssrc), ptr_of_length_(nullptr) {}
+ : local_ssrc_(sending_ssrc), ptr_of_length_(nullptr), writer_(nullptr, 0) {}
RtcpBuilder::~RtcpBuilder() = default;
diff --git a/chromium/media/cast/net/rtcp/rtcp_builder.h b/chromium/media/cast/net/rtcp/rtcp_builder.h
index 8c08c8e591f..db8bc642fc9 100644
--- a/chromium/media/cast/net/rtcp/rtcp_builder.h
+++ b/chromium/media/cast/net/rtcp/rtcp_builder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -52,10 +52,10 @@ class RtcpBuilder {
RtcpReceiverLogMessage* receiver_log_message,
size_t* total_number_of_messages_to_send);
- base::BigEndianWriter writer_;
const uint32_t local_ssrc_;
raw_ptr<char> ptr_of_length_;
PacketRef packet_;
+ base::BigEndianWriter writer_;
};
} // namespace cast
diff --git a/chromium/media/cast/net/rtcp/rtcp_builder_unittest.cc b/chromium/media/cast/net/rtcp/rtcp_builder_unittest.cc
index 3ec935cf2b3..a03f09edc3d 100644
--- a/chromium/media/cast/net/rtcp/rtcp_builder_unittest.cc
+++ b/chromium/media/cast/net/rtcp/rtcp_builder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/rtcp_defines.cc b/chromium/media/cast/net/rtcp/rtcp_defines.cc
index 6554f0d4deb..814ab7cfa6b 100644
--- a/chromium/media/cast/net/rtcp/rtcp_defines.cc
+++ b/chromium/media/cast/net/rtcp/rtcp_defines.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/rtcp_defines.h b/chromium/media/cast/net/rtcp/rtcp_defines.h
index 160811d89f0..76dfc4045cb 100644
--- a/chromium/media/cast/net/rtcp/rtcp_defines.h
+++ b/chromium/media/cast/net/rtcp/rtcp_defines.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/rtcp_session.h b/chromium/media/cast/net/rtcp/rtcp_session.h
index 01528338336..07e8a199a56 100644
--- a/chromium/media/cast/net/rtcp/rtcp_session.h
+++ b/chromium/media/cast/net/rtcp/rtcp_session.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/rtcp_unittest.cc b/chromium/media/cast/net/rtcp/rtcp_unittest.cc
index 97937efdabc..11aa7570879 100644
--- a/chromium/media/cast/net/rtcp/rtcp_unittest.cc
+++ b/chromium/media/cast/net/rtcp/rtcp_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/rtcp_utility.cc b/chromium/media/cast/net/rtcp/rtcp_utility.cc
index 4cce2a754e3..15401a57ebd 100644
--- a/chromium/media/cast/net/rtcp/rtcp_utility.cc
+++ b/chromium/media/cast/net/rtcp/rtcp_utility.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/rtcp_utility.h b/chromium/media/cast/net/rtcp/rtcp_utility.h
index f36579b4e65..577929aa1b4 100644
--- a/chromium/media/cast/net/rtcp/rtcp_utility.h
+++ b/chromium/media/cast/net/rtcp/rtcp_utility.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/rtcp_utility_unittest.cc b/chromium/media/cast/net/rtcp/rtcp_utility_unittest.cc
index fa186a57fe7..e16b0c203e5 100644
--- a/chromium/media/cast/net/rtcp/rtcp_utility_unittest.cc
+++ b/chromium/media/cast/net/rtcp/rtcp_utility_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/sender_rtcp_session.cc b/chromium/media/cast/net/rtcp/sender_rtcp_session.cc
index d22f7cb836e..9b01adcb3b5 100644
--- a/chromium/media/cast/net/rtcp/sender_rtcp_session.cc
+++ b/chromium/media/cast/net/rtcp/sender_rtcp_session.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtcp/sender_rtcp_session.h b/chromium/media/cast/net/rtcp/sender_rtcp_session.h
index 92849e67818..a6cba9e5014 100644
--- a/chromium/media/cast/net/rtcp/sender_rtcp_session.h
+++ b/chromium/media/cast/net/rtcp/sender_rtcp_session.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/packet_storage.cc b/chromium/media/cast/net/rtp/packet_storage.cc
index 15bb977779f..b9b30b8fcee 100644
--- a/chromium/media/cast/net/rtp/packet_storage.cc
+++ b/chromium/media/cast/net/rtp/packet_storage.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/packet_storage.h b/chromium/media/cast/net/rtp/packet_storage.h
index ebfa0f4a054..6603d03faa0 100644
--- a/chromium/media/cast/net/rtp/packet_storage.h
+++ b/chromium/media/cast/net/rtp/packet_storage.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/packet_storage_unittest.cc b/chromium/media/cast/net/rtp/packet_storage_unittest.cc
index 6f19fe3c3bb..c2a4e8e29ad 100644
--- a/chromium/media/cast/net/rtp/packet_storage_unittest.cc
+++ b/chromium/media/cast/net/rtp/packet_storage_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/rtp_defines.cc b/chromium/media/cast/net/rtp/rtp_defines.cc
index 16144042df8..a18c4516a38 100644
--- a/chromium/media/cast/net/rtp/rtp_defines.cc
+++ b/chromium/media/cast/net/rtp/rtp_defines.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/rtp_defines.h b/chromium/media/cast/net/rtp/rtp_defines.h
index 92b4f8b39b1..a0757e5426e 100644
--- a/chromium/media/cast/net/rtp/rtp_defines.h
+++ b/chromium/media/cast/net/rtp/rtp_defines.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/rtp_packetizer.cc b/chromium/media/cast/net/rtp/rtp_packetizer.cc
index 2f13bc0c792..9eb3f649198 100644
--- a/chromium/media/cast/net/rtp/rtp_packetizer.cc
+++ b/chromium/media/cast/net/rtp/rtp_packetizer.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "media/cast/common/encoded_frame.h"
#include "media/cast/net/pacing/paced_sender.h"
#include "media/cast/net/rtp/rtp_defines.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
namespace media {
namespace cast {
@@ -99,14 +100,18 @@ void RtpPacketizer::SendFrameAsPackets(const EncodedFrame& frame) {
frame.rtp_timestamp);
// Build Cast header.
- DCHECK_NE(frame.dependency, EncodedFrame::UNKNOWN_DEPENDENCY);
+ DCHECK_NE(frame.dependency,
+ openscreen::cast::EncodedFrame::Dependency::kUnknown);
uint8_t byte0 = kCastReferenceFrameIdBitMask;
- if (frame.dependency == EncodedFrame::KEY)
+ if (frame.dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame)
byte0 |= kCastKeyFrameBitMask;
+
// Extensions only go on the first packet of the frame
const uint16_t packet_id = static_cast<uint16_t>(packets.size());
if (packet_id == 0)
byte0 |= num_extensions;
+
packet->data.push_back(byte0);
packet->data.push_back(frame.frame_id.lower_8_bits());
size_t start_size = packet->data.size();
diff --git a/chromium/media/cast/net/rtp/rtp_packetizer.h b/chromium/media/cast/net/rtp/rtp_packetizer.h
index 029442aec7a..f0160d9231e 100644
--- a/chromium/media/cast/net/rtp/rtp_packetizer.h
+++ b/chromium/media/cast/net/rtp/rtp_packetizer.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/rtp_packetizer_unittest.cc b/chromium/media/cast/net/rtp/rtp_packetizer_unittest.cc
index ba947bd75b9..f03aaceabc6 100644
--- a/chromium/media/cast/net/rtp/rtp_packetizer_unittest.cc
+++ b/chromium/media/cast/net/rtp/rtp_packetizer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,6 +16,7 @@
#include "media/cast/net/rtp/packet_storage.h"
#include "media/cast/net/rtp/rtp_parser.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
namespace media {
namespace cast {
@@ -141,7 +142,8 @@ class RtpPacketizerTest : public ::testing::Test {
pacer_->RegisterSsrc(config_.ssrc, false);
rtp_packetizer_ = std::make_unique<RtpPacketizer>(
pacer_.get(), &packet_storage_, config_);
- video_frame_.dependency = EncodedFrame::DEPENDENT;
+ video_frame_.dependency =
+ openscreen::cast::EncodedFrame::Dependency::kDependent;
video_frame_.frame_id = FrameId::first() + 1;
video_frame_.referenced_frame_id = video_frame_.frame_id - 1;
video_frame_.data.assign(kFrameSize, 123);
diff --git a/chromium/media/cast/net/rtp/rtp_parser.cc b/chromium/media/cast/net/rtp/rtp_parser.cc
index 76b9d5d5cf8..279428febe6 100644
--- a/chromium/media/cast/net/rtp/rtp_parser.cc
+++ b/chromium/media/cast/net/rtp/rtp_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/rtp_parser.h b/chromium/media/cast/net/rtp/rtp_parser.h
index f4ac0125c2f..a2701fe2b2f 100644
--- a/chromium/media/cast/net/rtp/rtp_parser.h
+++ b/chromium/media/cast/net/rtp/rtp_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/rtp_parser_unittest.cc b/chromium/media/cast/net/rtp/rtp_parser_unittest.cc
index ce3272b8aaa..b02c487a303 100644
--- a/chromium/media/cast/net/rtp/rtp_parser_unittest.cc
+++ b/chromium/media/cast/net/rtp/rtp_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/rtp_sender.cc b/chromium/media/cast/net/rtp/rtp_sender.cc
index 4a9fe1e98d5..1c599c23925 100644
--- a/chromium/media/cast/net/rtp/rtp_sender.cc
+++ b/chromium/media/cast/net/rtp/rtp_sender.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/rtp/rtp_sender.h b/chromium/media/cast/net/rtp/rtp_sender.h
index 65ce5e994d7..2c6ed95ffc8 100644
--- a/chromium/media/cast/net/rtp/rtp_sender.h
+++ b/chromium/media/cast/net/rtp/rtp_sender.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/transport_util.cc b/chromium/media/cast/net/transport_util.cc
index 0662bf3915e..9ba94d2599e 100644
--- a/chromium/media/cast/net/transport_util.cc
+++ b/chromium/media/cast/net/transport_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/transport_util.h b/chromium/media/cast/net/transport_util.h
index b78591999f6..8fb92eecd38 100644
--- a/chromium/media/cast/net/transport_util.h
+++ b/chromium/media/cast/net/transport_util.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/udp_packet_pipe.cc b/chromium/media/cast/net/udp_packet_pipe.cc
index 2c85a0c1ac7..7cf6bd50074 100644
--- a/chromium/media/cast/net/udp_packet_pipe.cc
+++ b/chromium/media/cast/net/udp_packet_pipe.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/udp_packet_pipe.h b/chromium/media/cast/net/udp_packet_pipe.h
index 4970785a365..1bc82c947ee 100644
--- a/chromium/media/cast/net/udp_packet_pipe.h
+++ b/chromium/media/cast/net/udp_packet_pipe.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/udp_packet_pipe_unittest.cc b/chromium/media/cast/net/udp_packet_pipe_unittest.cc
index 0ea3dbfc144..fd8e2f47622 100644
--- a/chromium/media/cast/net/udp_packet_pipe_unittest.cc
+++ b/chromium/media/cast/net/udp_packet_pipe_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/udp_transport_impl.cc b/chromium/media/cast/net/udp_transport_impl.cc
index fdbe9b64825..af60184836a 100644
--- a/chromium/media/cast/net/udp_transport_impl.cc
+++ b/chromium/media/cast/net/udp_transport_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/udp_transport_impl.h b/chromium/media/cast/net/udp_transport_impl.h
index afefd29ee73..9a56c65efe6 100644
--- a/chromium/media/cast/net/udp_transport_impl.h
+++ b/chromium/media/cast/net/udp_transport_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/udp_transport_interface.h b/chromium/media/cast/net/udp_transport_interface.h
index 308be48e1a7..9e485e0b6ab 100644
--- a/chromium/media/cast/net/udp_transport_interface.h
+++ b/chromium/media/cast/net/udp_transport_interface.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/net/udp_transport_unittest.cc b/chromium/media/cast/net/udp_transport_unittest.cc
index 6046da6004a..ffff5be7ab6 100644
--- a/chromium/media/cast/net/udp_transport_unittest.cc
+++ b/chromium/media/cast/net/udp_transport_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/sender/audio_sender.cc b/chromium/media/cast/sender/audio_sender.cc
index 284cad5c7f0..89ab257c876 100644
--- a/chromium/media/cast/sender/audio_sender.cc
+++ b/chromium/media/cast/sender/audio_sender.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/check_op.h"
#include "base/notreached.h"
+#include "base/trace_event/trace_event.h"
#include "media/base/media_switches.h"
#include "media/cast/common/openscreen_conversion_helpers.h"
#include "media/cast/common/rtp_time.h"
@@ -35,12 +36,14 @@ AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
AudioSender::AudioSender(scoped_refptr<CastEnvironment> cast_environment,
const FrameSenderConfig& audio_config,
StatusChangeOnceCallback status_change_cb,
- openscreen::cast::Sender* sender)
- : AudioSender(
- cast_environment,
- audio_config,
- std::move(status_change_cb),
- FrameSender::Create(cast_environment, audio_config, sender, *this)) {
+ std::unique_ptr<openscreen::cast::Sender> sender)
+ : AudioSender(cast_environment,
+ audio_config,
+ std::move(status_change_cb),
+ FrameSender::Create(cast_environment,
+ audio_config,
+ std::move(sender),
+ *this)) {
DCHECK(base::FeatureList::IsEnabled(kOpenscreenCastStreamingSession));
}
@@ -104,6 +107,10 @@ base::TimeDelta AudioSender::GetTargetPlayoutDelay() const {
return frame_sender_->GetTargetPlayoutDelay();
}
+int AudioSender::GetEncoderBitrate() const {
+ return audio_encoder_->GetBitrate();
+}
+
base::WeakPtr<AudioSender> AudioSender::AsWeakPtr() {
return weak_factory_.GetWeakPtr();
}
@@ -126,7 +133,14 @@ void AudioSender::OnEncodedAudioFrame(
samples_in_encoder_ -= audio_encoder_->GetSamplesPerFrame() + samples_skipped;
DCHECK_GE(samples_in_encoder_, 0);
- frame_sender_->EnqueueFrame(std::move(encoded_frame));
+
+ const RtpTimeTicks rtp_timestamp = encoded_frame->rtp_timestamp;
+ if (!frame_sender_->EnqueueFrame(std::move(encoded_frame))) {
+ TRACE_EVENT_INSTANT2("cast.stream", "Audio Frame Drop (already encoded)",
+ TRACE_EVENT_SCOPE_THREAD, "rtp_timestamp",
+ rtp_timestamp.lower_32_bits(), "reason",
+ "openscreen sender did not accept the frame");
+ }
}
} // namespace media::cast
diff --git a/chromium/media/cast/sender/audio_sender.h b/chromium/media/cast/sender/audio_sender.h
index 90147a58c84..5e36fefc3e9 100644
--- a/chromium/media/cast/sender/audio_sender.h
+++ b/chromium/media/cast/sender/audio_sender.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -47,7 +47,7 @@ class AudioSender final : public FrameSender::Client {
AudioSender(scoped_refptr<CastEnvironment> cast_environment,
const FrameSenderConfig& audio_config,
StatusChangeOnceCallback status_change_cb,
- openscreen::cast::Sender* sender);
+ std::unique_ptr<openscreen::cast::Sender> sender);
AudioSender(const AudioSender&) = delete;
AudioSender& operator=(const AudioSender&) = delete;
@@ -62,6 +62,7 @@ class AudioSender final : public FrameSender::Client {
void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay);
base::TimeDelta GetTargetPlayoutDelay() const;
+ int GetEncoderBitrate() const;
base::WeakPtr<AudioSender> AsWeakPtr();
diff --git a/chromium/media/cast/sender/audio_sender_unittest.cc b/chromium/media/cast/sender/audio_sender_unittest.cc
index b7bd01a451f..f646bd514d1 100644
--- a/chromium/media/cast/sender/audio_sender_unittest.cc
+++ b/chromium/media/cast/sender/audio_sender_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/sender/congestion_control.cc b/chromium/media/cast/sender/congestion_control.cc
index 49d8de305ee..4772dfe9ec1 100644
--- a/chromium/media/cast/sender/congestion_control.cc
+++ b/chromium/media/cast/sender/congestion_control.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/sender/congestion_control.h b/chromium/media/cast/sender/congestion_control.h
index 4e2dcb1753e..0bd33e6634a 100644
--- a/chromium/media/cast/sender/congestion_control.h
+++ b/chromium/media/cast/sender/congestion_control.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/sender/congestion_control_unittest.cc b/chromium/media/cast/sender/congestion_control_unittest.cc
index c86d8183f5c..7840fc56f33 100644
--- a/chromium/media/cast/sender/congestion_control_unittest.cc
+++ b/chromium/media/cast/sender/congestion_control_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/sender/frame_sender.cc b/chromium/media/cast/sender/frame_sender.cc
index e40797753f2..96db18082fe 100644
--- a/chromium/media/cast/sender/frame_sender.cc
+++ b/chromium/media/cast/sender/frame_sender.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/sender/frame_sender.h b/chromium/media/cast/sender/frame_sender.h
index 0164872fdd4..031c92c63dd 100644
--- a/chromium/media/cast/sender/frame_sender.h
+++ b/chromium/media/cast/sender/frame_sender.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -59,12 +59,18 @@ class FrameSender {
CastTransport* const transport_sender,
Client& client);
+ // NOTE: currently only used by the VideoSender.
+ // TODO(https://crbug.com/1316434): cleanup bitrate calculations when libcast
+ // has successfully launched.
+ using GetSuggestedVideoBitrateCB = base::RepeatingCallback<int()>;
+
// Method of creating a frame sender using an openscreen::cast::Sender.
static std::unique_ptr<FrameSender> Create(
scoped_refptr<CastEnvironment> cast_environment,
const FrameSenderConfig& config,
- openscreen::cast::Sender* sender,
- Client& client);
+ std::unique_ptr<openscreen::cast::Sender> sender,
+ Client& client,
+ GetSuggestedVideoBitrateCB get_bitrate_cb = GetSuggestedVideoBitrateCB());
FrameSender();
FrameSender(FrameSender&&) = delete;
@@ -85,8 +91,9 @@ class FrameSender {
// indication event.
virtual bool NeedsKeyFrame() const = 0;
- // Called by the encoder with the next encoded frame to send.
- virtual void EnqueueFrame(
+ // Called by the encoder with the next encoded frame to send. Returns true
+ // if successfully enqueued.
+ virtual bool EnqueueFrame(
std::unique_ptr<SenderEncodedFrame> encoded_frame) = 0;
// Returns true if too many frames would be in-flight by encoding and sending
diff --git a/chromium/media/cast/sender/frame_sender_impl.cc b/chromium/media/cast/sender/frame_sender_impl.cc
index 0ac8fed18a9..66455937a49 100644
--- a/chromium/media/cast/sender/frame_sender_impl.cc
+++ b/chromium/media/cast/sender/frame_sender_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,6 +18,7 @@
#include "media/cast/common/openscreen_conversion_helpers.h"
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/constants.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
namespace media::cast {
namespace {
@@ -98,13 +99,12 @@ FrameSenderImpl::FrameSenderImpl(
DCHECK(transport_sender_);
DCHECK_GT(config_.rtp_timebase, 0);
DCHECK(congestion_control_);
- // We assume animated content to begin with since that is the common use
- // case today.
+
+ // We start at the minimum playout delay and extend if necessary later.
VLOG(1) << SENDER_SSRC << "min latency "
- << config_.min_playout_delay.InMilliseconds() << "max latency "
- << config_.max_playout_delay.InMilliseconds() << "animated latency "
- << config_.animated_playout_delay.InMilliseconds();
- SetTargetPlayoutDelay(config_.animated_playout_delay);
+ << config_.min_playout_delay.InMilliseconds() << ", max latency "
+ << config_.max_playout_delay.InMilliseconds();
+ SetTargetPlayoutDelay(config_.min_playout_delay);
CastTransportRtpConfig transport_config;
transport_config.ssrc = config.sender_ssrc;
@@ -304,7 +304,7 @@ base::TimeDelta FrameSenderImpl::GetAllowedInFlightMediaDuration() const {
return target_playout_delay_ + (current_round_trip_time_ / 2);
}
-void FrameSenderImpl::EnqueueFrame(
+bool FrameSenderImpl::EnqueueFrame(
std::unique_ptr<SenderEncodedFrame> encoded_frame) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
@@ -316,7 +316,8 @@ void FrameSenderImpl::EnqueueFrame(
const bool is_first_frame_to_be_sent = last_send_time_.is_null();
if (picture_lost_at_receiver_ &&
- (encoded_frame->dependency == EncodedFrame::KEY)) {
+ (encoded_frame->dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame)) {
picture_lost_at_receiver_ = false;
DCHECK(frame_id > latest_acked_frame_id_);
// Cancel sending remaining frames.
@@ -341,7 +342,9 @@ void FrameSenderImpl::EnqueueFrame(
ScheduleNextResendCheck();
}
- VLOG_IF(1, !is_audio_ && encoded_frame->dependency == EncodedFrame::KEY)
+ VLOG_IF(1, !is_audio_ &&
+ encoded_frame->dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame)
<< SENDER_SSRC << "Sending encoded key frame, id=" << frame_id;
std::unique_ptr<FrameEvent> encode_event(new FrameEvent());
@@ -351,7 +354,9 @@ void FrameSenderImpl::EnqueueFrame(
encode_event->rtp_timestamp = encoded_frame->rtp_timestamp;
encode_event->frame_id = frame_id;
encode_event->size = base::checked_cast<uint32_t>(encoded_frame->data.size());
- encode_event->key_frame = encoded_frame->dependency == EncodedFrame::KEY;
+ encode_event->key_frame =
+ encoded_frame->dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame;
encode_event->target_bitrate = encoded_frame->encoder_bitrate;
encode_event->encoder_cpu_utilization = encoded_frame->encoder_utilization;
encode_event->idealized_bitrate_utilization = encoded_frame->lossiness;
@@ -396,6 +401,7 @@ void FrameSenderImpl::EnqueueFrame(
"cast.stream", name, TRACE_ID_WITH_SCOPE(name, frame_id.lower_32_bits()),
"rtp_timestamp", encoded_frame->rtp_timestamp.lower_32_bits());
transport_sender_->InsertFrame(config_.sender_ssrc, *encoded_frame);
+ return true;
}
void FrameSenderImpl::OnReceivedCastFeedback(
diff --git a/chromium/media/cast/sender/frame_sender_impl.h b/chromium/media/cast/sender/frame_sender_impl.h
index 4b9c1920e58..c34e5be9c24 100644
--- a/chromium/media/cast/sender/frame_sender_impl.h
+++ b/chromium/media/cast/sender/frame_sender_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -36,7 +36,7 @@ class FrameSenderImpl : public FrameSender {
void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay) override;
base::TimeDelta GetTargetPlayoutDelay() const override;
bool NeedsKeyFrame() const override;
- void EnqueueFrame(std::unique_ptr<SenderEncodedFrame> encoded_frame) override;
+ bool EnqueueFrame(std::unique_ptr<SenderEncodedFrame> encoded_frame) override;
bool ShouldDropNextFrame(base::TimeDelta frame_duration) const override;
RtpTimeTicks GetRecordedRtpTimestamp(FrameId frame_id) const override;
int GetUnacknowledgedFrameCount() const override;
diff --git a/chromium/media/cast/sender/openscreen_frame_sender.cc b/chromium/media/cast/sender/openscreen_frame_sender.cc
index 4449ae3ae19..c129c19a40f 100644
--- a/chromium/media/cast/sender/openscreen_frame_sender.cc
+++ b/chromium/media/cast/sender/openscreen_frame_sender.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,6 +20,7 @@
#include "media/cast/common/openscreen_conversion_helpers.h"
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/constants.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
namespace media::cast {
@@ -30,10 +31,12 @@ static constexpr int kMaxFrameBurst = 5;
std::unique_ptr<FrameSender> FrameSender::Create(
scoped_refptr<CastEnvironment> cast_environment,
const FrameSenderConfig& config,
- openscreen::cast::Sender* sender,
- Client& client) {
+ std::unique_ptr<openscreen::cast::Sender> sender,
+ Client& client,
+ FrameSender::GetSuggestedVideoBitrateCB get_bitrate_cb) {
return std::make_unique<OpenscreenFrameSender>(cast_environment, config,
- sender, client);
+ std::move(sender), client,
+ std::move(get_bitrate_cb));
}
// Convenience macro used in logging statements throughout this file.
@@ -44,33 +47,24 @@ std::unique_ptr<FrameSender> FrameSender::Create(
OpenscreenFrameSender::OpenscreenFrameSender(
scoped_refptr<CastEnvironment> cast_environment,
const FrameSenderConfig& config,
- openscreen::cast::Sender* sender,
- Client& client)
+ std::unique_ptr<openscreen::cast::Sender> sender,
+ Client& client,
+ FrameSender::GetSuggestedVideoBitrateCB get_bitrate_cb)
: cast_environment_(cast_environment),
- sender_(sender),
+ sender_(std::move(sender)),
client_(client),
+ get_bitrate_cb_(std::move(get_bitrate_cb)),
max_frame_rate_(config.max_frame_rate),
is_audio_(config.rtp_payload_type <= RtpPayloadType::AUDIO_LAST),
- // We only use the adaptive control for software video encoding.
- congestion_control_(
- (!config.use_external_encoder && !is_audio_)
- ? NewAdaptiveCongestionControl(cast_environment->Clock(),
- config.max_bitrate,
- config.min_bitrate,
- max_frame_rate_)
- : NewFixedCongestionControl(
- (config.min_bitrate + config.max_bitrate) / 2)
-
- ),
min_playout_delay_(config.min_playout_delay),
max_playout_delay_(config.max_playout_delay) {
DCHECK_GT(sender_->config().rtp_timebase, 0);
- // We assume animated content to begin with since that is the common use
- // case today.
- VLOG_WITH_SSRC(1) << "target latency "
- << sender_->config().target_playout_delay.count() << "ms";
- SetTargetPlayoutDelay(config.animated_playout_delay);
+ const std::chrono::milliseconds target_playout_delay =
+ sender_->config().target_playout_delay;
+ VLOG_WITH_SSRC(1) << "target latency " << target_playout_delay.count()
+ << "ms";
+ SetTargetPlayoutDelay(base::Milliseconds(target_playout_delay.count()));
sender_->SetObserver(this);
}
@@ -102,7 +96,6 @@ void OpenscreenFrameSender::SetTargetPlayoutDelay(
<< new_target_playout_delay.InMilliseconds() << " ms.";
target_playout_delay_ = new_target_playout_delay;
send_target_playout_delay_ = true;
- congestion_control_->UpdateTargetPlayoutDelay(target_playout_delay_);
}
base::TimeDelta OpenscreenFrameSender::GetTargetPlayoutDelay() const {
@@ -127,16 +120,19 @@ void OpenscreenFrameSender::RecordLatestFrameTimestamps(
}
base::TimeDelta OpenscreenFrameSender::GetInFlightMediaDuration() const {
- const base::TimeDelta encoder_duration = client_.GetEncoderBacklogDuration();
- const RtpTimeTicks newest_timestamp =
- GetRecordedRtpTimestamp(last_sent_frame_id_);
- return encoder_duration +
- ToTimeDelta(sender_->GetInFlightMediaDuration(newest_timestamp));
+ base::TimeDelta duration = client_.GetEncoderBacklogDuration();
+ if (!last_enqueued_frame_id_.is_null()) {
+ const RtpTimeTicks newest_timestamp =
+ GetRecordedRtpTimestamp(last_enqueued_frame_id_);
+ duration +=
+ ToTimeDelta(sender_->GetInFlightMediaDuration(newest_timestamp));
+ }
+ return duration;
}
RtpTimeTicks OpenscreenFrameSender::GetRecordedRtpTimestamp(
FrameId frame_id) const {
- if (static_cast<size_t>(std::abs(last_sent_frame_id_ - frame_id)) >=
+ if (static_cast<size_t>(std::abs(last_enqueued_frame_id_ - frame_id)) >=
std::size(frame_rtp_timestamps_)) {
return {};
}
@@ -149,7 +145,9 @@ int OpenscreenFrameSender::GetUnacknowledgedFrameCount() const {
int OpenscreenFrameSender::GetSuggestedBitrate(base::TimeTicks playout_time,
base::TimeDelta playout_delay) {
- return congestion_control_->GetBitrate(playout_time, playout_delay);
+ // Currently only used by the video sender.
+ DCHECK(!is_audio_);
+ return get_bitrate_cb_.Run();
}
double OpenscreenFrameSender::MaxFrameRate() const {
@@ -186,20 +184,23 @@ base::TimeDelta OpenscreenFrameSender::GetAllowedInFlightMediaDuration() const {
return ToTimeDelta(sender_->GetMaxInFlightMediaDuration());
}
-void OpenscreenFrameSender::EnqueueFrame(
+bool OpenscreenFrameSender::EnqueueFrame(
std::unique_ptr<SenderEncodedFrame> encoded_frame) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
- VLOG_WITH_SSRC(2) << "About to send another frame: last_sent="
- << last_sent_frame_id_;
+ VLOG_WITH_SSRC(2) << "About to send another frame. last enqueued="
+ << last_enqueued_frame_id_;
- const FrameId frame_id = encoded_frame->frame_id;
+ DCHECK_GE(encoded_frame->frame_id, last_enqueued_frame_id_)
+ << "enqueued frames out of order.";
+ last_enqueued_frame_id_ = encoded_frame->frame_id;
last_send_time_ = cast_environment_->Clock()->NowTicks();
- DCHECK(frame_id > last_sent_frame_id_) << "enqueued frames out of order.";
- last_sent_frame_id_ = frame_id;
- if (!is_audio_ && encoded_frame->dependency == EncodedFrame::KEY) {
- VLOG_WITH_SSRC(1) << "Sending encoded key frame, id=" << frame_id;
+ if (!is_audio_ && encoded_frame->dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame) {
+ VLOG_WITH_SSRC(1) << "Sending encoded key frame, id="
+ << encoded_frame->frame_id;
+ frame_id_map_.clear();
}
auto encode_event = std::make_unique<FrameEvent>();
@@ -207,9 +208,11 @@ void OpenscreenFrameSender::EnqueueFrame(
encode_event->type = FRAME_ENCODED;
encode_event->media_type = is_audio_ ? AUDIO_EVENT : VIDEO_EVENT;
encode_event->rtp_timestamp = encoded_frame->rtp_timestamp;
- encode_event->frame_id = frame_id;
+ encode_event->frame_id = encoded_frame->frame_id;
encode_event->size = base::checked_cast<uint32_t>(encoded_frame->data.size());
- encode_event->key_frame = encoded_frame->dependency == EncodedFrame::KEY;
+ encode_event->key_frame =
+ encoded_frame->dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame;
encode_event->target_bitrate = encoded_frame->encoder_bitrate;
encode_event->encoder_cpu_utilization = encoded_frame->encoder_utilization;
encode_event->idealized_bitrate_utilization = encoded_frame->lossiness;
@@ -218,7 +221,8 @@ void OpenscreenFrameSender::EnqueueFrame(
// production.
cast_environment_->logger()->DispatchFrameEvent(std::move(encode_event));
- RecordLatestFrameTimestamps(frame_id, encoded_frame->reference_time,
+ RecordLatestFrameTimestamps(encoded_frame->frame_id,
+ encoded_frame->reference_time,
encoded_frame->rtp_timestamp);
if (!is_audio_) {
@@ -228,9 +232,6 @@ void OpenscreenFrameSender::EnqueueFrame(
encoded_frame->rtp_timestamp.lower_32_bits());
}
- congestion_control_->WillSendFrameToTransport(
- frame_id, encoded_frame->data.size(), last_send_time_);
-
if (send_target_playout_delay_) {
encoded_frame->new_playout_delay_ms =
target_playout_delay_.InMilliseconds();
@@ -239,14 +240,27 @@ void OpenscreenFrameSender::EnqueueFrame(
static const char* name = is_audio_ ? "Audio Transport" : "Video Transport";
TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(
- "cast.stream", name, TRACE_ID_WITH_SCOPE(name, frame_id.lower_32_bits()),
+ "cast.stream", name,
+ TRACE_ID_WITH_SCOPE(name, encoded_frame->frame_id.lower_32_bits()),
"rtp_timestamp", encoded_frame->rtp_timestamp.lower_32_bits());
- const auto result =
- sender_->EnqueueFrame(ToOpenscreenEncodedFrame(*encoded_frame));
- if (result != openscreen::cast::Sender::EnqueueFrameResult::OK) {
- VLOG(1) << "Failed to enqueue frame " << frame_id << ", dropping...";
- }
+ // The `FrameId` given to us by child classes such as VideoSender should
+ // be at least the result of openscreen::cast::Sender::GetNextFrameId(). If
+ // the Open Screen Sender choose to not send a frame, it does not advance the
+ // frame identifier.
+ const FrameId openscreen_frame_id = sender_->GetNextFrameId();
+ DCHECK_GE(encoded_frame->frame_id, openscreen_frame_id);
+ frame_id_map_.insert_or_assign(encoded_frame->frame_id, openscreen_frame_id);
+
+ // Finally, convert to an Open Screen encoded frame using the equivalent frame
+ // identifiers generated by the Open Screen sender.
+ auto openscreen_frame = ToOpenscreenEncodedFrame(*encoded_frame);
+ openscreen_frame.frame_id = openscreen_frame_id;
+ openscreen_frame.referenced_frame_id =
+ frame_id_map_[encoded_frame->referenced_frame_id];
+ const auto result = sender_->EnqueueFrame(std::move(openscreen_frame));
+
+ return result == openscreen::cast::Sender::EnqueueFrameResult::OK;
}
void OpenscreenFrameSender::OnReceivedCastFeedback(
diff --git a/chromium/media/cast/sender/openscreen_frame_sender.h b/chromium/media/cast/sender/openscreen_frame_sender.h
index 1066b3bbc9c..352892cc535 100644
--- a/chromium/media/cast/sender/openscreen_frame_sender.h
+++ b/chromium/media/cast/sender/openscreen_frame_sender.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include "base/containers/flat_map.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -15,7 +16,6 @@
#include "media/cast/cast_environment.h"
#include "media/cast/net/cast_transport.h"
#include "media/cast/net/rtcp/rtcp_defines.h"
-#include "media/cast/sender/congestion_control.h"
#include "media/cast/sender/frame_sender.h"
#include "third_party/openscreen/src/cast/streaming/sender.h"
@@ -31,23 +31,25 @@ struct SenderEncodedFrame;
//
// For more information, see the Cast Streaming README.md located at:
// https://source.chromium.org/chromium/chromium/src/+/main:third_party/openscreen/src/cast/streaming/README.md
-
class OpenscreenFrameSender : public FrameSender,
openscreen::cast::Sender::Observer {
public:
- // TODO(https://crbug.com/1318499): will likely need to remove
- // FrameSenderConfig here once the migration to libcast is complete.
OpenscreenFrameSender(scoped_refptr<CastEnvironment> cast_environment,
const FrameSenderConfig& config,
- openscreen::cast::Sender* sender,
- Client& client);
+ std::unique_ptr<openscreen::cast::Sender> sender,
+ Client& client,
+ FrameSender::GetSuggestedVideoBitrateCB get_bitrate_cb);
+ OpenscreenFrameSender(OpenscreenFrameSender&& other) = delete;
+ OpenscreenFrameSender& operator=(OpenscreenFrameSender&& other) = delete;
+ OpenscreenFrameSender(const OpenscreenFrameSender&) = delete;
+ OpenscreenFrameSender& operator=(const OpenscreenFrameSender&) = delete;
~OpenscreenFrameSender() override;
// FrameSender overrides.
void SetTargetPlayoutDelay(base::TimeDelta new_target_playout_delay) override;
base::TimeDelta GetTargetPlayoutDelay() const override;
bool NeedsKeyFrame() const override;
- void EnqueueFrame(std::unique_ptr<SenderEncodedFrame> encoded_frame) override;
+ bool EnqueueFrame(std::unique_ptr<SenderEncodedFrame> encoded_frame) override;
bool ShouldDropNextFrame(base::TimeDelta frame_duration) const override;
RtpTimeTicks GetRecordedRtpTimestamp(FrameId frame_id) const override;
int GetUnacknowledgedFrameCount() const override;
@@ -91,21 +93,20 @@ class OpenscreenFrameSender : public FrameSender,
const scoped_refptr<CastEnvironment> cast_environment_;
// The backing Open Screen sender implementation.
- raw_ptr<openscreen::cast::Sender> const sender_;
+ std::unique_ptr<openscreen::cast::Sender> const sender_;
// The frame sender client.
Client& client_;
+ // The method for getting the recommended bitrate.
+ GetSuggestedVideoBitrateCB get_bitrate_cb_;
+
// Max encoded frames generated per second.
double max_frame_rate_;
// Whether this is an audio or video frame sender.
const bool is_audio_;
- // The congestion control manages frame statistics and helps make decisions
- // about what bitrate we encode the next frame at.
- std::unique_ptr<CongestionControl> congestion_control_;
-
// The target playout delay, may fluctuate between the min and max delays.
base::TimeDelta target_playout_delay_;
base::TimeDelta min_playout_delay_;
@@ -115,9 +116,15 @@ class OpenscreenFrameSender : public FrameSender,
// last time any frame was sent or re-sent.
base::TimeTicks last_send_time_;
- // The ID of the last frame sent. This member is invalid until
+ // The ID of the last enqueued frame. This member is invalid until
// |!last_send_time_.is_null()|.
- FrameId last_sent_frame_id_;
+ FrameId last_enqueued_frame_id_;
+
+ // Since the encoder emits frames that depend on each other, and the Open
+ // Screen sender demands that we use its FrameIDs for enqueued frames, we
+ // have to keep a map of the encoder's frame id to the Open Screen sender's
+ // frame id. This map is cleared on each keyframe.
+ base::flat_map<FrameId, FrameId> frame_id_map_;
// This is the maximum delay that the sender should get ack from receiver.
// Counts how many RTCP reports are being "aggressively" sent (i.e., one per
diff --git a/chromium/media/cast/sender/performance_metrics_overlay.cc b/chromium/media/cast/sender/performance_metrics_overlay.cc
index b242cb12d78..097ebcedc1a 100644
--- a/chromium/media/cast/sender/performance_metrics_overlay.cc
+++ b/chromium/media/cast/sender/performance_metrics_overlay.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -90,7 +90,8 @@ void RenderLineOfText(const std::string& line, int top, VideoFrame* frame) {
const int stride = frame->stride(kPlane);
uint8_t* p_ul =
// Start at the first pixel in the first row...
- frame->visible_data(kPlane) + (stride * top)
+ frame->GetWritableVisibleData(kPlane) +
+ (stride * top)
// ...now move to the right edge of the visible part of the frame...
+ frame->visible_rect().width()
// ...now move left to where line[0] would be rendered...
@@ -258,7 +259,7 @@ scoped_refptr<VideoFrame> MaybeRenderPerformanceMetricsOverlay(
plane, source->format(), source->visible_rect().width());
const uint8_t* src = source->visible_data(plane);
const int src_stride = source->stride(plane);
- uint8_t* dst = frame->visible_data(plane);
+ uint8_t* dst = frame->GetWritableVisibleData(plane);
const int dst_stride = frame->stride(plane);
for (size_t row = 0; row < row_count;
++row, src += src_stride, dst += dst_stride) {
diff --git a/chromium/media/cast/sender/performance_metrics_overlay.h b/chromium/media/cast/sender/performance_metrics_overlay.h
index f770a97d72c..689969fac81 100644
--- a/chromium/media/cast/sender/performance_metrics_overlay.h
+++ b/chromium/media/cast/sender/performance_metrics_overlay.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/sender/video_sender.cc b/chromium/media/cast/sender/video_sender.cc
index 7b5621e3297..d63412781da 100644
--- a/chromium/media/cast/sender/video_sender.cc
+++ b/chromium/media/cast/sender/video_sender.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,11 +15,13 @@
#include "base/trace_event/trace_event.h"
#include "media/base/media_switches.h"
#include "media/cast/common/openscreen_conversion_helpers.h"
+#include "media/cast/common/rtp_time.h"
#include "media/cast/common/sender_encoded_frame.h"
#include "media/cast/encoding/video_encoder.h"
#include "media/cast/net/cast_transport_config.h"
#include "media/cast/sender/openscreen_frame_sender.h"
#include "media/cast/sender/performance_metrics_overlay.h"
+#include "third_party/openscreen/src/cast/streaming/encoded_frame.h"
#include "third_party/openscreen/src/cast/streaming/sender.h"
namespace media::cast {
@@ -95,7 +97,7 @@ VideoSender::VideoSender(
const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
CastTransport* const transport_sender,
PlayoutDelayChangeCB playout_delay_change_cb,
- media::VideoCaptureFeedbackCB feedback_callback)
+ media::VideoCaptureFeedbackCB feedback_cb)
: VideoSender(cast_environment,
video_config,
std::move(status_change_cb),
@@ -105,24 +107,28 @@ VideoSender::VideoSender(
transport_sender,
*this),
std::move(playout_delay_change_cb),
- std::move(feedback_callback)) {}
+ std::move(feedback_cb)) {}
VideoSender::VideoSender(
scoped_refptr<CastEnvironment> cast_environment,
const FrameSenderConfig& video_config,
StatusChangeCallback status_change_cb,
const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
- openscreen::cast::Sender* sender,
+ std::unique_ptr<openscreen::cast::Sender> sender,
PlayoutDelayChangeCB playout_delay_change_cb,
- media::VideoCaptureFeedbackCB feedback_callback)
- : VideoSender(
- cast_environment,
- video_config,
- std::move(status_change_cb),
- std::move(create_vea_cb),
- FrameSender::Create(cast_environment, video_config, sender, *this),
- std::move(playout_delay_change_cb),
- std::move(feedback_callback)) {
+ media::VideoCaptureFeedbackCB feedback_cb,
+ FrameSender::GetSuggestedVideoBitrateCB get_bitrate_cb)
+ : VideoSender(cast_environment,
+ video_config,
+ std::move(status_change_cb),
+ std::move(create_vea_cb),
+ FrameSender::Create(cast_environment,
+ video_config,
+ std::move(sender),
+ *this,
+ std::move(get_bitrate_cb)),
+ std::move(playout_delay_change_cb),
+ std::move(feedback_cb)) {
DCHECK(base::FeatureList::IsEnabled(kOpenscreenCastStreamingSession));
}
@@ -142,7 +148,6 @@ VideoSender::VideoSender(
cast_environment_(cast_environment),
min_playout_delay_(video_config.min_playout_delay),
max_playout_delay_(video_config.max_playout_delay),
- animated_playout_delay_(video_config.animated_playout_delay),
playout_delay_change_cb_(std::move(playout_delay_change_cb)),
feedback_cb_(feedback_callback) {
video_encoder_ = VideoEncoder::Create(cast_environment_, video_config,
@@ -243,9 +248,9 @@ void VideoSender::InsertRawVideoFrame(
// This is intended to minimize freeze when moving from an interactive
// session to watching animating content while being limited by end-to-end
// delay.
- VLOG(1) << "Ensure playout time is at least " << animated_playout_delay_;
- if (new_target_delay < animated_playout_delay_)
- new_target_delay = animated_playout_delay_;
+ VLOG(1) << "Ensure playout time is at least " << min_playout_delay_;
+ if (new_target_delay < min_playout_delay_)
+ new_target_delay = min_playout_delay_;
VLOG(1) << "New target delay: " << new_target_delay.InMilliseconds();
playout_delay_change_cb_.Run(new_target_delay);
}
@@ -363,14 +368,27 @@ void VideoSender::OnEncodedVideoFrame(
// this can misguide the producer of the input video frames.
VideoCaptureFeedback feedback;
feedback.resource_utilization =
- encoded_frame->dependency == EncodedFrame::KEY
+ encoded_frame->dependency ==
+ openscreen::cast::EncodedFrame::Dependency::kKeyFrame
? std::min(1.0, attenuated_utilization)
: attenuated_utilization;
if (feedback_cb_)
feedback_cb_.Run(feedback);
}
- frame_sender_->EnqueueFrame(std::move(encoded_frame));
+ const RtpTimeTicks rtp_timestamp = encoded_frame->rtp_timestamp;
+ if (!frame_sender_->EnqueueFrame(std::move(encoded_frame))) {
+ // Since we have dropped an already encoded frame, which is much worse than
+ // dropping a raw frame above, we need to flush the encoder and emit a new
+ // keyframe.
+ video_encoder_->EmitFrames();
+ video_encoder_->GenerateKeyFrame();
+
+ TRACE_EVENT_INSTANT2("cast.stream", "Video Frame Drop (already encoded)",
+ TRACE_EVENT_SCOPE_THREAD, "rtp_timestamp",
+ rtp_timestamp.lower_32_bits(), "reason",
+ "openscreen sender did not accept the frame");
+ }
}
} // namespace media::cast
diff --git a/chromium/media/cast/sender/video_sender.h b/chromium/media/cast/sender/video_sender.h
index 816d7ef6e22..d07adfb361b 100644
--- a/chromium/media/cast/sender/video_sender.h
+++ b/chromium/media/cast/sender/video_sender.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -60,9 +60,10 @@ class VideoSender : public FrameSender::Client {
const FrameSenderConfig& video_config,
StatusChangeCallback status_change_cb,
const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
- openscreen::cast::Sender* sender,
+ std::unique_ptr<openscreen::cast::Sender> sender,
PlayoutDelayChangeCB playout_delay_change_cb,
- media::VideoCaptureFeedbackCB feedback_callback);
+ media::VideoCaptureFeedbackCB feedback_cb,
+ FrameSender::GetSuggestedVideoBitrateCB get_bitrate_cb);
VideoSender(const VideoSender&) = delete;
VideoSender& operator=(const VideoSender&) = delete;
@@ -135,9 +136,6 @@ class VideoSender : public FrameSender::Client {
base::TimeDelta min_playout_delay_;
base::TimeDelta max_playout_delay_;
- // Starting playout delay when streaming animated content.
- base::TimeDelta animated_playout_delay_;
-
PlayoutDelayChangeCB playout_delay_change_cb_;
media::VideoCaptureFeedbackCB feedback_cb_;
diff --git a/chromium/media/cast/sender/video_sender_unittest.cc b/chromium/media/cast/sender/video_sender_unittest.cc
index d515925c669..991b0210609 100644
--- a/chromium/media/cast/sender/video_sender_unittest.cc
+++ b/chromium/media/cast/sender/video_sender_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cast/test/proto/BUILD.gn b/chromium/media/cast/test/proto/BUILD.gn
index 82541404104..43f825ad98a 100644
--- a/chromium/media/cast/test/proto/BUILD.gn
+++ b/chromium/media/cast/test/proto/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/cdm/BUILD.gn b/chromium/media/cdm/BUILD.gn
index b9d7e026228..83d5806b7e2 100644
--- a/chromium/media/cdm/BUILD.gn
+++ b/chromium/media/cdm/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -117,6 +117,8 @@ source_set("cdm") {
"cdm_document_service.h",
"cdm_helpers.cc",
"cdm_helpers.h",
+ "load_cdm_uma_helper.cc",
+ "load_cdm_uma_helper.h",
]
deps += [
":cdm_api",
diff --git a/chromium/media/cdm/aes_cbc_crypto.cc b/chromium/media/cdm/aes_cbc_crypto.cc
index b16f2c17cbe..158a0c663eb 100644
--- a/chromium/media/cdm/aes_cbc_crypto.cc
+++ b/chromium/media/cdm/aes_cbc_crypto.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/aes_cbc_crypto.h b/chromium/media/cdm/aes_cbc_crypto.h
index 6a2fa1e9a4d..b4da960efa3 100644
--- a/chromium/media/cdm/aes_cbc_crypto.h
+++ b/chromium/media/cdm/aes_cbc_crypto.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/aes_cbc_crypto_unittest.cc b/chromium/media/cdm/aes_cbc_crypto_unittest.cc
index ea3ea46af52..cd91497dc43 100644
--- a/chromium/media/cdm/aes_cbc_crypto_unittest.cc
+++ b/chromium/media/cdm/aes_cbc_crypto_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/aes_decryptor.cc b/chromium/media/cdm/aes_decryptor.cc
index 428875fdfa8..3d29ac627d9 100644
--- a/chromium/media/cdm/aes_decryptor.cc
+++ b/chromium/media/cdm/aes_decryptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/aes_decryptor.h b/chromium/media/cdm/aes_decryptor.h
index 5d7e63c5ad7..edc40a43b3c 100644
--- a/chromium/media/cdm/aes_decryptor.h
+++ b/chromium/media/cdm/aes_decryptor.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/aes_decryptor_unittest.cc b/chromium/media/cdm/aes_decryptor_unittest.cc
index cc518325930..15d48d3ca58 100644
--- a/chromium/media/cdm/aes_decryptor_unittest.cc
+++ b/chromium/media/cdm/aes_decryptor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cbcs_decryptor.cc b/chromium/media/cdm/cbcs_decryptor.cc
index 10f4dfdfcd9..e286a8c1def 100644
--- a/chromium/media/cdm/cbcs_decryptor.cc
+++ b/chromium/media/cdm/cbcs_decryptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cbcs_decryptor.h b/chromium/media/cdm/cbcs_decryptor.h
index 702eb7a0879..13c6063398a 100644
--- a/chromium/media/cdm/cbcs_decryptor.h
+++ b/chromium/media/cdm/cbcs_decryptor.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cbcs_decryptor_fuzzer.cc b/chromium/media/cdm/cbcs_decryptor_fuzzer.cc
index a1d7b79589b..e0c09497189 100644
--- a/chromium/media/cdm/cbcs_decryptor_fuzzer.cc
+++ b/chromium/media/cdm/cbcs_decryptor_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cbcs_decryptor_unittest.cc b/chromium/media/cdm/cbcs_decryptor_unittest.cc
index 97d7757c85b..5811991a78b 100644
--- a/chromium/media/cdm/cbcs_decryptor_unittest.cc
+++ b/chromium/media/cdm/cbcs_decryptor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_adapter.cc b/chromium/media/cdm/cdm_adapter.cc
index 5d4425a0c52..e502f722194 100644
--- a/chromium/media/cdm/cdm_adapter.cc
+++ b/chromium/media/cdm/cdm_adapter.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_adapter.h b/chromium/media/cdm/cdm_adapter.h
index 0c599728d6d..eaf6ead5385 100644
--- a/chromium/media/cdm/cdm_adapter.h
+++ b/chromium/media/cdm/cdm_adapter.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_adapter_factory.cc b/chromium/media/cdm/cdm_adapter_factory.cc
index 95b2f681ed6..a5160cde30f 100644
--- a/chromium/media/cdm/cdm_adapter_factory.cc
+++ b/chromium/media/cdm/cdm_adapter_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_adapter_factory.h b/chromium/media/cdm/cdm_adapter_factory.h
index d1bcd896265..a82ee3b3bf8 100644
--- a/chromium/media/cdm/cdm_adapter_factory.h
+++ b/chromium/media/cdm/cdm_adapter_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_adapter_unittest.cc b/chromium/media/cdm/cdm_adapter_unittest.cc
index f73d981c40f..c0a1718fe26 100644
--- a/chromium/media/cdm/cdm_adapter_unittest.cc
+++ b/chromium/media/cdm/cdm_adapter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_allocator.cc b/chromium/media/cdm/cdm_allocator.cc
index 5417266272e..e13cdb17bc6 100644
--- a/chromium/media/cdm/cdm_allocator.cc
+++ b/chromium/media/cdm/cdm_allocator.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_allocator.h b/chromium/media/cdm/cdm_allocator.h
index 5895c817216..fb888d6b7ff 100644
--- a/chromium/media/cdm/cdm_allocator.h
+++ b/chromium/media/cdm/cdm_allocator.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_auxiliary_helper.cc b/chromium/media/cdm/cdm_auxiliary_helper.cc
index 7bc3f403de0..8440bc8cd04 100644
--- a/chromium/media/cdm/cdm_auxiliary_helper.cc
+++ b/chromium/media/cdm/cdm_auxiliary_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_auxiliary_helper.h b/chromium/media/cdm/cdm_auxiliary_helper.h
index ee903d3d209..6d953f38012 100644
--- a/chromium/media/cdm/cdm_auxiliary_helper.h
+++ b/chromium/media/cdm/cdm_auxiliary_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_capability.cc b/chromium/media/cdm/cdm_capability.cc
index 6433249ddaf..5bb05e48676 100644
--- a/chromium/media/cdm/cdm_capability.cc
+++ b/chromium/media/cdm/cdm_capability.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_capability.h b/chromium/media/cdm/cdm_capability.h
index cd7c20335f0..ff80704658d 100644
--- a/chromium/media/cdm/cdm_capability.h
+++ b/chromium/media/cdm/cdm_capability.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_context_ref_impl.cc b/chromium/media/cdm/cdm_context_ref_impl.cc
index bd78438f730..91fc43cc089 100644
--- a/chromium/media/cdm/cdm_context_ref_impl.cc
+++ b/chromium/media/cdm/cdm_context_ref_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_context_ref_impl.h b/chromium/media/cdm/cdm_context_ref_impl.h
index 15a3d67e81c..89166f82851 100644
--- a/chromium/media/cdm/cdm_context_ref_impl.h
+++ b/chromium/media/cdm/cdm_context_ref_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_document_service.h b/chromium/media/cdm/cdm_document_service.h
index dbeb4c34546..726e1ce9033 100644
--- a/chromium/media/cdm/cdm_document_service.h
+++ b/chromium/media/cdm/cdm_document_service.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_helpers.cc b/chromium/media/cdm/cdm_helpers.cc
index 5a15d074d20..aa76971e492 100644
--- a/chromium/media/cdm/cdm_helpers.cc
+++ b/chromium/media/cdm/cdm_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_helpers.h b/chromium/media/cdm/cdm_helpers.h
index 010908e78c0..9f4bfda67f8 100644
--- a/chromium/media/cdm/cdm_helpers.h
+++ b/chromium/media/cdm/cdm_helpers.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_host_file.cc b/chromium/media/cdm/cdm_host_file.cc
index 2c7c749cd7d..4df6c0ebaa2 100644
--- a/chromium/media/cdm/cdm_host_file.cc
+++ b/chromium/media/cdm/cdm_host_file.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_host_file.h b/chromium/media/cdm/cdm_host_file.h
index bfb1ded8bd6..421c7307dc8 100644
--- a/chromium/media/cdm/cdm_host_file.h
+++ b/chromium/media/cdm/cdm_host_file.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_host_files.cc b/chromium/media/cdm/cdm_host_files.cc
index b2cd04dd787..54a3180ee11 100644
--- a/chromium/media/cdm/cdm_host_files.cc
+++ b/chromium/media/cdm/cdm_host_files.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_host_files.h b/chromium/media/cdm/cdm_host_files.h
index 42cc500fcd5..757a1ea3406 100644
--- a/chromium/media/cdm/cdm_host_files.h
+++ b/chromium/media/cdm/cdm_host_files.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_module.cc b/chromium/media/cdm/cdm_module.cc
index 051fdc29363..83bd26b0937 100644
--- a/chromium/media/cdm/cdm_module.cc
+++ b/chromium/media/cdm/cdm_module.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,12 +7,13 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
-#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/time/time.h"
+#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "components/crash/core/common/crash_key.h"
+#include "load_cdm_uma_helper.h"
#if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION)
#include "base/feature_list.h"
@@ -32,6 +33,9 @@ namespace {
static CdmModule* g_cdm_module = nullptr;
+// UMA report prefix
+const char kUmaPrefix[] = "Media.EME.Cdm";
+
#if BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION)
void InitCdmHostVerification(
base::NativeLibrary cdm_library,
@@ -49,34 +53,6 @@ void InitCdmHostVerification(
}
#endif // BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION)
-// These enums are reported to UMA so values should not be renumbered or reused.
-enum class LoadResult {
- kLoadSuccess,
- kFileMissing, // The CDM does not exist.
- kLoadFailed, // CDM exists but LoadNativeLibrary() failed.
- kEntryPointMissing, // CDM loaded but somce required entry point missing.
- // NOTE: Add new values only immediately above this line.
- kLoadResultCount // Boundary value for UMA_HISTOGRAM_ENUMERATION.
-};
-
-void ReportLoadResult(LoadResult load_result) {
- DCHECK_LT(load_result, LoadResult::kLoadResultCount);
- UMA_HISTOGRAM_ENUMERATION("Media.EME.CdmLoadResult", load_result,
- LoadResult::kLoadResultCount);
-}
-
-void ReportLoadErrorCode(const base::NativeLibraryLoadError* error) {
-// Only report load error code on Windows because that's the only platform that
-// has a numerical error value.
-#if BUILDFLAG(IS_WIN)
- base::UmaHistogramSparse("Media.EME.CdmLoadErrorCode", error->code);
-#endif
-}
-
-void ReportLoadTime(const base::TimeDelta load_time) {
- UMA_HISTOGRAM_TIMES("Media.EME.CdmLoadTime", load_time);
-}
-
} // namespace
// static
@@ -137,14 +113,15 @@ bool CdmModule::Initialize(const base::FilePath& cdm_path) {
if (!library_.is_valid()) {
LOG(ERROR) << "CDM at " << cdm_path.value() << " could not be loaded.";
LOG(ERROR) << "Error: " << library_.GetError()->ToString();
- ReportLoadResult(base::PathExists(cdm_path) ? LoadResult::kLoadFailed
- : LoadResult::kFileMissing);
- ReportLoadErrorCode(library_.GetError());
+ ReportLoadResult(kUmaPrefix, base::PathExists(cdm_path)
+ ? CdmLoadResult::kLoadFailed
+ : CdmLoadResult::kFileMissing);
+ ReportLoadErrorCode(kUmaPrefix, library_.GetError());
return false;
}
// Only report load time for success loads.
- ReportLoadTime(load_time);
+ ReportLoadTime(kUmaPrefix, load_time);
// Get function pointers.
// TODO(xhwang): Define function names in macros to avoid typo errors.
@@ -165,13 +142,14 @@ bool CdmModule::Initialize(const base::FilePath& cdm_path) {
create_cdm_func_ = nullptr;
get_cdm_version_func_ = nullptr;
library_.reset();
- ReportLoadResult(LoadResult::kEntryPointMissing);
+ ReportLoadResult(kUmaPrefix, CdmLoadResult::kEntryPointMissing);
return false;
}
// In case of crashes, provide CDM version to facilitate investigation.
std::string cdm_version = get_cdm_version_func_();
DVLOG(2) << __func__ << ": cdm_version = " << cdm_version;
+ TRACE_EVENT1("media", "CdmModule::Initialize", "cdm_version", cdm_version);
static crash_reporter::CrashKeyString<32> cdm_version_key("cdm-version");
cdm_version_key.Set(cdm_version);
@@ -187,7 +165,7 @@ bool CdmModule::Initialize(const base::FilePath& cdm_path) {
InitCdmHostVerification(library_.get(), cdm_path_, cdm_host_file_paths);
#endif // BUILDFLAG(ENABLE_CDM_HOST_VERIFICATION)
- ReportLoadResult(LoadResult::kLoadSuccess);
+ ReportLoadResult(kUmaPrefix, CdmLoadResult::kLoadSuccess);
return true;
}
diff --git a/chromium/media/cdm/cdm_module.h b/chromium/media/cdm/cdm_module.h
index ede4e6c3054..6abd0f405f1 100644
--- a/chromium/media/cdm/cdm_module.h
+++ b/chromium/media/cdm/cdm_module.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_paths.cc b/chromium/media/cdm/cdm_paths.cc
index 1aae2c863ef..22a9d940d07 100644
--- a/chromium/media/cdm/cdm_paths.cc
+++ b/chromium/media/cdm/cdm_paths.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,7 +15,12 @@ namespace media {
// Name of the ClearKey CDM library.
const char kClearKeyCdmLibraryName[] = "clearkeycdm";
-const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm";
+const char kClearKeyCdmBaseDirectory[] =
+#if BUILDFLAG(IS_FUCHSIA)
+ "lib/"
+#endif
+ "ClearKeyCdm";
+
const char kClearKeyCdmDisplayName[] = "Clear Key CDM";
const CdmType kClearKeyCdmType{0x3a2e0fadde4bd1b7ull, 0xcb90df3e240d1694ull};
diff --git a/chromium/media/cdm/cdm_paths.h b/chromium/media/cdm/cdm_paths.h
index cabb002b862..9766053cb14 100644
--- a/chromium/media/cdm/cdm_paths.h
+++ b/chromium/media/cdm/cdm_paths.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_paths_unittest.cc b/chromium/media/cdm/cdm_paths_unittest.cc
index 1a569ef5ccf..92f6a871ff4 100644
--- a/chromium/media/cdm/cdm_paths_unittest.cc
+++ b/chromium/media/cdm/cdm_paths_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -29,6 +29,8 @@ const char kComponentPlatform[] =
"cros";
#elif BUILDFLAG(IS_LINUX)
"linux";
+#elif BUILDFLAG(IS_FUCHSIA)
+ "fuchsia";
#else
#error unsupported platform
#endif
diff --git a/chromium/media/cdm/cdm_type.h b/chromium/media/cdm/cdm_type.h
index 71cf2588471..e3f4f870dc0 100644
--- a/chromium/media/cdm/cdm_type.h
+++ b/chromium/media/cdm/cdm_type.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_type_conversion.cc b/chromium/media/cdm/cdm_type_conversion.cc
index dd40ab1ecef..9041cb7668c 100644
--- a/chromium/media/cdm/cdm_type_conversion.cc
+++ b/chromium/media/cdm/cdm_type_conversion.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_type_conversion.h b/chromium/media/cdm/cdm_type_conversion.h
index d7b303ab946..dbb83a0edd1 100644
--- a/chromium/media/cdm/cdm_type_conversion.h
+++ b/chromium/media/cdm/cdm_type_conversion.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cdm_wrapper.h b/chromium/media/cdm/cdm_wrapper.h
index 94af7f15f03..8b3b4c9cd21 100644
--- a/chromium/media/cdm/cdm_wrapper.h
+++ b/chromium/media/cdm/cdm_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cenc_decryptor.cc b/chromium/media/cdm/cenc_decryptor.cc
index 647362eea23..ce9c4b8e12c 100644
--- a/chromium/media/cdm/cenc_decryptor.cc
+++ b/chromium/media/cdm/cenc_decryptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cenc_decryptor.h b/chromium/media/cdm/cenc_decryptor.h
index f71072dd3c7..44ba4f52ec3 100644
--- a/chromium/media/cdm/cenc_decryptor.h
+++ b/chromium/media/cdm/cenc_decryptor.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cenc_decryptor_fuzzer.cc b/chromium/media/cdm/cenc_decryptor_fuzzer.cc
index 6ae2c60533b..05eecd1b0cc 100644
--- a/chromium/media/cdm/cenc_decryptor_fuzzer.cc
+++ b/chromium/media/cdm/cenc_decryptor_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cenc_decryptor_unittest.cc b/chromium/media/cdm/cenc_decryptor_unittest.cc
index 3fdfc948795..979fb2f30de 100644
--- a/chromium/media/cdm/cenc_decryptor_unittest.cc
+++ b/chromium/media/cdm/cenc_decryptor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cenc_utils.cc b/chromium/media/cdm/cenc_utils.cc
index d71fd11edb9..c680ce5fdfb 100644
--- a/chromium/media/cdm/cenc_utils.cc
+++ b/chromium/media/cdm/cenc_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cenc_utils.h b/chromium/media/cdm/cenc_utils.h
index 6f5a82792fe..d1fac539cd5 100644
--- a/chromium/media/cdm/cenc_utils.h
+++ b/chromium/media/cdm/cenc_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cenc_utils_fuzzertest.cc b/chromium/media/cdm/cenc_utils_fuzzertest.cc
index 8644b399fd3..ae9aa6fb17a 100644
--- a/chromium/media/cdm/cenc_utils_fuzzertest.cc
+++ b/chromium/media/cdm/cenc_utils_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/cenc_utils_unittest.cc b/chromium/media/cdm/cenc_utils_unittest.cc
index 587436570a8..c4d101b5f74 100644
--- a/chromium/media/cdm/cenc_utils_unittest.cc
+++ b/chromium/media/cdm/cenc_utils_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/default_cdm_factory.cc b/chromium/media/cdm/default_cdm_factory.cc
index 6e5cfc5ae5c..349c8d36807 100644
--- a/chromium/media/cdm/default_cdm_factory.cc
+++ b/chromium/media/cdm/default_cdm_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/default_cdm_factory.h b/chromium/media/cdm/default_cdm_factory.h
index 6b628e82b8a..f0b3d426d23 100644
--- a/chromium/media/cdm/default_cdm_factory.h
+++ b/chromium/media/cdm/default_cdm_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/external_clear_key_test_helper.cc b/chromium/media/cdm/external_clear_key_test_helper.cc
index febd0d402f4..cd09b2f3b20 100644
--- a/chromium/media/cdm/external_clear_key_test_helper.cc
+++ b/chromium/media/cdm/external_clear_key_test_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -31,20 +31,15 @@ ExternalClearKeyTestHelper::~ExternalClearKeyTestHelper() {
}
void ExternalClearKeyTestHelper::LoadLibrary() {
-#if BUILDFLAG(IS_FUCHSIA)
- library_path_ =
- base::FilePath(base::GetLoadableModuleName(kClearKeyCdmLibraryName));
-#else // BUILDFLAG(IS_FUCHSIA)
// Determine the location of the CDM. It is expected to be in the same
// directory as the current module.
base::FilePath cdm_base_path;
- ASSERT_TRUE(base::PathService::Get(base::DIR_MODULE, &cdm_base_path));
+ ASSERT_TRUE(base::PathService::Get(base::DIR_ASSETS, &cdm_base_path));
cdm_base_path = cdm_base_path.Append(
GetPlatformSpecificDirectory(kClearKeyCdmBaseDirectory));
library_path_ = cdm_base_path.AppendASCII(
base::GetLoadableModuleName(kClearKeyCdmLibraryName));
ASSERT_TRUE(base::PathExists(library_path_)) << library_path_.value();
-#endif // BUILDFLAG(IS_FUCHSIA)
// Now load the CDM library.
library_ = base::ScopedNativeLibrary(library_path_);
diff --git a/chromium/media/cdm/external_clear_key_test_helper.h b/chromium/media/cdm/external_clear_key_test_helper.h
index cc5c7a218db..854580d3295 100644
--- a/chromium/media/cdm/external_clear_key_test_helper.h
+++ b/chromium/media/cdm/external_clear_key_test_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/json_web_key.cc b/chromium/media/cdm/json_web_key.cc
index 0f36c8867a0..6a9e76b691d 100644
--- a/chromium/media/cdm/json_web_key.cc
+++ b/chromium/media/cdm/json_web_key.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/json_web_key.h b/chromium/media/cdm/json_web_key.h
index c490a16a513..94dc4d364a1 100644
--- a/chromium/media/cdm/json_web_key.h
+++ b/chromium/media/cdm/json_web_key.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/json_web_key_fuzzer.cc b/chromium/media/cdm/json_web_key_fuzzer.cc
index e45c518ccc9..7de3b867c4a 100644
--- a/chromium/media/cdm/json_web_key_fuzzer.cc
+++ b/chromium/media/cdm/json_web_key_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/json_web_key_unittest.cc b/chromium/media/cdm/json_web_key_unittest.cc
index ec386dda06c..c1bdb435f64 100644
--- a/chromium/media/cdm/json_web_key_unittest.cc
+++ b/chromium/media/cdm/json_web_key_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/BUILD.gn b/chromium/media/cdm/library_cdm/BUILD.gn
index a467704c4bc..0d75a55c97f 100644
--- a/chromium/media/cdm/library_cdm/BUILD.gn
+++ b/chromium/media/cdm/library_cdm/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/cdm_host_proxy.h b/chromium/media/cdm/library_cdm/cdm_host_proxy.h
index ac1ff8d5403..cc57326dc92 100644
--- a/chromium/media/cdm/library_cdm/cdm_host_proxy.h
+++ b/chromium/media/cdm/library_cdm/cdm_host_proxy.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/cdm_host_proxy_impl.h b/chromium/media/cdm/library_cdm/cdm_host_proxy_impl.h
index 4ea7cee2b93..cb813946e91 100644
--- a/chromium/media/cdm/library_cdm/cdm_host_proxy_impl.h
+++ b/chromium/media/cdm/library_cdm/cdm_host_proxy_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/cdm_paths.gni b/chromium/media/cdm/library_cdm/cdm_paths.gni
index d18f179f04d..1dd10660f81 100644
--- a/chromium/media/cdm/library_cdm/cdm_paths.gni
+++ b/chromium/media/cdm/library_cdm/cdm_paths.gni
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -21,6 +21,8 @@ if (is_chromeos) {
component_os = "win"
} else if (is_mac) {
component_os = "mac"
+} else if (is_fuchsia) {
+ component_os = "fuchsia"
} else {
assert(false, "unsupported_platform")
}
@@ -31,15 +33,16 @@ component_arch = "$current_cpu"
# components, but is optional for other platforms.
# Note:
# - |cdm_platform_specific_path| is exported as a BUILDFLAG to cdm_paths.cc.
-if (is_fuchsia) {
- cdm_platform_specific_path = ""
- clearkey_cdm_path = "lib"
- widevine_cdm_path = "lib"
-} else {
- cdm_platform_specific_path =
- "_platform_specific/$component_os" + "_" + "$component_arch"
+cdm_platform_specific_path =
+ "_platform_specific/$component_os" + "_" + "$component_arch"
- # Path of Clear Key and Widevine CDMs relative to the output dir.
- clearkey_cdm_path = "ClearKeyCdm/$cdm_platform_specific_path"
- widevine_cdm_path = "WidevineCdm/$cdm_platform_specific_path"
+# Path of Clear Key and Widevine CDMs relative to the output dir.
+clearkey_cdm_path = "ClearKeyCdm/$cdm_platform_specific_path"
+widevine_cdm_path = "WidevineCdm/$cdm_platform_specific_path"
+
+# Shared libraries must be within lib/ on Fuchsia.
+# TODO(fxbug.dev/105910): Remove when the GN SDK drops this limitation.
+if (is_fuchsia) {
+ clearkey_cdm_path = "lib/" + clearkey_cdm_path
+ widevine_cdm_path = "lib/" + clearkey_cdm_path
}
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/BUILD.gn b/chromium/media/cdm/library_cdm/clear_key_cdm/BUILD.gn
index 94deeb5ccec..37f6c3b6eef 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/BUILD.gn
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -8,7 +8,7 @@ import("//media/media_options.gni")
assert(enable_library_cdms)
-loadable_module("clear_key_cdm") {
+loadable_module("clear_key_cdm_bin") {
testonly = true
output_dir = "$root_out_dir/$clearkey_cdm_path"
output_name = "clearkeycdm"
@@ -48,3 +48,17 @@ loadable_module("clear_key_cdm") {
deps += [ "//third_party/ffmpeg" ]
}
}
+
+group("clear_key_cdm") {
+ testonly = true
+ deps = [ ":clear_key_cdm_bin" ]
+ if (is_fuchsia) {
+ # Tests that need the CDM binary must include this target in their
+ # `data_deps`. Due to the unique path of CDMs, the Fuchsia SDK will include
+ # the unstripped binary (see fxbug.dev/105910). Therefore, targets that
+ # depend on this one must add the unstripped library path to
+ # `excluded_files` when `is_fuchsia` to prevent the unstripped binary from
+ # being added to the package.
+ data = [ "$root_out_dir/$clearkey_cdm_path/libclearkeycdm.so" ]
+ }
+}
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.cc b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.cc
index f5d28505eb0..4bb44a9e9f4 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.cc
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.h b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.h
index 9ce43358bed..b9e3dd261d0 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.h
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_adapter.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.cc b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.cc
index aaacfb1f568..868dcc0b5e1 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.cc
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.h b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.h
index f4d5a40772f..b8ad857e58a 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.h
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_file_io_test.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
index 15166819bdb..69d46cb3c41 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.h b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.h
index 133af1fcaa6..ceea9df04fd 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.h
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.cc b/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.cc
index 5461f9833bc..f5f07034029 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.cc
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.h b/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.h
index ef478f6e648..0348d5e1335 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.h
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_cdm.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.cc b/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.cc
index ea19b0b1dbf..0385ac972b9 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.cc
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.h b/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.h
index e1f800875bc..fca9452810d 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.h
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/clear_key_persistent_session_cdm.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc b/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc
index 9b1ad9f7675..eb7765ec30b 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.h b/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.h
index 9bb56b9a41c..be4d7e5ca0f 100644
--- a/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.h
+++ b/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/mock_library_cdm.cc b/chromium/media/cdm/library_cdm/mock_library_cdm.cc
index 46a1c576e60..df90fd6d135 100644
--- a/chromium/media/cdm/library_cdm/mock_library_cdm.cc
+++ b/chromium/media/cdm/library_cdm/mock_library_cdm.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/library_cdm/mock_library_cdm.h b/chromium/media/cdm/library_cdm/mock_library_cdm.h
index 032a5cdcbae..2b2fa2db5d9 100644
--- a/chromium/media/cdm/library_cdm/mock_library_cdm.h
+++ b/chromium/media/cdm/library_cdm/mock_library_cdm.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/load_cdm_uma_helper.cc b/chromium/media/cdm/load_cdm_uma_helper.cc
new file mode 100644
index 00000000000..12e9d615816
--- /dev/null
+++ b/chromium/media/cdm/load_cdm_uma_helper.cc
@@ -0,0 +1,35 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "load_cdm_uma_helper.h"
+
+#include <string>
+
+#include "base/metrics/histogram_functions.h"
+#include "base/native_library.h"
+#include "base/time/time.h"
+
+namespace media {
+
+void ReportLoadResult(const std::string& uma_prefix,
+ CdmLoadResult load_result) {
+ DCHECK_LE(load_result, CdmLoadResult::kMaxValue);
+ base::UmaHistogramEnumeration(uma_prefix + "LoadResult", load_result);
+}
+
+void ReportLoadErrorCode(const std::string& uma_prefix,
+ const base::NativeLibraryLoadError* error) {
+// Only report load error code on Windows because that's the only platform that
+// has a numerical error value.
+#if BUILDFLAG(IS_WIN)
+ base::UmaHistogramSparse(uma_prefix + "LoadErrorCode", error->code);
+#endif
+}
+
+void ReportLoadTime(const std::string& uma_prefix,
+ const base::TimeDelta load_time) {
+ base::UmaHistogramTimes(uma_prefix + "LoadTime", load_time);
+}
+
+} // namespace media
diff --git a/chromium/media/cdm/load_cdm_uma_helper.h b/chromium/media/cdm/load_cdm_uma_helper.h
new file mode 100644
index 00000000000..4ee148c621a
--- /dev/null
+++ b/chromium/media/cdm/load_cdm_uma_helper.h
@@ -0,0 +1,40 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_CDM_LOAD_CDM_UMA_HELPER_H_
+#define MEDIA_CDM_LOAD_CDM_UMA_HELPER_H_
+
+#include <string>
+
+#include "base/native_library.h"
+#include "base/time/time.h"
+
+namespace media {
+
+// These enums are reported to UMA so values should not be renumbered or
+// reused.
+enum class CdmLoadResult {
+ kLoadSuccess,
+ kFileMissing, // The CDM does not exist.
+ kLoadFailed, // CDM exists but LoadNativeLibrary() failed.
+ kEntryPointMissing, // CDM loaded but some required entry point missing.
+ kActivateCdmFactoryFailed, // CDM loaded but ActivateCdmFactory() failed.
+ kMaxValue =
+ kActivateCdmFactoryFailed // Max value for Uma Histogram Enumeration.
+};
+
+// Reports the result of loading CDM library to UMA.
+void ReportLoadResult(const std::string& uma_prefix, CdmLoadResult load_result);
+
+// Reports the error code of loading CDM library to UMA.
+void ReportLoadErrorCode(const std::string& uma_prefix,
+ const base::NativeLibraryLoadError* error);
+
+// Reports the loading time of CDM library to UMA.
+void ReportLoadTime(const std::string& uma_prefix,
+ const base::TimeDelta load_time);
+
+} // namespace media
+
+#endif // MEDIA_CDM_LOAD_CDM_UMA_HELPER_H_
diff --git a/chromium/media/cdm/media_foundation_cdm_data.cc b/chromium/media/cdm/media_foundation_cdm_data.cc
index 0d21a94b20e..926126fc8b2 100644
--- a/chromium/media/cdm/media_foundation_cdm_data.cc
+++ b/chromium/media/cdm/media_foundation_cdm_data.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/media_foundation_cdm_data.h b/chromium/media/cdm/media_foundation_cdm_data.h
index b0967cd6f99..36b0efa0618 100644
--- a/chromium/media/cdm/media_foundation_cdm_data.h
+++ b/chromium/media/cdm/media_foundation_cdm_data.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/mock_helpers.cc b/chromium/media/cdm/mock_helpers.cc
index 4934a98dfc3..505f669c1d8 100644
--- a/chromium/media/cdm/mock_helpers.cc
+++ b/chromium/media/cdm/mock_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/mock_helpers.h b/chromium/media/cdm/mock_helpers.h
index cae84000d14..00bf6abc5f8 100644
--- a/chromium/media/cdm/mock_helpers.h
+++ b/chromium/media/cdm/mock_helpers.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/output_protection.h b/chromium/media/cdm/output_protection.h
index bd58865b881..0d543a7cac7 100644
--- a/chromium/media/cdm/output_protection.h
+++ b/chromium/media/cdm/output_protection.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/simple_cdm_allocator.cc b/chromium/media/cdm/simple_cdm_allocator.cc
index 854ad8cf7ea..45e39b9371f 100644
--- a/chromium/media/cdm/simple_cdm_allocator.cc
+++ b/chromium/media/cdm/simple_cdm_allocator.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/simple_cdm_allocator.h b/chromium/media/cdm/simple_cdm_allocator.h
index 2fc25ef7306..f90d768ce93 100644
--- a/chromium/media/cdm/simple_cdm_allocator.h
+++ b/chromium/media/cdm/simple_cdm_allocator.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/simple_cdm_allocator_unittest.cc b/chromium/media/cdm/simple_cdm_allocator_unittest.cc
index 371053429b1..0a89cb355a0 100644
--- a/chromium/media/cdm/simple_cdm_allocator_unittest.cc
+++ b/chromium/media/cdm/simple_cdm_allocator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/simple_cdm_buffer.cc b/chromium/media/cdm/simple_cdm_buffer.cc
index ea2a5d357d4..09b617302aa 100644
--- a/chromium/media/cdm/simple_cdm_buffer.cc
+++ b/chromium/media/cdm/simple_cdm_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/simple_cdm_buffer.h b/chromium/media/cdm/simple_cdm_buffer.h
index 8dc9171b909..64b54d0b5e0 100644
--- a/chromium/media/cdm/simple_cdm_buffer.h
+++ b/chromium/media/cdm/simple_cdm_buffer.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/supported_audio_codecs.cc b/chromium/media/cdm/supported_audio_codecs.cc
index 0765602d3c0..0bfc512c4e6 100644
--- a/chromium/media/cdm/supported_audio_codecs.cc
+++ b/chromium/media/cdm/supported_audio_codecs.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/supported_audio_codecs.h b/chromium/media/cdm/supported_audio_codecs.h
index 00d28c934ea..1e0d278d1d5 100644
--- a/chromium/media/cdm/supported_audio_codecs.h
+++ b/chromium/media/cdm/supported_audio_codecs.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/supported_cdm_versions.cc b/chromium/media/cdm/supported_cdm_versions.cc
index eca81444316..88286e72f9c 100644
--- a/chromium/media/cdm/supported_cdm_versions.cc
+++ b/chromium/media/cdm/supported_cdm_versions.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/supported_cdm_versions.h b/chromium/media/cdm/supported_cdm_versions.h
index 25bb6ed3f33..57a27078132 100644
--- a/chromium/media/cdm/supported_cdm_versions.h
+++ b/chromium/media/cdm/supported_cdm_versions.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm.cc b/chromium/media/cdm/win/media_foundation_cdm.cc
index 27f3b99b0c7..01f72af259b 100644
--- a/chromium/media/cdm/win/media_foundation_cdm.cc
+++ b/chromium/media/cdm/win/media_foundation_cdm.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,6 +18,7 @@
#include "base/win/win_util.h"
#include "base/win/windows_version.h"
#include "media/base/cdm_promise.h"
+#include "media/base/win/hresults.h"
#include "media/base/win/media_foundation_cdm_proxy.h"
#include "media/base/win/mf_helpers.h"
#include "media/cdm/win/media_foundation_cdm_module.h"
@@ -237,7 +238,7 @@ class CdmProxyImpl : public MediaFoundationCdmProxy {
RETURN_IF_FAILED(
mf_cdm_->GetProtectionSystemIds(&protection_system_ids, &count));
if (count == 0)
- return E_FAIL;
+ return kErrorZeroProtectionSystemId;
*protection_system_id = *protection_system_ids;
DVLOG(2) << __func__ << " protection_system_id="
diff --git a/chromium/media/cdm/win/media_foundation_cdm.h b/chromium/media/cdm/win/media_foundation_cdm.h
index 7f232239a34..0d1745545e1 100644
--- a/chromium/media/cdm/win/media_foundation_cdm.h
+++ b/chromium/media/cdm/win/media_foundation_cdm.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm_factory.cc b/chromium/media/cdm/win/media_foundation_cdm_factory.cc
index c016f125eb8..670ec04e0a7 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_factory.cc
+++ b/chromium/media/cdm/win/media_foundation_cdm_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -150,9 +150,7 @@ HRESULT MediaFoundationCdmFactory::GetCdmFactory(
auto itr = create_cdm_factory_cbs_for_testing_.find(key_system);
if (itr != create_cdm_factory_cbs_for_testing_.end()) {
auto& create_cdm_factory_cb = itr->second;
- if (!create_cdm_factory_cb)
- return E_FAIL;
-
+ DCHECK(create_cdm_factory_cb);
RETURN_IF_FAILED(create_cdm_factory_cb.Run(cdm_factory));
return S_OK;
}
diff --git a/chromium/media/cdm/win/media_foundation_cdm_factory.h b/chromium/media/cdm/win/media_foundation_cdm_factory.h
index 3bca73ff4ec..8903b4207e9 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_factory.h
+++ b/chromium/media/cdm/win/media_foundation_cdm_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm_factory_unittest.cc b/chromium/media/cdm/win/media_foundation_cdm_factory_unittest.cc
index 79907fa8653..f48160c8169 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_factory_unittest.cc
+++ b/chromium/media/cdm/win/media_foundation_cdm_factory_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm_module.cc b/chromium/media/cdm/win/media_foundation_cdm_module.cc
index b633095a045..a77e2249e5f 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_module.cc
+++ b/chromium/media/cdm/win/media_foundation_cdm_module.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,9 +6,12 @@
#include "base/files/file_util.h"
#include "base/logging.h"
+#include "base/metrics/histogram_functions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/scoped_hstring.h"
+#include "media/base/win/hresults.h"
#include "media/base/win/mf_helpers.h"
+#include "media/cdm/load_cdm_uma_helper.h"
namespace media {
@@ -18,6 +21,9 @@ using Microsoft::WRL::ComPtr;
static MediaFoundationCdmModule* g_cdm_module = nullptr;
+// UMA report prefix
+const char kUmaPrefix[] = "Media.EME.MediaFoundationCdm.";
+
} // namespace
// static
@@ -41,10 +47,21 @@ void MediaFoundationCdmModule::Initialize(const base::FilePath& cdm_path) {
// If `cdm_path_` is not empty, load the CDM before the sandbox is sealed.
if (!cdm_path_.empty()) {
+ base::TimeTicks start = base::TimeTicks::Now();
library_ = base::ScopedNativeLibrary(cdm_path_);
- LOG_IF(ERROR, !library_.is_valid())
- << __func__ << ": Failed to load CDM at " << cdm_path_.value()
- << " (Error: " << library_.GetError()->ToString() << ")";
+ base::TimeDelta load_time = base::TimeTicks::Now() - start;
+ if (!library_.is_valid()) {
+ LOG(ERROR) << __func__ << ": Failed to load CDM at " << cdm_path_.value()
+ << " (Error: " << library_.GetError()->ToString() << ")";
+ ReportLoadResult(kUmaPrefix, base::PathExists(cdm_path)
+ ? CdmLoadResult::kLoadFailed
+ : CdmLoadResult::kFileMissing);
+ ReportLoadErrorCode(kUmaPrefix, library_.GetError());
+ return;
+ }
+
+ // Only report load time for success loads.
+ ReportLoadTime(kUmaPrefix, load_time);
}
}
@@ -69,8 +86,17 @@ HRESULT MediaFoundationCdmModule::GetCdmFactory(
return E_NOT_VALID_STATE;
}
- if (!cdm_factory_)
- RETURN_IF_FAILED(ActivateCdmFactory());
+ if (!cdm_factory_) {
+ auto hr = ActivateCdmFactory();
+ if (FAILED(hr)) {
+ ReportLoadResult(kUmaPrefix, CdmLoadResult::kActivateCdmFactoryFailed);
+ base::UmaHistogramSparse(
+ std::string(kUmaPrefix) + "ActivateCdmFactoryResult", hr);
+ return hr;
+ }
+
+ ReportLoadResult(kUmaPrefix, CdmLoadResult::kLoadSuccess);
+ }
cdm_factory = cdm_factory_;
return S_OK;
@@ -94,12 +120,12 @@ HRESULT MediaFoundationCdmModule::ActivateCdmFactory() {
if (!library_.is_valid()) {
LOG(ERROR) << "CDM failed to load previously";
- return E_FAIL;
+ return kErrorLoadLibrary;
}
// Initialization required to call base::win::ScopedHString::Create();
if (!base::win::ScopedHString::ResolveCoreWinRTStringDelayload())
- return E_FAIL;
+ return kErrorResolveCoreWinRTStringDelayload;
// Get function pointer to the activation factory.
using GetActivationFactoryFunc =
@@ -110,7 +136,7 @@ HRESULT MediaFoundationCdmModule::ActivateCdmFactory() {
library_.GetFunctionPointer(kDllGetActivationFactory));
if (!get_activation_factory_func) {
LOG(ERROR) << "Cannot get function " << kDllGetActivationFactory;
- return E_FAIL;
+ return kErrorGetFunctionPointer;
}
// Activate CdmFactory. Assuming the class ID is always in the format
diff --git a/chromium/media/cdm/win/media_foundation_cdm_module.h b/chromium/media/cdm/win/media_foundation_cdm_module.h
index b65d1786c1f..1ba9a46e555 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_module.h
+++ b/chromium/media/cdm/win/media_foundation_cdm_module.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm_session.cc b/chromium/media/cdm/win/media_foundation_cdm_session.cc
index d67cb15fd93..5dfa142002a 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_session.cc
+++ b/chromium/media/cdm/win/media_foundation_cdm_session.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm_session.h b/chromium/media/cdm/win/media_foundation_cdm_session.h
index 7087fa255ab..054af661fd8 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_session.h
+++ b/chromium/media/cdm/win/media_foundation_cdm_session.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm_session_unittest.cc b/chromium/media/cdm/win/media_foundation_cdm_session_unittest.cc
index f8964556db8..f06f244c263 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_session_unittest.cc
+++ b/chromium/media/cdm/win/media_foundation_cdm_session_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm_unittest.cc b/chromium/media/cdm/win/media_foundation_cdm_unittest.cc
index 90e99244ea0..75b5801355b 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_unittest.cc
+++ b/chromium/media/cdm/win/media_foundation_cdm_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm_util.cc b/chromium/media/cdm/win/media_foundation_cdm_util.cc
index 6ab78f60e32..351db43be39 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_util.cc
+++ b/chromium/media/cdm/win/media_foundation_cdm_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/cdm/win/media_foundation_cdm_util.h b/chromium/media/cdm/win/media_foundation_cdm_util.h
index f37c1849d5d..ceb02c2d904 100644
--- a/chromium/media/cdm/win/media_foundation_cdm_util.h
+++ b/chromium/media/cdm/win/media_foundation_cdm_util.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/device_monitors/BUILD.gn b/chromium/media/device_monitors/BUILD.gn
index 9345776627b..73f77d514da 100644
--- a/chromium/media/device_monitors/BUILD.gn
+++ b/chromium/media/device_monitors/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/device_monitors/device_monitor_mac.h b/chromium/media/device_monitors/device_monitor_mac.h
index ca1e8cb23f9..b0ee1998f8d 100644
--- a/chromium/media/device_monitors/device_monitor_mac.h
+++ b/chromium/media/device_monitors/device_monitor_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/device_monitors/device_monitor_mac.mm b/chromium/media/device_monitors/device_monitor_mac.mm
index e36a0c64196..d704965bed7 100644
--- a/chromium/media/device_monitors/device_monitor_mac.mm
+++ b/chromium/media/device_monitors/device_monitor_mac.mm
@@ -1,17 +1,20 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/device_monitors/device_monitor_mac.h"
#include <AVFoundation/AVFoundation.h>
+
#include <set>
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h"
#include "base/memory/raw_ptr.h"
+#include "base/ranges/algorithm.h"
#include "base/task/task_runner_util.h"
#include "base/threading/thread_checker.h"
@@ -92,7 +95,7 @@ void DeviceMonitorMacImpl::ConsolidateDevicesListAndNotify(
std::vector<DeviceInfo>::const_iterator it;
for (it = snapshot_devices.begin(); it != snapshot_devices.end(); ++it) {
std::vector<DeviceInfo>::iterator cached_devices_iterator =
- std::find(cached_devices_.begin(), cached_devices_.end(), *it);
+ base::ranges::find(cached_devices_, *it);
if (cached_devices_iterator == cached_devices_.end()) {
video_device_added |= ((it->type() == DeviceInfo::kVideo) ||
(it->type() == DeviceInfo::kMuxed));
@@ -374,8 +377,7 @@ void AVFoundationMonitorImpl::OnDeviceChanged() {
DCHECK(_mainThreadChecker.CalledOnValidThread());
DCHECK(device != nil);
// Skip this device if there are already observers connected to it.
- if (std::find(_monitoredDevices.begin(), _monitoredDevices.end(), device) !=
- _monitoredDevices.end()) {
+ if (base::Contains(_monitoredDevices, device)) {
return;
}
[device addObserver:self
@@ -394,7 +396,7 @@ void AVFoundationMonitorImpl::OnDeviceChanged() {
DCHECK(device != nil);
std::set<base::scoped_nsobject<AVCaptureDevice>>::iterator found =
- std::find(_monitoredDevices.begin(), _monitoredDevices.end(), device);
+ base::ranges::find(_monitoredDevices, device);
DCHECK(found != _monitoredDevices.end());
[self removeObservers:*found];
_monitoredDevices.erase(found);
diff --git a/chromium/media/device_monitors/device_monitor_udev.cc b/chromium/media/device_monitors/device_monitor_udev.cc
index 94d938004fe..0a3d067b233 100644
--- a/chromium/media/device_monitors/device_monitor_udev.cc
+++ b/chromium/media/device_monitors/device_monitor_udev.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/device_monitors/device_monitor_udev.h b/chromium/media/device_monitors/device_monitor_udev.h
index 38ca4bbc098..7e8146c7fd8 100644
--- a/chromium/media/device_monitors/device_monitor_udev.h
+++ b/chromium/media/device_monitors/device_monitor_udev.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/device_monitors/system_message_window_win.cc b/chromium/media/device_monitors/system_message_window_win.cc
index df421bde6f5..f343c607c80 100644
--- a/chromium/media/device_monitors/system_message_window_win.cc
+++ b/chromium/media/device_monitors/system_message_window_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/device_monitors/system_message_window_win.h b/chromium/media/device_monitors/system_message_window_win.h
index c30026decdc..576c1d5dc06 100644
--- a/chromium/media/device_monitors/system_message_window_win.h
+++ b/chromium/media/device_monitors/system_message_window_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/device_monitors/system_message_window_win_unittest.cc b/chromium/media/device_monitors/system_message_window_win_unittest.cc
index 96912d96ee1..d3511df7067 100644
--- a/chromium/media/device_monitors/system_message_window_win_unittest.cc
+++ b/chromium/media/device_monitors/system_message_window_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/BUILD.gn b/chromium/media/ffmpeg/BUILD.gn
index 72a6eba4de1..1254dc85837 100644
--- a/chromium/media/ffmpeg/BUILD.gn
+++ b/chromium/media/ffmpeg/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_common.cc b/chromium/media/ffmpeg/ffmpeg_common.cc
index 9500983595f..899d7521d3a 100644
--- a/chromium/media/ffmpeg/ffmpeg_common.cc
+++ b/chromium/media/ffmpeg/ffmpeg_common.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -37,6 +37,14 @@ EncryptionScheme GetEncryptionScheme(const AVStream* stream) {
return key ? EncryptionScheme::kCenc : EncryptionScheme::kUnencrypted;
}
+VideoDecoderConfig::AlphaMode GetAlphaMode(const AVStream* stream) {
+ AVDictionaryEntry* alpha_mode =
+ av_dict_get(stream->metadata, "alpha_mode", nullptr, 0);
+ return alpha_mode && !strcmp(alpha_mode->value, "1")
+ ? VideoDecoderConfig::AlphaMode::kHasAlpha
+ : VideoDecoderConfig::AlphaMode::kIsOpaque;
+}
+
} // namespace
// Why AV_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
@@ -498,6 +506,7 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
// for now, but may not always be true forever. Fix this in the future.
gfx::Rect visible_rect(codec_context->width, codec_context->height);
gfx::Size coded_size = visible_rect.size();
+ gfx::HDRMetadata hdr_metadata;
// In some cases a container may have a DAR but no PAR, but FFmpeg translates
// everything to PAR. It is possible to get the render width and height, but I
@@ -534,6 +543,9 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
codec_context->color_range == AVCOL_RANGE_JPEG
? gfx::ColorSpace::RangeID::FULL
: gfx::ColorSpace::RangeID::LIMITED);
+
+ VideoDecoderConfig::AlphaMode alpha_mode = GetAlphaMode(stream);
+
switch (codec) {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
case VideoCodec::kH264: {
@@ -572,6 +584,8 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
// the container
color_space = hevc_config.GetColorSpace();
}
+ hdr_metadata = hevc_config.GetHDRMetadata();
+ alpha_mode = hevc_config.GetAlphaMode();
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
}
}
@@ -652,9 +666,6 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
profile = ProfileIDToVideoCodecProfile(codec_context->profile);
}
- auto* alpha_mode = av_dict_get(stream->metadata, "alpha_mode", nullptr, 0);
- const bool has_alpha = alpha_mode && !strcmp(alpha_mode->value, "1");
-
void* display_matrix =
av_stream_get_side_data(stream, AV_PKT_DATA_DISPLAYMATRIX, nullptr);
@@ -707,12 +718,9 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
codec_context->extradata + codec_context->extradata_size);
}
// TODO(tmathmeyer) ffmpeg can't provide us with an actual video rotation yet.
- config->Initialize(codec, profile,
- has_alpha ? VideoDecoderConfig::AlphaMode::kHasAlpha
- : VideoDecoderConfig::AlphaMode::kIsOpaque,
- color_space, video_transformation, coded_size,
- visible_rect, natural_size, extra_data,
- GetEncryptionScheme(stream));
+ config->Initialize(codec, profile, alpha_mode, color_space,
+ video_transformation, coded_size, visible_rect,
+ natural_size, extra_data, GetEncryptionScheme(stream));
// Set the aspect ratio explicitly since our version hasn't been rounded.
config->set_aspect_ratio(aspect_ratio);
@@ -722,7 +730,6 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
if (side_data.type != AV_PKT_DATA_MASTERING_DISPLAY_METADATA)
continue;
- gfx::HDRMetadata hdr_metadata{};
AVMasteringDisplayMetadata* metadata =
reinterpret_cast<AVMasteringDisplayMetadata*>(side_data.data);
if (metadata->has_primaries) {
@@ -744,10 +751,13 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
hdr_metadata.color_volume_metadata.luminance_min =
av_q2d(metadata->min_luminance);
}
- config->set_hdr_metadata(hdr_metadata);
}
}
+ if (hdr_metadata.IsValid()) {
+ config->set_hdr_metadata(hdr_metadata);
+ }
+
return true;
}
diff --git a/chromium/media/ffmpeg/ffmpeg_common.h b/chromium/media/ffmpeg/ffmpeg_common.h
index 97d6307e284..cac69b08109 100644
--- a/chromium/media/ffmpeg/ffmpeg_common.h
+++ b/chromium/media/ffmpeg/ffmpeg_common.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_common_unittest.cc b/chromium/media/ffmpeg/ffmpeg_common_unittest.cc
index e391f55e05b..a44d7eda796 100644
--- a/chromium/media/ffmpeg/ffmpeg_common_unittest.cc
+++ b/chromium/media/ffmpeg/ffmpeg_common_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_decoding_loop.cc b/chromium/media/ffmpeg/ffmpeg_decoding_loop.cc
index a005f0197cd..63de64aeb41 100644
--- a/chromium/media/ffmpeg/ffmpeg_decoding_loop.cc
+++ b/chromium/media/ffmpeg/ffmpeg_decoding_loop.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_decoding_loop.h b/chromium/media/ffmpeg/ffmpeg_decoding_loop.h
index 99b264f7508..ab71f712e4e 100644
--- a/chromium/media/ffmpeg/ffmpeg_decoding_loop.h
+++ b/chromium/media/ffmpeg/ffmpeg_decoding_loop.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_deleters.h b/chromium/media/ffmpeg/ffmpeg_deleters.h
index 346c862603a..3246f6a108a 100644
--- a/chromium/media/ffmpeg/ffmpeg_deleters.h
+++ b/chromium/media/ffmpeg/ffmpeg_deleters.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_regression_tests.cc b/chromium/media/ffmpeg/ffmpeg_regression_tests.cc
index ca8db2426f8..ba71809085b 100644
--- a/chromium/media/ffmpeg/ffmpeg_regression_tests.cc
+++ b/chromium/media/ffmpeg/ffmpeg_regression_tests.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/ffmpeg/scoped_av_packet.cc b/chromium/media/ffmpeg/scoped_av_packet.cc
index bb9b7b4a968..458c3021d33 100644
--- a/chromium/media/ffmpeg/scoped_av_packet.cc
+++ b/chromium/media/ffmpeg/scoped_av_packet.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/scoped_av_packet.h b/chromium/media/ffmpeg/scoped_av_packet.h
index 17d2aabc9e3..9635f31d7df 100644
--- a/chromium/media/ffmpeg/scoped_av_packet.h
+++ b/chromium/media/ffmpeg/scoped_av_packet.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/scoped_av_packet_unittest.cc b/chromium/media/ffmpeg/scoped_av_packet_unittest.cc
index ad58d265b7b..0420bb2d7c2 100644
--- a/chromium/media/ffmpeg/scoped_av_packet_unittest.cc
+++ b/chromium/media/ffmpeg/scoped_av_packet_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/BUILD.gn b/chromium/media/filters/BUILD.gn
index 9677fa2e334..129afcc53db 100644
--- a/chromium/media/filters/BUILD.gn
+++ b/chromium/media/filters/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -99,6 +99,13 @@ source_set("filters") {
"h264_to_annex_b_bitstream_converter.cc",
"h264_to_annex_b_bitstream_converter.h",
]
+
+ if (enable_platform_hevc) {
+ sources += [
+ "h265_to_annex_b_bitstream_converter.cc",
+ "h265_to_annex_b_bitstream_converter.h",
+ ]
+ }
}
if (media_use_ffmpeg) {
@@ -207,6 +214,12 @@ source_set("filters") {
"mac/audio_toolbox_audio_encoder.h",
]
}
+ if (is_win && enable_platform_dts_audio) {
+ sources += [
+ "passthrough_dts_audio_decoder.cc",
+ "passthrough_dts_audio_decoder.h",
+ ]
+ }
if (is_win) {
sources += [
"win/media_foundation_utils.cc",
@@ -379,6 +392,10 @@ source_set("unit_tests") {
if (proprietary_codecs) {
sources += [ "h264_to_annex_b_bitstream_converter_unittest.cc" ]
+ if (enable_platform_hevc) {
+ sources += [ "h265_to_annex_b_bitstream_converter_unittest.cc" ]
+ }
+
if (media_use_ffmpeg) {
sources += [
"ffmpeg_aac_bitstream_converter_unittest.cc",
diff --git a/chromium/media/filters/android/media_codec_audio_decoder.cc b/chromium/media/filters/android/media_codec_audio_decoder.cc
index ab4703111b5..f90596d7cdd 100644
--- a/chromium/media/filters/android/media_codec_audio_decoder.cc
+++ b/chromium/media/filters/android/media_codec_audio_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -173,13 +173,9 @@ bool MediaCodecAudioDecoder::CreateMediaCodecLoop() {
std::unique_ptr<MediaCodecBridge> audio_codec_bridge(
MediaCodecBridgeImpl::CreateAudioDecoder(
config_, media_crypto,
- // Use the asynchronous API if we're on Marshallow or higher.
- base::android::BuildInfo::GetInstance()->sdk_int() >=
- base::android::SDK_VERSION_MARSHMALLOW
- ? BindToCurrentLoop(base::BindRepeating(
- &MediaCodecAudioDecoder::PumpMediaCodecLoop,
- weak_factory_.GetWeakPtr()))
- : base::RepeatingClosure()));
+ BindToCurrentLoop(
+ base::BindRepeating(&MediaCodecAudioDecoder::PumpMediaCodecLoop,
+ weak_factory_.GetWeakPtr()))));
if (!audio_codec_bridge) {
DLOG(ERROR) << __func__ << " failed: cannot create MediaCodecBridge";
return false;
@@ -447,10 +443,12 @@ bool MediaCodecAudioDecoder::OnDecodedFrame(
} else if (config_.codec() == AudioCodec::kEAC3) {
frame_count = Ac3Util::ParseTotalEac3SampleCount(
audio_buffer->channel_data()[0], out.size);
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
} else if (config_.codec() == AudioCodec::kDTS) {
frame_count = media::dts::ParseTotalSampleCount(
audio_buffer->channel_data()[0], out.size, AudioCodec::kDTS);
DVLOG(2) << ": DTS Frame Count = " << frame_count;
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
} else {
NOTREACHED() << "Unsupported passthrough format.";
}
diff --git a/chromium/media/filters/android/media_codec_audio_decoder.h b/chromium/media/filters/android/media_codec_audio_decoder.h
index 7971cf36550..e904fa9c3da 100644
--- a/chromium/media/filters/android/media_codec_audio_decoder.h
+++ b/chromium/media/filters/android/media_codec_audio_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/android/video_frame_extractor.cc b/chromium/media/filters/android/video_frame_extractor.cc
index f81f1b6d388..0833dc25192 100644
--- a/chromium/media/filters/android/video_frame_extractor.cc
+++ b/chromium/media/filters/android/video_frame_extractor.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/android/video_frame_extractor.h b/chromium/media/filters/android/video_frame_extractor.h
index afade764c04..9203a07fd67 100644
--- a/chromium/media/filters/android/video_frame_extractor.h
+++ b/chromium/media/filters/android/video_frame_extractor.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/android/video_frame_extractor_unittest.cc b/chromium/media/filters/android/video_frame_extractor_unittest.cc
index 4fcd0972c81..82425e7cfb9 100644
--- a/chromium/media/filters/android/video_frame_extractor_unittest.cc
+++ b/chromium/media/filters/android/video_frame_extractor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_clock.cc b/chromium/media/filters/audio_clock.cc
index 73d6806e9d6..77c6b055114 100644
--- a/chromium/media/filters/audio_clock.cc
+++ b/chromium/media/filters/audio_clock.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_clock.h b/chromium/media/filters/audio_clock.h
index 1dff64d416e..422b086bb96 100644
--- a/chromium/media/filters/audio_clock.h
+++ b/chromium/media/filters/audio_clock.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_clock_unittest.cc b/chromium/media/filters/audio_clock_unittest.cc
index 631d163e9f1..a03a4b2e161 100644
--- a/chromium/media/filters/audio_clock_unittest.cc
+++ b/chromium/media/filters/audio_clock_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_decoder_stream_unittest.cc b/chromium/media/filters/audio_decoder_stream_unittest.cc
index 474ac3ffca3..a3b920e95c6 100644
--- a/chromium/media/filters/audio_decoder_stream_unittest.cc
+++ b/chromium/media/filters/audio_decoder_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_decoder_unittest.cc b/chromium/media/filters/audio_decoder_unittest.cc
index b64e63df3cb..e7f422a371c 100644
--- a/chromium/media/filters/audio_decoder_unittest.cc
+++ b/chromium/media/filters/audio_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_file_reader.cc b/chromium/media/filters/audio_file_reader.cc
index 951c003956f..200788edca5 100644
--- a/chromium/media/filters/audio_file_reader.cc
+++ b/chromium/media/filters/audio_file_reader.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_file_reader.h b/chromium/media/filters/audio_file_reader.h
index 0d8a46d4926..885eea20d21 100644
--- a/chromium/media/filters/audio_file_reader.h
+++ b/chromium/media/filters/audio_file_reader.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_file_reader_unittest.cc b/chromium/media/filters/audio_file_reader_unittest.cc
index 1f45a50cace..a1c633d4019 100644
--- a/chromium/media/filters/audio_file_reader_unittest.cc
+++ b/chromium/media/filters/audio_file_reader_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -205,7 +205,7 @@ TEST_F(AudioFileReaderTest, CorruptMP3) {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
TEST_F(AudioFileReaderTest, AAC) {
RunTest("sfx.m4a", "0.79,2.31,4.15,4.92,4.04,1.44,", 1, 44100,
- base::Microseconds(371660), 16391, 12701);
+ base::Microseconds(347665), 15333, 12701);
}
TEST_F(AudioFileReaderTest, AAC_SinglePacket) {
diff --git a/chromium/media/filters/audio_renderer_algorithm.cc b/chromium/media/filters/audio_renderer_algorithm.cc
index 12195522a4e..9fe07032a5e 100644
--- a/chromium/media/filters/audio_renderer_algorithm.cc
+++ b/chromium/media/filters/audio_renderer_algorithm.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_renderer_algorithm.h b/chromium/media/filters/audio_renderer_algorithm.h
index 77cbed26232..84238e03a67 100644
--- a/chromium/media/filters/audio_renderer_algorithm.h
+++ b/chromium/media/filters/audio_renderer_algorithm.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_renderer_algorithm_unittest.cc b/chromium/media/filters/audio_renderer_algorithm_unittest.cc
index d7f7e570a0d..f39cc12e388 100644
--- a/chromium/media/filters/audio_renderer_algorithm_unittest.cc
+++ b/chromium/media/filters/audio_renderer_algorithm_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -117,8 +117,9 @@ class AudioRendererAlgorithmTest : public testing::Test {
else if (sample_format == kSampleFormatDts)
format = media::AudioParameters::AUDIO_BITSTREAM_DTS;
- AudioParameters params(format, channel_layout, samples_per_second,
- frames_per_buffer);
+ AudioParameters params(format,
+ ChannelLayoutConfig(channel_layout, channels_),
+ samples_per_second, frames_per_buffer);
is_bitstream_format_ = params.IsBitstreamFormat();
bool is_encrypted = false;
algorithm_.Initialize(params, is_encrypted);
@@ -345,11 +346,12 @@ class AudioRendererAlgorithmTest : public testing::Test {
void WsolaTest(double playback_rate) {
const int kSampleRateHz = 48000;
- const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
+ constexpr ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
const int kNumFrames = kSampleRateHz / 100; // 10 milliseconds.
channels_ = ChannelLayoutToChannelCount(kChannelLayout);
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
kSampleRateHz, kNumFrames);
bool is_encrypted = false;
algorithm_.Initialize(params, is_encrypted);
diff --git a/chromium/media/filters/audio_timestamp_validator.cc b/chromium/media/filters/audio_timestamp_validator.cc
index e8b7b46cc24..ec7fcaa60c6 100644
--- a/chromium/media/filters/audio_timestamp_validator.cc
+++ b/chromium/media/filters/audio_timestamp_validator.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_timestamp_validator.h b/chromium/media/filters/audio_timestamp_validator.h
index 45b07e33e50..6bbf8b61bcb 100644
--- a/chromium/media/filters/audio_timestamp_validator.h
+++ b/chromium/media/filters/audio_timestamp_validator.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_timestamp_validator_unittest.cc b/chromium/media/filters/audio_timestamp_validator_unittest.cc
index 2d86430798d..cd7b5949429 100644
--- a/chromium/media/filters/audio_timestamp_validator_unittest.cc
+++ b/chromium/media/filters/audio_timestamp_validator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_video_metadata_extractor.cc b/chromium/media/filters/audio_video_metadata_extractor.cc
index af9e84f50c0..c2eb0169c94 100644
--- a/chromium/media/filters/audio_video_metadata_extractor.cc
+++ b/chromium/media/filters/audio_video_metadata_extractor.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_video_metadata_extractor.h b/chromium/media/filters/audio_video_metadata_extractor.h
index d552432b178..b934f8b3b3b 100644
--- a/chromium/media/filters/audio_video_metadata_extractor.h
+++ b/chromium/media/filters/audio_video_metadata_extractor.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/audio_video_metadata_extractor_unittest.cc b/chromium/media/filters/audio_video_metadata_extractor_unittest.cc
index b26dd2c3a4c..42df821acca 100644
--- a/chromium/media/filters/audio_video_metadata_extractor_unittest.cc
+++ b/chromium/media/filters/audio_video_metadata_extractor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -167,7 +167,7 @@ TEST(AudioVideoMetadataExtractorTest, VideoWebM) {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
TEST(AudioVideoMetadataExtractorTest, AndroidRotatedMP4Video) {
std::unique_ptr<AudioVideoMetadataExtractor> extractor =
- GetExtractor("90rotation.mp4", true, true, 0.196, 1920, 1080);
+ GetExtractor("90rotation.mp4", true, true, 0.196056, 1920, 1080);
EXPECT_EQ(90, extractor->rotation());
@@ -257,7 +257,7 @@ TEST(AudioVideoMetadataExtractorTest, AudioMP3) {
TEST(AudioVideoMetadataExtractorTest, AudioFLACInMp4) {
std::unique_ptr<AudioVideoMetadataExtractor> extractor =
- GetExtractor("sfx-flac.mp4", true, true, 0.289, -1, -1);
+ GetExtractor("sfx-flac.mp4", true, true, 0.288413, -1, -1);
EXPECT_EQ("Lavf57.75.100", extractor->encoder());
EXPECT_EQ("mov,mp4,m4a,3gp,3g2,mj2", extractor->stream_infos()[0].type);
diff --git a/chromium/media/filters/blocking_url_protocol.cc b/chromium/media/filters/blocking_url_protocol.cc
index 0b32146b342..3df4b70b657 100644
--- a/chromium/media/filters/blocking_url_protocol.cc
+++ b/chromium/media/filters/blocking_url_protocol.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/blocking_url_protocol.h b/chromium/media/filters/blocking_url_protocol.h
index a95d23c64d8..f8bc159ed6b 100644
--- a/chromium/media/filters/blocking_url_protocol.h
+++ b/chromium/media/filters/blocking_url_protocol.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/blocking_url_protocol_unittest.cc b/chromium/media/filters/blocking_url_protocol_unittest.cc
index 2faabf75886..21b20e17bff 100644
--- a/chromium/media/filters/blocking_url_protocol_unittest.cc
+++ b/chromium/media/filters/blocking_url_protocol_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/chunk_demuxer.cc b/chromium/media/filters/chunk_demuxer.cc
index a2df9fec53c..0bf2bf7a938 100644
--- a/chromium/media/filters/chunk_demuxer.cc
+++ b/chromium/media/filters/chunk_demuxer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,8 +11,6 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
-#include "base/location.h"
-#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
diff --git a/chromium/media/filters/chunk_demuxer.h b/chromium/media/filters/chunk_demuxer.h
index e7d75d56cf9..3ffd5d15c1c 100644
--- a/chromium/media/filters/chunk_demuxer.h
+++ b/chromium/media/filters/chunk_demuxer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,7 +11,6 @@
#include <map>
#include <set>
#include <string>
-#include <utility>
#include <vector>
#include "base/containers/circular_deque.h"
@@ -20,7 +19,6 @@
#include "base/synchronization/lock.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
-#include "media/base/byte_queue.h"
#include "media/base/demuxer.h"
#include "media/base/demuxer_stream.h"
#include "media/base/media_tracks.h"
diff --git a/chromium/media/filters/chunk_demuxer_unittest.cc b/chromium/media/filters/chunk_demuxer_unittest.cc
index 0241962e3c1..a7ee5a69165 100644
--- a/chromium/media/filters/chunk_demuxer_unittest.cc
+++ b/chromium/media/filters/chunk_demuxer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -202,9 +202,7 @@ class ChunkDemuxerTest : public ::testing::Test {
&media_log_);
}
- virtual ~ChunkDemuxerTest() {
- ShutdownDemuxer();
- }
+ ~ChunkDemuxerTest() override { ShutdownDemuxer(); }
void CreateInitSegment(int stream_flags,
bool is_audio_encrypted,
diff --git a/chromium/media/filters/dav1d_video_decoder.cc b/chromium/media/filters/dav1d_video_decoder.cc
index 40daa6fc85a..a98f4ff2830 100644
--- a/chromium/media/filters/dav1d_video_decoder.cc
+++ b/chromium/media/filters/dav1d_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/dav1d_video_decoder.h b/chromium/media/filters/dav1d_video_decoder.h
index 4c7f1d0dc65..fcb444ef284 100644
--- a/chromium/media/filters/dav1d_video_decoder.h
+++ b/chromium/media/filters/dav1d_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/dav1d_video_decoder_unittest.cc b/chromium/media/filters/dav1d_video_decoder_unittest.cc
index 676a02b8ad3..47092544d3d 100644
--- a/chromium/media/filters/dav1d_video_decoder_unittest.cc
+++ b/chromium/media/filters/dav1d_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -333,7 +333,7 @@ TEST_F(Dav1dVideoDecoderTest, FrameValidAfterPoolDestruction) {
// Write to the Y plane. The memory tools should detect a
// use-after-free if the storage was actually removed by pool destruction.
- memset(output_frames_.front()->data(VideoFrame::kYPlane), 0xff,
+ memset(output_frames_.front()->writable_data(VideoFrame::kYPlane), 0xff,
output_frames_.front()->rows(VideoFrame::kYPlane) *
output_frames_.front()->stride(VideoFrame::kYPlane));
}
diff --git a/chromium/media/filters/decoder_selector.cc b/chromium/media/filters/decoder_selector.cc
index 23a28d21322..85dc67d5618 100644
--- a/chromium/media/filters/decoder_selector.cc
+++ b/chromium/media/filters/decoder_selector.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decoder_selector.h b/chromium/media/filters/decoder_selector.h
index de604995f5d..7c5b4743c47 100644
--- a/chromium/media/filters/decoder_selector.h
+++ b/chromium/media/filters/decoder_selector.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decoder_selector_unittest.cc b/chromium/media/filters/decoder_selector_unittest.cc
index 4310170f674..ffb91ce8ab2 100644
--- a/chromium/media/filters/decoder_selector_unittest.cc
+++ b/chromium/media/filters/decoder_selector_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decoder_stream.cc b/chromium/media/filters/decoder_stream.cc
index d530e3e95e7..0cd53a521db 100644
--- a/chromium/media/filters/decoder_stream.cc
+++ b/chromium/media/filters/decoder_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decoder_stream.h b/chromium/media/filters/decoder_stream.h
index ec7491da834..9870a4507b2 100644
--- a/chromium/media/filters/decoder_stream.h
+++ b/chromium/media/filters/decoder_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decoder_stream_traits.cc b/chromium/media/filters/decoder_stream_traits.cc
index f7f8b83a34f..c178bd5c412 100644
--- a/chromium/media/filters/decoder_stream_traits.cc
+++ b/chromium/media/filters/decoder_stream_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decoder_stream_traits.h b/chromium/media/filters/decoder_stream_traits.h
index 839c9adafd2..d5ae197863c 100644
--- a/chromium/media/filters/decoder_stream_traits.h
+++ b/chromium/media/filters/decoder_stream_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_audio_decoder.cc b/chromium/media/filters/decrypting_audio_decoder.cc
index 6703510573d..cd4848389e3 100644
--- a/chromium/media/filters/decrypting_audio_decoder.cc
+++ b/chromium/media/filters/decrypting_audio_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_audio_decoder.h b/chromium/media/filters/decrypting_audio_decoder.h
index 492d54435b3..11eee94f3a7 100644
--- a/chromium/media/filters/decrypting_audio_decoder.h
+++ b/chromium/media/filters/decrypting_audio_decoder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_audio_decoder_unittest.cc b/chromium/media/filters/decrypting_audio_decoder_unittest.cc
index 704299b3eaf..190007e9b61 100644
--- a/chromium/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/chromium/media/filters/decrypting_audio_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_demuxer_stream.cc b/chromium/media/filters/decrypting_demuxer_stream.cc
index c494ecfd930..46dc5e76f0f 100644
--- a/chromium/media/filters/decrypting_demuxer_stream.cc
+++ b/chromium/media/filters/decrypting_demuxer_stream.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_demuxer_stream.h b/chromium/media/filters/decrypting_demuxer_stream.h
index 88662b0bc44..1578a7e2844 100644
--- a/chromium/media/filters/decrypting_demuxer_stream.h
+++ b/chromium/media/filters/decrypting_demuxer_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_demuxer_stream_unittest.cc b/chromium/media/filters/decrypting_demuxer_stream_unittest.cc
index 02eec6a6984..38e64dea514 100644
--- a/chromium/media/filters/decrypting_demuxer_stream_unittest.cc
+++ b/chromium/media/filters/decrypting_demuxer_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_media_resource.cc b/chromium/media/filters/decrypting_media_resource.cc
index 3a8ca993299..3501ea2f0a6 100644
--- a/chromium/media/filters/decrypting_media_resource.cc
+++ b/chromium/media/filters/decrypting_media_resource.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_media_resource.h b/chromium/media/filters/decrypting_media_resource.h
index da891317140..a6b47c6c38a 100644
--- a/chromium/media/filters/decrypting_media_resource.h
+++ b/chromium/media/filters/decrypting_media_resource.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_media_resource_unittest.cc b/chromium/media/filters/decrypting_media_resource_unittest.cc
index f47f105e969..857129ce7a5 100644
--- a/chromium/media/filters/decrypting_media_resource_unittest.cc
+++ b/chromium/media/filters/decrypting_media_resource_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,7 +69,7 @@ class DecryptingMediaResourceTest : public testing::Test {
task_environment_.GetMainThreadTaskRunner());
}
- ~DecryptingMediaResourceTest() {
+ ~DecryptingMediaResourceTest() override {
// Ensure that the DecryptingMediaResource is destructed before other
// objects that it internally references but does not own.
decrypting_media_resource_.reset();
diff --git a/chromium/media/filters/decrypting_video_decoder.cc b/chromium/media/filters/decrypting_video_decoder.cc
index a98e206bb5d..97a56f33a00 100644
--- a/chromium/media/filters/decrypting_video_decoder.cc
+++ b/chromium/media/filters/decrypting_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_video_decoder.h b/chromium/media/filters/decrypting_video_decoder.h
index 9b6a4bf4a9e..7d3dff1ec9b 100644
--- a/chromium/media/filters/decrypting_video_decoder.h
+++ b/chromium/media/filters/decrypting_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/decrypting_video_decoder_unittest.cc b/chromium/media/filters/decrypting_video_decoder_unittest.cc
index 5eb6f1328f1..605439bf9a1 100644
--- a/chromium/media/filters/decrypting_video_decoder_unittest.cc
+++ b/chromium/media/filters/decrypting_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/demuxer_perftest.cc b/chromium/media/filters/demuxer_perftest.cc
index 24743b49b60..c386e5d892f 100644
--- a/chromium/media/filters/demuxer_perftest.cc
+++ b/chromium/media/filters/demuxer_perftest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/fake_video_decoder.cc b/chromium/media/filters/fake_video_decoder.cc
index d37f69dd8df..35e00866353 100644
--- a/chromium/media/filters/fake_video_decoder.cc
+++ b/chromium/media/filters/fake_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/fake_video_decoder.h b/chromium/media/filters/fake_video_decoder.h
index 52ac03fe0ff..7c1def62395 100644
--- a/chromium/media/filters/fake_video_decoder.h
+++ b/chromium/media/filters/fake_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/fake_video_decoder_unittest.cc b/chromium/media/filters/fake_video_decoder_unittest.cc
index 18063e9afe6..4e9d2a79a6b 100644
--- a/chromium/media/filters/fake_video_decoder_unittest.cc
+++ b/chromium/media/filters/fake_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc b/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc
index ca5e5fb927d..e26b6cd1913 100644
--- a/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc
+++ b/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_aac_bitstream_converter.h b/chromium/media/filters/ffmpeg_aac_bitstream_converter.h
index 85ce1cfd442..68fbd9279a5 100644
--- a/chromium/media/filters/ffmpeg_aac_bitstream_converter.h
+++ b/chromium/media/filters/ffmpeg_aac_bitstream_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc b/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
index 9ccc034b8e2..1897eb09833 100644
--- a/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
+++ b/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_audio_decoder.cc b/chromium/media/filters/ffmpeg_audio_decoder.cc
index 4615fdeb3fb..be6500139a7 100644
--- a/chromium/media/filters/ffmpeg_audio_decoder.cc
+++ b/chromium/media/filters/ffmpeg_audio_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -175,6 +175,8 @@ bool FFmpegAudioDecoder::FFmpegDecode(const DecoderBuffer& buffer) {
} else {
packet->data = const_cast<uint8_t*>(buffer.data());
packet->size = buffer.data_size();
+ packet->pts =
+ ConvertToTimeBase(codec_context_->time_base, buffer.timestamp());
DCHECK(packet->data);
DCHECK_GT(packet->size, 0);
diff --git a/chromium/media/filters/ffmpeg_audio_decoder.h b/chromium/media/filters/ffmpeg_audio_decoder.h
index 82bd6fff7e0..0a0bcbf84fd 100644
--- a/chromium/media/filters/ffmpeg_audio_decoder.h
+++ b/chromium/media/filters/ffmpeg_audio_decoder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_bitstream_converter.h b/chromium/media/filters/ffmpeg_bitstream_converter.h
index dd133f4ea98..140b15cbe6d 100644
--- a/chromium/media/filters/ffmpeg_bitstream_converter.h
+++ b/chromium/media/filters/ffmpeg_bitstream_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_demuxer.cc b/chromium/media/filters/ffmpeg_demuxer.cc
index d28693a7bf8..76661fc9cdd 100644
--- a/chromium/media/filters/ffmpeg_demuxer.cc
+++ b/chromium/media/filters/ffmpeg_demuxer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_demuxer.h b/chromium/media/filters/ffmpeg_demuxer.h
index 939f01e97d9..8991e00f245 100644
--- a/chromium/media/filters/ffmpeg_demuxer.h
+++ b/chromium/media/filters/ffmpeg_demuxer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_demuxer_unittest.cc b/chromium/media/filters/ffmpeg_demuxer_unittest.cc
index a24ec284237..830b0ad81db 100644
--- a/chromium/media/filters/ffmpeg_demuxer_unittest.cc
+++ b/chromium/media/filters/ffmpeg_demuxer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_glue.cc b/chromium/media/filters/ffmpeg_glue.cc
index 586c8ad366a..23529ffee06 100644
--- a/chromium/media/filters/ffmpeg_glue.cc
+++ b/chromium/media/filters/ffmpeg_glue.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_glue.h b/chromium/media/filters/ffmpeg_glue.h
index 90d7d605953..15fa4e5856f 100644
--- a/chromium/media/filters/ffmpeg_glue.h
+++ b/chromium/media/filters/ffmpeg_glue.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_glue_unittest.cc b/chromium/media/filters/ffmpeg_glue_unittest.cc
index 4c748589189..4c026ce5c1e 100644
--- a/chromium/media/filters/ffmpeg_glue_unittest.cc
+++ b/chromium/media/filters/ffmpeg_glue_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc b/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc
index 64f8c53440d..7b65ccc4230 100644
--- a/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc
+++ b/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h b/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h
index 7b474dc8fa5..9dd4045b2f3 100644
--- a/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h
+++ b/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc b/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc
index b5278f572e8..13537a28134 100644
--- a/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc
+++ b/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc b/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc
index 200794e63c9..480e57ef4db 100644
--- a/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc
+++ b/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h b/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h
index 8c6a0d1cdca..ac960c3529c 100644
--- a/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h
+++ b/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_video_decoder.cc b/chromium/media/filters/ffmpeg_video_decoder.cc
index 99f5231d91e..78195a324a0 100644
--- a/chromium/media/filters/ffmpeg_video_decoder.cc
+++ b/chromium/media/filters/ffmpeg_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -208,7 +208,7 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
}
for (size_t i = 0; i < VideoFrame::NumPlanes(video_frame->format()); i++) {
- frame->data[i] = video_frame->data(i);
+ frame->data[i] = video_frame->writable_data(i);
frame->linesize[i] = video_frame->stride(i);
}
diff --git a/chromium/media/filters/ffmpeg_video_decoder.h b/chromium/media/filters/ffmpeg_video_decoder.h
index fd74c2cb9a9..7536511667f 100644
--- a/chromium/media/filters/ffmpeg_video_decoder.h
+++ b/chromium/media/filters/ffmpeg_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ffmpeg_video_decoder_unittest.cc b/chromium/media/filters/ffmpeg_video_decoder_unittest.cc
index 6f11af4fcb0..a44a8322453 100644
--- a/chromium/media/filters/ffmpeg_video_decoder_unittest.cc
+++ b/chromium/media/filters/ffmpeg_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/file_data_source.cc b/chromium/media/filters/file_data_source.cc
index d0240fdaeb9..d1e7f1d379b 100644
--- a/chromium/media/filters/file_data_source.cc
+++ b/chromium/media/filters/file_data_source.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/file_data_source.h b/chromium/media/filters/file_data_source.h
index fd73233610f..7c1bfaa9073 100644
--- a/chromium/media/filters/file_data_source.h
+++ b/chromium/media/filters/file_data_source.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/file_data_source_unittest.cc b/chromium/media/filters/file_data_source_unittest.cc
index 17c91b90cd3..bbb0c00f9cf 100644
--- a/chromium/media/filters/file_data_source_unittest.cc
+++ b/chromium/media/filters/file_data_source_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/frame_buffer_pool.cc b/chromium/media/filters/frame_buffer_pool.cc
index 0d8c455c711..1bdf7d590e0 100644
--- a/chromium/media/filters/frame_buffer_pool.cc
+++ b/chromium/media/filters/frame_buffer_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include "base/location.h"
#include "base/memory/free_deleter.h"
#include "base/process/memory.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/threading/sequenced_task_runner_handle.h"
@@ -58,9 +59,8 @@ uint8_t* FrameBufferPool::GetFrameBuffer(size_t min_size, void** fb_priv) {
}
// Check if a free frame buffer exists.
- auto it = std::find_if(
- frame_buffers_.begin(), frame_buffers_.end(),
- [](const std::unique_ptr<FrameBuffer>& fb) { return !IsUsed(fb.get()); });
+ auto it = base::ranges::find_if_not(frame_buffers_, &IsUsed,
+ &std::unique_ptr<FrameBuffer>::get);
// If not, create one.
if (it == frame_buffers_.end())
diff --git a/chromium/media/filters/frame_buffer_pool.h b/chromium/media/filters/frame_buffer_pool.h
index 94ce205f37e..11224d4e345 100644
--- a/chromium/media/filters/frame_buffer_pool.h
+++ b/chromium/media/filters/frame_buffer_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/frame_buffer_pool_unittest.cc b/chromium/media/filters/frame_buffer_pool_unittest.cc
index a06039c0fe1..5a1dc0e9462 100644
--- a/chromium/media/filters/frame_buffer_pool_unittest.cc
+++ b/chromium/media/filters/frame_buffer_pool_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/frame_processor.cc b/chromium/media/filters/frame_processor.cc
index 47190f97d73..22ca300052a 100644
--- a/chromium/media/filters/frame_processor.cc
+++ b/chromium/media/filters/frame_processor.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/frame_processor.h b/chromium/media/filters/frame_processor.h
index 75bf72973d1..bc96a76d0d2 100644
--- a/chromium/media/filters/frame_processor.h
+++ b/chromium/media/filters/frame_processor.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/frame_processor_unittest.cc b/chromium/media/filters/frame_processor_unittest.cc
index 6c8844bebfe..47ef88a29eb 100644
--- a/chromium/media/filters/frame_processor_unittest.cc
+++ b/chromium/media/filters/frame_processor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/gav1_video_decoder.cc b/chromium/media/filters/gav1_video_decoder.cc
index 79203e5ff09..31416c80df6 100644
--- a/chromium/media/filters/gav1_video_decoder.cc
+++ b/chromium/media/filters/gav1_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -162,7 +162,7 @@ libgav1::StatusCode GetFrameBufferImpl(void* callback_private_data,
for (int i = 0; i < 3; i++) {
// frame_buffer->plane[i] points to the first byte of the frame proper,
// not the first byte of the buffer.
- frame_buffer->plane[i] = video_frame->visible_data(i);
+ frame_buffer->plane[i] = video_frame->GetWritableVisibleData(i);
frame_buffer->stride[i] = video_frame->stride(i);
}
if (image_format == libgav1::kImageFormatMonochrome400) {
@@ -175,11 +175,11 @@ libgav1::StatusCode GetFrameBufferImpl(void* callback_private_data,
// and V samples in video_frame to the blank value.
if (bitdepth == 8) {
constexpr uint8_t kBlankUV = 256 / 2;
- memset(video_frame->visible_data(i), kBlankUV, size_needed);
+ memset(video_frame->GetWritableVisibleData(i), kBlankUV, size_needed);
} else {
const uint16_t kBlankUV = (1 << bitdepth) / 2;
uint16_t* data =
- reinterpret_cast<uint16_t*>(video_frame->visible_data(i));
+ reinterpret_cast<uint16_t*>(video_frame->GetWritableVisibleData(i));
std::fill(data, data + size_needed / 2, kBlankUV);
}
}
diff --git a/chromium/media/filters/gav1_video_decoder.h b/chromium/media/filters/gav1_video_decoder.h
index 5b09368a433..09677034ce0 100644
--- a/chromium/media/filters/gav1_video_decoder.h
+++ b/chromium/media/filters/gav1_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/gav1_video_decoder_unittest.cc b/chromium/media/filters/gav1_video_decoder_unittest.cc
index b2d57bea4d7..743fc28d228 100644
--- a/chromium/media/filters/gav1_video_decoder_unittest.cc
+++ b/chromium/media/filters/gav1_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -354,7 +354,7 @@ TEST_F(Gav1VideoDecoderTest, FrameValidAfterPoolDestruction) {
// Write to the Y plane. The memory tools should detect a
// use-after-free if the storage was actually removed by pool destruction.
- memset(output_frames_.front()->data(VideoFrame::kYPlane), 0xff,
+ memset(output_frames_.front()->writable_data(VideoFrame::kYPlane), 0xff,
output_frames_.front()->rows(VideoFrame::kYPlane) *
output_frames_.front()->stride(VideoFrame::kYPlane));
}
diff --git a/chromium/media/filters/h264_bitstream_buffer.cc b/chromium/media/filters/h264_bitstream_buffer.cc
index 48c20e67e5a..8b2dffe0eb2 100644
--- a/chromium/media/filters/h264_bitstream_buffer.cc
+++ b/chromium/media/filters/h264_bitstream_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/h264_bitstream_buffer.h b/chromium/media/filters/h264_bitstream_buffer.h
index 416495dcde7..0d42ee2000b 100644
--- a/chromium/media/filters/h264_bitstream_buffer.h
+++ b/chromium/media/filters/h264_bitstream_buffer.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/filters/h264_bitstream_buffer_unittest.cc b/chromium/media/filters/h264_bitstream_buffer_unittest.cc
index 4f5e9cfa1ad..38c669c68e3 100644
--- a/chromium/media/filters/h264_bitstream_buffer_unittest.cc
+++ b/chromium/media/filters/h264_bitstream_buffer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/h264_to_annex_b_bitstream_converter.cc b/chromium/media/filters/h264_to_annex_b_bitstream_converter.cc
index 1397c3bf527..e31351d5259 100644
--- a/chromium/media/filters/h264_to_annex_b_bitstream_converter.cc
+++ b/chromium/media/filters/h264_to_annex_b_bitstream_converter.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/h264_to_annex_b_bitstream_converter.h b/chromium/media/filters/h264_to_annex_b_bitstream_converter.h
index dab30607799..a78a70ca499 100644
--- a/chromium/media/filters/h264_to_annex_b_bitstream_converter.h
+++ b/chromium/media/filters/h264_to_annex_b_bitstream_converter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/h264_to_annex_b_bitstream_converter_unittest.cc b/chromium/media/filters/h264_to_annex_b_bitstream_converter_unittest.cc
index b55c247b28e..c2d0a7176fc 100644
--- a/chromium/media/filters/h264_to_annex_b_bitstream_converter_unittest.cc
+++ b/chromium/media/filters/h264_to_annex_b_bitstream_converter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/h265_to_annex_b_bitstream_converter.cc b/chromium/media/filters/h265_to_annex_b_bitstream_converter.cc
new file mode 100644
index 00000000000..60af198f918
--- /dev/null
+++ b/chromium/media/filters/h265_to_annex_b_bitstream_converter.cc
@@ -0,0 +1,295 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/filters/h265_to_annex_b_bitstream_converter.h"
+
+#include <stddef.h>
+
+#include "base/logging.h"
+#include "media/formats/mp4/box_definitions.h"
+#include "media/formats/mp4/hevc.h"
+#include "media/video/h265_nalu_parser.h"
+
+namespace media {
+namespace {
+
+static const uint8_t kStartCodePrefix[3] = {0, 0, 1};
+static const uint32_t kParamSetStartCodeSize = 1 + sizeof(kStartCodePrefix);
+
+// Helper function which determines whether NAL unit of given type marks
+// access unit boundary.
+static bool IsAccessUnitBoundaryNal(int nal_unit_type) {
+ // Spec 7.4.2.4.4
+ // Check if this packet marks access unit boundary by checking the
+ // packet type.
+ if (nal_unit_type == media::H265NALU::VPS_NUT ||
+ nal_unit_type == media::H265NALU::SPS_NUT ||
+ nal_unit_type == media::H265NALU::PPS_NUT ||
+ nal_unit_type == media::H265NALU::AUD_NUT ||
+ nal_unit_type == media::H265NALU::PREFIX_SEI_NUT ||
+ (nal_unit_type >= media::H265NALU::RSV_NVCL41 &&
+ nal_unit_type <= media::H265NALU::RSV_NVCL44) ||
+ (nal_unit_type >= media::H265NALU::UNSPEC48 &&
+ nal_unit_type <= media::H265NALU::UNSPEC55)) {
+ return true;
+ }
+ return false;
+}
+
+} // namespace
+
+H265ToAnnexBBitstreamConverter::H265ToAnnexBBitstreamConverter() = default;
+
+H265ToAnnexBBitstreamConverter::~H265ToAnnexBBitstreamConverter() = default;
+
+bool H265ToAnnexBBitstreamConverter::ParseConfiguration(
+ const uint8_t* configuration_record,
+ int configuration_record_size,
+ mp4::HEVCDecoderConfigurationRecord* hevc_config) {
+ DCHECK(configuration_record);
+ DCHECK_GT(configuration_record_size, 0);
+ DCHECK(hevc_config);
+
+ if (!hevc_config->Parse(configuration_record, configuration_record_size))
+ return false;
+
+ configuration_processed_ = true;
+ return true;
+}
+
+uint32_t H265ToAnnexBBitstreamConverter::GetConfigSize(
+ const mp4::HEVCDecoderConfigurationRecord& hevc_config) const {
+ uint32_t config_size = 0;
+
+ for (auto& nalu_array : hevc_config.arrays) {
+ for (auto& nalu : nalu_array.units) {
+ config_size += kParamSetStartCodeSize + nalu.size();
+ }
+ }
+ return config_size;
+}
+
+uint32_t H265ToAnnexBBitstreamConverter::CalculateNeededOutputBufferSize(
+ const uint8_t* input,
+ uint32_t input_size,
+ const mp4::HEVCDecoderConfigurationRecord* hevc_config) const {
+ uint32_t output_size = 0;
+ uint32_t data_left = input_size;
+ bool first_nal_in_this_access_unit = first_nal_unit_in_access_unit_;
+
+ if (input_size == 0)
+ return 0; // Error: invalid input data
+
+ if (!configuration_processed_) {
+ return 0; // Error: configuration not handled, we don't know nal unit width
+ }
+
+ if (hevc_config)
+ output_size += GetConfigSize(*hevc_config);
+
+ uint8_t nal_unit_length_field_width = hevc_config->lengthSizeMinusOne + 1;
+ CHECK(nal_unit_length_field_width == 1 || nal_unit_length_field_width == 2 ||
+ nal_unit_length_field_width == 4);
+
+ // Then add the needed size for the actual packet
+ while (data_left > 0) {
+ if (data_left < nal_unit_length_field_width) {
+ return 0; // Error: not enough data for correct conversion.
+ }
+
+ // Read the next NAL unit length from the input buffer
+ uint8_t size_of_len_field;
+ uint32_t nal_unit_length;
+ for (nal_unit_length = 0, size_of_len_field = nal_unit_length_field_width;
+ size_of_len_field > 0; input++, size_of_len_field--, data_left--) {
+ nal_unit_length <<= 8;
+ nal_unit_length |= *input;
+ }
+
+ if (nal_unit_length == 0) {
+ break; // Signifies that no more data left in the buffer
+ } else if (nal_unit_length > data_left) {
+ return 0; // Error: Not enough data for correct conversion
+ }
+ data_left -= nal_unit_length;
+
+ // Six bits after forbidden_zero_bit of first NAL unit byte signify
+ // nal_unit_type.
+ int nal_unit_type = (*input >> 1) & 0x3F;
+ if (first_nal_in_this_access_unit ||
+ IsAccessUnitBoundaryNal(nal_unit_type)) {
+ output_size += 1; // Extra zero_byte for these nal units
+ first_nal_in_this_access_unit = false;
+ }
+ // Start code prefix
+ output_size += sizeof(kStartCodePrefix);
+ // Actual NAL unit size
+ output_size += nal_unit_length;
+ input += nal_unit_length;
+ // No need for trailing zero bits
+ }
+ return output_size;
+}
+
+bool H265ToAnnexBBitstreamConverter::ConvertHEVCDecoderConfigToByteStream(
+ const mp4::HEVCDecoderConfigurationRecord& hevc_config,
+ uint8_t* output,
+ uint32_t* output_size) {
+ uint8_t* out = output;
+ uint32_t out_size = *output_size;
+ *output_size = 0;
+
+ for (auto& nalu_array : hevc_config.arrays) {
+ for (auto& nalu : nalu_array.units) {
+ if (!WriteParamSet(nalu, &out, &out_size)) {
+ return false;
+ }
+ }
+ }
+
+ configuration_processed_ = true;
+ *output_size = out - output;
+ return true;
+}
+
+bool H265ToAnnexBBitstreamConverter::ConvertNalUnitStreamToByteStream(
+ const uint8_t* input,
+ uint32_t input_size,
+ const mp4::HEVCDecoderConfigurationRecord* hevc_config,
+ uint8_t* output,
+ uint32_t* output_size) {
+ const uint8_t* inscan = input; // We read the input from here progressively
+ uint8_t* outscan = output; // We write the output to here progressively
+ uint32_t data_left = input_size;
+
+ if (input_size == 0 || *output_size == 0) {
+ *output_size = 0;
+ return false; // Error: invalid input
+ }
+
+ uint8_t nal_unit_length_field_width = hevc_config->lengthSizeMinusOne + 1;
+ CHECK(nal_unit_length_field_width == 1 || nal_unit_length_field_width == 2 ||
+ nal_unit_length_field_width == 4);
+
+ // Do the actual conversion for the actual input packet
+ int nal_unit_count = 0;
+ while (data_left > 0) {
+ uint8_t i;
+ uint32_t nal_unit_length;
+
+ // Read the next NAL unit length from the input buffer by scanning
+ // the input stream with the specific length field width
+ for (nal_unit_length = 0, i = nal_unit_length_field_width;
+ i > 0 && data_left > 0; inscan++, i--, data_left--) {
+ nal_unit_length <<= 8;
+ nal_unit_length |= *inscan;
+ }
+
+ if (nal_unit_length == 0) {
+ break; // Successful conversion, end of buffer
+ } else if (nal_unit_length > data_left) {
+ *output_size = 0;
+ return false; // Error: not enough data for correct conversion
+ }
+
+ // Six bits after forbidden_zero_bit of first NAL unit byte signify
+ // nal_unit_type.
+ int nal_unit_type = (*inscan >> 1) & 0x3F;
+ nal_unit_count++;
+
+ // Insert the config after the AUD if an AUD is the first NAL unit or
+ // before all NAL units if the first one isn't an AUD.
+ if (hevc_config &&
+ (nal_unit_type != H265NALU::AUD_NUT || nal_unit_count > 1)) {
+ uint32_t output_bytes_used = outscan - output;
+
+ DCHECK_GE(*output_size, output_bytes_used);
+
+ uint32_t config_size = *output_size - output_bytes_used;
+ if (!ConvertHEVCDecoderConfigToByteStream(*hevc_config, outscan,
+ &config_size)) {
+ DVLOG(1) << "Failed to insert parameter sets.";
+ *output_size = 0;
+ return false; // Failed to convert the buffer.
+ }
+ outscan += config_size;
+ hevc_config = nullptr;
+ }
+ uint32_t start_code_len;
+ first_nal_unit_in_access_unit_
+ ? start_code_len = sizeof(kStartCodePrefix) + 1
+ : start_code_len = sizeof(kStartCodePrefix);
+ if (static_cast<uint32_t>(outscan - output) + start_code_len +
+ nal_unit_length >
+ *output_size) {
+ *output_size = 0;
+ return false; // Error: too small output buffer
+ }
+
+ // Check if this packet marks access unit boundary by checking the
+ // packet type.
+ if (IsAccessUnitBoundaryNal(nal_unit_type)) {
+ first_nal_unit_in_access_unit_ = true;
+ }
+
+ // Write extra zero-byte before start code prefix if this packet
+ // signals next access unit.
+ if (first_nal_unit_in_access_unit_) {
+ *outscan = 0;
+ outscan++;
+ first_nal_unit_in_access_unit_ = false;
+ }
+
+ // No need to write leading zero bits.
+ // Write start-code prefix.
+ memcpy(outscan, kStartCodePrefix, sizeof(kStartCodePrefix));
+ outscan += sizeof(kStartCodePrefix);
+ // Then write the actual NAL unit from the input buffer.
+ memcpy(outscan, inscan, nal_unit_length);
+ inscan += nal_unit_length;
+ data_left -= nal_unit_length;
+ outscan += nal_unit_length;
+ // No need for trailing zero bits.
+ }
+ // Successful conversion, output the freshly allocated bitstream buffer.
+ *output_size = static_cast<uint32_t>(outscan - output);
+ return true;
+}
+
+bool H265ToAnnexBBitstreamConverter::WriteParamSet(
+ const std::vector<uint8_t>& param_set,
+ uint8_t** out,
+ uint32_t* out_size) const {
+ // Strip trailing null bytes.
+ size_t size = param_set.size();
+ while (size && param_set[size - 1] == 0)
+ size--;
+ if (!size)
+ return false;
+
+ // Verify space.
+ uint32_t bytes_left = *out_size;
+ if (bytes_left < kParamSetStartCodeSize ||
+ bytes_left - kParamSetStartCodeSize < size) {
+ return false;
+ }
+
+ uint8_t* start = *out;
+ uint8_t* buf = start;
+
+ // Write the 4 byte Annex B start code.
+ *buf++ = 0; // zero byte
+ memcpy(buf, kStartCodePrefix, sizeof(kStartCodePrefix));
+ buf += sizeof(kStartCodePrefix);
+
+ // Copy the data.
+ memcpy(buf, &param_set[0], size);
+ buf += size;
+
+ *out = buf;
+ *out_size -= buf - start;
+ return true;
+}
+
+} // namespace media
diff --git a/chromium/media/filters/h265_to_annex_b_bitstream_converter.h b/chromium/media/filters/h265_to_annex_b_bitstream_converter.h
new file mode 100644
index 00000000000..07467a35412
--- /dev/null
+++ b/chromium/media/filters/h265_to_annex_b_bitstream_converter.h
@@ -0,0 +1,156 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_FILTERS_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_
+#define MEDIA_FILTERS_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_
+
+#include <stdint.h>
+
+#include <vector>
+
+#include "media/base/media_export.h"
+
+namespace media {
+
+namespace mp4 {
+struct HEVCDecoderConfigurationRecord;
+}
+
+// H265ToAnnexBBitstreamConverter is a class to convert H.265 bitstream from
+// MP4 format (as specified in ISO/IEC 14496-15) into H.265 bytestream
+// (as specified in ISO/IEC 14496-10 Annex B).
+class MEDIA_EXPORT H265ToAnnexBBitstreamConverter {
+ public:
+ H265ToAnnexBBitstreamConverter();
+
+ H265ToAnnexBBitstreamConverter(const H265ToAnnexBBitstreamConverter&) =
+ delete;
+ H265ToAnnexBBitstreamConverter& operator=(
+ const H265ToAnnexBBitstreamConverter&) = delete;
+
+ ~H265ToAnnexBBitstreamConverter();
+
+ // Parses the global HEVCDecoderConfigurationRecord from the file format's
+ // headers. Converter will remember the field length from the configuration
+ // headers after this.
+ //
+ // Parameters
+ // configuration_record
+ // Pointer to buffer containing HEVCDecoderConfigurationRecord.
+ // configuration_record_size
+ // Size of the buffer in bytes.
+ // hevc_config
+ // Pointer to place the parsed HEVCDecoderConfigurationRecord data into.
+ //
+ // Returns
+ // Returns true if |configuration_record| was successfully parsed. False
+ // is returned if a parsing error occurred.
+ // |hevc_config| only contains valid data when true is returned.
+ bool ParseConfiguration(const uint8_t* configuration_record,
+ int configuration_record_size,
+ mp4::HEVCDecoderConfigurationRecord* hevc_config);
+
+ // Returns the buffer size needed to store the parameter sets in |hevc_config|
+ // in Annex B form.
+ uint32_t GetConfigSize(
+ const mp4::HEVCDecoderConfigurationRecord& hevc_config) const;
+
+ // Calculates needed buffer size for the bitstream converted into bytestream.
+ // Lightweight implementation that does not do the actual conversion.
+ //
+ // Parameters
+ // input
+ // Pointer to buffer containing NAL units in MP4 format.
+ // input_size
+ // Size of the buffer in bytes.
+ // hevc_config
+ // The HEVCDecoderConfigurationRecord that contains the parameter sets
+ // that will be inserted into the output. nullptr if no parameter sets
+ // need to be inserted.
+ //
+ // Returns
+ // Required buffer size for the output NAL unit buffer when converted
+ // to bytestream format, or 0 if could not determine the size of
+ // the output buffer from the data in |input| and |hevc_config|.
+ uint32_t CalculateNeededOutputBufferSize(
+ const uint8_t* input,
+ uint32_t input_size,
+ const mp4::HEVCDecoderConfigurationRecord* hevc_config) const;
+
+ // ConvertHEVCDecoderConfigToByteStream converts the
+ // HEVCDecoderConfigurationRecord from the MP4 headers to bytestream format.
+ // Client is responsible for making sure the output buffer is large enough
+ // to hold the output data. Client can precalculate the needed output buffer
+ // size by using GetConfigSize().
+ //
+ // Parameters
+ // hevc_config
+ // The HEVCDecoderConfigurationRecord that contains the parameter sets
+ // that will be written to |output|.
+ // output
+ // Pointer to buffer where the output should be written to.
+ // output_size (i/o)
+ // Pointer to the size of the output buffer. Will contain the number of
+ // bytes written to output after successful call.
+ //
+ // Returns
+ // true if successful conversion|
+ // false if conversion not successful (|output_size| will hold the amount
+ // of converted data)
+ bool ConvertHEVCDecoderConfigToByteStream(
+ const mp4::HEVCDecoderConfigurationRecord& hevc_config,
+ uint8_t* output,
+ uint32_t* output_size);
+
+ // ConvertNalUnitStreamToByteStream converts the NAL unit from MP4 format
+ // to bytestream format. Client is responsible for making sure the output
+ // buffer is large enough to hold the output data. Client can precalculate the
+ // needed output buffer size by using CalculateNeededOutputBufferSize.
+ //
+ // Parameters
+ // input
+ // Pointer to buffer containing NAL units in MP4 format.
+ // input_size
+ // Size of the buffer in bytes.
+ // hevc_config
+ // The HEVCDecoderConfigurationRecord that contains the parameter sets to
+ // insert into the output. NULL if no parameter sets need to be inserted.
+ // output
+ // Pointer to buffer where the output should be written to.
+ // output_size (i/o)
+ // Pointer to the size of the output buffer. Will contain the number of
+ // bytes written to output after successful call.
+ //
+ // Returns
+ // true if successful conversion
+ // false if conversion not successful (output_size will hold the amount
+ // of converted data)
+ bool ConvertNalUnitStreamToByteStream(
+ const uint8_t* input,
+ uint32_t input_size,
+ const mp4::HEVCDecoderConfigurationRecord* hevc_config,
+ uint8_t* output,
+ uint32_t* output_size);
+
+ private:
+ // Writes Annex B start code and |param_set| to |*out|.
+ // |*out| - Is the memory location to write the parameter set.
+ // |*out_size| - Number of bytes available for the parameter set.
+ // Returns true if the start code and param set were successfully
+ // written. On a successful write, |*out| is updated to point to the first
+ // byte after the data that was written. |*out_size| is updated to reflect
+ // the new number of bytes left in |*out|.
+ bool WriteParamSet(const std::vector<uint8_t>& param_set,
+ uint8_t** out,
+ uint32_t* out_size) const;
+
+ // Flag for indicating whether global parameter sets have been processed.
+ bool configuration_processed_ = false;
+ // Flag for indicating whether next NAL unit starts new access unit.
+ bool first_nal_unit_in_access_unit_ = false;
+};
+
+} // namespace media
+
+#endif // MEDIA_FILTERS_H265_TO_ANNEX_B_BITSTREAM_CONVERTER_H_
diff --git a/chromium/media/filters/h265_to_annex_b_bitstream_converter_unittest.cc b/chromium/media/filters/h265_to_annex_b_bitstream_converter_unittest.cc
new file mode 100644
index 00000000000..7481e10c108
--- /dev/null
+++ b/chromium/media/filters/h265_to_annex_b_bitstream_converter_unittest.cc
@@ -0,0 +1,238 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/filters/h265_to_annex_b_bitstream_converter.h"
+
+#include <stdint.h>
+
+#include <memory>
+
+#include "media/formats/mp4/box_definitions.h"
+#include "media/formats/mp4/hevc.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media {
+
+class H265ToAnnexBBitstreamConverterTest : public testing::Test {
+ public:
+ H265ToAnnexBBitstreamConverterTest(
+ const H265ToAnnexBBitstreamConverterTest&) = delete;
+ H265ToAnnexBBitstreamConverterTest& operator=(
+ const H265ToAnnexBBitstreamConverterTest&) = delete;
+
+ protected:
+ H265ToAnnexBBitstreamConverterTest() = default;
+
+ ~H265ToAnnexBBitstreamConverterTest() override = default;
+
+ protected:
+ mp4::HEVCDecoderConfigurationRecord hevc_config_;
+};
+
+static const uint8_t kHeaderDataOkWithFieldLen4[] = {
+ 0x01, 0x01, 0x60, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x96, 0xf0, 0x00, 0xfc, 0xfd, 0xf8, 0xf8, 0x00, 0x00, 0x0f,
+ 0x03, 0xa0, 0x00, 0x01, 0x00, 0x18, 0x40, 0x01, 0x0c, 0x01, 0xff,
+ 0xff, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x03, 0x00, 0x96, 0x9d, 0xc0, 0x90, 0xa1, 0x00, 0x01,
+ 0x00, 0x29, 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00,
+ 0x80, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x96, 0xa0, 0x03,
+ 0xc0, 0x80, 0x10, 0xe5, 0x96, 0x77, 0x92, 0x46, 0xda, 0xf0, 0x10,
+ 0x10, 0x00, 0x00, 0x3e, 0x80, 0x00, 0x06, 0x1a, 0x80, 0x80, 0xa2,
+ 0x00, 0x01, 0x00, 0x06, 0x44, 0x01, 0xc1, 0x73, 0xd1, 0x89};
+
+static const uint8_t kPacketDataOkWithFieldLen4[] = {
+ 0x00, 0x00, 0x00, 0x2d, 0x00, 0x01, 0xe0, 0xa6, 0xf5, 0xd7,
+ 0xd2, 0x24, 0x0a, 0x19, 0x1a, 0xa0, 0xdc, 0x8c, 0x68, 0x5e,
+ 0x35, 0x20, 0x40, 0x64, 0x1c, 0x86, 0x81, 0x8a, 0x25, 0x5d,
+ 0x65, 0x6c, 0xfe, 0x80, 0x7a, 0xe3, 0xf4, 0x63, 0xe1, 0xcf,
+ 0xf2, 0x6e, 0x92, 0x1e, 0xff, 0xd3, 0x65, 0xd9, 0x60};
+
+TEST_F(H265ToAnnexBBitstreamConverterTest, Success) {
+ // Initialize converter.
+ std::unique_ptr<uint8_t[]> output;
+ H265ToAnnexBBitstreamConverter converter;
+
+ // Parse the headers.
+ EXPECT_TRUE(converter.ParseConfiguration(kHeaderDataOkWithFieldLen4,
+ sizeof(kHeaderDataOkWithFieldLen4),
+ &hevc_config_));
+ uint32_t config_size = converter.GetConfigSize(hevc_config_);
+ EXPECT_GT(config_size, 0U);
+
+ // Go on with converting the headers.
+ output.reset(new uint8_t[config_size]);
+ EXPECT_TRUE(output.get() != nullptr);
+ EXPECT_TRUE(converter.ConvertHEVCDecoderConfigToByteStream(
+ hevc_config_, output.get(), &config_size));
+
+ // Calculate buffer size for actual NAL unit.
+ uint32_t output_size = converter.CalculateNeededOutputBufferSize(
+ kPacketDataOkWithFieldLen4, sizeof(kPacketDataOkWithFieldLen4),
+ &hevc_config_);
+ EXPECT_GT(output_size, 0U);
+ output.reset(new uint8_t[output_size]);
+ EXPECT_TRUE(output.get() != nullptr);
+
+ uint32_t output_size_left_for_nal_unit = output_size;
+ // Do the conversion for actual NAL unit.
+ EXPECT_TRUE(converter.ConvertNalUnitStreamToByteStream(
+ kPacketDataOkWithFieldLen4, sizeof(kPacketDataOkWithFieldLen4),
+ &hevc_config_, output.get(), &output_size_left_for_nal_unit));
+}
+
+TEST_F(H265ToAnnexBBitstreamConverterTest, FailureHeaderBufferOverflow) {
+ // Initialize converter
+ H265ToAnnexBBitstreamConverter converter;
+
+ // Simulate 10 nalu_array HEVCDecoderConfigurationRecord,
+ // which would extend beyond the buffer.
+ uint8_t corrupted_header[sizeof(kHeaderDataOkWithFieldLen4)];
+ memcpy(corrupted_header, kHeaderDataOkWithFieldLen4,
+ sizeof(kHeaderDataOkWithFieldLen4));
+ // 23th byte contain the number of nalu arrays
+ corrupted_header[22] = corrupted_header[22] | 0xA;
+
+ // Parse the headers
+ EXPECT_FALSE(converter.ParseConfiguration(
+ corrupted_header, sizeof(corrupted_header), &hevc_config_));
+}
+
+TEST_F(H265ToAnnexBBitstreamConverterTest, FailureNalUnitBreakage) {
+ // Initialize converter.
+ std::unique_ptr<uint8_t[]> output;
+ H265ToAnnexBBitstreamConverter converter;
+
+ // Parse the headers.
+ EXPECT_TRUE(converter.ParseConfiguration(kHeaderDataOkWithFieldLen4,
+ sizeof(kHeaderDataOkWithFieldLen4),
+ &hevc_config_));
+ uint32_t config_size = converter.GetConfigSize(hevc_config_);
+ EXPECT_GT(config_size, 0U);
+
+ // Go on with converting the headers.
+ output.reset(new uint8_t[config_size]);
+ EXPECT_TRUE(output.get() != nullptr);
+ EXPECT_TRUE(converter.ConvertHEVCDecoderConfigToByteStream(
+ hevc_config_, output.get(), &config_size));
+
+ // Simulate NAL unit broken in middle by writing only some of the data.
+ uint8_t corrupted_nal_unit[sizeof(kPacketDataOkWithFieldLen4) - 30];
+ memcpy(corrupted_nal_unit, kPacketDataOkWithFieldLen4,
+ sizeof(kPacketDataOkWithFieldLen4) - 30);
+
+ // Calculate buffer size for actual NAL unit, should return 0 because of
+ // incomplete input buffer.
+ uint32_t output_size = converter.CalculateNeededOutputBufferSize(
+ corrupted_nal_unit, sizeof(corrupted_nal_unit), &hevc_config_);
+ EXPECT_EQ(output_size, 0U);
+
+ // Ignore the error and try to go on with conversion simulating wrong usage.
+ output_size = sizeof(kPacketDataOkWithFieldLen4);
+ output.reset(new uint8_t[output_size]);
+ EXPECT_TRUE(output.get() != nullptr);
+
+ uint32_t output_size_left_for_nal_unit = output_size;
+ // Do the conversion for actual NAL unit, expecting failure.
+ EXPECT_FALSE(converter.ConvertNalUnitStreamToByteStream(
+ corrupted_nal_unit, sizeof(corrupted_nal_unit), &hevc_config_,
+ output.get(), &output_size_left_for_nal_unit));
+ EXPECT_EQ(output_size_left_for_nal_unit, 0U);
+}
+
+TEST_F(H265ToAnnexBBitstreamConverterTest, FailureTooSmallOutputBuffer) {
+ // Initialize converter.
+ std::unique_ptr<uint8_t[]> output;
+ H265ToAnnexBBitstreamConverter converter;
+
+ // Parse the headers.
+ EXPECT_TRUE(converter.ParseConfiguration(kHeaderDataOkWithFieldLen4,
+ sizeof(kHeaderDataOkWithFieldLen4),
+ &hevc_config_));
+ uint32_t config_size = converter.GetConfigSize(hevc_config_);
+ EXPECT_GT(config_size, 0U);
+ uint32_t real_config_size = config_size;
+
+ // Go on with converting the headers with too small buffer.
+ config_size -= 10;
+ output.reset(new uint8_t[config_size]);
+ EXPECT_TRUE(output.get() != nullptr);
+ EXPECT_FALSE(converter.ConvertHEVCDecoderConfigToByteStream(
+ hevc_config_, output.get(), &config_size));
+ EXPECT_EQ(config_size, 0U);
+
+ // Still too small (but only 1 byte short).
+ config_size = real_config_size - 1;
+ output.reset(new uint8_t[config_size]);
+ EXPECT_TRUE(output.get() != nullptr);
+ EXPECT_FALSE(converter.ConvertHEVCDecoderConfigToByteStream(
+ hevc_config_, output.get(), &config_size));
+ EXPECT_EQ(config_size, 0U);
+
+ // Finally, retry with valid buffer.
+ config_size = real_config_size;
+ output.reset(new uint8_t[config_size]);
+ EXPECT_TRUE(output.get() != nullptr);
+ EXPECT_TRUE(converter.ConvertHEVCDecoderConfigToByteStream(
+ hevc_config_, output.get(), &config_size));
+
+ // Calculate buffer size for actual NAL unit.
+ uint32_t output_size = converter.CalculateNeededOutputBufferSize(
+ kPacketDataOkWithFieldLen4, sizeof(kPacketDataOkWithFieldLen4),
+ &hevc_config_);
+ EXPECT_GT(output_size, 0U);
+ // Simulate too small output buffer.
+ output_size -= 1;
+ output.reset(new uint8_t[output_size]);
+ EXPECT_TRUE(output.get() != nullptr);
+
+ uint32_t output_size_left_for_nal_unit = output_size;
+ // Do the conversion for actual NAL unit (expect failure).
+ EXPECT_FALSE(converter.ConvertNalUnitStreamToByteStream(
+ kPacketDataOkWithFieldLen4, sizeof(kPacketDataOkWithFieldLen4),
+ &hevc_config_, output.get(), &output_size_left_for_nal_unit));
+ EXPECT_EQ(output_size_left_for_nal_unit, 0U);
+}
+
+static const uint8_t kCorruptedPacketConfiguration[] = {
+ 0x01, 0x01, 0x60, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x96, 0xf0, 0x00, 0xfc, 0xfd, 0xf8, 0xf8, 0x00, 0x00, 0x0f,
+ 0x03, 0xa0, 0x00, 0x01, 0x00, 0x18, 0x40, 0x01, 0x0c, 0x01, 0xff,
+ 0xff, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x80, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x03, 0x00, 0x96, 0x9d, 0xc0, 0x90, 0xa1, 0x00, 0x01,
+ 0x00, 0x29, 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00,
+ 0x80, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x96, 0xa0, 0x03,
+ 0xc0, 0x80, 0x10, 0xe5, 0x96, 0x77, 0x92, 0x46, 0xda, 0xf0, 0x10,
+ 0x10, 0x00, 0x00, 0x3e, 0x80, 0x00, 0x06, 0x1a, 0x80, 0x80, 0xa2,
+ 0x00, 0x01, 0x00, 0x06, 0x44, 0x01, 0xc1, 0x73, 0xd1, 0x89};
+
+static const uint8_t kCorruptedPacketData[] = {
+ 0x00, 0x00, 0x00, 0x15, 0x01, 0x9f, 0x6e, 0xbc, 0x85, 0x3f,
+ 0x0f, 0x87, 0x47, 0xa8, 0xd7, 0x5b, 0xfc, 0xb8, 0xfd, 0x3f,
+ 0x57, 0x0e, 0xac, 0xf5, 0x4c, 0x01, 0x2e, 0x57};
+
+TEST_F(H265ToAnnexBBitstreamConverterTest, CorruptedPacket) {
+ // Initialize converter.
+ std::unique_ptr<uint8_t[]> output;
+ H265ToAnnexBBitstreamConverter converter;
+
+ // Parse the headers.
+ EXPECT_TRUE(converter.ParseConfiguration(
+ kCorruptedPacketConfiguration, sizeof(kCorruptedPacketConfiguration),
+ &hevc_config_));
+ uint32_t config_size = converter.GetConfigSize(hevc_config_);
+ EXPECT_GT(config_size, 0U);
+
+ // Go on with converting the headers.
+ output.reset(new uint8_t[config_size]);
+ EXPECT_TRUE(converter.ConvertHEVCDecoderConfigToByteStream(
+ hevc_config_, output.get(), &config_size));
+
+ // Expect an error here.
+ uint32_t output_size = converter.CalculateNeededOutputBufferSize(
+ kCorruptedPacketData, sizeof(kCorruptedPacketData), &hevc_config_);
+ EXPECT_EQ(output_size, 0U);
+}
+
+} // namespace media
diff --git a/chromium/media/filters/in_memory_url_protocol.cc b/chromium/media/filters/in_memory_url_protocol.cc
index 6f75bb9a251..3d43081d8be 100644
--- a/chromium/media/filters/in_memory_url_protocol.cc
+++ b/chromium/media/filters/in_memory_url_protocol.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/in_memory_url_protocol.h b/chromium/media/filters/in_memory_url_protocol.h
index 9b4146574c8..541b4b9cfe3 100644
--- a/chromium/media/filters/in_memory_url_protocol.h
+++ b/chromium/media/filters/in_memory_url_protocol.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/in_memory_url_protocol_unittest.cc b/chromium/media/filters/in_memory_url_protocol_unittest.cc
index 212bb9120b1..3e5539018ab 100644
--- a/chromium/media/filters/in_memory_url_protocol_unittest.cc
+++ b/chromium/media/filters/in_memory_url_protocol_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ivf_parser.cc b/chromium/media/filters/ivf_parser.cc
index 8991799d41d..2db86a04386 100644
--- a/chromium/media/filters/ivf_parser.cc
+++ b/chromium/media/filters/ivf_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ivf_parser.h b/chromium/media/filters/ivf_parser.h
index 4b17d4ca2b4..b0cf889a1a5 100644
--- a/chromium/media/filters/ivf_parser.h
+++ b/chromium/media/filters/ivf_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/ivf_parser_unittest.cc b/chromium/media/filters/ivf_parser_unittest.cc
index 91a27e911c0..eea49a9b21f 100644
--- a/chromium/media/filters/ivf_parser_unittest.cc
+++ b/chromium/media/filters/ivf_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/mac/audio_toolbox_audio_decoder.cc b/chromium/media/filters/mac/audio_toolbox_audio_decoder.cc
index 5bfdb09ea45..c841a6a8f50 100644
--- a/chromium/media/filters/mac/audio_toolbox_audio_decoder.cc
+++ b/chromium/media/filters/mac/audio_toolbox_audio_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/mac/audio_toolbox_audio_decoder.h b/chromium/media/filters/mac/audio_toolbox_audio_decoder.h
index 1ce0a73ddad..3058f39f354 100644
--- a/chromium/media/filters/mac/audio_toolbox_audio_decoder.h
+++ b/chromium/media/filters/mac/audio_toolbox_audio_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/mac/audio_toolbox_audio_encoder.cc b/chromium/media/filters/mac/audio_toolbox_audio_encoder.cc
index 8c3d6e96e98..ffd30ec7a3e 100644
--- a/chromium/media/filters/mac/audio_toolbox_audio_encoder.cc
+++ b/chromium/media/filters/mac/audio_toolbox_audio_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include "base/task/single_thread_task_runner.h"
#include "media/base/audio_buffer.h"
#include "media/base/audio_timestamp_helper.h"
+#include "media/base/converting_audio_fifo.h"
#include "media/base/encoder_status.h"
#include "media/base/timestamp_constants.h"
#include "media/formats/mp4/es_descriptor.h"
@@ -21,12 +22,10 @@ namespace {
struct InputData {
raw_ptr<const AudioBus> bus = nullptr;
- AudioStreamPacketDescription packet = {};
bool flushing = false;
};
-// Special error code we use to differentiate real errors from end of buffer.
-constexpr OSStatus kNoMoreDataError = -12345;
+constexpr int kAacFramesPerBuffer = 1024;
// Callback used to provide input data to the AudioConverter.
OSStatus ProvideInputCallback(AudioConverterRef decoder,
@@ -35,12 +34,13 @@ OSStatus ProvideInputCallback(AudioConverterRef decoder,
AudioStreamPacketDescription** packets,
void* user_data) {
auto* input_data = reinterpret_cast<InputData*>(user_data);
- if (!input_data->bus) {
+ if (input_data->flushing) {
*num_packets = 0;
- return input_data->flushing ? noErr : kNoMoreDataError;
+ return noErr;
}
- DCHECK(!input_data->flushing);
+ CHECK(input_data->bus);
+ DCHECK_EQ(input_data->bus->frames(), kAacFramesPerBuffer);
const AudioBus* bus = input_data->bus;
buffer_list->mNumberBuffers = bus->channels();
@@ -53,10 +53,11 @@ OSStatus ProvideInputCallback(AudioConverterRef decoder,
buffer_list->mBuffers[i].mData = const_cast<float*>(bus->channel(i));
}
+ // nFramesPerPacket is 1 for the input stream.
*num_packets = bus->frames();
- // This ensures that if this callback is called again, we'll exit via the
- // kNoMoreDataError path above.
+ // This callback should never be called more than once. Otherwise, we will
+ // run into the CHECK above.
input_data->bus = nullptr;
return noErr;
}
@@ -157,6 +158,17 @@ void AudioToolboxAudioEncoder::Initialize(const Options& options,
return;
}
+ const AudioParameters fifo_params(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Guess(channel_count_),
+ sample_rate_, kAacFramesPerBuffer);
+
+ // `fifo_` will rebuffer frames to have kAacFramesPerBuffer, and remix to the
+ // right number of channels if needed. `fifo_` should not resample any data.
+ fifo_ = std::make_unique<ConvertingAudioFifo>(
+ fifo_params, fifo_params,
+ base::BindRepeating(&AudioToolboxAudioEncoder::DoEncode,
+ base::Unretained(this)));
+
timestamp_helper_ = std::make_unique<AudioTimestampHelper>(sample_rate_);
output_cb_ = output_cb;
std::move(done_cb).Run(EncoderStatus::Codes::kOk);
@@ -171,75 +183,20 @@ void AudioToolboxAudioEncoder::Encode(std::unique_ptr<AudioBus> input_bus,
return;
}
+ DCHECK(timestamp_helper_);
+
if (timestamp_helper_->base_timestamp() == kNoTimestamp)
timestamp_helper_->SetBaseTimestamp(capture_time - base::TimeTicks());
- if (input_bus) {
- DVLOG(1) << __func__ << ": Encoding " << capture_time << ": "
- << timestamp_helper_->GetFrameDuration(input_bus->frames());
- } else {
- DVLOG(1) << __func__ << ": Encoding end-of-stream.";
- }
-
- InputData input_data;
- input_data.bus = input_bus.get();
- input_data.flushing = !input_bus;
+ current_done_cb_ = std::move(done_cb);
- do {
- // Note: This doesn't zero initialize the buffer.
- // FIXME: This greedily allocates, we should preserve the buffer for the
- // next call if we don't fill it.
- std::unique_ptr<uint8_t[]> packet_buffer(new uint8_t[max_packet_size_]);
-
- AudioBufferList output_buffer_list = {};
- output_buffer_list.mNumberBuffers = 1;
- output_buffer_list.mBuffers[0].mNumberChannels = channel_count_;
- output_buffer_list.mBuffers[0].mData = packet_buffer.get();
- output_buffer_list.mBuffers[0].mDataByteSize = max_packet_size_;
-
- // Encodes |num_packets| into |packet_buffer| by calling the
- // ProvideInputCallback to fill an AudioBufferList that points into
- // |input_bus|. See media::AudioConverter for a similar mechanism.
- UInt32 num_packets = 1;
- AudioStreamPacketDescription packet_description = {};
- auto result = AudioConverterFillComplexBuffer(
- encoder_, ProvideInputCallback, &input_data, &num_packets,
- &output_buffer_list, &packet_description);
-
- if ((result == kNoMoreDataError || result == noErr) && !num_packets) {
- std::move(done_cb).Run(EncoderStatus::Codes::kOk);
- return;
- }
+ // This might synchronously call DoEncode().
+ fifo_->Push(std::move(input_bus));
- if (result != noErr && result != kNoMoreDataError) {
- OSSTATUS_DLOG(ERROR, result)
- << "AudioConverterFillComplexBuffer() failed";
- std::move(done_cb).Run(EncoderStatus::Codes::kEncoderFailedEncode);
- return;
- }
-
- DCHECK_LE(packet_description.mDataByteSize, max_packet_size_);
-
- // All AAC-LC packets are 1024 frames in size. Note: If other AAC profiles
- // are added later, this value must be updated.
- auto num_frames = 1024 * num_packets;
- DVLOG(1) << __func__ << ": Output: num_frames=" << num_frames;
-
- EncodedAudioBuffer encoded_buffer(
- AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
- GuessChannelLayout(channel_count_), sample_rate_,
- num_frames),
- std::move(packet_buffer), packet_description.mDataByteSize,
- base::TimeTicks() + timestamp_helper_->GetTimestamp(),
- timestamp_helper_->GetFrameDuration(num_frames));
-
- absl::optional<CodecDescription> desc;
- if (timestamp_helper_->frame_count() == 0)
- desc = codec_desc_;
-
- timestamp_helper_->AddFrames(num_frames);
- output_cb_.Run(std::move(encoded_buffer), desc);
- } while (true);
+ if (current_done_cb_) {
+ // If |current_donc_cb_| is null, DoEncode() has already reported an error.
+ std::move(current_done_cb_).Run(EncoderStatus::Codes::kOk);
+ }
}
void AudioToolboxAudioEncoder::Flush(EncoderStatusCB flush_cb) {
@@ -251,8 +208,19 @@ void AudioToolboxAudioEncoder::Flush(EncoderStatusCB flush_cb) {
return;
}
- // Flush any remaining output.
- Encode(nullptr, base::TimeTicks(), base::DoNothing());
+ if (timestamp_helper_->base_timestamp() == kNoTimestamp) {
+ // We never fed any data into the encoder. Skip the flush.
+ std::move(flush_cb).Run(EncoderStatus::Codes::kOk);
+ return;
+ }
+
+ current_done_cb_ = std::move(flush_cb);
+
+ // Feed remaining data to the encoder. This might call DoEncode().
+ fifo_->Flush();
+
+ // Send an EOS to the encoder.
+ DoEncode(nullptr);
const auto result = AudioConverterReset(encoder_);
@@ -263,7 +231,11 @@ void AudioToolboxAudioEncoder::Flush(EncoderStatusCB flush_cb) {
}
timestamp_helper_->SetBaseTimestamp(kNoTimestamp);
- std::move(flush_cb).Run(status_code);
+
+ if (current_done_cb_) {
+ // If |current_done_cb_| is null, DoEncode() has already reported an error.
+ std::move(current_done_cb_).Run(status_code);
+ }
}
bool AudioToolboxAudioEncoder::CreateEncoder(
@@ -319,4 +291,71 @@ bool AudioToolboxAudioEncoder::CreateEncoder(
return true;
}
+void AudioToolboxAudioEncoder::DoEncode(AudioBus* input_bus) {
+ bool is_flushing = !input_bus;
+
+ InputData input_data;
+ input_data.bus = input_bus;
+ input_data.flushing = is_flushing;
+
+ do {
+ // Note: This doesn't zero initialize the buffer.
+ // FIXME: This greedily allocates, we should preserve the buffer for the
+ // next call if we don't fill it.
+ std::unique_ptr<uint8_t[]> packet_buffer(new uint8_t[max_packet_size_]);
+
+ AudioBufferList output_buffer_list = {};
+ output_buffer_list.mNumberBuffers = 1;
+ output_buffer_list.mBuffers[0].mNumberChannels = channel_count_;
+ output_buffer_list.mBuffers[0].mData = packet_buffer.get();
+ output_buffer_list.mBuffers[0].mDataByteSize = max_packet_size_;
+
+ // Encodes |num_packets| into |packet_buffer| by calling the
+ // ProvideInputCallback to fill an AudioBufferList that points into
+ // |input_bus|. See media::AudioConverter for a similar mechanism.
+ UInt32 num_packets = 1;
+ AudioStreamPacketDescription packet_description = {};
+ auto result = AudioConverterFillComplexBuffer(
+ encoder_, ProvideInputCallback, &input_data, &num_packets,
+ &output_buffer_list, &packet_description);
+
+ // We expect "1 in, 1 out" when feeding packets into the encoder, except
+ // when flushing.
+ if (result == noErr && !num_packets) {
+ DCHECK(is_flushing);
+ return;
+ }
+
+ if (result != noErr) {
+ OSSTATUS_DLOG(ERROR, result)
+ << "AudioConverterFillComplexBuffer() failed";
+ std::move(current_done_cb_)
+ .Run(EncoderStatus::Codes::kEncoderFailedEncode);
+ return;
+ }
+
+ DCHECK_LE(packet_description.mDataByteSize, max_packet_size_);
+
+ // All AAC-LC packets are 1024 frames in size. Note: If other AAC profiles
+ // are added later, this value must be updated.
+ auto num_frames = kAacFramesPerBuffer * num_packets;
+ DVLOG(1) << __func__ << ": Output: num_frames=" << num_frames;
+
+ EncodedAudioBuffer encoded_buffer(
+ AudioParameters(AudioParameters::AUDIO_PCM_LINEAR,
+ ChannelLayoutConfig::Guess(channel_count_),
+ sample_rate_, num_frames),
+ std::move(packet_buffer), packet_description.mDataByteSize,
+ base::TimeTicks() + timestamp_helper_->GetTimestamp(),
+ timestamp_helper_->GetFrameDuration(num_frames));
+
+ absl::optional<CodecDescription> desc;
+ if (timestamp_helper_->frame_count() == 0)
+ desc = codec_desc_;
+
+ timestamp_helper_->AddFrames(num_frames);
+ output_cb_.Run(std::move(encoded_buffer), desc);
+ } while (is_flushing); // Only encode once when we aren't flushing.
+}
+
} // namespace media
diff --git a/chromium/media/filters/mac/audio_toolbox_audio_encoder.h b/chromium/media/filters/mac/audio_toolbox_audio_encoder.h
index 02f7ddfcb0e..8acc616ee5e 100644
--- a/chromium/media/filters/mac/audio_toolbox_audio_encoder.h
+++ b/chromium/media/filters/mac/audio_toolbox_audio_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,6 +15,7 @@
namespace media {
class AudioTimestampHelper;
+class ConvertingAudioFifo;
// Audio encoder based on macOS's AudioToolbox API. The AudioToolbox
// API is required to encode codecs that aren't supported by Chromium.
@@ -40,6 +41,8 @@ class MEDIA_EXPORT AudioToolboxAudioEncoder : public AudioEncoder {
bool CreateEncoder(const AudioEncoderConfig& config,
const AudioStreamBasicDescription& output_format);
+ void DoEncode(AudioBus* data);
+
// "Converter" for turning raw audio into encoded samples.
AudioConverterRef encoder_ = nullptr;
@@ -49,6 +52,8 @@ class MEDIA_EXPORT AudioToolboxAudioEncoder : public AudioEncoder {
// Actual sample rate from the encoder, may be different than config.
uint32_t sample_rate_ = 0u;
+ EncoderStatusCB current_done_cb_;
+
// Callback that delivers encoded frames.
OutputCB output_cb_;
@@ -58,6 +63,9 @@ class MEDIA_EXPORT AudioToolboxAudioEncoder : public AudioEncoder {
std::unique_ptr<AudioTimestampHelper> timestamp_helper_;
std::vector<uint8_t> codec_desc_;
+
+ // Ensures the data sent to Encode() matches the encoder's input format.
+ std::unique_ptr<ConvertingAudioFifo> fifo_;
};
} // namespace media
diff --git a/chromium/media/filters/media_file_checker.cc b/chromium/media/filters/media_file_checker.cc
index db67fb7370a..422068b19c2 100644
--- a/chromium/media/filters/media_file_checker.cc
+++ b/chromium/media/filters/media_file_checker.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/media_file_checker.h b/chromium/media/filters/media_file_checker.h
index 1deba3d7c49..265c9a8fef0 100644
--- a/chromium/media/filters/media_file_checker.h
+++ b/chromium/media/filters/media_file_checker.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/media_file_checker_unittest.cc b/chromium/media/filters/media_file_checker_unittest.cc
index b8d52aacad5..fe6b3843fa5 100644
--- a/chromium/media/filters/media_file_checker_unittest.cc
+++ b/chromium/media/filters/media_file_checker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/memory_data_source.cc b/chromium/media/filters/memory_data_source.cc
index 7e34c624ed7..9c02e757010 100644
--- a/chromium/media/filters/memory_data_source.cc
+++ b/chromium/media/filters/memory_data_source.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/memory_data_source.h b/chromium/media/filters/memory_data_source.h
index c94a6793f72..780facd401d 100644
--- a/chromium/media/filters/memory_data_source.h
+++ b/chromium/media/filters/memory_data_source.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/memory_data_source_unittest.cc b/chromium/media/filters/memory_data_source_unittest.cc
index 89872fabc6b..af1908c1617 100644
--- a/chromium/media/filters/memory_data_source_unittest.cc
+++ b/chromium/media/filters/memory_data_source_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/offloading_video_decoder.cc b/chromium/media/filters/offloading_video_decoder.cc
index c80b975611b..609e9cb7672 100644
--- a/chromium/media/filters/offloading_video_decoder.cc
+++ b/chromium/media/filters/offloading_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/containers/contains.h"
#include "base/synchronization/atomic_flag.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
@@ -94,8 +95,7 @@ void OffloadingVideoDecoder::Initialize(const VideoDecoderConfig& config,
const bool disable_offloading =
config.is_encrypted() ||
config.coded_size().width() < min_offloading_width_ ||
- std::find(supported_codecs_.begin(), supported_codecs_.end(),
- config.codec()) == supported_codecs_.end();
+ !base::Contains(supported_codecs_, config.codec());
if (initialized_) {
initialized_ = false;
diff --git a/chromium/media/filters/offloading_video_decoder.h b/chromium/media/filters/offloading_video_decoder.h
index fb193fc9d02..c3c1a797a88 100644
--- a/chromium/media/filters/offloading_video_decoder.h
+++ b/chromium/media/filters/offloading_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/offloading_video_decoder_unittest.cc b/chromium/media/filters/offloading_video_decoder_unittest.cc
index 8fcda25b83e..1ae7d506e31 100644
--- a/chromium/media/filters/offloading_video_decoder_unittest.cc
+++ b/chromium/media/filters/offloading_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/passthrough_dts_audio_decoder.cc b/chromium/media/filters/passthrough_dts_audio_decoder.cc
new file mode 100644
index 00000000000..a1cb03ed3f0
--- /dev/null
+++ b/chromium/media/filters/passthrough_dts_audio_decoder.cc
@@ -0,0 +1,116 @@
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/filters/passthrough_dts_audio_decoder.h"
+
+#include "media/base/audio_buffer.h"
+#include "media/base/bind_to_current_loop.h"
+#include "media/formats/dts/dts_util.h"
+
+namespace media {
+
+PassthroughDTSAudioDecoder::PassthroughDTSAudioDecoder(
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ MediaLog* media_log)
+ : task_runner_(task_runner),
+ media_log_(media_log),
+ pool_(new AudioBufferMemoryPool()) {
+ DETACH_FROM_SEQUENCE(sequence_checker_);
+}
+
+PassthroughDTSAudioDecoder::~PassthroughDTSAudioDecoder() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+}
+
+AudioDecoderType PassthroughDTSAudioDecoder::GetDecoderType() const {
+ return AudioDecoderType::kPassthroughDTS;
+}
+
+void PassthroughDTSAudioDecoder::Initialize(const AudioDecoderConfig& config,
+ CdmContext* /* cdm_context */,
+ InitCB init_cb,
+ const OutputCB& output_cb,
+ const WaitingCB& /* waiting_cb */) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(config.IsValidConfig());
+ InitCB bound_init_cb = BindToCurrentLoop(std::move(init_cb));
+ if (config.is_encrypted()) {
+ std::move(bound_init_cb)
+ .Run(DecoderStatus(DecoderStatus::Codes::kUnsupportedEncryptionMode,
+ "PassthroughDTSAudioDecoder does not support "
+ "encrypted content"));
+ return;
+ }
+
+ if (config.target_output_sample_format() != kSampleFormatDts) {
+ std::move(bound_init_cb)
+ .Run(
+ DecoderStatus(DecoderStatus::Codes::kUnsupportedConfig,
+ "PassthroughDTSAudioDecoder does not support codec"));
+ return;
+ }
+
+ // Success!
+ config_ = config;
+ output_cb_ = BindToCurrentLoop(output_cb);
+ std::move(bound_init_cb).Run(OkStatus());
+}
+
+void PassthroughDTSAudioDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
+ DecodeCB decode_cb) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(decode_cb);
+ DecodeCB decode_cb_bound = BindToCurrentLoop(std::move(decode_cb));
+
+ if (buffer->end_of_stream()) {
+ std::move(decode_cb_bound).Run(DecoderStatus::Codes::kOk);
+ return;
+ }
+
+ ProcessBuffer(*buffer, std::move(decode_cb_bound));
+}
+
+void PassthroughDTSAudioDecoder::Reset(base::OnceClosure closure) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
+ task_runner_->PostTask(FROM_HERE, std::move(closure));
+}
+
+void PassthroughDTSAudioDecoder::ProcessBuffer(const DecoderBuffer& buffer,
+ DecodeCB decode_cb) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
+ // Make sure we are notified if http://crbug.com/49709 returns. Issue also
+ // occurs with some damaged files.
+ if (!buffer.end_of_stream() && buffer.timestamp() == kNoTimestamp) {
+ DVLOG(1) << "Received a buffer without timestamps!";
+ std::move(decode_cb).Run(DecoderStatus::Codes::kFailed);
+ return;
+ }
+ EncapsulateFrame(buffer);
+
+ std::move(decode_cb).Run(DecoderStatus::Codes::kOk);
+}
+
+void PassthroughDTSAudioDecoder::EncapsulateFrame(const DecoderBuffer& buffer) {
+ if (config_.target_output_sample_format() != kSampleFormatDts)
+ return;
+ const size_t samples_per_frame = dts::GetDTSSamplesPerFrame(config_.codec());
+ const size_t dts_frame_size = 2 * 2 * samples_per_frame;
+ std::vector<uint8_t> output_buffer(dts_frame_size);
+
+ // Encapsulated a compressed DTS frame per IEC61937
+ base::span<const uint8_t> input_data;
+ input_data = base::span<const uint8_t>(buffer.data(), buffer.data_size());
+ dts::WrapDTSWithIEC61937(input_data, output_buffer, config_.codec());
+
+ // Create a mono channel "buffer" to hold IEC encapsulated bitstream
+ uint8_t* output_channels[1] = {output_buffer.data()};
+ scoped_refptr<AudioBuffer> output = AudioBuffer::CopyBitstreamFrom(
+ kSampleFormatIECDts, CHANNEL_LAYOUT_MONO, 1, config_.samples_per_second(),
+ samples_per_frame, output_channels, dts_frame_size, buffer.timestamp());
+ output_cb_.Run(output);
+}
+
+} // namespace media
diff --git a/chromium/media/filters/passthrough_dts_audio_decoder.h b/chromium/media/filters/passthrough_dts_audio_decoder.h
new file mode 100644
index 00000000000..e62ba1bdb61
--- /dev/null
+++ b/chromium/media/filters/passthrough_dts_audio_decoder.h
@@ -0,0 +1,70 @@
+// Copyright 2022 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_FILTERS_PASSTHROUGH_DTS_AUDIO_DECODER_H_
+#define MEDIA_FILTERS_PASSTHROUGH_DTS_AUDIO_DECODER_H_
+
+#include "media/base/audio_buffer.h"
+#include "media/base/audio_decoder.h"
+#include "media/base/media_log.h"
+#include "media/base/sample_format.h"
+
+namespace base {
+class SequencedTaskRunner;
+}
+
+namespace media {
+
+class DecoderBuffer;
+
+// PassthroughDTSAudioDecoder does not decode DTS audio frames. Instead,
+// every DTS audio frame is encapsulated in IEC-61937 frame, which is
+// then pass to a compatible HDMI audio sink for actual decoding.
+// All public APIs and callbacks are trampolined to the |task_runner_| so
+// that no locks are required for thread safety.
+class MEDIA_EXPORT PassthroughDTSAudioDecoder : public AudioDecoder {
+ public:
+ PassthroughDTSAudioDecoder(
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ MediaLog* media_log);
+ PassthroughDTSAudioDecoder(const PassthroughDTSAudioDecoder&) = delete;
+ PassthroughDTSAudioDecoder& operator=(const PassthroughDTSAudioDecoder&) =
+ delete;
+ ~PassthroughDTSAudioDecoder() override;
+
+ // AudioDecoder implementation.
+ AudioDecoderType GetDecoderType() const override;
+ void Initialize(const AudioDecoderConfig& config,
+ CdmContext* cdm_context,
+ InitCB init_cb,
+ const OutputCB& output_cb,
+ const WaitingCB& waiting_cb) override;
+ void Decode(scoped_refptr<DecoderBuffer> buffer, DecodeCB decode_cb) override;
+ void Reset(base::OnceClosure closure) override;
+
+ private:
+ // Reset decoder and call |reset_cb_|.
+ void DoReset();
+
+ // Process an unencrypted buffer with a DTS audio frame.
+ void ProcessBuffer(const DecoderBuffer& buffer, DecodeCB decode_cb);
+
+ // Encapsulate a DTS audio frame in IEC-61937.
+ void EncapsulateFrame(const DecoderBuffer& buffer);
+
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
+ SEQUENCE_CHECKER(sequence_checker_);
+
+ OutputCB output_cb_;
+
+ AudioDecoderConfig config_;
+
+ MediaLog* media_log_;
+
+ scoped_refptr<AudioBufferMemoryPool> pool_;
+};
+
+} // namespace media
+
+#endif // MEDIA_FILTERS_PASSTHROUGH_DTS_AUDIO_DECODER_H_
diff --git a/chromium/media/filters/pipeline_controller.cc b/chromium/media/filters/pipeline_controller.cc
index 26074c045c6..62f8d171fd5 100644
--- a/chromium/media/filters/pipeline_controller.cc
+++ b/chromium/media/filters/pipeline_controller.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/pipeline_controller.h b/chromium/media/filters/pipeline_controller.h
index 116cae18973..4eff4f79b3e 100644
--- a/chromium/media/filters/pipeline_controller.h
+++ b/chromium/media/filters/pipeline_controller.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/pipeline_controller_unittest.cc b/chromium/media/filters/pipeline_controller_unittest.cc
index 8bd37dfefeb..823adbadb0e 100644
--- a/chromium/media/filters/pipeline_controller_unittest.cc
+++ b/chromium/media/filters/pipeline_controller_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/source_buffer_parse_warnings.h b/chromium/media/filters/source_buffer_parse_warnings.h
index 222c7f5f0a6..f921d49310d 100644
--- a/chromium/media/filters/source_buffer_parse_warnings.h
+++ b/chromium/media/filters/source_buffer_parse_warnings.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/source_buffer_range.cc b/chromium/media/filters/source_buffer_range.cc
index c11f26ddd1a..07ec131726b 100644
--- a/chromium/media/filters/source_buffer_range.cc
+++ b/chromium/media/filters/source_buffer_range.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/source_buffer_range.h b/chromium/media/filters/source_buffer_range.h
index 485527f7693..9a2f95dd1dd 100644
--- a/chromium/media/filters/source_buffer_range.h
+++ b/chromium/media/filters/source_buffer_range.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/source_buffer_state.cc b/chromium/media/filters/source_buffer_state.cc
index 0ff019c8549..a3c279cf290 100644
--- a/chromium/media/filters/source_buffer_state.cc
+++ b/chromium/media/filters/source_buffer_state.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include "base/callback_helpers.h"
#include "base/command_line.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
@@ -662,8 +663,8 @@ bool SourceBufferState::OnNewConfigs(
<< " config: " << audio_config.AsHumanReadableString();
DCHECK(audio_config.IsValidConfig());
- const auto& it = std::find(expected_acodecs.begin(),
- expected_acodecs.end(), audio_config.codec());
+ const auto& it =
+ base::ranges::find(expected_acodecs, audio_config.codec());
if (it == expected_acodecs.end()) {
MEDIA_LOG(ERROR, media_log_) << "Audio stream codec "
<< GetCodecName(audio_config.codec())
@@ -730,8 +731,8 @@ bool SourceBufferState::OnNewConfigs(
}
#endif // BUILDFLAG(ENABLE_PLATFORM_ENCRYPTED_DOLBY_VISION)
- const auto& it = std::find(expected_vcodecs.begin(),
- expected_vcodecs.end(), video_config.codec());
+ const auto& it =
+ base::ranges::find(expected_vcodecs, video_config.codec());
if (it == expected_vcodecs.end()) {
MEDIA_LOG(ERROR, media_log_) << "Video stream codec "
<< GetCodecName(video_config.codec())
diff --git a/chromium/media/filters/source_buffer_state.h b/chromium/media/filters/source_buffer_state.h
index eaf483b1415..2158f480ff8 100644
--- a/chromium/media/filters/source_buffer_state.h
+++ b/chromium/media/filters/source_buffer_state.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/source_buffer_state_unittest.cc b/chromium/media/filters/source_buffer_state_unittest.cc
index df9b2ba1a4d..ba9f8f10ffd 100644
--- a/chromium/media/filters/source_buffer_state_unittest.cc
+++ b/chromium/media/filters/source_buffer_state_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/source_buffer_stream.cc b/chromium/media/filters/source_buffer_stream.cc
index ddd4a39475b..123a941481b 100644
--- a/chromium/media/filters/source_buffer_stream.cc
+++ b/chromium/media/filters/source_buffer_stream.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,7 +12,6 @@
#include "base/bind.h"
#include "base/logging.h"
-#include "base/metrics/histogram_macros.h"
#include "base/trace_event/trace_event.h"
#include "media/base/demuxer_memory_limit.h"
#include "media/base/media_switches.h"
@@ -1657,6 +1656,16 @@ void SourceBufferStream::WarnIfTrackBufferExhaustionSkipsForward(
}
}
+bool SourceBufferStream::IsNextBufferConfigChanged() {
+ if (!track_buffer_.empty())
+ return track_buffer_.front()->GetConfigId() != current_config_index_;
+
+ if (!selected_range_ || !selected_range_->HasNextBuffer())
+ return false;
+
+ return selected_range_->GetNextConfigId() != current_config_index_;
+}
+
base::TimeDelta SourceBufferStream::GetNextBufferTimestamp() {
if (!track_buffer_.empty())
return track_buffer_.front()->timestamp();
diff --git a/chromium/media/filters/source_buffer_stream.h b/chromium/media/filters/source_buffer_stream.h
index 2584c57e25e..313565082b2 100644
--- a/chromium/media/filters/source_buffer_stream.h
+++ b/chromium/media/filters/source_buffer_stream.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -179,6 +179,11 @@ class MEDIA_EXPORT SourceBufferStream {
memory_limit_ = memory_limit;
}
+ // A helper function for detecting video/audio config change, so that we
+ // can "peek" the next buffer instead of dequeuing it directly from the source
+ // stream buffer queue.
+ bool IsNextBufferConfigChanged();
+
private:
friend class SourceBufferStreamTest;
diff --git a/chromium/media/filters/source_buffer_stream_unittest.cc b/chromium/media/filters/source_buffer_stream_unittest.cc
index 54d387062ef..f159c1c6628 100644
--- a/chromium/media/filters/source_buffer_stream_unittest.cc
+++ b/chromium/media/filters/source_buffer_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -3368,10 +3368,41 @@ TEST_F(SourceBufferStreamTest, GetRemovalRange_Range) {
EXPECT_EQ(18, bytes_removed);
}
-TEST_F(SourceBufferStreamTest, ConfigChange_Basic) {
+TEST_F(SourceBufferStreamTest, IsNextBufferConfigChanged) {
+ // selected_range_ is nullptr, so return false
+ EXPECT_FALSE(stream_->IsNextBufferConfigChanged());
VideoDecoderConfig new_config = TestVideoConfig::Large();
ASSERT_FALSE(new_config.Matches(video_config_));
+ // read all buffers
+ NewCodedFrameGroupAppend("0K 10 20");
+ Seek(0);
+ CheckExpectedRangesByTimestamp("{ [0,30) }");
+ CheckExpectedBuffers("0K 10 20");
+ EXPECT_FALSE(stream_->IsNextBufferConfigChanged());
+
+ // Signal a config change.
+ stream_->UpdateVideoConfig(new_config, false);
+ NewCodedFrameGroupAppend("30K 40");
+ EXPECT_TRUE(stream_->IsNextBufferConfigChanged());
+
+ scoped_refptr<StreamParserBuffer> buffer;
+ EXPECT_STATUS_FOR_STREAM_OP(kConfigChange, GetNextBuffer(&buffer));
+ CheckVideoConfig(new_config);
+
+ // Overlap-append
+ NewCodedFrameGroupAppend(
+ "21K 41 51 61 71 81 91 101 111 121 "
+ "131K 141");
+ CheckExpectedRangesByTimestamp("{ [0,151) }");
+
+ // track_buffer has the buffers with timestamp 30 and 40
+ EXPECT_FALSE(stream_->IsNextBufferConfigChanged());
+}
+
+TEST_F(SourceBufferStreamTest, ConfigChange_Basic) {
+ VideoDecoderConfig new_config = TestVideoConfig::Large();
+ ASSERT_FALSE(new_config.Matches(video_config_));
Seek(0);
CheckVideoConfig(video_config_);
@@ -3399,6 +3430,7 @@ TEST_F(SourceBufferStreamTest, ConfigChange_Basic) {
// Verify the next attempt to get a buffer will signal that a config change
// has happened.
+ EXPECT_TRUE(stream_->IsNextBufferConfigChanged());
EXPECT_STATUS_FOR_STREAM_OP(kConfigChange, GetNextBuffer(&buffer));
// Verify that the new config is now returned.
@@ -3425,6 +3457,7 @@ TEST_F(SourceBufferStreamTest, ConfigChange_Seek) {
CheckVideoConfig(video_config_);
Seek(5);
CheckVideoConfig(video_config_);
+ EXPECT_TRUE(stream_->IsNextBufferConfigChanged());
EXPECT_STATUS_FOR_STREAM_OP(kConfigChange, GetNextBuffer(&buffer));
CheckVideoConfig(new_config);
CheckExpectedBuffers(5, 9, &kDataB);
@@ -3443,6 +3476,7 @@ TEST_F(SourceBufferStreamTest, ConfigChange_Seek) {
CheckVideoConfig(new_config);
Seek(0);
CheckVideoConfig(new_config);
+ EXPECT_TRUE(stream_->IsNextBufferConfigChanged());
EXPECT_STATUS_FOR_STREAM_OP(kConfigChange, GetNextBuffer(&buffer));
CheckVideoConfig(video_config_);
CheckExpectedBuffers(0, 4, &kDataA);
@@ -4578,6 +4612,7 @@ TEST_F(SourceBufferStreamTest, Audio_ConfigChangeWithPreroll) {
// Verify the next attempt to get a buffer will signal that a config change
// has happened.
scoped_refptr<StreamParserBuffer> buffer;
+ EXPECT_TRUE(stream_->IsNextBufferConfigChanged());
EXPECT_STATUS_FOR_STREAM_OP(kConfigChange, GetNextBuffer(&buffer));
// Verify upcoming buffers will use the new config.
@@ -4832,6 +4867,7 @@ TEST_F(SourceBufferStreamTest, ConfigChange_ReSeek) {
CheckVideoConfig(video_config_);
SeekToTimestampMs(2030);
CheckVideoConfig(video_config_);
+ EXPECT_TRUE(stream_->IsNextBufferConfigChanged());
EXPECT_STATUS_FOR_STREAM_OP(kConfigChange, GetNextBuffer(&buffer));
CheckVideoConfig(new_config);
@@ -4853,10 +4889,12 @@ TEST_F(SourceBufferStreamTest, ConfigChange_ReSeek) {
SeekToTimestampMs(2000);
CheckVideoConfig(new_config);
ASSERT_FALSE(new_config.Matches(video_config_));
+ EXPECT_TRUE(stream_->IsNextBufferConfigChanged());
EXPECT_STATUS_FOR_STREAM_OP(kConfigChange, GetNextBuffer(&buffer));
CheckVideoConfig(video_config_);
CheckExpectedBuffers("2000K 2010 2020D10");
CheckVideoConfig(video_config_);
+ EXPECT_TRUE(stream_->IsNextBufferConfigChanged());
EXPECT_STATUS_FOR_STREAM_OP(kConfigChange, GetNextBuffer(&buffer));
CheckVideoConfig(new_config);
CheckExpectedBuffers("2030K 2040 2050D10");
diff --git a/chromium/media/filters/stream_parser_factory.cc b/chromium/media/filters/stream_parser_factory.cc
index c7194e30475..160697c4886 100644
--- a/chromium/media/filters/stream_parser_factory.cc
+++ b/chromium/media/filters/stream_parser_factory.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/strings/pattern.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
@@ -41,7 +42,7 @@
namespace media {
-typedef bool (*CodecIDValidatorFunction)(const std::string& codecs_id,
+typedef bool (*CodecIDValidatorFunction)(base::StringPiece codecs_id,
MediaLog* media_log);
struct CodecInfo {
@@ -120,7 +121,7 @@ static StreamParser* BuildWebMParser(base::span<const std::string> codecs,
}
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
-static int GetMP4AudioObjectType(const std::string& codec_id,
+static int GetMP4AudioObjectType(base::StringPiece codec_id,
MediaLog* media_log) {
// From RFC 6381 section 3.3 (ISO Base Media File Format Name Space):
// When the first element of a ['codecs' parameter value] is 'mp4a' ...,
@@ -150,7 +151,7 @@ constexpr int kAACSBRObjectType = 5;
constexpr int kAACPSObjectType = 29;
constexpr int kAACXHEObjectType = 42;
-bool ValidateMP4ACodecID(const std::string& codec_id, MediaLog* media_log) {
+bool ValidateMP4ACodecID(base::StringPiece codec_id, MediaLog* media_log) {
int audio_object_type = GetMP4AudioObjectType(codec_id, media_log);
if (audio_object_type == kAACLCObjectType ||
audio_object_type == kAACSBRObjectType ||
@@ -481,7 +482,7 @@ static bool VerifyCodec(const CodecInfo* codec_info,
// The value of each of |factory_function|, |audio_codecs| and |video_codecs| is
// not updated if it was nullptr initially.
static SupportsType CheckTypeAndCodecs(
- const std::string& type,
+ base::StringPiece type,
base::span<const std::string> codecs,
MediaLog* media_log,
ParserFactoryFunction* factory_function,
@@ -562,7 +563,7 @@ static SupportsType CheckTypeAndCodecs(
// static
SupportsType StreamParserFactory::IsTypeSupported(
- const std::string& type,
+ base::StringPiece type,
base::span<const std::string> codecs) {
// TODO(wolenetz): Questionable MediaLog usage, http://crbug.com/712310
NullMediaLog media_log;
@@ -572,7 +573,7 @@ SupportsType StreamParserFactory::IsTypeSupported(
// static
std::unique_ptr<StreamParser> StreamParserFactory::Create(
- const std::string& type,
+ base::StringPiece type,
base::span<const std::string> codecs,
MediaLog* media_log) {
std::unique_ptr<StreamParser> stream_parser;
diff --git a/chromium/media/filters/stream_parser_factory.h b/chromium/media/filters/stream_parser_factory.h
index 117c7c6ee83..14a550b71a6 100644
--- a/chromium/media/filters/stream_parser_factory.h
+++ b/chromium/media/filters/stream_parser_factory.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include <vector>
#include "base/containers/span.h"
+#include "base/strings/string_piece_forward.h"
#include "media/base/media_export.h"
#include "media/base/media_log.h"
#include "media/base/mime_util.h"
@@ -30,7 +31,7 @@ class MEDIA_EXPORT StreamParserFactory {
// supported for the mime type.
// kMaybeSupported indicates the mime type is supported, but the mime type
// requires a codecs parameter that is missing.
- static SupportsType IsTypeSupported(const std::string& type,
+ static SupportsType IsTypeSupported(base::StringPiece type,
base::span<const std::string> codecs);
// Creates a new StreamParser object if the specified |type| and |codecs| list
@@ -54,7 +55,7 @@ class MEDIA_EXPORT StreamParserFactory {
// error should occur for unsupported or invalid decoder configs during
// attempted decode.
static std::unique_ptr<StreamParser> Create(
- const std::string& type,
+ base::StringPiece type,
base::span<const std::string> codecs,
MediaLog* media_log);
static std::unique_ptr<StreamParser> Create(
diff --git a/chromium/media/filters/video_cadence_estimator.cc b/chromium/media/filters/video_cadence_estimator.cc
index cbbd1109b90..615c4b9abfd 100644
--- a/chromium/media/filters/video_cadence_estimator.cc
+++ b/chromium/media/filters/video_cadence_estimator.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/video_cadence_estimator.h b/chromium/media/filters/video_cadence_estimator.h
index d1cc14bacfb..eec7fd1339d 100644
--- a/chromium/media/filters/video_cadence_estimator.h
+++ b/chromium/media/filters/video_cadence_estimator.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/video_cadence_estimator_unittest.cc b/chromium/media/filters/video_cadence_estimator_unittest.cc
index d2b7cc57f69..aecf3450407 100644
--- a/chromium/media/filters/video_cadence_estimator_unittest.cc
+++ b/chromium/media/filters/video_cadence_estimator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/video_decoder_stream_unittest.cc b/chromium/media/filters/video_decoder_stream_unittest.cc
index 713071dc550..2f27ea8ac56 100644
--- a/chromium/media/filters/video_decoder_stream_unittest.cc
+++ b/chromium/media/filters/video_decoder_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/video_renderer_algorithm.cc b/chromium/media/filters/video_renderer_algorithm.cc
index 0d0533cc23e..b30878e51b7 100644
--- a/chromium/media/filters/video_renderer_algorithm.cc
+++ b/chromium/media/filters/video_renderer_algorithm.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/video_renderer_algorithm.h b/chromium/media/filters/video_renderer_algorithm.h
index 2cc07ce802d..efa6d6edaca 100644
--- a/chromium/media/filters/video_renderer_algorithm.h
+++ b/chromium/media/filters/video_renderer_algorithm.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/video_renderer_algorithm_unittest.cc b/chromium/media/filters/video_renderer_algorithm_unittest.cc
index 50cf9b6c4df..f4a6262188a 100644
--- a/chromium/media/filters/video_renderer_algorithm_unittest.cc
+++ b/chromium/media/filters/video_renderer_algorithm_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_bool_decoder.cc b/chromium/media/filters/vp9_bool_decoder.cc
index e5e76f49fe8..29f94d9a0f3 100644
--- a/chromium/media/filters/vp9_bool_decoder.cc
+++ b/chromium/media/filters/vp9_bool_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_bool_decoder.h b/chromium/media/filters/vp9_bool_decoder.h
index d290f3c0b10..1885bb2edb0 100644
--- a/chromium/media/filters/vp9_bool_decoder.h
+++ b/chromium/media/filters/vp9_bool_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_compressed_header_parser.cc b/chromium/media/filters/vp9_compressed_header_parser.cc
index 4daae0d83eb..294d3ddf187 100644
--- a/chromium/media/filters/vp9_compressed_header_parser.cc
+++ b/chromium/media/filters/vp9_compressed_header_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_compressed_header_parser.h b/chromium/media/filters/vp9_compressed_header_parser.h
index 1c837364e3c..10195cee46f 100644
--- a/chromium/media/filters/vp9_compressed_header_parser.h
+++ b/chromium/media/filters/vp9_compressed_header_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_parser.cc b/chromium/media/filters/vp9_parser.cc
index 6de3dab48c1..3cbc758dce0 100644
--- a/chromium/media/filters/vp9_parser.cc
+++ b/chromium/media/filters/vp9_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/filters/vp9_parser.h b/chromium/media/filters/vp9_parser.h
index ebe38a12845..e58a4c56693 100644
--- a/chromium/media/filters/vp9_parser.h
+++ b/chromium/media/filters/vp9_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/filters/vp9_parser_encrypted_fuzzertest.cc b/chromium/media/filters/vp9_parser_encrypted_fuzzertest.cc
index a1d5c8e7603..1737a0e2d01 100644
--- a/chromium/media/filters/vp9_parser_encrypted_fuzzertest.cc
+++ b/chromium/media/filters/vp9_parser_encrypted_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_parser_fuzzertest.cc b/chromium/media/filters/vp9_parser_fuzzertest.cc
index 07fb0ad2847..30c47b2aa95 100644
--- a/chromium/media/filters/vp9_parser_fuzzertest.cc
+++ b/chromium/media/filters/vp9_parser_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_parser_unittest.cc b/chromium/media/filters/vp9_parser_unittest.cc
index 06411ffdb87..9cf5e80cfc6 100644
--- a/chromium/media/filters/vp9_parser_unittest.cc
+++ b/chromium/media/filters/vp9_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_raw_bits_reader.cc b/chromium/media/filters/vp9_raw_bits_reader.cc
index 2a43def6f14..82f21803eff 100644
--- a/chromium/media/filters/vp9_raw_bits_reader.cc
+++ b/chromium/media/filters/vp9_raw_bits_reader.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_raw_bits_reader.h b/chromium/media/filters/vp9_raw_bits_reader.h
index af315ee6d3d..16d413b6db4 100644
--- a/chromium/media/filters/vp9_raw_bits_reader.h
+++ b/chromium/media/filters/vp9_raw_bits_reader.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_raw_bits_reader_unittest.cc b/chromium/media/filters/vp9_raw_bits_reader_unittest.cc
index 3f49e3d6307..7c2c42287e1 100644
--- a/chromium/media/filters/vp9_raw_bits_reader_unittest.cc
+++ b/chromium/media/filters/vp9_raw_bits_reader_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_uncompressed_header_parser.cc b/chromium/media/filters/vp9_uncompressed_header_parser.cc
index 294c709ae57..68f431a97d8 100644
--- a/chromium/media/filters/vp9_uncompressed_header_parser.cc
+++ b/chromium/media/filters/vp9_uncompressed_header_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_uncompressed_header_parser.h b/chromium/media/filters/vp9_uncompressed_header_parser.h
index 78df0c1ab96..7edfc09e181 100644
--- a/chromium/media/filters/vp9_uncompressed_header_parser.h
+++ b/chromium/media/filters/vp9_uncompressed_header_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vp9_uncompressed_header_parser_unittest.cc b/chromium/media/filters/vp9_uncompressed_header_parser_unittest.cc
index 53fbfafe261..4ba19dcc41e 100644
--- a/chromium/media/filters/vp9_uncompressed_header_parser_unittest.cc
+++ b/chromium/media/filters/vp9_uncompressed_header_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vpx_video_decoder.cc b/chromium/media/filters/vpx_video_decoder.cc
index e75428f7c55..3c1188e2c27 100644
--- a/chromium/media/filters/vpx_video_decoder.cc
+++ b/chromium/media/filters/vpx_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -349,12 +349,13 @@ bool VpxVideoDecoder::VpxDecode(const DecoderBuffer* buffer,
return false;
if (vpx_image_alpha && config_.codec() == VideoCodec::kVP8) {
- libyuv::CopyPlane(vpx_image_alpha->planes[VPX_PLANE_Y],
- vpx_image_alpha->stride[VPX_PLANE_Y],
- (*video_frame)->visible_data(VideoFrame::kAPlane),
- (*video_frame)->stride(VideoFrame::kAPlane),
- (*video_frame)->visible_rect().width(),
- (*video_frame)->visible_rect().height());
+ libyuv::CopyPlane(
+ vpx_image_alpha->planes[VPX_PLANE_Y],
+ vpx_image_alpha->stride[VPX_PLANE_Y],
+ (*video_frame)->GetWritableVisibleData(VideoFrame::kAPlane),
+ (*video_frame)->stride(VideoFrame::kAPlane),
+ (*video_frame)->visible_rect().width(),
+ (*video_frame)->visible_rect().height());
}
(*video_frame)->set_timestamp(buffer->timestamp());
@@ -592,10 +593,11 @@ bool VpxVideoDecoder::CopyVpxImageToVideoFrame(
return false;
for (int plane = 0; plane < 3; plane++) {
- libyuv::CopyPlane(
- vpx_image->planes[plane], vpx_image->stride[plane],
- (*video_frame)->visible_data(plane), (*video_frame)->stride(plane),
- (*video_frame)->row_bytes(plane), (*video_frame)->rows(plane));
+ libyuv::CopyPlane(vpx_image->planes[plane], vpx_image->stride[plane],
+ (*video_frame)->GetWritableVisibleData(plane),
+ (*video_frame)->stride(plane),
+ (*video_frame)->row_bytes(plane),
+ (*video_frame)->rows(plane));
}
return true;
diff --git a/chromium/media/filters/vpx_video_decoder.h b/chromium/media/filters/vpx_video_decoder.h
index edbb8850428..eb0bc747793 100644
--- a/chromium/media/filters/vpx_video_decoder.h
+++ b/chromium/media/filters/vpx_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vpx_video_decoder_fuzzertest.cc b/chromium/media/filters/vpx_video_decoder_fuzzertest.cc
index 58e768f56f0..c86eb0c4348 100644
--- a/chromium/media/filters/vpx_video_decoder_fuzzertest.cc
+++ b/chromium/media/filters/vpx_video_decoder_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/vpx_video_decoder_unittest.cc b/chromium/media/filters/vpx_video_decoder_unittest.cc
index 05729bd08a2..ac28313a48e 100644
--- a/chromium/media/filters/vpx_video_decoder_unittest.cc
+++ b/chromium/media/filters/vpx_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -304,7 +304,7 @@ TEST_F(VpxVideoDecoderTest, FrameValidAfterPoolDestruction) {
// Write to the Y plane. The memory tools should detect a
// use-after-free if the storage was actually removed by pool destruction.
- memset(output_frames_.front()->data(VideoFrame::kYPlane), 0xff,
+ memset(output_frames_.front()->writable_data(VideoFrame::kYPlane), 0xff,
output_frames_.front()->rows(VideoFrame::kYPlane) *
output_frames_.front()->stride(VideoFrame::kYPlane));
}
@@ -354,7 +354,7 @@ TEST_F(VpxVideoDecoderTest, MemoryPoolAllowsMultipleDisplay) {
Destroy();
// ASAN will be very unhappy with this line if the above is incorrect.
- memset(last_frame->data(VideoFrame::kYPlane), 0,
+ memset(last_frame->writable_data(VideoFrame::kYPlane), 0,
last_frame->row_bytes(VideoFrame::kYPlane));
}
#endif // !defined(LIBVPX_NO_HIGH_BIT_DEPTH) && !defined(ARCH_CPU_ARM_FAMILY)
diff --git a/chromium/media/filters/win/media_foundation_audio_decoder.cc b/chromium/media/filters/win/media_foundation_audio_decoder.cc
index 66ddd3cd963..0299d9254df 100644
--- a/chromium/media/filters/win/media_foundation_audio_decoder.cc
+++ b/chromium/media/filters/win/media_foundation_audio_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -85,7 +85,7 @@ void MediaFoundationAudioDecoder::Initialize(const AudioDecoderConfig& config,
InitCB init_cb,
const OutputCB& output_cb,
const WaitingCB& waiting_cb) {
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
if (config.codec() != AudioCodec::kDTS &&
config.codec() != AudioCodec::kDTSXP2) {
std::move(init_cb).Run(
@@ -93,10 +93,9 @@ void MediaFoundationAudioDecoder::Initialize(const AudioDecoderConfig& config,
"MFT Codec does not support DTS content"));
return;
}
-#else
+#else // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
#error "MediaFoundationAudioDecoder requires proprietary codecs and DTS audio"
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
// FIXME: MFT will need to be signed by a Microsoft Certificate
// to support a secured chain of custody on Windows.
@@ -119,14 +118,13 @@ void MediaFoundationAudioDecoder::Initialize(const AudioDecoderConfig& config,
config_ = config;
output_cb_ = output_cb;
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
if (config.codec() == AudioCodec::kDTS ||
config.codec() == AudioCodec::kDTSXP2) {
std::move(init_cb).Run(
CreateDecoder() ? OkStatus() : DecoderStatus::Codes::kUnsupportedCodec);
}
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
}
void MediaFoundationAudioDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
@@ -231,20 +229,19 @@ bool MediaFoundationAudioDecoder::CreateDecoder() {
// for a codec pump), but alas MFT_ENUM_FLAG_ASYNC_MFT returns no matches :(
MFT_REGISTER_TYPE_INFO type_info;
switch (config_.codec()) {
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
case AudioCodec::kDTSXP2:
type_info = {MFMediaType_Audio, MFAudioFormat_DTS_UHD};
break;
case AudioCodec::kDTS:
type_info = {MFMediaType_Audio, MFAudioFormat_DTS_RAW};
break;
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
default:
type_info = {MFMediaType_Audio, MFAudioFormat_Base};
}
- IMFActivate** acts = NULL;
+ base::win::ScopedCoMem<IMFActivate*> acts;
UINT32 acts_num = 0;
::MFTEnumEx(MFT_CATEGORY_AUDIO_DECODER,
MFT_ENUM_FLAG_SYNCMFT | MFT_ENUM_FLAG_LOCALMFT |
@@ -285,7 +282,7 @@ bool MediaFoundationAudioDecoder::ConfigureOutput() {
RETURN_ON_HR_FAILURE(output_type->GetGUID(MF_MT_SUBTYPE, &out_subtype),
"Failed to get output subtype", false);
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
if (config_.codec() == AudioCodec::kDTS ||
config_.codec() == AudioCodec::kDTSXP2) {
// Configuration specific to DTS Sound Unbound MFT v1.3.0
@@ -319,8 +316,7 @@ bool MediaFoundationAudioDecoder::ConfigureOutput() {
}
}
}
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
if (!output_sample_) {
output_type.Reset();
continue;
@@ -354,6 +350,7 @@ bool MediaFoundationAudioDecoder::ConfigureOutput() {
"Sample rate is not supported", false);
timestamp_helper_ = std::make_unique<AudioTimestampHelper>(sample_rate_);
+ decoder_->ProcessMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0);
return true;
}
RETURN_ON_HR_FAILURE(decoder_->SetOutputType(0, output_type.Get(), 0),
@@ -363,13 +360,12 @@ bool MediaFoundationAudioDecoder::ConfigureOutput() {
int GetBytesPerFrame(AudioCodec codec) {
switch (codec) {
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
// DTS Sound Unbound MFT v1.3 supports 24-bit PCM output only
case AudioCodec::kDTS:
case AudioCodec::kDTSXP2:
return 3;
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
default:
return 4;
}
@@ -432,7 +428,7 @@ MediaFoundationAudioDecoder::PumpOutput(PumpState pump_state) {
channel_count_, sample_rate_, frames, pool_);
audio_buffer->set_timestamp(timestamp_helper_->GetTimestamp());
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
// DTS Sound Unbound MFT v1.3.0 outputs 24-bit PCM samples, and will
// be converted to 32-bit float
if (config_.codec() == AudioCodec::kDTS ||
@@ -449,8 +445,7 @@ MediaFoundationAudioDecoder::PumpOutput(PumpState pump_state) {
}
}
}
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
timestamp_helper_->AddFrames(frames);
diff --git a/chromium/media/filters/win/media_foundation_audio_decoder.h b/chromium/media/filters/win/media_foundation_audio_decoder.h
index d96545d179c..d6841826180 100644
--- a/chromium/media/filters/win/media_foundation_audio_decoder.h
+++ b/chromium/media/filters/win/media_foundation_audio_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/win/media_foundation_utils.cc b/chromium/media/filters/win/media_foundation_utils.cc
index ef3a7c311b0..4431d2dfe74 100644
--- a/chromium/media/filters/win/media_foundation_utils.cc
+++ b/chromium/media/filters/win/media_foundation_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -72,13 +72,12 @@ GUID AudioCodecToMediaFoundationSubtype(AudioCodec codec) {
return MFAudioFormat_ALAC;
case AudioCodec::kAC3:
return MFAudioFormat_Dolby_AC3;
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
case AudioCodec::kDTS:
return MFAudioFormat_DTS_RAW;
case AudioCodec::kDTSXP2:
return MFAudioFormat_DTS_UHD;
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
default:
return GUID_NULL;
}
diff --git a/chromium/media/filters/win/media_foundation_utils.h b/chromium/media/filters/win/media_foundation_utils.h
index bedf5379c77..dce3bee6950 100644
--- a/chromium/media/filters/win/media_foundation_utils.h
+++ b/chromium/media/filters/win/media_foundation_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/wsola_internals.cc b/chromium/media/filters/wsola_internals.cc
index 684c9568478..c82ef6bdee4 100644
--- a/chromium/media/filters/wsola_internals.cc
+++ b/chromium/media/filters/wsola_internals.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/filters/wsola_internals.h b/chromium/media/filters/wsola_internals.h
index 527b89d32c8..411c0387b61 100644
--- a/chromium/media/filters/wsola_internals.h
+++ b/chromium/media/filters/wsola_internals.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/BUILD.gn b/chromium/media/formats/BUILD.gn
index 2cd5dc25ff2..c25c7b7f7a2 100644
--- a/chromium/media/formats/BUILD.gn
+++ b/chromium/media/formats/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -24,10 +24,6 @@ source_set("formats") {
"common/offset_byte_queue.h",
"common/opus_constants.cc",
"common/opus_constants.h",
- "dts/dts_stream_parser.cc",
- "dts/dts_stream_parser.h",
- "dts/dts_util.cc",
- "dts/dts_util.h",
"mp4/bitstream_converter.cc",
"mp4/bitstream_converter.h",
"mp4/box_definitions.cc",
@@ -128,8 +124,12 @@ source_set("formats") {
]
}
- if (proprietary_codecs && enable_platform_dts_audio) {
+ if (enable_platform_dts_audio) {
sources += [
+ "dts/dts_stream_parser.cc",
+ "dts/dts_stream_parser.h",
+ "dts/dts_util.cc",
+ "dts/dts_util.h",
"mp4/dts.cc",
"mp4/dts.h",
"mp4/dtsx.cc",
@@ -262,7 +262,6 @@ source_set("unit_tests") {
sources = [
"ac3/ac3_util_unittest.cc",
"common/offset_byte_queue_unittest.cc",
- "dts/dts_util_unittest.cc",
"mpeg/mpeg1_audio_stream_parser_unittest.cc",
"webm/webm_cluster_parser_unittest.cc",
"webm/webm_content_encodings_client_unittest.cc",
@@ -299,6 +298,7 @@ source_set("unit_tests") {
if (enable_platform_dts_audio) {
sources += [
+ "dts/dts_util_unittest.cc",
"mp4/dts_unittest.cc",
"mp4/dtsx_unittest.cc",
]
@@ -392,3 +392,13 @@ if (proprietary_codecs) {
]
}
}
+
+if (enable_platform_dts_audio) {
+ fuzzer_test("dts_util_fuzzer") {
+ sources = [ "dts/dts_util_fuzzer.cc" ]
+ deps = [
+ "//media",
+ "//base",
+ ]
+ }
+}
diff --git a/chromium/media/formats/ac3/ac3_util.cc b/chromium/media/formats/ac3/ac3_util.cc
index 83e9c1cfdf7..a359cd95de2 100644
--- a/chromium/media/formats/ac3/ac3_util.cc
+++ b/chromium/media/formats/ac3/ac3_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/ac3/ac3_util.h b/chromium/media/formats/ac3/ac3_util.h
index d79ecec20f7..05e2ac343de 100644
--- a/chromium/media/formats/ac3/ac3_util.h
+++ b/chromium/media/formats/ac3/ac3_util.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/ac3/ac3_util_unittest.cc b/chromium/media/formats/ac3/ac3_util_unittest.cc
index 59bea645cf3..a2c88631a40 100644
--- a/chromium/media/formats/ac3/ac3_util_unittest.cc
+++ b/chromium/media/formats/ac3/ac3_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/common/offset_byte_queue.cc b/chromium/media/formats/common/offset_byte_queue.cc
index 831c4d0ffe9..47efd0cd684 100644
--- a/chromium/media/formats/common/offset_byte_queue.cc
+++ b/chromium/media/formats/common/offset_byte_queue.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/common/offset_byte_queue.h b/chromium/media/formats/common/offset_byte_queue.h
index 159193c6115..41ab10078fb 100644
--- a/chromium/media/formats/common/offset_byte_queue.h
+++ b/chromium/media/formats/common/offset_byte_queue.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/common/offset_byte_queue_unittest.cc b/chromium/media/formats/common/offset_byte_queue_unittest.cc
index 4b3899a6f97..13610551cef 100644
--- a/chromium/media/formats/common/offset_byte_queue_unittest.cc
+++ b/chromium/media/formats/common/offset_byte_queue_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/common/opus_constants.cc b/chromium/media/formats/common/opus_constants.cc
index 3b6c4e6011c..f54eb435d2b 100644
--- a/chromium/media/formats/common/opus_constants.cc
+++ b/chromium/media/formats/common/opus_constants.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/common/opus_constants.h b/chromium/media/formats/common/opus_constants.h
index a8769c7aea4..d0127e6c907 100644
--- a/chromium/media/formats/common/opus_constants.h
+++ b/chromium/media/formats/common/opus_constants.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/common/stream_parser_test_base.cc b/chromium/media/formats/common/stream_parser_test_base.cc
index 24cc64cb877..fe4ce0a6c74 100644
--- a/chromium/media/formats/common/stream_parser_test_base.cc
+++ b/chromium/media/formats/common/stream_parser_test_base.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/common/stream_parser_test_base.h b/chromium/media/formats/common/stream_parser_test_base.h
index d13bdbe62af..5e871a5e7b8 100644
--- a/chromium/media/formats/common/stream_parser_test_base.h
+++ b/chromium/media/formats/common/stream_parser_test_base.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/dts/dts_stream_parser.cc b/chromium/media/formats/dts/dts_stream_parser.cc
index 5fb5200b26e..108de4dc5fa 100644
--- a/chromium/media/formats/dts/dts_stream_parser.cc
+++ b/chromium/media/formats/dts/dts_stream_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/dts/dts_stream_parser.h b/chromium/media/formats/dts/dts_stream_parser.h
index 4e61da85c76..92bb19f55c5 100644
--- a/chromium/media/formats/dts/dts_stream_parser.h
+++ b/chromium/media/formats/dts/dts_stream_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/dts/dts_util.cc b/chromium/media/formats/dts/dts_util.cc
index ac9d0f56d2a..fe05cedf22a 100644
--- a/chromium/media/formats/dts/dts_util.cc
+++ b/chromium/media/formats/dts/dts_util.cc
@@ -1,11 +1,12 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/formats/dts/dts_util.h"
#include "base/logging.h"
-#include "base/stl_util.h"
+#include "base/sys_byteorder.h"
+#include "media/base/audio_parameters.h"
#include "media/base/bit_reader.h"
#include "media/formats/dts/dts_stream_parser.h"
@@ -113,6 +114,72 @@ int ParseTotalSampleCount(const uint8_t* data,
return total_sample_count;
}
+namespace {
+
+constexpr size_t kDTSSamplesPerFrame = 512;
+constexpr size_t kDTSXP2SamplesPerFrame = 1024;
+
+} // namespace
+
+int WrapDTSWithIEC61937(base::span<const uint8_t> input_data_s,
+ base::span<uint8_t> output_data_s,
+ AudioCodec dts_codec_type) {
+ if (dts_codec_type == AudioCodec::kDTS) {
+ // IEC 61937 frame for DTS-CA (IEC 61937-5) is defined as
+ // 2 bytes per sample * 2 channel * 512 samples per frame.
+ constexpr size_t kDTSFrameSize = 2 * 2 * kDTSSamplesPerFrame;
+ static constexpr uint8_t kDTSCAHeader[] = {0x72, 0xF8, 0x1F, 0x4E,
+ 0x0B, 0x00, 0x00, 0x20};
+
+ // Output bytes: header + data + optional 2-byte alignment
+ size_t output_bytes = sizeof(kDTSCAHeader) + input_data_s.size();
+ if (output_bytes & 1)
+ output_bytes++;
+
+ // Header + input data must fit in output buffer, limited to one DTS frame
+ if (input_data_s.size() > kDTSFrameSize - sizeof(kDTSCAHeader) ||
+ output_bytes > output_data_s.size()) {
+ return 0;
+ }
+
+ // Copy header to output buffer
+ memcpy(output_data_s.data(), kDTSCAHeader, sizeof(kDTSCAHeader));
+
+ // Use 16-bit span for 16-bit byte swap
+ base::span<const uint16_t> input_16(
+ reinterpret_cast<const uint16_t*>(input_data_s.data()),
+ input_data_s.size() / 2);
+ output_data_s = output_data_s.subspan(sizeof(kDTSCAHeader));
+ base::span<uint16_t> output_16(
+ reinterpret_cast<uint16_t*>(output_data_s.data()),
+ output_data_s.size() / 2);
+
+ auto output_16_iterator = base::ranges::transform(
+ input_16.begin(), input_16.end(), output_16.begin(),
+ [](uint16_t n) -> uint16_t { return base::ByteSwap(n); });
+
+ // Zero fill the remaining output buffer
+ std::fill(output_16_iterator, output_16.end(), 0);
+
+ return kDTSFrameSize;
+ }
+ if (dts_codec_type == AudioCodec::kDTSXP2) {
+ NOTIMPLEMENTED();
+ }
+ return 0;
+}
+
+int GetDTSSamplesPerFrame(AudioCodec dts_codec_type) {
+ switch (dts_codec_type) {
+ case AudioCodec::kDTS:
+ return kDTSSamplesPerFrame;
+ case AudioCodec::kDTSXP2:
+ return kDTSXP2SamplesPerFrame;
+ default:
+ return 0;
+ }
+}
+
} // namespace dts
} // namespace media
diff --git a/chromium/media/formats/dts/dts_util.h b/chromium/media/formats/dts/dts_util.h
index c917ed2ac82..214720dc201 100644
--- a/chromium/media/formats/dts/dts_util.h
+++ b/chromium/media/formats/dts/dts_util.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include "base/containers/span.h"
#include "media/base/audio_codecs.h"
#include "media/base/media_export.h"
@@ -21,6 +22,16 @@ MEDIA_EXPORT int ParseTotalSampleCount(const uint8_t* data,
size_t size,
AudioCodec dts_codec_type);
+// Encapsulate a single DTS audio frame with IEC 61937 encapsulation to
+// allow IEC 61937 frame to pass through to audio sink (HDMI/SPDIF).
+// Return the size of the IEC 61937 frame.
+MEDIA_EXPORT int WrapDTSWithIEC61937(base::span<const uint8_t> input_data,
+ base::span<uint8_t> output_data,
+ AudioCodec dts_codec_type);
+
+// Return the number of audio samples per DTS audio frame.
+MEDIA_EXPORT int GetDTSSamplesPerFrame(AudioCodec dts_codec_type);
+
} // namespace dts
} // namespace media
diff --git a/chromium/media/formats/dts/dts_util_fuzzer.cc b/chromium/media/formats/dts/dts_util_fuzzer.cc
new file mode 100644
index 00000000000..6e689bfe0b4
--- /dev/null
+++ b/chromium/media/formats/dts/dts_util_fuzzer.cc
@@ -0,0 +1,18 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <memory>
+
+#include "base/check.h"
+#include "media/base/media_util.h"
+#include "media/formats/dts/dts_util.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
+ media::dts::ParseTotalSampleCount(data, size, media::AudioCodec::kDTS);
+ return 0;
+}
diff --git a/chromium/media/formats/dts/dts_util_unittest.cc b/chromium/media/formats/dts/dts_util_unittest.cc
index 8caedf8261a..f637813aceb 100644
--- a/chromium/media/formats/dts/dts_util_unittest.cc
+++ b/chromium/media/formats/dts/dts_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -55,4 +55,43 @@ TEST_F(DTSUtilTest, NormalInputTest) {
EXPECT_EQ(total, 512);
}
+TEST_F(DTSUtilTest, GetDTSSamplesPerFrameTest) {
+ EXPECT_EQ(512, media::dts::GetDTSSamplesPerFrame(AudioCodec::kDTS));
+ EXPECT_EQ(1024, media::dts::GetDTSSamplesPerFrame(AudioCodec::kDTSXP2));
+}
+
+TEST_F(DTSUtilTest, WrapDTSWithIEC61937IncorrectInputTest) {
+ constexpr uint8_t short_input[2048 - 7] = {0};
+ constexpr uint8_t long_input[2048 + 3] = {0};
+ base::span<const uint8_t> input_data;
+ std::vector<uint8_t> output_data(2048);
+
+ input_data = base::span<const uint8_t>(short_input, 2048 - 7);
+ EXPECT_EQ(0, media::dts::WrapDTSWithIEC61937(input_data, output_data,
+ AudioCodec::kDTS));
+
+ input_data = base::span<const uint8_t>(long_input, 2048 + 3);
+ EXPECT_EQ(0, media::dts::WrapDTSWithIEC61937(input_data, output_data,
+ AudioCodec::kDTS));
+}
+
+TEST_F(DTSUtilTest, WrapDTSWithIEC61937NormalInputTest) {
+ constexpr uint8_t header[8] = {0x72, 0xF8, 0x1F, 0x4E,
+ 0x0B, 0x00, 0x00, 0x20};
+ constexpr uint8_t payload[4] = {1, 2, 3, 4};
+ constexpr uint8_t swapped_payload[4] = {2, 1, 4, 3};
+ uint8_t input[512] = {0};
+ uint8_t output[2048] = {0};
+ base::span<const uint8_t> input_data;
+ std::vector<uint8_t> output_data(2048);
+
+ memcpy(input, payload, 4);
+ input_data = base::span<const uint8_t>(input, 512);
+ EXPECT_EQ(2048, media::dts::WrapDTSWithIEC61937(input_data, output_data,
+ AudioCodec::kDTS));
+ memcpy(output, header, 8);
+ memcpy(output + 8, swapped_payload, 4);
+ EXPECT_EQ(0, memcmp(output, output_data.data(), 2048));
+}
+
} // namespace media
diff --git a/chromium/media/formats/hls/attribute_list_fuzzer.cc b/chromium/media/formats/hls/attribute_list_fuzzer.cc
index 5b58448981e..69bf1991c0b 100644
--- a/chromium/media/formats/hls/attribute_list_fuzzer.cc
+++ b/chromium/media/formats/hls/attribute_list_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/common_playlist_unittest.cc b/chromium/media/formats/hls/common_playlist_unittest.cc
index f994f79b021..7ce09e45717 100644
--- a/chromium/media/formats/hls/common_playlist_unittest.cc
+++ b/chromium/media/formats/hls/common_playlist_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/items.cc b/chromium/media/formats/hls/items.cc
index 9833b3f2cc0..88229136428 100644
--- a/chromium/media/formats/hls/items.cc
+++ b/chromium/media/formats/hls/items.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/items.h b/chromium/media/formats/hls/items.h
index e73fd78bd95..c47ba33191f 100644
--- a/chromium/media/formats/hls/items.h
+++ b/chromium/media/formats/hls/items.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/items_fuzzer.cc b/chromium/media/formats/hls/items_fuzzer.cc
index 7547bfc6771..a1c6c99fcb2 100644
--- a/chromium/media/formats/hls/items_fuzzer.cc
+++ b/chromium/media/formats/hls/items_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/items_unittest.cc b/chromium/media/formats/hls/items_unittest.cc
index 9de96286d85..01cfdfff52a 100644
--- a/chromium/media/formats/hls/items_unittest.cc
+++ b/chromium/media/formats/hls/items_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/media_playlist.cc b/chromium/media/formats/hls/media_playlist.cc
index fc70d892466..5f5ce5d3a84 100644
--- a/chromium/media/formats/hls/media_playlist.cc
+++ b/chromium/media/formats/hls/media_playlist.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -46,10 +46,6 @@ struct MediaPlaylist::CtorArgs {
absl::optional<base::TimeDelta> part_hold_back_distance;
};
-MediaPlaylist::MediaPlaylist(MediaPlaylist&&) = default;
-
-MediaPlaylist& MediaPlaylist::operator=(MediaPlaylist&&) = default;
-
MediaPlaylist::~MediaPlaylist() = default;
Playlist::Kind MediaPlaylist::GetKind() const {
@@ -57,7 +53,7 @@ Playlist::Kind MediaPlaylist::GetKind() const {
}
// static
-ParseStatus::Or<MediaPlaylist> MediaPlaylist::Parse(
+ParseStatus::Or<scoped_refptr<MediaPlaylist>> MediaPlaylist::Parse(
base::StringPiece source,
GURL uri,
types::DecimalInteger version,
@@ -518,7 +514,8 @@ ParseStatus::Or<MediaPlaylist> MediaPlaylist::Parse(
playlist_type = playlist_type_tag->type;
}
- return MediaPlaylist(
+ return base::MakeRefCounted<MediaPlaylist>(
+ base::PassKey<MediaPlaylist>(),
CtorArgs{.uri = std::move(uri),
.version = version,
.independent_segments = independent_segments,
@@ -537,7 +534,7 @@ ParseStatus::Or<MediaPlaylist> MediaPlaylist::Parse(
.part_hold_back_distance = part_hold_back_distance});
}
-MediaPlaylist::MediaPlaylist(CtorArgs args)
+MediaPlaylist::MediaPlaylist(base::PassKey<MediaPlaylist>, CtorArgs args)
: Playlist(std::move(args.uri), args.version, args.independent_segments),
target_duration_(args.target_duration),
partial_segment_info_(std::move(args.partial_segment_info)),
diff --git a/chromium/media/formats/hls/media_playlist.h b/chromium/media/formats/hls/media_playlist.h
index 9971c9f2e6d..aa00bafd321 100644
--- a/chromium/media/formats/hls/media_playlist.h
+++ b/chromium/media/formats/hls/media_playlist.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "base/memory/scoped_refptr.h"
#include "base/time/time.h"
+#include "base/types/pass_key.h"
#include "media/base/media_export.h"
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/playlist.h"
@@ -38,11 +39,12 @@ class MEDIA_EXPORT MediaPlaylist final : public Playlist {
base::TimeDelta target_duration;
};
+ struct CtorArgs;
+ explicit MediaPlaylist(base::PassKey<MediaPlaylist>, CtorArgs);
MediaPlaylist(const MediaPlaylist&) = delete;
- MediaPlaylist(MediaPlaylist&&);
+ MediaPlaylist(MediaPlaylist&&) = delete;
MediaPlaylist& operator=(const MediaPlaylist&) = delete;
- MediaPlaylist& operator=(MediaPlaylist&&);
- ~MediaPlaylist() override;
+ MediaPlaylist& operator=(MediaPlaylist&&) = delete;
// `Playlist` implementation
Kind GetKind() const override;
@@ -139,15 +141,14 @@ class MEDIA_EXPORT MediaPlaylist final : public Playlist {
// order to support persistent properties and imported variables. Otherwise,
// it should be `nullptr`. If `source` is invalid, this returns an error.
// Otherwise, the parsed playlist is returned.
- static ParseStatus::Or<MediaPlaylist> Parse(
+ static ParseStatus::Or<scoped_refptr<MediaPlaylist>> Parse(
base::StringPiece source,
GURL uri,
types::DecimalInteger version,
const MultivariantPlaylist* parent_playlist);
private:
- struct CtorArgs;
- explicit MediaPlaylist(CtorArgs);
+ ~MediaPlaylist() override;
base::TimeDelta target_duration_;
absl::optional<PartialSegmentInfo> partial_segment_info_;
diff --git a/chromium/media/formats/hls/media_playlist_fuzzer.cc b/chromium/media/formats/hls/media_playlist_fuzzer.cc
index ad5b7161755..759c7ca1b3e 100644
--- a/chromium/media/formats/hls/media_playlist_fuzzer.cc
+++ b/chromium/media/formats/hls/media_playlist_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "base/at_exit.h"
#include "base/check.h"
#include "base/i18n/icu_util.h"
+#include "base/memory/scoped_refptr.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_piece_forward.h"
#include "media/formats/hls/media_playlist.h"
@@ -42,7 +43,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Decide whether to create a multivariant playlist + media playlist or just a
// media playlist
- std::unique_ptr<media::hls::MultivariantPlaylist> multivariant_playlist;
+ scoped_refptr<media::hls::MultivariantPlaylist> multivariant_playlist;
if (data_provider.ConsumeBool()) {
auto multivariant_playlist_source =
data_provider.ConsumeRandomLengthString();
@@ -56,8 +57,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
return 0;
}
- multivariant_playlist = std::make_unique<media::hls::MultivariantPlaylist>(
- std::move(multivariant_playlist_result).value());
+ multivariant_playlist = std::move(multivariant_playlist_result).value();
}
auto media_playlist_source = data_provider.ConsumeRemainingBytesAsString();
diff --git a/chromium/media/formats/hls/media_playlist_test_builder.cc b/chromium/media/formats/hls/media_playlist_test_builder.cc
index febc854b93e..ad0952f6bc8 100644
--- a/chromium/media/formats/hls/media_playlist_test_builder.cc
+++ b/chromium/media/formats/hls/media_playlist_test_builder.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/media_playlist_test_builder.h b/chromium/media/formats/hls/media_playlist_test_builder.h
index 9b20bb7d3c7..c9a703ec8a7 100644
--- a/chromium/media/formats/hls/media_playlist_test_builder.h
+++ b/chromium/media/formats/hls/media_playlist_test_builder.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/media_playlist_unittest.cc b/chromium/media/formats/hls/media_playlist_unittest.cc
index 2d8f567b3e3..ab830e1773c 100644
--- a/chromium/media/formats/hls/media_playlist_unittest.cc
+++ b/chromium/media/formats/hls/media_playlist_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,7 +24,7 @@ namespace media::hls {
namespace {
-MultivariantPlaylist CreateMultivariantPlaylist(
+scoped_refptr<MultivariantPlaylist> CreateMultivariantPlaylist(
std::initializer_list<base::StringPiece> lines,
GURL uri = GURL("http://localhost/multi_playlist.m3u8"),
types::DecimalInteger version = Playlist::kDefaultVersion) {
@@ -206,7 +206,7 @@ TEST(HlsMediaPlaylistTest, VariableSubstitution) {
{
// Referring to a parent playlist variable without importing it is an error
auto fork = builder;
- fork.SetParent(&parent);
+ fork.SetParent(parent.get());
fork.AppendLine("#EXTINF:9.9,\t");
fork.AppendLine("segments/{$IMPORTED}.ts");
fork.ExpectError(ParseStatusCode::kVariableUndefined);
@@ -215,7 +215,7 @@ TEST(HlsMediaPlaylistTest, VariableSubstitution) {
// Locally overwriting an unimported variable from a parent playlist is NOT
// an error
auto fork = builder;
- fork.SetParent(&parent);
+ fork.SetParent(parent.get());
fork.AppendLine(R"(#EXT-X-DEFINE:NAME="IMPORTED",VALUE="WORLD")");
fork.AppendLine("#EXTINF:9.9,\t");
fork.AppendLine("segments/{$IMPORTED}.ts");
@@ -230,7 +230,7 @@ TEST(HlsMediaPlaylistTest, VariableSubstitution) {
{
// Defining a variable once it's been imported is an error
auto fork = builder;
- fork.SetParent(&parent);
+ fork.SetParent(parent.get());
fork.AppendLine(R"(#EXT-X-DEFINE:IMPORT="IMPORTED")");
fork.AppendLine(R"(#EXT-X-DEFINE:NAME="IMPORTED",VALUE="WORLD")");
fork.ExpectError(ParseStatusCode::kVariableDefinedMultipleTimes);
@@ -238,7 +238,7 @@ TEST(HlsMediaPlaylistTest, VariableSubstitution) {
{
// Importing the same variable twice is an error
auto fork = builder;
- fork.SetParent(&parent);
+ fork.SetParent(parent.get());
fork.AppendLine(R"(#EXT-X-DEFINE:IMPORT="IMPORTED")");
fork.AppendLine(R"(#EXT-X-DEFINE:IMPORT="IMPORTED")");
fork.ExpectError(ParseStatusCode::kVariableDefinedMultipleTimes);
@@ -247,14 +247,14 @@ TEST(HlsMediaPlaylistTest, VariableSubstitution) {
// Importing a variable that hasn't been defined in the parent playlist is
// an error
auto fork = builder;
- fork.SetParent(&parent);
+ fork.SetParent(parent.get());
fork.AppendLine(R"(#EXT-X-DEFINE:IMPORT="FOO")");
fork.ExpectError(ParseStatusCode::kImportedVariableUndefined);
}
{
// Test actually using an imported variable
auto fork = builder;
- fork.SetParent(&parent);
+ fork.SetParent(parent.get());
fork.AppendLine(R"(#EXT-X-DEFINE:IMPORT="IMPORTED")");
fork.AppendLine("#EXTINF:9.9,\t");
fork.AppendLine("segments/{$IMPORTED}.ts");
@@ -297,7 +297,7 @@ TEST(HlsMediaPlaylistTest, XIndependentSegmentsTagInParent) {
// Parent value should carryover to media playlist
MediaPlaylistTestBuilder builder;
- builder.SetParent(&parent1);
+ builder.SetParent(parent1.get());
builder.AppendLine("#EXTM3U");
builder.AppendLine("#EXT-X-TARGETDURATION:10");
builder.ExpectPlaylist(HasIndependentSegments, true);
@@ -311,7 +311,7 @@ TEST(HlsMediaPlaylistTest, XIndependentSegmentsTagInParent) {
// in the child
auto parent2 = CreateMultivariantPlaylist({"#EXTM3U"});
builder = MediaPlaylistTestBuilder();
- builder.SetParent(&parent2);
+ builder.SetParent(parent2.get());
builder.AppendLine("#EXTM3U");
builder.AppendLine("#EXT-X-TARGETDURATION:10");
{
@@ -322,7 +322,7 @@ TEST(HlsMediaPlaylistTest, XIndependentSegmentsTagInParent) {
builder.AppendLine("#EXT-X-INDEPENDENT-SEGMENTS");
builder.ExpectPlaylist(HasIndependentSegments, true);
builder.ExpectOk();
- EXPECT_FALSE(parent2.AreSegmentsIndependent());
+ EXPECT_FALSE(parent2->AreSegmentsIndependent());
}
TEST(HlsMediaPlaylistTest, XBitrateTag) {
diff --git a/chromium/media/formats/hls/media_segment.cc b/chromium/media/formats/hls/media_segment.cc
index 447a4d88faa..131e12689c6 100644
--- a/chromium/media/formats/hls/media_segment.cc
+++ b/chromium/media/formats/hls/media_segment.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/media_segment.h b/chromium/media/formats/hls/media_segment.h
index dce54760f81..7aef602f645 100644
--- a/chromium/media/formats/hls/media_segment.h
+++ b/chromium/media/formats/hls/media_segment.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/multivariant_playlist.cc b/chromium/media/formats/hls/multivariant_playlist.cc
index 4d8ac0919cb..fb058cbee6c 100644
--- a/chromium/media/formats/hls/multivariant_playlist.cc
+++ b/chromium/media/formats/hls/multivariant_playlist.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,11 +25,6 @@
namespace media::hls {
-MultivariantPlaylist::MultivariantPlaylist(MultivariantPlaylist&&) = default;
-
-MultivariantPlaylist& MultivariantPlaylist::operator=(MultivariantPlaylist&&) =
- default;
-
MultivariantPlaylist::~MultivariantPlaylist() = default;
Playlist::Kind MultivariantPlaylist::GetKind() const {
@@ -37,10 +32,10 @@ Playlist::Kind MultivariantPlaylist::GetKind() const {
}
// static
-ParseStatus::Or<MultivariantPlaylist> MultivariantPlaylist::Parse(
- base::StringPiece source,
- GURL uri,
- types::DecimalInteger version) {
+ParseStatus::Or<scoped_refptr<MultivariantPlaylist>>
+MultivariantPlaylist::Parse(base::StringPiece source,
+ GURL uri,
+ types::DecimalInteger version) {
DCHECK(version != 0);
if (version < Playlist::kMinSupportedVersion ||
version > Playlist::kMaxSupportedVersion) {
@@ -179,13 +174,14 @@ ParseStatus::Or<MultivariantPlaylist> MultivariantPlaylist::Parse(
return ParseStatusCode::kPlaylistHasVersionMismatch;
}
- return MultivariantPlaylist(std::move(uri), version,
- common_state.independent_segments_tag.has_value(),
- std::move(variants),
- std::move(common_state.variable_dict));
+ return base::MakeRefCounted<MultivariantPlaylist>(
+ base::PassKey<MultivariantPlaylist>(), std::move(uri), version,
+ common_state.independent_segments_tag.has_value(), std::move(variants),
+ std::move(common_state.variable_dict));
}
MultivariantPlaylist::MultivariantPlaylist(
+ base::PassKey<MultivariantPlaylist>,
GURL uri,
types::DecimalInteger version,
bool independent_segments,
diff --git a/chromium/media/formats/hls/multivariant_playlist.h b/chromium/media/formats/hls/multivariant_playlist.h
index 8802755f3c0..48787fc4a83 100644
--- a/chromium/media/formats/hls/multivariant_playlist.h
+++ b/chromium/media/formats/hls/multivariant_playlist.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,7 +7,9 @@
#include <vector>
+#include "base/memory/scoped_refptr.h"
#include "base/strings/string_piece.h"
+#include "base/types/pass_key.h"
#include "media/base/media_export.h"
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/playlist.h"
@@ -21,11 +23,16 @@ class VariantStream;
class MEDIA_EXPORT MultivariantPlaylist final : public Playlist {
public:
+ MultivariantPlaylist(base::PassKey<MultivariantPlaylist>,
+ GURL uri,
+ types::DecimalInteger version,
+ bool independent_segments,
+ std::vector<VariantStream> variants,
+ VariableDictionary variable_dictionary);
MultivariantPlaylist(const MultivariantPlaylist&) = delete;
- MultivariantPlaylist(MultivariantPlaylist&&);
+ MultivariantPlaylist(MultivariantPlaylist&&) = delete;
MultivariantPlaylist& operator=(const MultivariantPlaylist&) = delete;
- MultivariantPlaylist& operator=(MultivariantPlaylist&&);
- ~MultivariantPlaylist() override;
+ MultivariantPlaylist& operator=(MultivariantPlaylist&&) = delete;
// Returns all variants described by this playlist.
const std::vector<VariantStream>& GetVariants() const { return variants_; }
@@ -44,15 +51,11 @@ class MEDIA_EXPORT MultivariantPlaylist final : public Playlist {
// in this playlist (or `Playlist::kDefaultVersion` if none), which may be
// determined via `Playlist::IdentifyPlaylist`. If the playlist source is
// invalid, returns an error.
- static ParseStatus::Or<MultivariantPlaylist>
+ static ParseStatus::Or<scoped_refptr<MultivariantPlaylist>>
Parse(base::StringPiece source, GURL uri, types::DecimalInteger version);
private:
- MultivariantPlaylist(GURL uri,
- types::DecimalInteger version,
- bool independent_segments,
- std::vector<VariantStream> variants,
- VariableDictionary variable_dictionary);
+ ~MultivariantPlaylist() override;
std::vector<VariantStream> variants_;
VariableDictionary variable_dictionary_;
diff --git a/chromium/media/formats/hls/multivariant_playlist_fuzzer.cc b/chromium/media/formats/hls/multivariant_playlist_fuzzer.cc
index 2a49a6b44d5..71a85896c2e 100644
--- a/chromium/media/formats/hls/multivariant_playlist_fuzzer.cc
+++ b/chromium/media/formats/hls/multivariant_playlist_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/multivariant_playlist_test_builder.cc b/chromium/media/formats/hls/multivariant_playlist_test_builder.cc
index 34d6b40f53c..b7393b79fe3 100644
--- a/chromium/media/formats/hls/multivariant_playlist_test_builder.cc
+++ b/chromium/media/formats/hls/multivariant_playlist_test_builder.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/multivariant_playlist_test_builder.h b/chromium/media/formats/hls/multivariant_playlist_test_builder.h
index 915b20f97d9..483c1219073 100644
--- a/chromium/media/formats/hls/multivariant_playlist_test_builder.h
+++ b/chromium/media/formats/hls/multivariant_playlist_test_builder.h
@@ -1,10 +1,13 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FORMATS_HLS_MULTIVARIANT_PLAYLIST_TEST_BUILDER_H_
#define MEDIA_FORMATS_HLS_MULTIVARIANT_PLAYLIST_TEST_BUILDER_H_
+#include <string>
+#include <vector>
+
#include "base/bind.h"
#include "base/callback.h"
#include "base/location.h"
@@ -107,7 +110,7 @@ inline void HasScore(absl::optional<types::DecimalFloatingPoint> score,
// Checks the value of `GetCodecs` on the latest variant against the given
// value.
-inline void HasCodecs(absl::optional<base::StringPiece> codecs,
+inline void HasCodecs(absl::optional<std::vector<std::string>> codecs,
const base::Location& from,
const VariantStream& variant) {
EXPECT_EQ(variant.GetCodecs(), codecs) << from.ToString();
diff --git a/chromium/media/formats/hls/multivariant_playlist_unittest.cc b/chromium/media/formats/hls/multivariant_playlist_unittest.cc
index 230c84b73ea..38ea6074e7f 100644
--- a/chromium/media/formats/hls/multivariant_playlist_unittest.cc
+++ b/chromium/media/formats/hls/multivariant_playlist_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -34,7 +34,8 @@ TEST(HlsMultivariantPlaylistTest, VariableSubstitution) {
builder.ExpectAdditionalVariant();
builder.ExpectVariant(HasPrimaryRenditionUri,
GURL("http://www.example.com/playlist1.m3u8"));
- builder.ExpectVariant(HasCodecs, "mp4a.40.2,avc1.4d401e");
+ builder.ExpectVariant(HasCodecs,
+ std::vector<std::string>{"mp4a.40.2", "avc1.4d401e"});
// Invalid variable references should result in an error
{
@@ -242,7 +243,7 @@ TEST(HlsMultivariantPlaylistTest, XStreamInfTag) {
builder.ExpectVariant(HasBandwidth, 108u);
builder.ExpectVariant(HasAverageBandwidth, absl::nullopt);
builder.ExpectVariant(HasScore, absl::nullopt);
- builder.ExpectVariant(HasCodecs, "foo,bar");
+ builder.ExpectVariant(HasCodecs, std::vector<std::string>{"foo", "bar"});
builder.ExpectVariant(HasResolution, absl::nullopt);
builder.ExpectVariant(HasFrameRate, absl::nullopt);
builder.ExpectOk();
diff --git a/chromium/media/formats/hls/parse_status.cc b/chromium/media/formats/hls/parse_status.cc
index 158fc5e3036..76b5c45bc7e 100644
--- a/chromium/media/formats/hls/parse_status.cc
+++ b/chromium/media/formats/hls/parse_status.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/parse_status.h b/chromium/media/formats/hls/parse_status.h
index a00fa2caf2c..9ccabc875f4 100644
--- a/chromium/media/formats/hls/parse_status.h
+++ b/chromium/media/formats/hls/parse_status.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/playlist.cc b/chromium/media/formats/hls/playlist.cc
index eb652e6b835..87df468c2d2 100644
--- a/chromium/media/formats/hls/playlist.cc
+++ b/chromium/media/formats/hls/playlist.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,8 +19,6 @@ Playlist::Playlist(GURL uri,
version_(version),
independent_segments_(independent_segments) {}
-Playlist::Playlist(Playlist&&) = default;
-Playlist& Playlist::operator=(Playlist&&) = default;
Playlist::~Playlist() = default;
// static
diff --git a/chromium/media/formats/hls/playlist.h b/chromium/media/formats/hls/playlist.h
index f6d59d5a11a..cafb48e9e2e 100644
--- a/chromium/media/formats/hls/playlist.h
+++ b/chromium/media/formats/hls/playlist.h
@@ -1,17 +1,18 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FORMATS_HLS_PLAYLIST_H_
#define MEDIA_FORMATS_HLS_PLAYLIST_H_
+#include "base/memory/ref_counted.h"
#include "media/base/media_export.h"
#include "media/formats/hls/types.h"
#include "url/gurl.h"
namespace media::hls {
-class MEDIA_EXPORT Playlist {
+class MEDIA_EXPORT Playlist : public base::RefCounted<Playlist> {
public:
// Unless explicitly specified via the `EXT-X-VERSION` tag, the default
// playlist version is `1`.
@@ -42,7 +43,9 @@ class MEDIA_EXPORT Playlist {
base::StringPiece src);
Playlist(const Playlist&) = delete;
+ Playlist(Playlist&&) = delete;
Playlist& operator=(const Playlist&) = delete;
+ Playlist& operator=(Playlist&&) = delete;
// Returns the resolved URI of this playlist.
const GURL& Uri() const { return uri_; }
@@ -61,8 +64,8 @@ class MEDIA_EXPORT Playlist {
protected:
Playlist(GURL uri, types::DecimalInteger version, bool independent_segments);
- Playlist(Playlist&&);
- Playlist& operator=(Playlist&&);
+
+ friend base::RefCounted<Playlist>;
virtual ~Playlist();
private:
diff --git a/chromium/media/formats/hls/playlist_common.cc b/chromium/media/formats/hls/playlist_common.cc
index bbe00102e2e..ec60c8f7ae2 100644
--- a/chromium/media/formats/hls/playlist_common.cc
+++ b/chromium/media/formats/hls/playlist_common.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/playlist_common.h b/chromium/media/formats/hls/playlist_common.h
index edb726b31f9..8b25de1ec31 100644
--- a/chromium/media/formats/hls/playlist_common.h
+++ b/chromium/media/formats/hls/playlist_common.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/playlist_test_builder.h b/chromium/media/formats/hls/playlist_test_builder.h
index b45ae53ee91..35c0cd2acc3 100644
--- a/chromium/media/formats/hls/playlist_test_builder.h
+++ b/chromium/media/formats/hls/playlist_test_builder.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -93,13 +93,13 @@ class PlaylistTestBuilder {
auto playlist = std::move(result).value();
// Ensure that playlist has expected version
- EXPECT_EQ(playlist.GetVersion(), version_) << from.ToString();
+ EXPECT_EQ(playlist->GetVersion(), version_) << from.ToString();
for (const auto& expectation : playlist_expectations_) {
- expectation.Run(playlist);
+ expectation.Run(*playlist);
}
- this->VerifyExpectations(playlist, from);
+ this->VerifyExpectations(*playlist, from);
}
private:
diff --git a/chromium/media/formats/hls/playlist_unittest.cc b/chromium/media/formats/hls/playlist_unittest.cc
index 6b680bf7544..497ecf73794 100644
--- a/chromium/media/formats/hls/playlist_unittest.cc
+++ b/chromium/media/formats/hls/playlist_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/source_string.cc b/chromium/media/formats/hls/source_string.cc
index ad9db86f436..fd584317322 100644
--- a/chromium/media/formats/hls/source_string.cc
+++ b/chromium/media/formats/hls/source_string.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/source_string.h b/chromium/media/formats/hls/source_string.h
index 19fead4f9f3..f3c1de85f43 100644
--- a/chromium/media/formats/hls/source_string.h
+++ b/chromium/media/formats/hls/source_string.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -120,26 +120,6 @@ class MEDIA_EXPORT GenericSourceString {
ResolutionState resolution_state_;
};
-// `SourceLineIterator` may not create resolved source strings
-template <>
-ResolvedSourceString ResolvedSourceString::Create(
- base::PassKey<SourceLineIterator>,
- size_t line,
- base::StringPiece str) = delete;
-
-// `VariableDictionary` may not create unresolved source strings
-template <>
-SourceString SourceString::Create(base::PassKey<VariableDictionary>,
- size_t line,
- size_t column,
- base::StringPiece str,
- SourceStringState resolution_state) = delete;
-
-// Resolved source strings may not skip variable substitution
-template <>
-ResolvedSourceString ResolvedSourceString::SkipVariableSubstitution() const =
- delete;
-
// Exposes a line-based iteration API over the source text of an HLS manifest.
struct MEDIA_EXPORT SourceLineIterator {
explicit SourceLineIterator(base::StringPiece source);
diff --git a/chromium/media/formats/hls/tag_name.cc b/chromium/media/formats/hls/tag_name.cc
index 7057dc2ee98..8c82beff438 100644
--- a/chromium/media/formats/hls/tag_name.cc
+++ b/chromium/media/formats/hls/tag_name.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/tag_name.h b/chromium/media/formats/hls/tag_name.h
index d7b68fce0f4..074c036fe18 100644
--- a/chromium/media/formats/hls/tag_name.h
+++ b/chromium/media/formats/hls/tag_name.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/tags.cc b/chromium/media/formats/hls/tags.cc
index 74ade02d0f0..cc9bcb9aa63 100644
--- a/chromium/media/formats/hls/tags.cc
+++ b/chromium/media/formats/hls/tags.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,8 +7,10 @@
#include <cstddef>
#include <type_traits>
#include <utility>
+
#include "base/notreached.h"
#include "base/time/time.h"
+#include "media/base/mime_util.h"
#include "media/formats/hls/items.h"
#include "media/formats/hls/parse_status.h"
#include "media/formats/hls/variable_dictionary.h"
@@ -126,6 +128,7 @@ constexpr base::StringPiece GetAttributeName(XMediaTagAttribute attribute) {
// Attributes expected in `EXT-X-STREAM-INF` tag contents.
// These must remain sorted alphabetically.
enum class XStreamInfTagAttribute {
+ kAudio,
kAverageBandwidth,
kBandwidth,
kCodecs,
@@ -138,6 +141,8 @@ enum class XStreamInfTagAttribute {
constexpr base::StringPiece GetAttributeName(XStreamInfTagAttribute attribute) {
switch (attribute) {
+ case XStreamInfTagAttribute::kAudio:
+ return "AUDIO";
case XStreamInfTagAttribute::kAverageBandwidth:
return "AVERAGE-BANDWIDTH";
case XStreamInfTagAttribute::kBandwidth:
@@ -606,7 +611,7 @@ ParseStatus::Or<XMediaTag> XMediaTag::Parse(
}
// Parse the 'AUTOSELECT' attribute
- bool autoselect = false;
+ bool autoselect = is_default;
if (map.HasValue(XMediaTagAttribute::kAutoselect)) {
if (map.GetValue(XMediaTagAttribute::kAutoselect).Str() == "YES") {
autoselect = true;
@@ -788,14 +793,18 @@ ParseStatus::Or<XStreamInfTag> XStreamInfTag::Parse(
// Extract the 'CODECS' attribute
if (map.HasValue(XStreamInfTagAttribute::kCodecs)) {
- auto codecs =
+ auto codecs_string =
types::ParseQuotedString(map.GetValue(XStreamInfTagAttribute::kCodecs),
variable_dict, sub_buffer);
- if (codecs.has_error()) {
+ if (codecs_string.has_error()) {
return ParseStatus(ParseStatusCode::kMalformedTag)
- .AddCause(std::move(codecs).error());
+ .AddCause(std::move(codecs_string).error());
}
- out.codecs = std::string{std::move(codecs).value().Str()};
+
+ // Split the list of codecs
+ std::vector<std::string> codecs;
+ SplitCodecs(std::move(codecs_string).value().Str(), &codecs);
+ out.codecs = std::move(codecs);
}
// Extract the 'RESOLUTION' attribute
@@ -822,6 +831,18 @@ ParseStatus::Or<XStreamInfTag> XStreamInfTag::Parse(
out.frame_rate = std::move(frame_rate).value();
}
+ // Extract the 'AUDIO' attribute
+ if (map.HasValue(XStreamInfTagAttribute::kAudio)) {
+ auto audio =
+ types::ParseQuotedString(map.GetValue(XStreamInfTagAttribute::kAudio),
+ variable_dict, sub_buffer);
+ if (audio.has_error()) {
+ return ParseStatus(ParseStatusCode::kMalformedTag)
+ .AddCause(std::move(audio).error());
+ }
+ out.audio = std::move(audio).value();
+ }
+
return out;
}
diff --git a/chromium/media/formats/hls/tags.h b/chromium/media/formats/hls/tags.h
index d27de0144aa..8992d972c96 100644
--- a/chromium/media/formats/hls/tags.h
+++ b/chromium/media/formats/hls/tags.h
@@ -1,13 +1,17 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_FORMATS_HLS_TAGS_H_
#define MEDIA_FORMATS_HLS_TAGS_H_
+#include <string>
+#include <vector>
+
#include "base/time/time.h"
#include "media/base/media_export.h"
#include "media/formats/hls/parse_status.h"
+#include "media/formats/hls/source_string.h"
#include "media/formats/hls/tag_name.h"
#include "media/formats/hls/types.h"
#include "media/formats/hls/variable_dictionary.h"
@@ -168,13 +172,13 @@ struct MEDIA_EXPORT XStreamInfTag {
// author, however higher scores must indicate a better playback experience.
absl::optional<types::DecimalFloatingPoint> score;
- // A comma-separated list of formats, where each format specifies a media
+ // A list of formats, where each format specifies a media
// sample type that is present is one or more renditions of the variant stream
// this tag applies to. According to the spec this *should* be present on
// every instance of this tag, but in practice it's not. It's represented as
// optional here so that the caller may decide how they wish to handle its
// absence.
- absl::optional<std::string> codecs;
+ absl::optional<std::vector<std::string>> codecs;
// The optimal pixel resolution at which to display all video in this variant
// stream.
@@ -182,6 +186,10 @@ struct MEDIA_EXPORT XStreamInfTag {
// This describes the maximum framerate for all video in this variant stream.
absl::optional<types::DecimalFloatingPoint> frame_rate;
+
+ // The id of an audio rendition group that should be used when playing this
+ // variant.
+ absl::optional<ResolvedSourceString> audio;
};
// Represents the contents of the #EXTINF tag
diff --git a/chromium/media/formats/hls/tags_unittest.cc b/chromium/media/formats/hls/tags_unittest.cc
index df46281d361..4715017486b 100644
--- a/chromium/media/formats/hls/tags_unittest.cc
+++ b/chromium/media/formats/hls/tags_unittest.cc
@@ -1,12 +1,14 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/formats/hls/tags.h"
+#include <array>
#include <utility>
#include "base/location.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "media/formats/hls/items.h"
@@ -730,7 +732,7 @@ TEST(HlsTagsTest, ParseXMediaTag) {
EXPECT_EQ(result.tag.name.Str(), "name");
EXPECT_EQ(result.tag.stable_rendition_id, absl::nullopt);
EXPECT_EQ(result.tag.is_default, true);
- EXPECT_EQ(result.tag.autoselect, false);
+ EXPECT_EQ(result.tag.autoselect, true); // DEFAULT=YES implies AUTOSELECT=YES
EXPECT_EQ(result.tag.forced, false);
EXPECT_EQ(result.tag.instream_id, absl::nullopt);
EXPECT_EQ(result.tag.characteristics.size(), 0u);
@@ -1081,7 +1083,9 @@ TEST(HlsTagsTest, ParseXStreamInfTag) {
EXPECT_EQ(result.tag.bandwidth, 1010u);
EXPECT_EQ(result.tag.average_bandwidth, 1000u);
EXPECT_DOUBLE_EQ(result.tag.score.value(), 12.2);
- EXPECT_EQ(result.tag.codecs, "foo,bar");
+ ASSERT_TRUE(result.tag.codecs.has_value());
+ EXPECT_TRUE(
+ base::ranges::equal(result.tag.codecs.value(), std::array{"foo", "bar"}));
EXPECT_EQ(result.tag.resolution, absl::nullopt);
EXPECT_EQ(result.tag.frame_rate, absl::nullopt);
@@ -1157,7 +1161,9 @@ TEST(HlsTagsTest, ParseXStreamInfTag) {
EXPECT_EQ(result.tag.bandwidth, 1010u);
EXPECT_EQ(result.tag.average_bandwidth, absl::nullopt);
EXPECT_EQ(result.tag.score, absl::nullopt);
- EXPECT_EQ(result.tag.codecs, "bar,baz");
+ ASSERT_TRUE(result.tag.codecs.has_value());
+ EXPECT_TRUE(
+ base::ranges::equal(result.tag.codecs.value(), std::array{"bar", "baz"}));
EXPECT_EQ(result.tag.resolution, absl::nullopt);
// "RESOLUTION" must be a valid decimal-resolution
@@ -1173,6 +1179,25 @@ TEST(HlsTagsTest, ParseXStreamInfTag) {
sub_buffer, ParseStatusCode::kMalformedTag);
ErrorTest<XStreamInfTag>(R"(BANDWIDTH=1010,FRAME-RATE=30.0.0)", variable_dict,
sub_buffer, ParseStatusCode::kMalformedTag);
+
+ // "AUDIO" must be a valid quoted-string
+ ErrorTest<XStreamInfTag>(R"(BANDWIDTH=1010,AUDIO=1)", variable_dict,
+ sub_buffer, ParseStatusCode::kMalformedTag);
+ ErrorTest<XStreamInfTag>(R"(BANDWIDTH=1010,AUDIO="")", variable_dict,
+ sub_buffer, ParseStatusCode::kMalformedTag);
+ ErrorTest<XStreamInfTag>(R"(BANDWIDTH=1010,AUDIO=stereo)", variable_dict,
+ sub_buffer, ParseStatusCode::kMalformedTag);
+
+ // "AUDIO" is subject to variable substitution
+ result = OkTest<XStreamInfTag>(R"(BANDWIDTH=1010,AUDIO="{$FOO}{$BAR}")",
+ variable_dict, sub_buffer);
+ EXPECT_EQ(result.tag.bandwidth, 1010u);
+ EXPECT_EQ(result.tag.average_bandwidth, absl::nullopt);
+ EXPECT_EQ(result.tag.score, absl::nullopt);
+ EXPECT_EQ(result.tag.codecs, absl::nullopt);
+ EXPECT_EQ(result.tag.resolution, absl::nullopt);
+ ASSERT_TRUE(result.tag.audio.has_value());
+ EXPECT_EQ(result.tag.audio->Str(), "barbaz");
}
TEST(HlsTagsTest, ParseInfTag) {
diff --git a/chromium/media/formats/hls/test_util.h b/chromium/media/formats/hls/test_util.h
index 17268ee1ac8..6065d6a399c 100644
--- a/chromium/media/formats/hls/test_util.h
+++ b/chromium/media/formats/hls/test_util.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/types.cc b/chromium/media/formats/hls/types.cc
index 5339aeb5089..57552d2af4f 100644
--- a/chromium/media/formats/hls/types.cc
+++ b/chromium/media/formats/hls/types.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/types.h b/chromium/media/formats/hls/types.h
index 1b383cf2728..3e28accbd4d 100644
--- a/chromium/media/formats/hls/types.h
+++ b/chromium/media/formats/hls/types.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/types_unittest.cc b/chromium/media/formats/hls/types_unittest.cc
index aad31649c62..1bbbd43e554 100644
--- a/chromium/media/formats/hls/types_unittest.cc
+++ b/chromium/media/formats/hls/types_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/variable_dictionary.cc b/chromium/media/formats/hls/variable_dictionary.cc
index 16ccaee1f3f..3e339bfabae 100644
--- a/chromium/media/formats/hls/variable_dictionary.cc
+++ b/chromium/media/formats/hls/variable_dictionary.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/variable_dictionary.h b/chromium/media/formats/hls/variable_dictionary.h
index e5400de5d5f..61546e749fc 100644
--- a/chromium/media/formats/hls/variable_dictionary.h
+++ b/chromium/media/formats/hls/variable_dictionary.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/variable_dictionary_unittest.cc b/chromium/media/formats/hls/variable_dictionary_unittest.cc
index 745cc7f2ff5..11b27d5a3de 100644
--- a/chromium/media/formats/hls/variable_dictionary_unittest.cc
+++ b/chromium/media/formats/hls/variable_dictionary_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/hls/variant_stream.cc b/chromium/media/formats/hls/variant_stream.cc
index 3eaa46f4334..0faad30ee89 100644
--- a/chromium/media/formats/hls/variant_stream.cc
+++ b/chromium/media/formats/hls/variant_stream.cc
@@ -1,9 +1,12 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/formats/hls/variant_stream.h"
+#include <string>
+#include <vector>
+
namespace media::hls {
VariantStream::VariantStream(
@@ -11,7 +14,7 @@ VariantStream::VariantStream(
types::DecimalInteger bandwidth,
absl::optional<types::DecimalInteger> average_bandwidth,
absl::optional<types::DecimalFloatingPoint> score,
- absl::optional<std::string> codecs,
+ absl::optional<std::vector<std::string>> codecs,
absl::optional<types::DecimalResolution> resolution,
absl::optional<types::DecimalFloatingPoint> frame_rate)
: primary_rendition_uri_(std::move(primary_rendition_uri)),
diff --git a/chromium/media/formats/hls/variant_stream.h b/chromium/media/formats/hls/variant_stream.h
index a7936a4107a..1c621e8bec4 100644
--- a/chromium/media/formats/hls/variant_stream.h
+++ b/chromium/media/formats/hls/variant_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,7 +19,7 @@ class MEDIA_EXPORT VariantStream {
types::DecimalInteger bandwidth,
absl::optional<types::DecimalInteger> average_bandwidth,
absl::optional<types::DecimalFloatingPoint> score,
- absl::optional<std::string> codecs,
+ absl::optional<std::vector<std::string>> codecs,
absl::optional<types::DecimalResolution> resolution,
absl::optional<types::DecimalFloatingPoint> frame_rate);
VariantStream(const VariantStream&) = delete;
@@ -76,9 +76,11 @@ class MEDIA_EXPORT VariantStream {
return score_;
}
- // A comma-separated list of media sample formats present in one or more
- // renditions of this variant.
- const absl::optional<std::string>& GetCodecs() const { return codecs_; }
+ // A list of media sample formats present in one or more renditions of this
+ // variant.
+ const absl::optional<std::vector<std::string>>& GetCodecs() const {
+ return codecs_;
+ }
// A value representing the optimal pixel resolution at which to display all
// video in this variant stream.
@@ -96,7 +98,7 @@ class MEDIA_EXPORT VariantStream {
types::DecimalInteger bandwidth_;
absl::optional<types::DecimalInteger> average_bandwidth_;
absl::optional<types::DecimalFloatingPoint> score_;
- absl::optional<std::string> codecs_;
+ absl::optional<std::vector<std::string>> codecs_;
absl::optional<types::DecimalResolution> resolution_;
absl::optional<types::DecimalFloatingPoint> frame_rate_;
};
diff --git a/chromium/media/formats/mp2t/descriptors.cc b/chromium/media/formats/mp2t/descriptors.cc
index 075ea59ecce..94c967fbbc1 100644
--- a/chromium/media/formats/mp2t/descriptors.cc
+++ b/chromium/media/formats/mp2t/descriptors.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/descriptors.h b/chromium/media/formats/mp2t/descriptors.h
index 817da22c93c..1618995fc7c 100644
--- a/chromium/media/formats/mp2t/descriptors.h
+++ b/chromium/media/formats/mp2t/descriptors.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_adapter_video.cc b/chromium/media/formats/mp2t/es_adapter_video.cc
index eb181aa342b..b173051305d 100644
--- a/chromium/media/formats/mp2t/es_adapter_video.cc
+++ b/chromium/media/formats/mp2t/es_adapter_video.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_adapter_video.h b/chromium/media/formats/mp2t/es_adapter_video.h
index 2fb768834d3..f6df4fcb471 100644
--- a/chromium/media/formats/mp2t/es_adapter_video.h
+++ b/chromium/media/formats/mp2t/es_adapter_video.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_adapter_video_unittest.cc b/chromium/media/formats/mp2t/es_adapter_video_unittest.cc
index 0665abb2e4d..edb0ee83a1e 100644
--- a/chromium/media/formats/mp2t/es_adapter_video_unittest.cc
+++ b/chromium/media/formats/mp2t/es_adapter_video_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser.cc b/chromium/media/formats/mp2t/es_parser.cc
index df46f0a7b15..2c17bc7348e 100644
--- a/chromium/media/formats/mp2t/es_parser.cc
+++ b/chromium/media/formats/mp2t/es_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser.h b/chromium/media/formats/mp2t/es_parser.h
index 91ce1f95afb..ac5ed7b6d39 100644
--- a/chromium/media/formats/mp2t/es_parser.h
+++ b/chromium/media/formats/mp2t/es_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_adts.cc b/chromium/media/formats/mp2t/es_parser_adts.cc
index a484ee338c0..2a050488242 100644
--- a/chromium/media/formats/mp2t/es_parser_adts.cc
+++ b/chromium/media/formats/mp2t/es_parser_adts.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_adts.h b/chromium/media/formats/mp2t/es_parser_adts.h
index fbf72aabb86..dbadd9927ae 100644
--- a/chromium/media/formats/mp2t/es_parser_adts.h
+++ b/chromium/media/formats/mp2t/es_parser_adts.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_adts_fuzzer.cc b/chromium/media/formats/mp2t/es_parser_adts_fuzzer.cc
index 194d4eab377..12e290e2b58 100644
--- a/chromium/media/formats/mp2t/es_parser_adts_fuzzer.cc
+++ b/chromium/media/formats/mp2t/es_parser_adts_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_adts_unittest.cc b/chromium/media/formats/mp2t/es_parser_adts_unittest.cc
index 7d26cf2bf58..ee7cbf1118e 100644
--- a/chromium/media/formats/mp2t/es_parser_adts_unittest.cc
+++ b/chromium/media/formats/mp2t/es_parser_adts_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_h264.cc b/chromium/media/formats/mp2t/es_parser_h264.cc
index 7132c58724b..0cc43f5abf0 100644
--- a/chromium/media/formats/mp2t/es_parser_h264.cc
+++ b/chromium/media/formats/mp2t/es_parser_h264.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_h264.h b/chromium/media/formats/mp2t/es_parser_h264.h
index eee3cf88ef2..6769b6f8a95 100644
--- a/chromium/media/formats/mp2t/es_parser_h264.h
+++ b/chromium/media/formats/mp2t/es_parser_h264.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_h264_fuzzer.cc b/chromium/media/formats/mp2t/es_parser_h264_fuzzer.cc
index b39953c93da..e90d6856422 100644
--- a/chromium/media/formats/mp2t/es_parser_h264_fuzzer.cc
+++ b/chromium/media/formats/mp2t/es_parser_h264_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_h264_unittest.cc b/chromium/media/formats/mp2t/es_parser_h264_unittest.cc
index efdb442d1eb..428939e775c 100644
--- a/chromium/media/formats/mp2t/es_parser_h264_unittest.cc
+++ b/chromium/media/formats/mp2t/es_parser_h264_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_mpeg1audio.cc b/chromium/media/formats/mp2t/es_parser_mpeg1audio.cc
index a48a4ba6062..eb046520172 100644
--- a/chromium/media/formats/mp2t/es_parser_mpeg1audio.cc
+++ b/chromium/media/formats/mp2t/es_parser_mpeg1audio.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_mpeg1audio.h b/chromium/media/formats/mp2t/es_parser_mpeg1audio.h
index ed3f0a56199..41723de856d 100644
--- a/chromium/media/formats/mp2t/es_parser_mpeg1audio.h
+++ b/chromium/media/formats/mp2t/es_parser_mpeg1audio.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_mpeg1audio_fuzzer.cc b/chromium/media/formats/mp2t/es_parser_mpeg1audio_fuzzer.cc
index ada891dc244..62f5436ef57 100644
--- a/chromium/media/formats/mp2t/es_parser_mpeg1audio_fuzzer.cc
+++ b/chromium/media/formats/mp2t/es_parser_mpeg1audio_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc b/chromium/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc
index 07980bbd03b..e4361176a5f 100644
--- a/chromium/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc
+++ b/chromium/media/formats/mp2t/es_parser_mpeg1audio_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_test_base.cc b/chromium/media/formats/mp2t/es_parser_test_base.cc
index 8f448b74104..4ab3226b5e5 100644
--- a/chromium/media/formats/mp2t/es_parser_test_base.cc
+++ b/chromium/media/formats/mp2t/es_parser_test_base.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/es_parser_test_base.h b/chromium/media/formats/mp2t/es_parser_test_base.h
index 43c0993b6c3..b9bcacec47b 100644
--- a/chromium/media/formats/mp2t/es_parser_test_base.h
+++ b/chromium/media/formats/mp2t/es_parser_test_base.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/mp2t_common.h b/chromium/media/formats/mp2t/mp2t_common.h
index ebced862cbe..9ddcb603e54 100644
--- a/chromium/media/formats/mp2t/mp2t_common.h
+++ b/chromium/media/formats/mp2t/mp2t_common.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/mp2t_stream_parser.cc b/chromium/media/formats/mp2t/mp2t_stream_parser.cc
index a15bef6bb7d..a9f4a176e7b 100644
--- a/chromium/media/formats/mp2t/mp2t_stream_parser.cc
+++ b/chromium/media/formats/mp2t/mp2t_stream_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -243,12 +243,12 @@ Mp2tStreamParser::~Mp2tStreamParser() = default;
void Mp2tStreamParser::Init(
InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool /* ignore_text_tracks */,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) {
DCHECK(!is_initialized_);
DCHECK(!init_cb_);
@@ -260,11 +260,11 @@ void Mp2tStreamParser::Init(
DCHECK(end_of_segment_cb);
init_cb_ = std::move(init_cb);
- config_cb_ = config_cb;
- new_buffers_cb_ = new_buffers_cb;
- encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
- new_segment_cb_ = new_segment_cb;
- end_of_segment_cb_ = end_of_segment_cb;
+ config_cb_ = std::move(config_cb);
+ new_buffers_cb_ = std::move(new_buffers_cb);
+ encrypted_media_init_data_cb_ = std::move(encrypted_media_init_data_cb);
+ new_segment_cb_ = std::move(new_segment_cb);
+ end_of_segment_cb_ = std::move(end_of_segment_cb);
media_log_ = media_log;
}
diff --git a/chromium/media/formats/mp2t/mp2t_stream_parser.h b/chromium/media/formats/mp2t/mp2t_stream_parser.h
index b99b6adec68..e8c09123b88 100644
--- a/chromium/media/formats/mp2t/mp2t_stream_parser.h
+++ b/chromium/media/formats/mp2t/mp2t_stream_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -45,12 +45,12 @@ class MEDIA_EXPORT Mp2tStreamParser : public StreamParser {
// StreamParser implementation.
void Init(InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool ignore_text_tracks,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) override;
void Flush() override;
bool GetGenerateTimestampsFlag() const override;
diff --git a/chromium/media/formats/mp2t/mp2t_stream_parser_unittest.cc b/chromium/media/formats/mp2t/mp2t_stream_parser_unittest.cc
index 27734436a31..484dce43947 100644
--- a/chromium/media/formats/mp2t/mp2t_stream_parser_unittest.cc
+++ b/chromium/media/formats/mp2t/mp2t_stream_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/timestamp_unroller.cc b/chromium/media/formats/mp2t/timestamp_unroller.cc
index 31a994dabbe..95cbf1c6e84 100644
--- a/chromium/media/formats/mp2t/timestamp_unroller.cc
+++ b/chromium/media/formats/mp2t/timestamp_unroller.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/timestamp_unroller.h b/chromium/media/formats/mp2t/timestamp_unroller.h
index ce2b15e77ca..6416129a2c4 100644
--- a/chromium/media/formats/mp2t/timestamp_unroller.h
+++ b/chromium/media/formats/mp2t/timestamp_unroller.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/timestamp_unroller_unittest.cc b/chromium/media/formats/mp2t/timestamp_unroller_unittest.cc
index 61d6da73911..cc2f9992289 100644
--- a/chromium/media/formats/mp2t/timestamp_unroller_unittest.cc
+++ b/chromium/media/formats/mp2t/timestamp_unroller_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_packet.cc b/chromium/media/formats/mp2t/ts_packet.cc
index ea9e9072cdb..f3a44989a97 100644
--- a/chromium/media/formats/mp2t/ts_packet.cc
+++ b/chromium/media/formats/mp2t/ts_packet.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_packet.h b/chromium/media/formats/mp2t/ts_packet.h
index 5ed69fdaa78..c952f5209c3 100644
--- a/chromium/media/formats/mp2t/ts_packet.h
+++ b/chromium/media/formats/mp2t/ts_packet.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section.h b/chromium/media/formats/mp2t/ts_section.h
index f6ee44a7c1f..4f17b542590 100644
--- a/chromium/media/formats/mp2t/ts_section.h
+++ b/chromium/media/formats/mp2t/ts_section.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_cat.cc b/chromium/media/formats/mp2t/ts_section_cat.cc
index 9d340ac368d..a686767f4ae 100644
--- a/chromium/media/formats/mp2t/ts_section_cat.cc
+++ b/chromium/media/formats/mp2t/ts_section_cat.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_cat.h b/chromium/media/formats/mp2t/ts_section_cat.h
index 3fd286dfdea..6bc5c7490cc 100644
--- a/chromium/media/formats/mp2t/ts_section_cat.h
+++ b/chromium/media/formats/mp2t/ts_section_cat.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_cets_ecm.cc b/chromium/media/formats/mp2t/ts_section_cets_ecm.cc
index d458c06fb5c..b93c58bc81a 100644
--- a/chromium/media/formats/mp2t/ts_section_cets_ecm.cc
+++ b/chromium/media/formats/mp2t/ts_section_cets_ecm.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_cets_ecm.h b/chromium/media/formats/mp2t/ts_section_cets_ecm.h
index aa58ca000c2..7ea876f1102 100644
--- a/chromium/media/formats/mp2t/ts_section_cets_ecm.h
+++ b/chromium/media/formats/mp2t/ts_section_cets_ecm.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_cets_pssh.cc b/chromium/media/formats/mp2t/ts_section_cets_pssh.cc
index 976d4b53898..032cb783b6c 100644
--- a/chromium/media/formats/mp2t/ts_section_cets_pssh.cc
+++ b/chromium/media/formats/mp2t/ts_section_cets_pssh.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_cets_pssh.h b/chromium/media/formats/mp2t/ts_section_cets_pssh.h
index b476dbcc6ee..d358f85bf58 100644
--- a/chromium/media/formats/mp2t/ts_section_cets_pssh.h
+++ b/chromium/media/formats/mp2t/ts_section_cets_pssh.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_pat.cc b/chromium/media/formats/mp2t/ts_section_pat.cc
index 28c5d8429ab..ef0061c524f 100644
--- a/chromium/media/formats/mp2t/ts_section_pat.cc
+++ b/chromium/media/formats/mp2t/ts_section_pat.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_pat.h b/chromium/media/formats/mp2t/ts_section_pat.h
index 1bcf7a3475c..f865296822c 100644
--- a/chromium/media/formats/mp2t/ts_section_pat.h
+++ b/chromium/media/formats/mp2t/ts_section_pat.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_pes.cc b/chromium/media/formats/mp2t/ts_section_pes.cc
index 59a5dc56e81..c6bf662e37a 100644
--- a/chromium/media/formats/mp2t/ts_section_pes.cc
+++ b/chromium/media/formats/mp2t/ts_section_pes.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_pes.h b/chromium/media/formats/mp2t/ts_section_pes.h
index 8ae2e11663f..2ecc4808ff8 100644
--- a/chromium/media/formats/mp2t/ts_section_pes.h
+++ b/chromium/media/formats/mp2t/ts_section_pes.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_pmt.cc b/chromium/media/formats/mp2t/ts_section_pmt.cc
index 1746bb8ceb1..284843c9143 100644
--- a/chromium/media/formats/mp2t/ts_section_pmt.cc
+++ b/chromium/media/formats/mp2t/ts_section_pmt.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_pmt.h b/chromium/media/formats/mp2t/ts_section_pmt.h
index 8e95f310a9b..10c76c006ee 100644
--- a/chromium/media/formats/mp2t/ts_section_pmt.h
+++ b/chromium/media/formats/mp2t/ts_section_pmt.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_psi.cc b/chromium/media/formats/mp2t/ts_section_psi.cc
index aef0acaf3ab..ca7a88bf1e3 100644
--- a/chromium/media/formats/mp2t/ts_section_psi.cc
+++ b/chromium/media/formats/mp2t/ts_section_psi.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp2t/ts_section_psi.h b/chromium/media/formats/mp2t/ts_section_psi.h
index 58bbaf76840..749ec581788 100644
--- a/chromium/media/formats/mp2t/ts_section_psi.h
+++ b/chromium/media/formats/mp2t/ts_section_psi.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/aac.cc b/chromium/media/formats/mp4/aac.cc
index 7742a469567..bf09f75de0d 100644
--- a/chromium/media/formats/mp4/aac.cc
+++ b/chromium/media/formats/mp4/aac.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/aac.h b/chromium/media/formats/mp4/aac.h
index 301b239f95c..e4b80ab226c 100644
--- a/chromium/media/formats/mp4/aac.h
+++ b/chromium/media/formats/mp4/aac.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/aac_unittest.cc b/chromium/media/formats/mp4/aac_unittest.cc
index 5afee41c492..ce0ebc21e9e 100644
--- a/chromium/media/formats/mp4/aac_unittest.cc
+++ b/chromium/media/formats/mp4/aac_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/avc.cc b/chromium/media/formats/mp4/avc.cc
index c3a3b29ea12..f620eaaec88 100644
--- a/chromium/media/formats/mp4/avc.cc
+++ b/chromium/media/formats/mp4/avc.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/avc.h b/chromium/media/formats/mp4/avc.h
index 7497069f54f..97a3502e114 100644
--- a/chromium/media/formats/mp4/avc.h
+++ b/chromium/media/formats/mp4/avc.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/avc_unittest.cc b/chromium/media/formats/mp4/avc_unittest.cc
index e929f3fc397..d1fb073307b 100644
--- a/chromium/media/formats/mp4/avc_unittest.cc
+++ b/chromium/media/formats/mp4/avc_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/bitstream_converter.cc b/chromium/media/formats/mp4/bitstream_converter.cc
index ca5be617dab..5a499aa01ee 100644
--- a/chromium/media/formats/mp4/bitstream_converter.cc
+++ b/chromium/media/formats/mp4/bitstream_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/bitstream_converter.h b/chromium/media/formats/mp4/bitstream_converter.h
index 4b9677131cc..072c4853027 100644
--- a/chromium/media/formats/mp4/bitstream_converter.h
+++ b/chromium/media/formats/mp4/bitstream_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/box_definitions.cc b/chromium/media/formats/mp4/box_definitions.cc
index 69299b3d102..c0a89d5df35 100644
--- a/chromium/media/formats/mp4/box_definitions.cc
+++ b/chromium/media/formats/mp4/box_definitions.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -126,6 +126,25 @@ VideoColorSpace ConvertColorParameterInformationToColorSpace(
: gfx::ColorSpace::RangeID::LIMITED);
}
+gfx::ColorVolumeMetadata ConvertMdcvToColorVolumeMetadata(
+ const MasteringDisplayColorVolume& mdcv) {
+ gfx::ColorVolumeMetadata color_volume_metadata;
+
+ color_volume_metadata.primary_r = gfx::ColorVolumeMetadata::Chromaticity(
+ mdcv.display_primaries_rx, mdcv.display_primaries_ry);
+ color_volume_metadata.primary_g = gfx::ColorVolumeMetadata::Chromaticity(
+ mdcv.display_primaries_gx, mdcv.display_primaries_gy);
+ color_volume_metadata.primary_b = gfx::ColorVolumeMetadata::Chromaticity(
+ mdcv.display_primaries_bx, mdcv.display_primaries_by);
+ color_volume_metadata.white_point = gfx::ColorVolumeMetadata::Chromaticity(
+ mdcv.white_point_x, mdcv.white_point_y);
+
+ color_volume_metadata.luminance_max = mdcv.max_display_mastering_luminance;
+ color_volume_metadata.luminance_min = mdcv.min_display_mastering_luminance;
+
+ return color_volume_metadata;
+}
+
} // namespace
FileType::FileType() = default;
@@ -1053,6 +1072,7 @@ VideoSampleEntry::VideoSampleEntry()
data_reference_index(0),
width(0),
height(0),
+ alpha_mode(VideoDecoderConfig::AlphaMode::kIsOpaque),
video_codec(VideoCodec::kUnknown),
video_codec_profile(VIDEO_CODEC_PROFILE_UNKNOWN),
video_codec_level(kNoVideoCodecLevel) {}
@@ -1089,6 +1109,7 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
}
}
+ gfx::HDRMetadata hdr_static_metadata;
const FourCC actual_format =
format == FOURCC_ENCV ? sinf.format.format : format;
switch (actual_format) {
@@ -1128,6 +1149,8 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
video_codec_profile = hevcConfig->GetVideoProfile();
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
video_color_space = hevcConfig->GetColorSpace();
+ hdr_metadata = hevcConfig->GetHDRMetadata();
+ alpha_mode = hevcConfig->GetAlphaMode();
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
frame_bitstream_converter =
base::MakeRefCounted<HEVCBitstreamConverter>(std::move(hevcConfig));
@@ -1171,6 +1194,8 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
RCHECK(reader->ReadChild(hevcConfig.get()));
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
video_color_space = hevcConfig->GetColorSpace();
+ hdr_metadata = hevcConfig->GetHDRMetadata();
+ alpha_mode = hevcConfig->GetAlphaMode();
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
frame_bitstream_converter =
base::MakeRefCounted<HEVCBitstreamConverter>(std::move(hevcConfig));
@@ -1199,13 +1224,17 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
SMPTE2086MasteringDisplayMetadataBox color_volume;
if (reader->HasChild(&color_volume)) {
RCHECK(reader->ReadChild(&color_volume));
- mastering_display_color_volume = color_volume;
+ hdr_static_metadata.color_volume_metadata =
+ ConvertMdcvToColorVolumeMetadata(color_volume);
}
ContentLightLevel level_information;
if (reader->HasChild(&level_information)) {
RCHECK(reader->ReadChild(&level_information));
- content_light_level_information = level_information;
+ hdr_static_metadata.max_content_light_level =
+ level_information.max_content_light_level;
+ hdr_static_metadata.max_frame_average_light_level =
+ level_information.max_pic_average_light_level;
}
break;
}
@@ -1240,13 +1269,21 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
MasteringDisplayColorVolume color_volume;
if (reader->HasChild(&color_volume)) {
RCHECK(reader->ReadChild(&color_volume));
- mastering_display_color_volume = color_volume;
+ hdr_static_metadata.color_volume_metadata =
+ ConvertMdcvToColorVolumeMetadata(color_volume);
}
ContentLightLevelInformation level_information;
if (reader->HasChild(&level_information)) {
RCHECK(reader->ReadChild(&level_information));
- content_light_level_information = level_information;
+ hdr_static_metadata.max_content_light_level =
+ level_information.max_content_light_level;
+ hdr_static_metadata.max_frame_average_light_level =
+ level_information.max_pic_average_light_level;
+ }
+
+ if (hdr_static_metadata.IsValid()) {
+ hdr_metadata = hdr_static_metadata;
}
if (video_codec_profile == VIDEO_CODEC_PROFILE_UNKNOWN) {
@@ -1441,7 +1478,7 @@ bool OpusSpecificBox::Parse(BoxReader* reader) {
return true;
}
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
DtsSpecificBox::DtsSpecificBox() {}
DtsSpecificBox::DtsSpecificBox(const DtsSpecificBox& other) = default;
@@ -1481,8 +1518,7 @@ bool DtsUhdSpecificBox::Parse(BoxReader* reader) {
return true;
}
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
AudioSampleEntry::AudioSampleEntry()
: format(FOURCC_NULL),
@@ -1535,7 +1571,7 @@ bool AudioSampleEntry::Parse(BoxReader* reader) {
"OpusSpecificBox STREAMINFO channel count");
}
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
if (format == FOURCC_DTSC) {
RCHECK_MEDIA_LOGGED(reader->ReadChild(&ddts), reader->media_log(),
"Failure parsing DtsSpecificBox (ddts)");
@@ -1543,8 +1579,7 @@ bool AudioSampleEntry::Parse(BoxReader* reader) {
RCHECK_MEDIA_LOGGED(reader->ReadChild(&udts), reader->media_log(),
"Failure parsing DtsUhdSpecificBox (udts)");
}
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
// Read the FLACSpecificBox, even if CENC is signalled.
if (format == FOURCC_FLAC ||
diff --git a/chromium/media/formats/mp4/box_definitions.h b/chromium/media/formats/mp4/box_definitions.h
index 4630095911b..8362f4c3489 100644
--- a/chromium/media/formats/mp4/box_definitions.h
+++ b/chromium/media/formats/mp4/box_definitions.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -329,13 +329,14 @@ struct MEDIA_EXPORT VideoSampleEntry : Box {
PixelAspectRatioBox pixel_aspect;
ProtectionSchemeInfo sinf;
+ VideoDecoderConfig::AlphaMode alpha_mode;
+
VideoCodec video_codec;
VideoCodecProfile video_codec_profile;
VideoCodecLevel video_codec_level;
VideoColorSpace video_color_space;
- absl::optional<MasteringDisplayColorVolume> mastering_display_color_volume;
- absl::optional<ContentLightLevelInformation> content_light_level_information;
+ absl::optional<gfx::HDRMetadata> hdr_metadata;
bool IsFormatValid() const;
@@ -381,7 +382,7 @@ struct MEDIA_EXPORT OpusSpecificBox : Box {
uint32_t sample_rate;
};
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
struct MEDIA_EXPORT DtsSpecificBox : Box {
DECLARE_BOX_METHODS(DtsSpecificBox);
DTS dts;
@@ -391,8 +392,7 @@ struct MEDIA_EXPORT DtsUhdSpecificBox : Box {
DECLARE_BOX_METHODS(DtsUhdSpecificBox);
DTSX dtsx;
};
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
struct MEDIA_EXPORT AudioSampleEntry : Box {
DECLARE_BOX_METHODS(AudioSampleEntry);
@@ -407,11 +407,10 @@ struct MEDIA_EXPORT AudioSampleEntry : Box {
ElementaryStreamDescriptor esds;
FlacSpecificBox dfla;
OpusSpecificBox dops;
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
DtsSpecificBox ddts;
DtsUhdSpecificBox udts;
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
};
struct MEDIA_EXPORT SampleDescription : Box {
diff --git a/chromium/media/formats/mp4/box_reader.cc b/chromium/media/formats/mp4/box_reader.cc
index ac93dc5caff..f5ec3e46ce8 100644
--- a/chromium/media/formats/mp4/box_reader.cc
+++ b/chromium/media/formats/mp4/box_reader.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/box_reader.h b/chromium/media/formats/mp4/box_reader.h
index 2a3b8d51f29..8f1d3a8907d 100644
--- a/chromium/media/formats/mp4/box_reader.h
+++ b/chromium/media/formats/mp4/box_reader.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/box_reader_unittest.cc b/chromium/media/formats/mp4/box_reader_unittest.cc
index d30c6a982bd..346d1e1f91f 100644
--- a/chromium/media/formats/mp4/box_reader_unittest.cc
+++ b/chromium/media/formats/mp4/box_reader_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/dolby_vision.cc b/chromium/media/formats/mp4/dolby_vision.cc
index 1e110623b17..2251bbcf20a 100644
--- a/chromium/media/formats/mp4/dolby_vision.cc
+++ b/chromium/media/formats/mp4/dolby_vision.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/dolby_vision.h b/chromium/media/formats/mp4/dolby_vision.h
index 4ce6c1c2fc5..932f3d4af61 100644
--- a/chromium/media/formats/mp4/dolby_vision.h
+++ b/chromium/media/formats/mp4/dolby_vision.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/dolby_vision_unittest.cc b/chromium/media/formats/mp4/dolby_vision_unittest.cc
index 9ed24b008e4..d3879a23237 100644
--- a/chromium/media/formats/mp4/dolby_vision_unittest.cc
+++ b/chromium/media/formats/mp4/dolby_vision_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/dts.cc b/chromium/media/formats/mp4/dts.cc
index f4e74f4db7b..e0aac357ae1 100644
--- a/chromium/media/formats/mp4/dts.cc
+++ b/chromium/media/formats/mp4/dts.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/dts.h b/chromium/media/formats/mp4/dts.h
index 26b9120a1aa..9d2a11cc94b 100644
--- a/chromium/media/formats/mp4/dts.h
+++ b/chromium/media/formats/mp4/dts.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/dts_unittest.cc b/chromium/media/formats/mp4/dts_unittest.cc
index de95a02e8f8..eff1dbc8bbb 100644
--- a/chromium/media/formats/mp4/dts_unittest.cc
+++ b/chromium/media/formats/mp4/dts_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/dtsx.cc b/chromium/media/formats/mp4/dtsx.cc
index 8f36c77a7e3..a818c77343e 100644
--- a/chromium/media/formats/mp4/dtsx.cc
+++ b/chromium/media/formats/mp4/dtsx.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/dtsx.h b/chromium/media/formats/mp4/dtsx.h
index 82574788047..4192813ab2b 100644
--- a/chromium/media/formats/mp4/dtsx.h
+++ b/chromium/media/formats/mp4/dtsx.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/dtsx_unittest.cc b/chromium/media/formats/mp4/dtsx_unittest.cc
index 64440f55a78..d0bf8663003 100644
--- a/chromium/media/formats/mp4/dtsx_unittest.cc
+++ b/chromium/media/formats/mp4/dtsx_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/es_descriptor.cc b/chromium/media/formats/mp4/es_descriptor.cc
index 08223d0e2eb..88ee800aab9 100644
--- a/chromium/media/formats/mp4/es_descriptor.cc
+++ b/chromium/media/formats/mp4/es_descriptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/es_descriptor.h b/chromium/media/formats/mp4/es_descriptor.h
index a671e8c8799..093342f37e7 100644
--- a/chromium/media/formats/mp4/es_descriptor.h
+++ b/chromium/media/formats/mp4/es_descriptor.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/es_descriptor_unittest.cc b/chromium/media/formats/mp4/es_descriptor_unittest.cc
index 8f1c67eeb4b..04e9eae062c 100644
--- a/chromium/media/formats/mp4/es_descriptor_unittest.cc
+++ b/chromium/media/formats/mp4/es_descriptor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/fourccs.h b/chromium/media/formats/mp4/fourccs.h
index bba3cd0a738..130441ec5d3 100644
--- a/chromium/media/formats/mp4/fourccs.h
+++ b/chromium/media/formats/mp4/fourccs.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -133,13 +133,12 @@ enum FourCC {
FOURCC_VP09 = 0x76703039,
FOURCC_VPCC = 0x76706343,
FOURCC_WIDE = 0x77696465,
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
FOURCC_DTSC = 0x64747363, // "dtsc"
FOURCC_DTSX = 0x64747378, // "dtsx"
FOURCC_DDTS = 0x64647473, // "ddts"
FOURCC_UDTS = 0x75647473, // "udts"
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
};
const inline std::string FourCCToString(FourCC fourcc) {
diff --git a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.cc b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.cc
index 09e24e173da..f4ad56b48a7 100644
--- a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.cc
+++ b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.h b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.h
index 011de26a756..474e792e03d 100644
--- a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.h
+++ b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_fuzztest.cc b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_fuzztest.cc
index ba0ab78b0b5..5e7d0c44616 100644
--- a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_fuzztest.cc
+++ b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_fuzztest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_unittest.cc b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_unittest.cc
index e44adfd4727..37b3a52e657 100644
--- a/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_unittest.cc
+++ b/chromium/media/formats/mp4/h264_annex_b_to_avc_bitstream_converter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/hevc.cc b/chromium/media/formats/mp4/hevc.cc
index 20fbb8c52af..20cd87c998a 100644
--- a/chromium/media/formats/mp4/hevc.cc
+++ b/chromium/media/formats/mp4/hevc.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "media/base/decrypt_config.h"
#include "media/base/media_util.h"
+#include "media/base/video_decoder_config.h"
#include "media/formats/mp4/avc.h"
#include "media/formats/mp4/box_definitions.h"
#include "media/formats/mp4/box_reader.h"
@@ -45,7 +46,8 @@ HEVCDecoderConfigurationRecord::HEVCDecoderConfigurationRecord()
numTemporalLayers(0),
temporalIdNested(0),
lengthSizeMinusOne(0),
- numOfArrays(0) {}
+ numOfArrays(0),
+ alpha_mode(VideoDecoderConfig::AlphaMode::kIsOpaque) {}
HEVCDecoderConfigurationRecord::~HEVCDecoderConfigurationRecord() {}
FourCC HEVCDecoderConfigurationRecord::BoxType() const { return FOURCC_HVCC; }
@@ -75,20 +77,18 @@ bool HEVCDecoderConfigurationRecord::ParseInternal(BufferReader* reader,
uint32_t general_constraint_indicator_flags_hi = 0;
uint16_t general_constraint_indicator_flags_lo = 0;
uint8_t misc = 0;
- RCHECK(reader->Read1(&configurationVersion) && configurationVersion == 1 &&
+ RCHECK(reader->Read1(&configurationVersion) &&
+ (configurationVersion == 0 || configurationVersion == 1) &&
reader->Read1(&profile_indication) &&
reader->Read4(&general_profile_compatibility_flags) &&
reader->Read4(&general_constraint_indicator_flags_hi) &&
reader->Read2(&general_constraint_indicator_flags_lo) &&
reader->Read1(&general_level_idc) &&
reader->Read2(&min_spatial_segmentation_idc) &&
- reader->Read1(&parallelismType) &&
- reader->Read1(&chromaFormat) &&
+ reader->Read1(&parallelismType) && reader->Read1(&chromaFormat) &&
reader->Read1(&bitDepthLumaMinus8) &&
- reader->Read1(&bitDepthChromaMinus8) &&
- reader->Read2(&avgFrameRate) &&
- reader->Read1(&misc) &&
- reader->Read1(&numOfArrays));
+ reader->Read1(&bitDepthChromaMinus8) && reader->Read2(&avgFrameRate) &&
+ reader->Read1(&misc) && reader->Read1(&numOfArrays));
general_profile_space = profile_indication >> 6;
general_tier_flag = (profile_indication >> 5) & 1;
@@ -125,6 +125,97 @@ bool HEVCDecoderConfigurationRecord::ParseInternal(BufferReader* reader,
}
}
+#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
+ if (!arrays.size()) {
+ DVLOG(1) << "Could not found HVCCNALArray";
+ return true;
+ }
+ // Parse the color space and hdr metadata.
+ std::vector<uint8_t> param_sets;
+ HEVC::ConvertConfigToAnnexB(*this, &param_sets);
+ H265Parser parser;
+ H265NALU nalu;
+ parser.SetStream(param_sets.data(), param_sets.size());
+ while (true) {
+ H265Parser::Result result = parser.AdvanceToNextNALU(&nalu);
+ if (result != H265Parser::kOk)
+ break;
+
+ switch (nalu.nal_unit_type) {
+ case H265NALU::SPS_NUT: {
+ int sps_id = -1;
+ result = parser.ParseSPS(&sps_id);
+ if (result != H265Parser::kOk) {
+ DVLOG(1) << "Could not parse SPS for fetching colorspace";
+ break;
+ }
+
+ const H265SPS* sps = parser.GetSPS(sps_id);
+ DCHECK(sps);
+ color_space = sps->GetColorSpace();
+ break;
+ }
+ case H265NALU::PREFIX_SEI_NUT: {
+ H265SEIMessage sei_msg;
+ result = parser.ParseSEI(&sei_msg);
+ if (result != H265Parser::kOk) {
+ DVLOG(1) << "Could not parse SEI for fetching HDR metadata";
+ break;
+ }
+ switch (sei_msg.type) {
+ case H265SEIMessage::kSEIContentLightLevelInfo:
+ hdr_metadata.max_content_light_level =
+ sei_msg.content_light_level_info.max_content_light_level;
+ hdr_metadata.max_frame_average_light_level =
+ sei_msg.content_light_level_info
+ .max_picture_average_light_level;
+ break;
+ case H265SEIMessage::kSEIMasteringDisplayInfo: {
+ constexpr auto kChromaDenominator = 50000.0f;
+ constexpr auto kLumaDenoninator = 10000.0f;
+ // display primaries are in G/B/R order in MDCV SEI.
+ hdr_metadata.color_volume_metadata.primary_r = gfx::PointF(
+ sei_msg.mastering_display_info.display_primaries[2][0] /
+ kChromaDenominator,
+ sei_msg.mastering_display_info.display_primaries[2][1] /
+ kChromaDenominator);
+ hdr_metadata.color_volume_metadata.primary_g = gfx::PointF(
+ sei_msg.mastering_display_info.display_primaries[0][0] /
+ kChromaDenominator,
+ sei_msg.mastering_display_info.display_primaries[0][1] /
+ kChromaDenominator);
+ hdr_metadata.color_volume_metadata.primary_b = gfx::PointF(
+ sei_msg.mastering_display_info.display_primaries[1][0] /
+ kChromaDenominator,
+ sei_msg.mastering_display_info.display_primaries[1][1] /
+ kChromaDenominator);
+ hdr_metadata.color_volume_metadata.white_point =
+ gfx::PointF(sei_msg.mastering_display_info.white_points[0] /
+ kChromaDenominator,
+ sei_msg.mastering_display_info.white_points[1] /
+ kChromaDenominator);
+ hdr_metadata.color_volume_metadata.luminance_max =
+ sei_msg.mastering_display_info.max_luminance / kLumaDenoninator;
+ hdr_metadata.color_volume_metadata.luminance_min =
+ sei_msg.mastering_display_info.min_luminance / kLumaDenoninator;
+ break;
+ }
+ case H265SEIMessage::kSEIAlphaChannelInfo:
+ if (sei_msg.alpha_channel_info.alpha_channel_cancel_flag == 0) {
+ alpha_mode = VideoDecoderConfig::AlphaMode::kHasAlpha;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+ }
+#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
+
return true;
}
@@ -160,42 +251,15 @@ VideoCodecProfile HEVCDecoderConfigurationRecord::GetVideoProfile() const {
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
VideoColorSpace HEVCDecoderConfigurationRecord::GetColorSpace() {
- if (!arrays.size()) {
- DVLOG(1) << "HVCCNALArray not found, fallback to default colorspace";
- return VideoColorSpace();
- }
-
- std::vector<uint8_t> param_sets;
- if (!HEVC::ConvertConfigToAnnexB(*this, &param_sets))
- return VideoColorSpace();
-
- H265Parser parser;
- H265NALU nalu;
- parser.SetStream(param_sets.data(), param_sets.size());
- while (true) {
- H265Parser::Result result = parser.AdvanceToNextNALU(&nalu);
-
- if (result != H265Parser::kOk)
- return VideoColorSpace();
+ return color_space;
+}
- switch (nalu.nal_unit_type) {
- case H265NALU::SPS_NUT: {
- int sps_id = -1;
- result = parser.ParseSPS(&sps_id);
- if (result != H265Parser::kOk) {
- DVLOG(1) << "Could not parse SPS, fallback to default colorspace";
- return VideoColorSpace();
- }
+gfx::HDRMetadata HEVCDecoderConfigurationRecord::GetHDRMetadata() {
+ return hdr_metadata;
+}
- const H265SPS* sps = parser.GetSPS(sps_id);
- DCHECK(sps);
- return sps->GetColorSpace();
- }
- default:
- break;
- }
- }
- NOTREACHED();
+VideoDecoderConfig::AlphaMode HEVCDecoderConfigurationRecord::GetAlphaMode() {
+ return alpha_mode;
}
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
@@ -228,7 +292,7 @@ bool HEVC::InsertParamSetsAnnexB(
start = NULL;
std::vector<uint8_t> param_sets;
- RCHECK(HEVC::ConvertConfigToAnnexB(hevc_config, &param_sets));
+ HEVC::ConvertConfigToAnnexB(hevc_config, &param_sets);
DVLOG(4) << __func__ << " converted hvcC to AnnexB "
<< " size=" << param_sets.size() << " inserted at "
<< (int)(config_insert_point - buffer->begin());
@@ -236,7 +300,7 @@ bool HEVC::InsertParamSetsAnnexB(
if (subsamples && !subsamples->empty()) {
int subsample_index = AVC::FindSubsampleIndex(*buffer, subsamples,
&(*config_insert_point));
- // Update the size of the subsample where SPS/PPS is to be inserted.
+ // Update the size of the subsample where VPS/SPS/PPS is to be inserted.
(*subsamples)[subsample_index].clear_bytes += param_sets.size();
}
@@ -249,7 +313,7 @@ bool HEVC::InsertParamSetsAnnexB(
}
// static
-bool HEVC::ConvertConfigToAnnexB(
+void HEVC::ConvertConfigToAnnexB(
const HEVCDecoderConfigurationRecord& hevc_config,
std::vector<uint8_t>* buffer) {
DCHECK(buffer->empty());
@@ -266,8 +330,6 @@ bool HEVC::ConvertConfigToAnnexB(
hevc_config.arrays[j].units[i].end());
}
}
-
- return true;
}
// static
@@ -303,6 +365,8 @@ BitstreamConverter::AnalysisResult HEVC::AnalyzeAnnexB(
// Rec. ITU-T H.265 v5 (02/2018)
// 7.4.2.4.4 Order of NAL units and coded pictures and their association to
// access units
+ // F.7.4.2.4.4 Order of NAL units and coded pictures and association to access
+ // units
while (true) {
H265NaluParser::Result h265_result = parser.AdvanceToNextNALU(&nalu);
if (h265_result == H265NaluParser::kEOStream) {
@@ -317,14 +381,6 @@ BitstreamConverter::AnalysisResult HEVC::AnalyzeAnnexB(
DVLOG(3) << "nal_unit_type " << nalu.nal_unit_type;
- // Definition of "access unit" and "base layer" is only applied to NALs with
- // nuh_layer_id equals 0.
- if (nalu.nuh_layer_id != 0) {
- LOG(WARNING) << "Unrecognized layer ID " << nalu.nuh_layer_id
- << ", skip.";
- continue;
- }
-
if (order_state == kNoMoreDataAllowed) {
DVLOG(1) << "No more data is allowed after EOB_NUT.";
return result;
@@ -337,10 +393,9 @@ BitstreamConverter::AnalysisResult HEVC::AnalyzeAnnexB(
}
switch (nalu.nal_unit_type) {
- // When an access unit delimiter NAL unit with nuh_layer_id equal to 0 is
- // present, it shall be the first NAL unit. There shall be at most one
- // access unit delimiter NAL unit with nuh_layer_id equal to 0 in any
- // access unit.
+ // When an access unit delimiter NAL unit is present, it shall be the
+ // first NAL unit. There shall be at most one access unit delimiter NAL
+ // unit in any access unit.
case H265NALU::AUD_NUT:
if (order_state > kAUDAllowed) {
DVLOG(1) << "Unexpected AUD in order_state " << order_state;
@@ -401,9 +456,8 @@ BitstreamConverter::AnalysisResult HEVC::AnalyzeAnnexB(
}
break;
- // When an end of sequence NAL unit with nuh_layer_id equal to 0 is
- // present, it shall be the last NAL unit among all NAL units with
- // nuh_layer_id equal to 0 in the access unit other than an end of
+ // When an end of sequence NAL unit is present, it shall be the last NAL
+ // unit among all NAL units in the access unit other than an end of
// bitstream NAL unit (when present).
case H265NALU::EOS_NUT:
if (order_state != kAfterFirstVCL) {
diff --git a/chromium/media/formats/mp4/hevc.h b/chromium/media/formats/mp4/hevc.h
index c5747a96879..a09e02f3750 100644
--- a/chromium/media/formats/mp4/hevc.h
+++ b/chromium/media/formats/mp4/hevc.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include "media/base/media_export.h"
#include "media/base/video_codecs.h"
+#include "media/base/video_decoder_config.h"
#include "media/formats/mp4/bitstream_converter.h"
#include "media/formats/mp4/box_definitions.h"
@@ -64,15 +65,20 @@ struct MEDIA_EXPORT HEVCDecoderConfigurationRecord : Box {
VideoCodecProfile GetVideoProfile() const;
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
VideoColorSpace GetColorSpace();
+ gfx::HDRMetadata GetHDRMetadata();
+ VideoDecoderConfig::AlphaMode GetAlphaMode();
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
private:
bool ParseInternal(BufferReader* reader, MediaLog* media_log);
+ VideoColorSpace color_space;
+ gfx::HDRMetadata hdr_metadata;
+ VideoDecoderConfig::AlphaMode alpha_mode;
};
class MEDIA_EXPORT HEVC {
public:
- static bool ConvertConfigToAnnexB(
+ static void ConvertConfigToAnnexB(
const HEVCDecoderConfigurationRecord& hevc_config,
std::vector<uint8_t>* buffer);
diff --git a/chromium/media/formats/mp4/hevc_unittest.cc b/chromium/media/formats/mp4/hevc_unittest.cc
index 0dbdcbf8d87..995cbe94b0e 100644
--- a/chromium/media/formats/mp4/hevc_unittest.cc
+++ b/chromium/media/formats/mp4/hevc_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/mp4_avcc_parser_fuzzer.cc b/chromium/media/formats/mp4/mp4_avcc_parser_fuzzer.cc
index 4d5c5742b72..51dc6b14b13 100644
--- a/chromium/media/formats/mp4/mp4_avcc_parser_fuzzer.cc
+++ b/chromium/media/formats/mp4/mp4_avcc_parser_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/mp4_box_reader_fuzzer.cc b/chromium/media/formats/mp4/mp4_box_reader_fuzzer.cc
index 7d511c0236e..87510a5b3f5 100644
--- a/chromium/media/formats/mp4/mp4_box_reader_fuzzer.cc
+++ b/chromium/media/formats/mp4/mp4_box_reader_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/mp4_status.h b/chromium/media/formats/mp4/mp4_status.h
index ee2ce0ef991..8238b462b12 100644
--- a/chromium/media/formats/mp4/mp4_status.h
+++ b/chromium/media/formats/mp4/mp4_status.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/mp4_stream_parser.cc b/chromium/media/formats/mp4/mp4_stream_parser.cc
index 7d070436fa1..e8ad908ee30 100644
--- a/chromium/media/formats/mp4/mp4_stream_parser.cc
+++ b/chromium/media/formats/mp4/mp4_stream_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -33,8 +33,7 @@
#include "media/formats/mp4/rcheck.h"
#include "media/formats/mpeg/adts_constants.h"
-namespace media {
-namespace mp4 {
+namespace media::mp4 {
namespace {
@@ -60,25 +59,6 @@ EncryptionScheme GetEncryptionScheme(const ProtectionSchemeInfo& sinf) {
return EncryptionScheme::kUnencrypted;
}
-gfx::ColorVolumeMetadata ConvertMdcvToColorVolumeMetadata(
- const MasteringDisplayColorVolume& mdcv) {
- gfx::ColorVolumeMetadata color_volume_metadata;
-
- color_volume_metadata.primary_r = gfx::ColorVolumeMetadata::Chromaticity(
- mdcv.display_primaries_rx, mdcv.display_primaries_ry);
- color_volume_metadata.primary_g = gfx::ColorVolumeMetadata::Chromaticity(
- mdcv.display_primaries_gx, mdcv.display_primaries_gy);
- color_volume_metadata.primary_b = gfx::ColorVolumeMetadata::Chromaticity(
- mdcv.display_primaries_bx, mdcv.display_primaries_by);
- color_volume_metadata.white_point = gfx::ColorVolumeMetadata::Chromaticity(
- mdcv.white_point_x, mdcv.white_point_y);
-
- color_volume_metadata.luminance_max = mdcv.max_display_mastering_luminance;
- color_volume_metadata.luminance_min = mdcv.min_display_mastering_luminance;
-
- return color_volume_metadata;
-}
-
} // namespace
MP4StreamParser::MP4StreamParser(const std::set<int>& audio_object_types,
@@ -101,12 +81,12 @@ MP4StreamParser::~MP4StreamParser() = default;
void MP4StreamParser::Init(
InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool /* ignore_text_tracks */,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) {
DCHECK_EQ(state_, kWaitingForInit);
DCHECK(!init_cb_);
@@ -119,11 +99,11 @@ void MP4StreamParser::Init(
ChangeState(kParsingBoxes);
init_cb_ = std::move(init_cb);
- config_cb_ = config_cb;
- new_buffers_cb_ = new_buffers_cb;
- encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
- new_segment_cb_ = new_segment_cb;
- end_of_segment_cb_ = end_of_segment_cb;
+ config_cb_ = std::move(config_cb);
+ new_buffers_cb_ = std::move(new_buffers_cb);
+ encrypted_media_init_data_cb_ = std::move(encrypted_media_init_data_cb);
+ new_segment_cb_ = std::move(new_segment_cb);
+ end_of_segment_cb_ = std::move(end_of_segment_cb);
media_log_ = media_log;
}
@@ -304,8 +284,7 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
// send a codec reconfiguration for fragments using a sample description
// index different from the previous one. See https://crbug.com/748250.
size_t desc_idx = 0;
- for (size_t t = 0; t < moov_->extends.tracks.size(); t++) {
- const TrackExtends& trex = moov_->extends.tracks[t];
+ for (const auto& trex : moov_->extends.tracks) {
if (trex.track_id == track->header.track_id) {
desc_idx = trex.default_sample_description_index;
break;
@@ -335,10 +314,9 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
#if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO)
audio_format != FOURCC_AC3 && audio_format != FOURCC_EAC3 &&
#endif
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
audio_format != FOURCC_DTSC && audio_format != FOURCC_DTSX &&
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
#if BUILDFLAG(ENABLE_PLATFORM_MPEG_H_AUDIO)
audio_format != FOURCC_MHM1 && audio_format != FOURCC_MHA1 &&
#endif
@@ -407,7 +385,7 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
if (audio_format == FOURCC_DTSX)
audio_type = kDTSX;
}
-#endif
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
DVLOG(1) << "audio_type 0x" << std::hex << static_cast<int>(audio_type);
if (audio_object_types_.find(audio_type) == audio_object_types_.end()) {
MEDIA_LOG(ERROR, media_log_)
@@ -568,8 +546,7 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
return false;
}
video_config.Initialize(entry.video_codec, entry.video_codec_profile,
- VideoDecoderConfig::AlphaMode::kIsOpaque,
- VideoColorSpace::REC709(),
+ entry.alpha_mode, VideoColorSpace::REC709(),
CalculateRotation(track->header, moov_->header),
coded_size, visible_rect, natural_size,
// No decoder-specific buffer needed for AVC;
@@ -581,22 +558,8 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
if (entry.video_color_space.IsSpecified())
video_config.set_color_space_info(entry.video_color_space);
- if (entry.mastering_display_color_volume ||
- entry.content_light_level_information) {
- gfx::HDRMetadata hdr_metadata;
- if (entry.mastering_display_color_volume) {
- hdr_metadata.color_volume_metadata = ConvertMdcvToColorVolumeMetadata(
- *entry.mastering_display_color_volume);
- }
-
- if (entry.content_light_level_information) {
- hdr_metadata.max_content_light_level =
- entry.content_light_level_information->max_content_light_level;
- hdr_metadata.max_frame_average_light_level =
- entry.content_light_level_information
- ->max_pic_average_light_level;
- }
- video_config.set_hdr_metadata(hdr_metadata);
+ if (entry.hdr_metadata.has_value() && entry.hdr_metadata->IsValid()) {
+ video_config.set_hdr_metadata(entry.hdr_metadata.value());
}
DVLOG(1) << "video_track_id=" << video_track_id
@@ -709,15 +672,15 @@ void MP4StreamParser::OnEncryptedMediaInitData(
// concatenated in arbitrary order) matches the EME spec.
// See https://www.w3.org/Bugs/Public/show_bug.cgi?id=17673.
size_t total_size = 0;
- for (size_t i = 0; i < headers.size(); i++)
- total_size += headers[i].raw_box.size();
+ for (const auto& header : headers) {
+ total_size += header.raw_box.size();
+ }
std::vector<uint8_t> init_data(total_size);
size_t pos = 0;
- for (size_t i = 0; i < headers.size(); i++) {
- memcpy(&init_data[pos], &headers[i].raw_box[0],
- headers[i].raw_box.size());
- pos += headers[i].raw_box.size();
+ for (const auto& header : headers) {
+ memcpy(&init_data[pos], &header.raw_box[0], header.raw_box.size());
+ pos += header.raw_box.size();
}
encrypted_media_init_data_cb_.Run(EmeInitDataType::CENC, init_data);
}
@@ -976,7 +939,7 @@ bool MP4StreamParser::ReadAndDiscardMDATsUntil(int64_t max_clear_offset) {
ParseResult result = ParseResult::kOk;
int64_t upper_bound = std::min(max_clear_offset, queue_.tail());
while (mdat_tail_ < upper_bound) {
- const uint8_t* buf = NULL;
+ const uint8_t* buf = nullptr;
int size = 0;
queue_.PeekAt(mdat_tail_, &buf, &size);
@@ -1043,5 +1006,4 @@ bool MP4StreamParser::ComputeHighestEndOffset(const MovieFragment& moof) {
return true;
}
-} // namespace mp4
-} // namespace media
+} // namespace media::mp4
diff --git a/chromium/media/formats/mp4/mp4_stream_parser.h b/chromium/media/formats/mp4/mp4_stream_parser.h
index e17587fbc81..486fd473a71 100644
--- a/chromium/media/formats/mp4/mp4_stream_parser.h
+++ b/chromium/media/formats/mp4/mp4_stream_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,8 +24,7 @@
#include "media/formats/mp4/aac.h"
#endif
-namespace media {
-namespace mp4 {
+namespace media::mp4 {
struct Movie;
struct MovieHeader;
@@ -44,12 +43,12 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser {
~MP4StreamParser() override;
void Init(InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool ignore_text_tracks,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) override;
void Flush() override;
bool GetGenerateTimestampsFlag() const override;
@@ -156,7 +155,6 @@ class MEDIA_EXPORT MP4StreamParser : public StreamParser {
int num_video_keyframe_mismatches_;
};
-} // namespace mp4
-} // namespace media
+} // namespace media::mp4
#endif // MEDIA_FORMATS_MP4_MP4_STREAM_PARSER_H_
diff --git a/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc b/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc
index 9ffeb0ab0ee..a3e248b8290 100644
--- a/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc
+++ b/chromium/media/formats/mp4/mp4_stream_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/nalu_test_helper.cc b/chromium/media/formats/mp4/nalu_test_helper.cc
index ea0f2d58500..7a8a7b0edfb 100644
--- a/chromium/media/formats/mp4/nalu_test_helper.cc
+++ b/chromium/media/formats/mp4/nalu_test_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/nalu_test_helper.h b/chromium/media/formats/mp4/nalu_test_helper.h
index 68f3df69e08..d6553dbde75 100644
--- a/chromium/media/formats/mp4/nalu_test_helper.h
+++ b/chromium/media/formats/mp4/nalu_test_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/parse_result.h b/chromium/media/formats/mp4/parse_result.h
index b5c8cb8a739..714ebd9a864 100644
--- a/chromium/media/formats/mp4/parse_result.h
+++ b/chromium/media/formats/mp4/parse_result.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/rcheck.h b/chromium/media/formats/mp4/rcheck.h
index 0c9700f59ad..294b98312f1 100644
--- a/chromium/media/formats/mp4/rcheck.h
+++ b/chromium/media/formats/mp4/rcheck.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/sample_to_group_iterator.cc b/chromium/media/formats/mp4/sample_to_group_iterator.cc
index b59916f42da..b9570b7054f 100644
--- a/chromium/media/formats/mp4/sample_to_group_iterator.cc
+++ b/chromium/media/formats/mp4/sample_to_group_iterator.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/sample_to_group_iterator.h b/chromium/media/formats/mp4/sample_to_group_iterator.h
index 117ad981129..7a460cdb7b4 100644
--- a/chromium/media/formats/mp4/sample_to_group_iterator.h
+++ b/chromium/media/formats/mp4/sample_to_group_iterator.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/sample_to_group_iterator_unittest.cc b/chromium/media/formats/mp4/sample_to_group_iterator_unittest.cc
index c6aeef89afa..fa99954ef99 100644
--- a/chromium/media/formats/mp4/sample_to_group_iterator_unittest.cc
+++ b/chromium/media/formats/mp4/sample_to_group_iterator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/track_run_iterator.cc b/chromium/media/formats/mp4/track_run_iterator.cc
index ee3e0ab0c1f..cf374122051 100644
--- a/chromium/media/formats/mp4/track_run_iterator.cc
+++ b/chromium/media/formats/mp4/track_run_iterator.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/track_run_iterator.h b/chromium/media/formats/mp4/track_run_iterator.h
index 66f8c77f84e..6dce1cc2add 100644
--- a/chromium/media/formats/mp4/track_run_iterator.h
+++ b/chromium/media/formats/mp4/track_run_iterator.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mp4/track_run_iterator_unittest.cc b/chromium/media/formats/mp4/track_run_iterator_unittest.cc
index 7c2033a215c..6cd264673c3 100644
--- a/chromium/media/formats/mp4/track_run_iterator_unittest.cc
+++ b/chromium/media/formats/mp4/track_run_iterator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mpeg/adts_constants.cc b/chromium/media/formats/mpeg/adts_constants.cc
index db82ac81678..5714b01d59c 100644
--- a/chromium/media/formats/mpeg/adts_constants.cc
+++ b/chromium/media/formats/mpeg/adts_constants.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mpeg/adts_constants.h b/chromium/media/formats/mpeg/adts_constants.h
index 1156f1ea508..5f8600c5791 100644
--- a/chromium/media/formats/mpeg/adts_constants.h
+++ b/chromium/media/formats/mpeg/adts_constants.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mpeg/adts_stream_parser.cc b/chromium/media/formats/mpeg/adts_stream_parser.cc
index 116f536a64d..a406375fc44 100644
--- a/chromium/media/formats/mpeg/adts_stream_parser.cc
+++ b/chromium/media/formats/mpeg/adts_stream_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mpeg/adts_stream_parser.h b/chromium/media/formats/mpeg/adts_stream_parser.h
index 6b155b1102f..393b2c44f28 100644
--- a/chromium/media/formats/mpeg/adts_stream_parser.h
+++ b/chromium/media/formats/mpeg/adts_stream_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mpeg/adts_stream_parser_unittest.cc b/chromium/media/formats/mpeg/adts_stream_parser_unittest.cc
index 8b3a055441e..53df8614afd 100644
--- a/chromium/media/formats/mpeg/adts_stream_parser_unittest.cc
+++ b/chromium/media/formats/mpeg/adts_stream_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc
index 5b996764f4f..7ef761848f7 100644
--- a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc
+++ b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.h b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.h
index 1b33af97b9f..7ba9b46555c 100644
--- a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.h
+++ b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser_unittest.cc b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser_unittest.cc
index 0315436cfb4..34d077e57ae 100644
--- a/chromium/media/formats/mpeg/mpeg1_audio_stream_parser_unittest.cc
+++ b/chromium/media/formats/mpeg/mpeg1_audio_stream_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.cc b/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.cc
index e2cdd453233..237f7966666 100644
--- a/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.cc
+++ b/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -64,20 +64,20 @@ MPEGAudioStreamParserBase::~MPEGAudioStreamParserBase() = default;
void MPEGAudioStreamParserBase::Init(
InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool ignore_text_tracks,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) {
DVLOG(1) << __func__;
DCHECK_EQ(state_, UNINITIALIZED);
init_cb_ = std::move(init_cb);
- config_cb_ = config_cb;
- new_buffers_cb_ = new_buffers_cb;
- new_segment_cb_ = new_segment_cb;
- end_of_segment_cb_ = end_of_segment_cb;
+ config_cb_ = std::move(config_cb);
+ new_buffers_cb_ = std::move(new_buffers_cb);
+ new_segment_cb_ = std::move(new_segment_cb);
+ end_of_segment_cb_ = std::move(end_of_segment_cb);
media_log_ = media_log;
ChangeState(INITIALIZED);
diff --git a/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.h b/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.h
index 58e4f114c64..5fbaa09127e 100644
--- a/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.h
+++ b/chromium/media/formats/mpeg/mpeg_audio_stream_parser_base.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -40,12 +40,12 @@ class MEDIA_EXPORT MPEGAudioStreamParserBase : public StreamParser {
// StreamParser implementation.
void Init(InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool ignore_text_tracks,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) override;
void Flush() override;
bool GetGenerateTimestampsFlag() const override;
diff --git a/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.cc b/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.cc
index 1eaa2dac1f8..acff6116d02 100644
--- a/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.cc
+++ b/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -46,12 +46,12 @@ WebCodecsEncodedChunkStreamParser::~WebCodecsEncodedChunkStreamParser() =
void WebCodecsEncodedChunkStreamParser::Init(
InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool /* ignore_text_tracks */,
- const EncryptedMediaInitDataCB& /* ignored */,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB /* ignored */,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) {
DCHECK_EQ(state_, kWaitingForInit);
DCHECK(!init_cb_);
@@ -63,10 +63,10 @@ void WebCodecsEncodedChunkStreamParser::Init(
ChangeState(kWaitingForConfigEmission);
init_cb_ = std::move(init_cb);
- config_cb_ = config_cb;
- new_buffers_cb_ = new_buffers_cb;
- new_segment_cb_ = new_segment_cb;
- end_of_segment_cb_ = end_of_segment_cb;
+ config_cb_ = std::move(config_cb);
+ new_buffers_cb_ = std::move(new_buffers_cb);
+ new_segment_cb_ = std::move(new_segment_cb);
+ end_of_segment_cb_ = std::move(end_of_segment_cb);
media_log_ = media_log;
}
diff --git a/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.h b/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.h
index e939bf1251c..1ee95930ac2 100644
--- a/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.h
+++ b/chromium/media/formats/webcodecs/webcodecs_encoded_chunk_stream_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -34,12 +34,12 @@ class MEDIA_EXPORT WebCodecsEncodedChunkStreamParser : public StreamParser {
// StreamParser implementation.
void Init(InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool ignore_text_tracks /* must be true */,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) override;
void Flush() override;
bool GetGenerateTimestampsFlag() const override;
diff --git a/chromium/media/formats/webm/cluster_builder.cc b/chromium/media/formats/webm/cluster_builder.cc
index 94c85d35107..72902684783 100644
--- a/chromium/media/formats/webm/cluster_builder.cc
+++ b/chromium/media/formats/webm/cluster_builder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/cluster_builder.h b/chromium/media/formats/webm/cluster_builder.h
index c4013b08b98..ad6a0425c61 100644
--- a/chromium/media/formats/webm/cluster_builder.h
+++ b/chromium/media/formats/webm/cluster_builder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/opus_packet_builder.cc b/chromium/media/formats/webm/opus_packet_builder.cc
index 9f71100df5d..140967c1fb3 100644
--- a/chromium/media/formats/webm/opus_packet_builder.cc
+++ b/chromium/media/formats/webm/opus_packet_builder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/opus_packet_builder.h b/chromium/media/formats/webm/opus_packet_builder.h
index a83f72f6a5c..08471e9c4d6 100644
--- a/chromium/media/formats/webm/opus_packet_builder.h
+++ b/chromium/media/formats/webm/opus_packet_builder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/tracks_builder.cc b/chromium/media/formats/webm/tracks_builder.cc
index 7ba64607f1f..ad61e449744 100644
--- a/chromium/media/formats/webm/tracks_builder.cc
+++ b/chromium/media/formats/webm/tracks_builder.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/tracks_builder.h b/chromium/media/formats/webm/tracks_builder.h
index 8fe59ad8848..5e3e8aa9d47 100644
--- a/chromium/media/formats/webm/tracks_builder.h
+++ b/chromium/media/formats/webm/tracks_builder.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_audio_client.cc b/chromium/media/formats/webm/webm_audio_client.cc
index 6c49c6dc3b1..b6e32876a99 100644
--- a/chromium/media/formats/webm/webm_audio_client.cc
+++ b/chromium/media/formats/webm/webm_audio_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_audio_client.h b/chromium/media/formats/webm/webm_audio_client.h
index 6ad18496a70..36be003188b 100644
--- a/chromium/media/formats/webm/webm_audio_client.h
+++ b/chromium/media/formats/webm/webm_audio_client.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_cluster_parser.cc b/chromium/media/formats/webm/webm_cluster_parser.cc
index b8457fc5545..5481e9f6e04 100644
--- a/chromium/media/formats/webm/webm_cluster_parser.cc
+++ b/chromium/media/formats/webm/webm_cluster_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_cluster_parser.h b/chromium/media/formats/webm/webm_cluster_parser.h
index c84196a8127..8a391571693 100644
--- a/chromium/media/formats/webm/webm_cluster_parser.h
+++ b/chromium/media/formats/webm/webm_cluster_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_cluster_parser_unittest.cc b/chromium/media/formats/webm/webm_cluster_parser_unittest.cc
index ab0f2eb135c..4add1d85b01 100644
--- a/chromium/media/formats/webm/webm_cluster_parser_unittest.cc
+++ b/chromium/media/formats/webm/webm_cluster_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_colour_parser.cc b/chromium/media/formats/webm/webm_colour_parser.cc
index ee28b27cecc..46e1e214d3d 100644
--- a/chromium/media/formats/webm/webm_colour_parser.cc
+++ b/chromium/media/formats/webm/webm_colour_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_colour_parser.h b/chromium/media/formats/webm/webm_colour_parser.h
index 084daa90f60..990e1e5c1c9 100644
--- a/chromium/media/formats/webm/webm_colour_parser.h
+++ b/chromium/media/formats/webm/webm_colour_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_constants.cc b/chromium/media/formats/webm/webm_constants.cc
index d6c5536fa3e..cbb04bb5562 100644
--- a/chromium/media/formats/webm/webm_constants.cc
+++ b/chromium/media/formats/webm/webm_constants.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_constants.h b/chromium/media/formats/webm/webm_constants.h
index 91a525be3fe..cb536bb736f 100644
--- a/chromium/media/formats/webm/webm_constants.h
+++ b/chromium/media/formats/webm/webm_constants.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_content_encodings.cc b/chromium/media/formats/webm/webm_content_encodings.cc
index 7c9aacaeeac..e0a1b863b29 100644
--- a/chromium/media/formats/webm/webm_content_encodings.cc
+++ b/chromium/media/formats/webm/webm_content_encodings.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_content_encodings.h b/chromium/media/formats/webm/webm_content_encodings.h
index 58320a4209d..c8aa68e11e3 100644
--- a/chromium/media/formats/webm/webm_content_encodings.h
+++ b/chromium/media/formats/webm/webm_content_encodings.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_content_encodings_client.cc b/chromium/media/formats/webm/webm_content_encodings_client.cc
index 2aeba86b8ed..62bb279972b 100644
--- a/chromium/media/formats/webm/webm_content_encodings_client.cc
+++ b/chromium/media/formats/webm/webm_content_encodings_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_content_encodings_client.h b/chromium/media/formats/webm/webm_content_encodings_client.h
index 47e78c2c6d6..16124f4aece 100644
--- a/chromium/media/formats/webm/webm_content_encodings_client.h
+++ b/chromium/media/formats/webm/webm_content_encodings_client.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_content_encodings_client_unittest.cc b/chromium/media/formats/webm/webm_content_encodings_client_unittest.cc
index 65f81937f72..b864bf7d72a 100644
--- a/chromium/media/formats/webm/webm_content_encodings_client_unittest.cc
+++ b/chromium/media/formats/webm/webm_content_encodings_client_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_crypto_helpers.cc b/chromium/media/formats/webm/webm_crypto_helpers.cc
index 846e6b7650a..dc8e54c5004 100644
--- a/chromium/media/formats/webm/webm_crypto_helpers.cc
+++ b/chromium/media/formats/webm/webm_crypto_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_crypto_helpers.h b/chromium/media/formats/webm/webm_crypto_helpers.h
index e1bf6c48115..78f3d90df78 100644
--- a/chromium/media/formats/webm/webm_crypto_helpers.h
+++ b/chromium/media/formats/webm/webm_crypto_helpers.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_crypto_helpers_unittest.cc b/chromium/media/formats/webm/webm_crypto_helpers_unittest.cc
index 842cc0d7289..a0c06ac9dd2 100644
--- a/chromium/media/formats/webm/webm_crypto_helpers_unittest.cc
+++ b/chromium/media/formats/webm/webm_crypto_helpers_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_info_parser.cc b/chromium/media/formats/webm/webm_info_parser.cc
index 831a5850191..9f9d4f2649e 100644
--- a/chromium/media/formats/webm/webm_info_parser.cc
+++ b/chromium/media/formats/webm/webm_info_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_info_parser.h b/chromium/media/formats/webm/webm_info_parser.h
index f4d376de736..329c6e9594b 100644
--- a/chromium/media/formats/webm/webm_info_parser.h
+++ b/chromium/media/formats/webm/webm_info_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_parser.cc b/chromium/media/formats/webm/webm_parser.cc
index 80c713d06d1..089ab3548fa 100644
--- a/chromium/media/formats/webm/webm_parser.cc
+++ b/chromium/media/formats/webm/webm_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_parser.h b/chromium/media/formats/webm/webm_parser.h
index e39aa61af98..2d78e6ae082 100644
--- a/chromium/media/formats/webm/webm_parser.h
+++ b/chromium/media/formats/webm/webm_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_parser_unittest.cc b/chromium/media/formats/webm/webm_parser_unittest.cc
index 173d2749265..ae30e9040f6 100644
--- a/chromium/media/formats/webm/webm_parser_unittest.cc
+++ b/chromium/media/formats/webm/webm_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_projection_parser.cc b/chromium/media/formats/webm/webm_projection_parser.cc
index c792390805b..73e9127ffba 100644
--- a/chromium/media/formats/webm/webm_projection_parser.cc
+++ b/chromium/media/formats/webm/webm_projection_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_projection_parser.h b/chromium/media/formats/webm/webm_projection_parser.h
index afc35e5db8d..52568fee33b 100644
--- a/chromium/media/formats/webm/webm_projection_parser.h
+++ b/chromium/media/formats/webm/webm_projection_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_projection_parser_unittest.cc b/chromium/media/formats/webm/webm_projection_parser_unittest.cc
index fd56cc7fe9c..0573e722f10 100644
--- a/chromium/media/formats/webm/webm_projection_parser_unittest.cc
+++ b/chromium/media/formats/webm/webm_projection_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_stream_parser.cc b/chromium/media/formats/webm/webm_stream_parser.cc
index f6d5ed71d58..7ded5a858ae 100644
--- a/chromium/media/formats/webm/webm_stream_parser.cc
+++ b/chromium/media/formats/webm/webm_stream_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -31,12 +31,12 @@ WebMStreamParser::~WebMStreamParser() = default;
void WebMStreamParser::Init(
InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool ignore_text_tracks,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) {
DCHECK_EQ(state_, kWaitingForInit);
DCHECK(!init_cb_);
@@ -49,12 +49,12 @@ void WebMStreamParser::Init(
ChangeState(kParsingHeaders);
init_cb_ = std::move(init_cb);
- config_cb_ = config_cb;
- new_buffers_cb_ = new_buffers_cb;
+ config_cb_ = std::move(config_cb);
+ new_buffers_cb_ = std::move(new_buffers_cb);
ignore_text_tracks_ = ignore_text_tracks;
- encrypted_media_init_data_cb_ = encrypted_media_init_data_cb;
- new_segment_cb_ = new_segment_cb;
- end_of_segment_cb_ = end_of_segment_cb;
+ encrypted_media_init_data_cb_ = std::move(encrypted_media_init_data_cb);
+ new_segment_cb_ = std::move(new_segment_cb);
+ end_of_segment_cb_ = std::move(end_of_segment_cb);
media_log_ = media_log;
}
@@ -82,7 +82,7 @@ bool WebMStreamParser::Parse(const uint8_t* buf, int size) {
int result = 0;
int bytes_parsed = 0;
- const uint8_t* cur = NULL;
+ const uint8_t* cur = nullptr;
int cur_size = 0;
byte_queue_.Peek(&cur, &cur_size);
diff --git a/chromium/media/formats/webm/webm_stream_parser.h b/chromium/media/formats/webm/webm_stream_parser.h
index 29d18efcdff..fffb4c7b9a6 100644
--- a/chromium/media/formats/webm/webm_stream_parser.h
+++ b/chromium/media/formats/webm/webm_stream_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -32,12 +32,12 @@ class MEDIA_EXPORT WebMStreamParser : public StreamParser {
// StreamParser implementation.
void Init(InitCB init_cb,
- const NewConfigCB& config_cb,
- const NewBuffersCB& new_buffers_cb,
+ NewConfigCB config_cb,
+ NewBuffersCB new_buffers_cb,
bool ignore_text_tracks,
- const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
- const NewMediaSegmentCB& new_segment_cb,
- const EndMediaSegmentCB& end_of_segment_cb,
+ EncryptedMediaInitDataCB encrypted_media_init_data_cb,
+ NewMediaSegmentCB new_segment_cb,
+ EndMediaSegmentCB end_of_segment_cb,
MediaLog* media_log) override;
void Flush() override;
bool GetGenerateTimestampsFlag() const override;
diff --git a/chromium/media/formats/webm/webm_stream_parser_unittest.cc b/chromium/media/formats/webm/webm_stream_parser_unittest.cc
index bdd4850f4ba..d59eebb87af 100644
--- a/chromium/media/formats/webm/webm_stream_parser_unittest.cc
+++ b/chromium/media/formats/webm/webm_stream_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_tracks_parser.cc b/chromium/media/formats/webm/webm_tracks_parser.cc
index b8d448042eb..9fd023b220b 100644
--- a/chromium/media/formats/webm/webm_tracks_parser.cc
+++ b/chromium/media/formats/webm/webm_tracks_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_tracks_parser.h b/chromium/media/formats/webm/webm_tracks_parser.h
index 285b4dd380f..ea8e6a7e03d 100644
--- a/chromium/media/formats/webm/webm_tracks_parser.h
+++ b/chromium/media/formats/webm/webm_tracks_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_tracks_parser_unittest.cc b/chromium/media/formats/webm/webm_tracks_parser_unittest.cc
index f28a877e9a0..27dcd7c19a1 100644
--- a/chromium/media/formats/webm/webm_tracks_parser_unittest.cc
+++ b/chromium/media/formats/webm/webm_tracks_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_video_client.cc b/chromium/media/formats/webm/webm_video_client.cc
index 8e4add7a4cf..b9add5a2d4e 100644
--- a/chromium/media/formats/webm/webm_video_client.cc
+++ b/chromium/media/formats/webm/webm_video_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_video_client.h b/chromium/media/formats/webm/webm_video_client.h
index 88371cf4011..50a5b0dcb89 100644
--- a/chromium/media/formats/webm/webm_video_client.h
+++ b/chromium/media/formats/webm/webm_video_client.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_video_client_unittest.cc b/chromium/media/formats/webm/webm_video_client_unittest.cc
index 6f01d52ae00..dd91182e214 100644
--- a/chromium/media/formats/webm/webm_video_client_unittest.cc
+++ b/chromium/media/formats/webm/webm_video_client_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_webvtt_parser.cc b/chromium/media/formats/webm/webm_webvtt_parser.cc
index d84009ccc5b..8001aac9a84 100644
--- a/chromium/media/formats/webm/webm_webvtt_parser.cc
+++ b/chromium/media/formats/webm/webm_webvtt_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_webvtt_parser.h b/chromium/media/formats/webm/webm_webvtt_parser.h
index 26b7af7ef9f..a32b0967210 100644
--- a/chromium/media/formats/webm/webm_webvtt_parser.h
+++ b/chromium/media/formats/webm/webm_webvtt_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/formats/webm/webm_webvtt_parser_unittest.cc b/chromium/media/formats/webm/webm_webvtt_parser_unittest.cc
index 6d1fef7d2c4..6c8cb6427b9 100644
--- a/chromium/media/formats/webm/webm_webvtt_parser_unittest.cc
+++ b/chromium/media/formats/webm/webm_webvtt_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/audio/BUILD.gn b/chromium/media/fuchsia/audio/BUILD.gn
index d188693c420..e70e0cdb004 100644
--- a/chromium/media/fuchsia/audio/BUILD.gn
+++ b/chromium/media/fuchsia/audio/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/fuchsia/audio/fake_audio_capturer.cc b/chromium/media/fuchsia/audio/fake_audio_capturer.cc
index e73b169e51a..b4fe16a73e1 100644
--- a/chromium/media/fuchsia/audio/fake_audio_capturer.cc
+++ b/chromium/media/fuchsia/audio/fake_audio_capturer.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include "base/fuchsia/fuchsia_logging.h"
#include "base/logging.h"
#include "base/notreached.h"
+#include "base/ranges/algorithm.h"
#include "base/threading/thread_task_runner_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -43,7 +44,7 @@ void FakeAudioCapturer::SendData(base::TimeTicks timestamp, void* data) {
EXPECT_TRUE(is_active_);
// Find unused packet.
- auto it = std::find(packets_usage_.begin(), packets_usage_.end(), false);
+ auto it = base::ranges::find(packets_usage_, false);
// Currently tests don't try to send more than 2 packets and the buffer
// always will have space for at least 2 packets.
diff --git a/chromium/media/fuchsia/audio/fake_audio_capturer.h b/chromium/media/fuchsia/audio/fake_audio_capturer.h
index 004943b36d0..1ea65fbbc70 100644
--- a/chromium/media/fuchsia/audio/fake_audio_capturer.h
+++ b/chromium/media/fuchsia/audio/fake_audio_capturer.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/audio/fake_audio_consumer.cc b/chromium/media/fuchsia/audio/fake_audio_consumer.cc
index c4e59e95487..30ce5d8ee16 100644
--- a/chromium/media/fuchsia/audio/fake_audio_consumer.cc
+++ b/chromium/media/fuchsia/audio/fake_audio_consumer.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/audio/fake_audio_consumer.h b/chromium/media/fuchsia/audio/fake_audio_consumer.h
index 678e064abb9..1ab3f1fbf7a 100644
--- a/chromium/media/fuchsia/audio/fake_audio_consumer.h
+++ b/chromium/media/fuchsia/audio/fake_audio_consumer.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/audio/fake_audio_device_enumerator.cc b/chromium/media/fuchsia/audio/fake_audio_device_enumerator.cc
index f9a2c0682a5..91e325d7b9d 100644
--- a/chromium/media/fuchsia/audio/fake_audio_device_enumerator.cc
+++ b/chromium/media/fuchsia/audio/fake_audio_device_enumerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/audio/fake_audio_device_enumerator.h b/chromium/media/fuchsia/audio/fake_audio_device_enumerator.h
index b0f0ac884dc..3d513572d1e 100644
--- a/chromium/media/fuchsia/audio/fake_audio_device_enumerator.h
+++ b/chromium/media/fuchsia/audio/fake_audio_device_enumerator.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.cc b/chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.cc
index 3dbe6862e95..46f75c0d2b2 100644
--- a/chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.cc
+++ b/chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.h b/chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.h
index 6e6f3620105..3de6fee23c7 100644
--- a/chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.h
+++ b/chromium/media/fuchsia/audio/fake_audio_device_enumerator_local_component.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/camera/BUILD.gn b/chromium/media/fuchsia/camera/BUILD.gn
index 9593d941e2e..2f81915c6d1 100644
--- a/chromium/media/fuchsia/camera/BUILD.gn
+++ b/chromium/media/fuchsia/camera/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2020 The Chromium Authors. All rights reserved.
+# Copyright 2020 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/fuchsia/camera/fake_fuchsia_camera.cc b/chromium/media/fuchsia/camera/fake_fuchsia_camera.cc
index 3c1311bf5d0..c333e2338d7 100644
--- a/chromium/media/fuchsia/camera/fake_fuchsia_camera.cc
+++ b/chromium/media/fuchsia/camera/fake_fuchsia_camera.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/camera/fake_fuchsia_camera.h b/chromium/media/fuchsia/camera/fake_fuchsia_camera.h
index 4f4a32cc674..99acd5d1099 100644
--- a/chromium/media/fuchsia/camera/fake_fuchsia_camera.h
+++ b/chromium/media/fuchsia/camera/fake_fuchsia_camera.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/BUILD.gn b/chromium/media/fuchsia/cdm/BUILD.gn
index a1e134a4f99..a9dce362c56 100644
--- a/chromium/media/fuchsia/cdm/BUILD.gn
+++ b/chromium/media/fuchsia/cdm/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/client/BUILD.gn b/chromium/media/fuchsia/cdm/client/BUILD.gn
index eda464d1c08..bafc1ac450c 100644
--- a/chromium/media/fuchsia/cdm/client/BUILD.gn
+++ b/chromium/media/fuchsia/cdm/client/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.cc b/chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.cc
index 041e52b34cf..63682c7df3d 100644
--- a/chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.cc
+++ b/chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.h b/chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.h
index a9da0438180..f6a7073cfbd 100644
--- a/chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.h
+++ b/chromium/media/fuchsia/cdm/client/fuchsia_cdm_util.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.cc b/chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.cc
index 60c713e3d66..143e1b466cc 100644
--- a/chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.cc
+++ b/chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.h b/chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.h
index 7411e111358..90a888b67ec 100644
--- a/chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.h
+++ b/chromium/media/fuchsia/cdm/client/mojo_fuchsia_cdm_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_cdm.cc b/chromium/media/fuchsia/cdm/fuchsia_cdm.cc
index 51297937cd3..19771b011b1 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_cdm.cc
+++ b/chromium/media/fuchsia/cdm/fuchsia_cdm.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_cdm.h b/chromium/media/fuchsia/cdm/fuchsia_cdm.h
index b41f8e63955..9eda5e2484f 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_cdm.h
+++ b/chromium/media/fuchsia/cdm/fuchsia_cdm.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_cdm_context.h b/chromium/media/fuchsia/cdm/fuchsia_cdm_context.h
index a382acb2468..a008f1278f5 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_cdm_context.h
+++ b/chromium/media/fuchsia/cdm/fuchsia_cdm_context.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_cdm_factory.cc b/chromium/media/fuchsia/cdm/fuchsia_cdm_factory.cc
index d3b65c8f343..2c7da55f703 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_cdm_factory.cc
+++ b/chromium/media/fuchsia/cdm/fuchsia_cdm_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_cdm_factory.h b/chromium/media/fuchsia/cdm/fuchsia_cdm_factory.h
index f4b80a537fa..9e799f6d821 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_cdm_factory.h
+++ b/chromium/media/fuchsia/cdm/fuchsia_cdm_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_cdm_provider.h b/chromium/media/fuchsia/cdm/fuchsia_cdm_provider.h
index 0e0a7b5565d..8d0d783de7d 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_cdm_provider.h
+++ b/chromium/media/fuchsia/cdm/fuchsia_cdm_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_decryptor.cc b/chromium/media/fuchsia/cdm/fuchsia_decryptor.cc
index 82ee7cad742..147221f9247 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_decryptor.cc
+++ b/chromium/media/fuchsia/cdm/fuchsia_decryptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_decryptor.h b/chromium/media/fuchsia/cdm/fuchsia_decryptor.h
index 9ae0c292beb..0cf274411e5 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_decryptor.h
+++ b/chromium/media/fuchsia/cdm/fuchsia_decryptor.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.cc b/chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.cc
index 9b2e4214546..2cbf5ba8bb5 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.cc
+++ b/chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.h b/chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.h
index bba2d0cbe46..ecd9fbd1db5 100644
--- a/chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.h
+++ b/chromium/media/fuchsia/cdm/fuchsia_stream_decryptor.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/service/BUILD.gn b/chromium/media/fuchsia/cdm/service/BUILD.gn
index d281a112869..4fc3994bc69 100644
--- a/chromium/media/fuchsia/cdm/service/BUILD.gn
+++ b/chromium/media/fuchsia/cdm/service/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.cc b/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.cc
index 1bef53c4d07..f8cbc905c84 100644
--- a/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.cc
+++ b/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.h b/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.h
index 8d3769da6ed..ff773989ddc 100644
--- a/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.h
+++ b/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager_unittest.cc b/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager_unittest.cc
index a47ff82ee30..7d77d764fe9 100644
--- a/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager_unittest.cc
+++ b/chromium/media/fuchsia/cdm/service/fuchsia_cdm_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/service/mock_provision_fetcher.cc b/chromium/media/fuchsia/cdm/service/mock_provision_fetcher.cc
index e80ca85861b..4b1ba7a65c7 100644
--- a/chromium/media/fuchsia/cdm/service/mock_provision_fetcher.cc
+++ b/chromium/media/fuchsia/cdm/service/mock_provision_fetcher.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/service/mock_provision_fetcher.h b/chromium/media/fuchsia/cdm/service/mock_provision_fetcher.h
index dab6c73215e..0c0c2528420 100644
--- a/chromium/media/fuchsia/cdm/service/mock_provision_fetcher.h
+++ b/chromium/media/fuchsia/cdm/service/mock_provision_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,7 +19,7 @@ namespace testing {
class MockProvisionFetcher : public ProvisionFetcher {
public:
MockProvisionFetcher();
- ~MockProvisionFetcher();
+ ~MockProvisionFetcher() override;
// Disallow copy and assign
MockProvisionFetcher(const MockProvisionFetcher&) = delete;
diff --git a/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.cc b/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.cc
index e3608572c37..040081c5673 100644
--- a/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.cc
+++ b/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.h b/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.h
index dde363365e3..780df277af1 100644
--- a/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.h
+++ b/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl_unittest.cc b/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl_unittest.cc
index 5e269255e49..f8b396944d6 100644
--- a/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl_unittest.cc
+++ b/chromium/media/fuchsia/cdm/service/provisioning_fetcher_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/BUILD.gn b/chromium/media/fuchsia/common/BUILD.gn
index 381db174a5f..87adaab2535 100644
--- a/chromium/media/fuchsia/common/BUILD.gn
+++ b/chromium/media/fuchsia/common/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.cc b/chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.cc
index 51a74989c83..eacf62e0931 100644
--- a/chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.cc
+++ b/chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.h b/chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.h
index 8fb00306abf..e08a2d943a1 100644
--- a/chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.h
+++ b/chromium/media/fuchsia/common/decrypting_sysmem_buffer_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.cc b/chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.cc
index bb04295fbe0..858c353bb68 100644
--- a/chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.cc
+++ b/chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.h b/chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.h
index 4cd9373e781..4617f6b7a68 100644
--- a/chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.h
+++ b/chromium/media/fuchsia/common/passthrough_sysmem_buffer_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/stream_processor_helper.cc b/chromium/media/fuchsia/common/stream_processor_helper.cc
index 95449cd110c..2f661018fe2 100644
--- a/chromium/media/fuchsia/common/stream_processor_helper.cc
+++ b/chromium/media/fuchsia/common/stream_processor_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/stream_processor_helper.h b/chromium/media/fuchsia/common/stream_processor_helper.h
index 3dd81909455..bb42837400d 100644
--- a/chromium/media/fuchsia/common/stream_processor_helper.h
+++ b/chromium/media/fuchsia/common/stream_processor_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/sysmem_buffer_stream.h b/chromium/media/fuchsia/common/sysmem_buffer_stream.h
index f02ebe9d175..f3fa3a2f183 100644
--- a/chromium/media/fuchsia/common/sysmem_buffer_stream.h
+++ b/chromium/media/fuchsia/common/sysmem_buffer_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/sysmem_client.cc b/chromium/media/fuchsia/common/sysmem_client.cc
index 4c5d86dbeb1..64df663d871 100644
--- a/chromium/media/fuchsia/common/sysmem_client.cc
+++ b/chromium/media/fuchsia/common/sysmem_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/sysmem_client.h b/chromium/media/fuchsia/common/sysmem_client.h
index e8b784f6b17..a88bca7addb 100644
--- a/chromium/media/fuchsia/common/sysmem_client.h
+++ b/chromium/media/fuchsia/common/sysmem_client.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/vmo_buffer.cc b/chromium/media/fuchsia/common/vmo_buffer.cc
index 111dbfbb92f..ec7e46ae843 100644
--- a/chromium/media/fuchsia/common/vmo_buffer.cc
+++ b/chromium/media/fuchsia/common/vmo_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/vmo_buffer.h b/chromium/media/fuchsia/common/vmo_buffer.h
index 4ff6a320ed9..d09b81a6616 100644
--- a/chromium/media/fuchsia/common/vmo_buffer.h
+++ b/chromium/media/fuchsia/common/vmo_buffer.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/vmo_buffer_writer_queue.cc b/chromium/media/fuchsia/common/vmo_buffer_writer_queue.cc
index cd25d06ad30..ea1d48e760a 100644
--- a/chromium/media/fuchsia/common/vmo_buffer_writer_queue.cc
+++ b/chromium/media/fuchsia/common/vmo_buffer_writer_queue.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/common/vmo_buffer_writer_queue.h b/chromium/media/fuchsia/common/vmo_buffer_writer_queue.h
index 2969297e877..88bec233f60 100644
--- a/chromium/media/fuchsia/common/vmo_buffer_writer_queue.h
+++ b/chromium/media/fuchsia/common/vmo_buffer_writer_queue.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/mojom/BUILD.gn b/chromium/media/fuchsia/mojom/BUILD.gn
index b6f18091352..dc0073f3c61 100644
--- a/chromium/media/fuchsia/mojom/BUILD.gn
+++ b/chromium/media/fuchsia/mojom/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/fuchsia/mojom/fuchsia_media_resource_provider.mojom b/chromium/media/fuchsia/mojom/fuchsia_media_resource_provider.mojom
index 6544c66df53..089eb513e96 100644
--- a/chromium/media/fuchsia/mojom/fuchsia_media_resource_provider.mojom
+++ b/chromium/media/fuchsia/mojom/fuchsia_media_resource_provider.mojom
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,6 +17,18 @@ struct StreamProcessorRequest {
handle<platform> request;
};
+enum VideoDecoderSecureMemoryMode {
+ // Input and output buffers are not protected.
+ CLEAR,
+
+ // Input and output buffers must be allocated in protected memory.
+ SECURE,
+
+ // Input buffers are not protected. Output buffers may be allocated in
+ // protected memory.
+ CLEAR_INPUT,
+};
+
// Interface used by the renderer to connect to CDM and mediacodec resources.
// Instances are document-scoped.
interface FuchsiaMediaResourceProvider {
@@ -27,6 +39,6 @@ interface FuchsiaMediaResourceProvider {
// Create connection to fuchsia::media::StreamProcessor for the specified
// `codec`.
- CreateVideoDecoder(VideoCodec codec, bool secure_memory,
+ CreateVideoDecoder(VideoCodec codec, VideoDecoderSecureMemoryMode secure_mode,
StreamProcessorRequest stream_processor_request);
};
diff --git a/chromium/media/fuchsia/mojom/fuchsia_media_resource_provider_mojom_traits.h b/chromium/media/fuchsia/mojom/fuchsia_media_resource_provider_mojom_traits.h
index 49475a5ccb3..8a32bd8155b 100644
--- a/chromium/media/fuchsia/mojom/fuchsia_media_resource_provider_mojom_traits.h
+++ b/chromium/media/fuchsia/mojom/fuchsia_media_resource_provider_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/test_support.shard.test-cml b/chromium/media/fuchsia/test_support.shard.test-cml
index ce94cecb444..2009b09c67f 100644
--- a/chromium/media/fuchsia/test_support.shard.test-cml
+++ b/chromium/media/fuchsia/test_support.shard.test-cml
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/fuchsia/video/BUILD.gn b/chromium/media/fuchsia/video/BUILD.gn
index addeb301c99..1157f907503 100644
--- a/chromium/media/fuchsia/video/BUILD.gn
+++ b/chromium/media/fuchsia/video/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2022 The Chromium Authors. All rights reserved.
+# Copyright 2022 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -6,6 +6,7 @@ source_set("video") {
visibility = [
":unittests",
"//content/renderer/*",
+ "//third_party/blink/renderer/modules/webcodecs/*",
]
sources = [
"fuchsia_decoder_factory.cc",
diff --git a/chromium/media/fuchsia/video/fuchsia_decoder_factory.cc b/chromium/media/fuchsia/video/fuchsia_decoder_factory.cc
index 19008176627..d1804916864 100644
--- a/chromium/media/fuchsia/video/fuchsia_decoder_factory.cc
+++ b/chromium/media/fuchsia/video/fuchsia_decoder_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,10 +12,11 @@
namespace media {
FuchsiaDecoderFactory::FuchsiaDecoderFactory(
- blink::BrowserInterfaceBrokerProxy* interface_broker) {
- interface_broker->GetInterface(
- media_resource_provider_handle_.InitWithNewPipeAndPassReceiver());
-}
+ mojo::PendingRemote<media::mojom::FuchsiaMediaResourceProvider>
+ resource_provider,
+ bool allow_overlays)
+ : resource_provider_(std::move(resource_provider)),
+ allow_overlays_(allow_overlays) {}
FuchsiaDecoderFactory::~FuchsiaDecoderFactory() = default;
@@ -26,12 +27,6 @@ void FuchsiaDecoderFactory::CreateAudioDecoders(
// There are no Fuchsia-specific audio decoders.
}
-SupportedVideoDecoderConfigs
-FuchsiaDecoderFactory::GetSupportedVideoDecoderConfigsForWebRTC() {
- // TODO(crbug.com/1207991) Enable HW decoder support for WebRTC.
- return {};
-}
-
void FuchsiaDecoderFactory::CreateVideoDecoders(
scoped_refptr<base::SequencedTaskRunner> task_runner,
GpuVideoAcceleratorFactories* gpu_factories,
@@ -39,10 +34,6 @@ void FuchsiaDecoderFactory::CreateVideoDecoders(
RequestOverlayInfoCB request_overlay_info_cb,
const gfx::ColorSpace& target_color_space,
std::vector<std::unique_ptr<VideoDecoder>>* video_decoders) {
- // Bind `media_resource_provider_` the first time this function is called.
- if (media_resource_provider_handle_)
- media_resource_provider_.Bind(std::move(media_resource_provider_handle_));
-
if (gpu_factories && gpu_factories->IsGpuVideoDecodeAcceleratorEnabled()) {
auto* context_provider = gpu_factories->GetMediaContextProvider();
@@ -55,7 +46,7 @@ void FuchsiaDecoderFactory::CreateVideoDecoders(
// TODO(crbug.com/995902) Handle lost context.
if (context_provider) {
video_decoders->push_back(std::make_unique<FuchsiaVideoDecoder>(
- context_provider, media_resource_provider_.get()));
+ context_provider, resource_provider_, allow_overlays_));
} else {
LOG(ERROR) << "Can't create FuchsiaVideoDecoder due to GPU context loss.";
}
diff --git a/chromium/media/fuchsia/video/fuchsia_decoder_factory.h b/chromium/media/fuchsia/video/fuchsia_decoder_factory.h
index 5d99a3e21ab..ac3b3cb5848 100644
--- a/chromium/media/fuchsia/video/fuchsia_decoder_factory.h
+++ b/chromium/media/fuchsia/video/fuchsia_decoder_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,41 +7,37 @@
#include "media/base/decoder_factory.h"
#include "media/fuchsia/mojom/fuchsia_media_resource_provider.mojom.h"
-#include "mojo/public/cpp/bindings/remote.h"
-
-namespace blink {
-class BrowserInterfaceBrokerProxy;
-} // namespace blink
+#include "mojo/public/cpp/bindings/shared_remote.h"
namespace media {
class FuchsiaDecoderFactory final : public DecoderFactory {
public:
- explicit FuchsiaDecoderFactory(
- blink::BrowserInterfaceBrokerProxy* interface_broker);
+ FuchsiaDecoderFactory(
+ mojo::PendingRemote<media::mojom::FuchsiaMediaResourceProvider>
+ resource_provider,
+ bool allow_overlays);
~FuchsiaDecoderFactory() final;
// DecoderFactory implementation.
void CreateAudioDecoders(
scoped_refptr<base::SequencedTaskRunner> task_runner,
MediaLog* media_log,
- std::vector<std::unique_ptr<AudioDecoder>>* audio_decoders) final;
- SupportedVideoDecoderConfigs GetSupportedVideoDecoderConfigsForWebRTC() final;
+ std::vector<std::unique_ptr<AudioDecoder>>* audio_decoders) override;
void CreateVideoDecoders(
scoped_refptr<base::SequencedTaskRunner> task_runner,
GpuVideoAcceleratorFactories* gpu_factories,
MediaLog* media_log,
RequestOverlayInfoCB request_overlay_info_cb,
const gfx::ColorSpace& target_color_space,
- std::vector<std::unique_ptr<VideoDecoder>>* video_decoders) final;
+ std::vector<std::unique_ptr<VideoDecoder>>* video_decoders) override;
private:
- mojo::PendingRemote<media::mojom::FuchsiaMediaResourceProvider>
- media_resource_provider_handle_;
- mojo::Remote<media::mojom::FuchsiaMediaResourceProvider>
- media_resource_provider_;
+ const mojo::SharedRemote<media::mojom::FuchsiaMediaResourceProvider>
+ resource_provider_;
+ const bool allow_overlays_;
};
} // namespace media
-#endif // MEDIA_FUCHSIA_VIDEO_FUCHSIA_DECODER_FACTORY_H_ \ No newline at end of file
+#endif // MEDIA_FUCHSIA_VIDEO_FUCHSIA_DECODER_FACTORY_H_
diff --git a/chromium/media/fuchsia/video/fuchsia_video_decoder.cc b/chromium/media/fuchsia/video/fuchsia_video_decoder.cc
index af4f19f6914..de7364631a3 100644
--- a/chromium/media/fuchsia/video/fuchsia_video_decoder.cc
+++ b/chromium/media/fuchsia/video/fuchsia_video_decoder.cc
@@ -1,22 +1,22 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/fuchsia/video/fuchsia_video_decoder.h"
+#include <fuchsia/sysmem/cpp/fidl.h>
#include <vulkan/vulkan.h>
#include "base/bind.h"
#include "base/callback.h"
-#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/fuchsia/fuchsia_logging.h"
-#include "base/fuchsia/process_context.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/process/process_metrics.h"
+#include "base/strings/string_number_conversions.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "components/viz/common/gpu/raster_context_provider.h"
#include "gpu/command_buffer/client/context_support.h"
@@ -27,16 +27,14 @@
#include "media/base/cdm_context.h"
#include "media/base/media_switches.h"
#include "media/base/video_aspect_ratio.h"
+#include "media/base/video_color_space.h"
#include "media/base/video_frame.h"
-#include "media/base/video_util.h"
#include "media/fuchsia/cdm/fuchsia_cdm_context.h"
-#include "media/fuchsia/cdm/fuchsia_decryptor.h"
#include "media/fuchsia/cdm/fuchsia_stream_decryptor.h"
#include "media/fuchsia/common/decrypting_sysmem_buffer_stream.h"
#include "media/fuchsia/common/passthrough_sysmem_buffer_stream.h"
#include "media/fuchsia/common/stream_processor_helper.h"
#include "media/fuchsia/mojom/fuchsia_media_resource_provider.mojom.h"
-#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/client_native_pixmap_factory.h"
#include "ui/ozone/public/client_native_pixmap_factory_ozone.h"
@@ -69,6 +67,42 @@ constexpr size_t kNumInputBuffers = 2;
// codecs, not just H264).
constexpr size_t kInputBufferSize = 1920 * 1080 * 3 / 2 / 2 + 128 * 1024;
+const fuchsia::sysmem::PixelFormatType kSupportedPixelFormats[] = {
+ fuchsia::sysmem::PixelFormatType::NV12,
+ fuchsia::sysmem::PixelFormatType::I420,
+ fuchsia::sysmem::PixelFormatType::YV12,
+};
+const fuchsia::sysmem::ColorSpaceType kSupportedColorSpaces[] = {
+ fuchsia::sysmem::ColorSpaceType::REC601_NTSC,
+ fuchsia::sysmem::ColorSpaceType::REC601_NTSC_FULL_RANGE,
+ fuchsia::sysmem::ColorSpaceType::REC601_PAL,
+ fuchsia::sysmem::ColorSpaceType::REC601_PAL_FULL_RANGE,
+ fuchsia::sysmem::ColorSpaceType::REC709,
+};
+
+absl::optional<gfx::Size> ParseMinBufferSize() {
+ std::string min_buffer_size_arg =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kMinVideoDecoderOutputBufferSize);
+ if (min_buffer_size_arg.empty())
+ return absl::nullopt;
+ size_t width;
+ size_t height;
+ if (sscanf(min_buffer_size_arg.c_str(), "%zux%zu" SCNu32, &width, &height) !=
+ 2) {
+ LOG(WARNING) << "Invalid value for --"
+ << switches::kMinVideoDecoderOutputBufferSize << ": '"
+ << min_buffer_size_arg << "'";
+ return absl::nullopt;
+ }
+ return gfx::Size(width, height);
+}
+
+absl::optional<gfx::Size> GetMinBufferSize() {
+ static absl::optional<gfx::Size> value = ParseMinBufferSize();
+ return value;
+}
+
} // namespace
// Helper used to hold mailboxes for the output textures. OutputMailbox may
@@ -77,17 +111,20 @@ class FuchsiaVideoDecoder::OutputMailbox {
public:
OutputMailbox(
scoped_refptr<viz::RasterContextProvider> raster_context_provider,
- std::unique_ptr<gfx::GpuMemoryBuffer> gmb)
+ std::unique_ptr<gfx::GpuMemoryBuffer> gmb,
+ const gfx::ColorSpace& color_space)
: raster_context_provider_(raster_context_provider),
size_(gmb->GetSize()),
weak_factory_(this) {
- uint32_t usage = gpu::SHARED_IMAGE_USAGE_DISPLAY |
+ uint32_t usage = gpu::SHARED_IMAGE_USAGE_DISPLAY_READ |
gpu::SHARED_IMAGE_USAGE_SCANOUT |
gpu::SHARED_IMAGE_USAGE_VIDEO_DECODE;
mailbox_ =
raster_context_provider_->SharedImageInterface()->CreateSharedImage(
- gmb.get(), nullptr, gfx::ColorSpace(), kTopLeft_GrSurfaceOrigin,
+ gmb.get(), nullptr, color_space, kTopLeft_GrSurfaceOrigin,
kPremul_SkAlphaType, usage);
+ create_sync_token_ = raster_context_provider_->SharedImageInterface()
+ ->GenVerifiedSyncToken();
}
OutputMailbox(const OutputMailbox&) = delete;
@@ -95,7 +132,7 @@ class FuchsiaVideoDecoder::OutputMailbox {
~OutputMailbox() {
raster_context_provider_->SharedImageInterface()->DestroySharedImage(
- sync_token_, mailbox_);
+ release_sync_token_, mailbox_);
}
const gpu::Mailbox& mailbox() { return mailbox_; }
@@ -116,8 +153,7 @@ class FuchsiaVideoDecoder::OutputMailbox {
gpu::MailboxHolder mailboxes[VideoFrame::kMaxPlanes];
mailboxes[0].mailbox = mailbox_;
- mailboxes[0].sync_token = raster_context_provider_->SharedImageInterface()
- ->GenUnverifiedSyncToken();
+ mailboxes[0].sync_token = create_sync_token_;
auto frame = VideoFrame::WrapNativeTextures(
pixel_format, mailboxes,
@@ -147,7 +183,7 @@ class FuchsiaVideoDecoder::OutputMailbox {
void OnFrameDestroyed(const gpu::SyncToken& sync_token) {
DCHECK(is_used_);
is_used_ = false;
- sync_token_ = sync_token;
+ release_sync_token_ = sync_token;
if (!reuse_callback_) {
// If the mailbox cannot be reused then we can just delete it.
@@ -156,13 +192,13 @@ class FuchsiaVideoDecoder::OutputMailbox {
}
raster_context_provider_->ContextSupport()->SignalSyncToken(
- sync_token_,
+ release_sync_token_,
BindToCurrentLoop(base::BindOnce(&OutputMailbox::OnSyncTokenSignaled,
weak_factory_.GetWeakPtr())));
}
void OnSyncTokenSignaled() {
- sync_token_.Clear();
+ release_sync_token_.Clear();
std::move(reuse_callback_).Run();
}
@@ -171,7 +207,9 @@ class FuchsiaVideoDecoder::OutputMailbox {
gfx::Size size_;
gpu::Mailbox mailbox_;
- gpu::SyncToken sync_token_;
+
+ gpu::SyncToken create_sync_token_;
+ gpu::SyncToken release_sync_token_;
// Set to true when the mailbox is referenced by a video frame.
bool is_used_ = false;
@@ -183,16 +221,19 @@ class FuchsiaVideoDecoder::OutputMailbox {
FuchsiaVideoDecoder::FuchsiaVideoDecoder(
scoped_refptr<viz::RasterContextProvider> raster_context_provider,
- media::mojom::FuchsiaMediaResourceProvider* media_resource_provider)
+ const mojo::SharedRemote<media::mojom::FuchsiaMediaResourceProvider>&
+ media_resource_provider,
+ bool allow_overlays)
: raster_context_provider_(raster_context_provider),
media_resource_provider_(media_resource_provider),
- use_overlays_for_video_(base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseOverlaysForVideo)),
+ use_overlays_for_video_(allow_overlays &&
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUseOverlaysForVideo)),
sysmem_allocator_("CrFuchsiaVideoDecoder"),
client_native_pixmap_factory_(
ui::CreateClientNativePixmapFactoryOzone()) {
+ DETACH_FROM_SEQUENCE(sequence_checker_);
DCHECK(raster_context_provider_);
- weak_this_ = weak_factory_.GetWeakPtr();
}
FuchsiaVideoDecoder::~FuchsiaVideoDecoder() {
@@ -223,8 +264,8 @@ void FuchsiaVideoDecoder::Initialize(const VideoDecoderConfig& config,
InitCB init_cb,
const OutputCB& output_cb,
const WaitingCB& waiting_cb) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(output_cb);
- DCHECK(waiting_cb);
DCHECK(decode_callbacks_.empty());
auto done_callback = BindToCurrentLoop(std::move(init_cb));
@@ -236,7 +277,6 @@ void FuchsiaVideoDecoder::Initialize(const VideoDecoderConfig& config,
output_cb_ = output_cb;
waiting_cb_ = waiting_cb;
- container_aspect_ratio_ = config.aspect_ratio();
// Keep decoder and decryptor if the configuration hasn't changed.
if (decoder_ && current_config_.codec() == config.codec() &&
@@ -249,14 +289,32 @@ void FuchsiaVideoDecoder::Initialize(const VideoDecoderConfig& config,
decoder_.reset();
// Initialize the stream.
- bool secure_mode = false;
+ bool secure_input = false;
DecoderStatus status = InitializeSysmemBufferStream(
- config.is_encrypted(), cdm_context, &secure_mode);
+ config.is_encrypted(), cdm_context, &secure_input);
+
if (!status.is_ok()) {
std::move(done_callback).Run(status);
return;
}
+ media::mojom::VideoDecoderSecureMemoryMode secure_mode =
+ media::mojom::VideoDecoderSecureMemoryMode::CLEAR_INPUT;
+ if (secure_input) {
+ if (!use_overlays_for_video_) {
+ DLOG(ERROR) << "Protected content can be rendered only using overlays.";
+ std::move(done_callback)
+ .Run(DecoderStatus(DecoderStatus::Codes::kUnsupportedConfig,
+ FROM_HERE));
+ return;
+ }
+ secure_mode = media::mojom::VideoDecoderSecureMemoryMode::SECURE;
+ } else if (!use_overlays_for_video_) {
+ // Protected output buffers can be rendered only using overlays. If overlays
+ // are not allowed then the output buffers cannot be protected.
+ secure_mode = media::mojom::VideoDecoderSecureMemoryMode::CLEAR;
+ }
+
// Reset output buffers since we won't be able to re-use them.
ReleaseOutputBuffers();
@@ -267,11 +325,20 @@ void FuchsiaVideoDecoder::Initialize(const VideoDecoderConfig& config,
current_config_ = config;
+ // Default to REC601 when the colorspace is not specified in the container.
+ // TODO(crbug.com/1364366): HW decoders currently don't provide accurate
+ // color space information to sysmem. Once that issue is resolved, we'll
+ // need to update this logic accordingly.
+ if (!current_config_.color_space_info().IsSpecified())
+ current_config_.set_color_space_info(VideoColorSpace::REC601());
+
std::move(done_callback).Run(DecoderStatus::Codes::kOk);
}
void FuchsiaVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
DecodeCB decode_cb) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
if (!decoder_) {
// Post the callback to the current sequence as DecoderStream doesn't expect
// Decode() to complete synchronously.
@@ -287,6 +354,8 @@ void FuchsiaVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
}
void FuchsiaVideoDecoder::Reset(base::OnceClosure closure) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
DropInputQueue(DecoderStatus::Codes::kAborted);
base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE,
std::move(closure));
@@ -297,10 +366,12 @@ bool FuchsiaVideoDecoder::NeedsBitstreamConversion() const {
}
bool FuchsiaVideoDecoder::CanReadWithoutStalling() const {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return num_used_output_buffers_ < kMaxUsedOutputBuffers;
}
int FuchsiaVideoDecoder::GetMaxDecodeRequests() const {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return max_decoder_requests_;
}
@@ -317,6 +388,9 @@ DecoderStatus FuchsiaVideoDecoder::InitializeSysmemBufferStream(
max_decoder_requests_ = kNumInputBuffers + 1;
if (is_encrypted) {
+ // `waiting_cb_` is required for encrypted streams.
+ DCHECK(waiting_cb_);
+
// Caller makes sure |cdm_context| is available if the stream is encrypted.
if (!cdm_context) {
DLOG(ERROR) << "No cdm context for encrypted stream.";
@@ -352,12 +426,14 @@ DecoderStatus FuchsiaVideoDecoder::InitializeSysmemBufferStream(
void FuchsiaVideoDecoder::OnSysmemBufferStreamBufferCollectionToken(
fuchsia::sysmem::BufferCollectionTokenPtr token) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(decoder_);
decoder_->SetInputBufferCollectionToken(std::move(token));
}
void FuchsiaVideoDecoder::OnSysmemBufferStreamOutputPacket(
StreamProcessorHelper::IoPacket packet) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
packet.AddOnDestroyClosure(
base::BindOnce(&FuchsiaVideoDecoder::CallNextDecodeCallback,
decode_callbacks_weak_factory_.GetWeakPtr()));
@@ -365,19 +441,24 @@ void FuchsiaVideoDecoder::OnSysmemBufferStreamOutputPacket(
}
void FuchsiaVideoDecoder::OnSysmemBufferStreamEndOfStream() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
decoder_->ProcessEos();
}
void FuchsiaVideoDecoder::OnSysmemBufferStreamError() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
OnError();
}
void FuchsiaVideoDecoder::OnSysmemBufferStreamNoKey() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
waiting_cb_.Run(WaitingReason::kNoDecryptionKey);
}
void FuchsiaVideoDecoder::OnStreamProcessorAllocateOutputBuffers(
const fuchsia::media::StreamBufferConstraints& output_constraints) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
ReleaseOutputBuffers();
output_buffer_collection_ = sysmem_allocator_.AllocateNewCollection();
@@ -396,11 +477,48 @@ void FuchsiaVideoDecoder::OnStreamProcessorAllocateOutputBuffers(
buffer_constraints.min_buffer_count_for_camping = kOutputBuffersForCamping;
buffer_constraints.min_buffer_count_for_shared_slack =
kMaxUsedOutputBuffers - kOutputBuffersForCamping;
+
+ buffer_constraints.image_format_constraints_count =
+ std::size(kSupportedPixelFormats);
+ for (size_t pixel_format_index = 0;
+ pixel_format_index < std::size(kSupportedPixelFormats);
+ ++pixel_format_index) {
+ auto& image_format_constraints =
+ buffer_constraints.image_format_constraints[pixel_format_index];
+ image_format_constraints.pixel_format.type =
+ kSupportedPixelFormats[pixel_format_index];
+ image_format_constraints.pixel_format.has_format_modifier = true;
+ image_format_constraints.pixel_format.format_modifier.value =
+ fuchsia::sysmem::FORMAT_MODIFIER_LINEAR;
+
+ image_format_constraints.color_spaces_count =
+ std::size(kSupportedColorSpaces);
+ for (size_t i = 0; i < std::size(kSupportedColorSpaces); ++i) {
+ image_format_constraints.color_space[i].type = kSupportedColorSpaces[i];
+ }
+ }
+
+ auto min_buffer_size = GetMinBufferSize();
+ if (min_buffer_size) {
+ for (size_t pixel_format_index = 0;
+ pixel_format_index < std::size(kSupportedPixelFormats);
+ ++pixel_format_index) {
+ auto& image_format_constraints =
+ buffer_constraints.image_format_constraints[pixel_format_index];
+ image_format_constraints.required_max_coded_width =
+ min_buffer_size->width();
+ image_format_constraints.required_max_coded_height =
+ min_buffer_size->height();
+ }
+ }
+
output_buffer_collection_->Initialize(std::move(buffer_constraints),
"ChromiumVideoDecoderOutput");
}
void FuchsiaVideoDecoder::OnStreamProcessorEndOfStream() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
// Decode() is not supposed to be called again after EOF.
DCHECK_EQ(decode_callbacks_.size(), 1U);
CallNextDecodeCallback();
@@ -408,6 +526,8 @@ void FuchsiaVideoDecoder::OnStreamProcessorEndOfStream() {
void FuchsiaVideoDecoder::OnStreamProcessorOutputFormat(
fuchsia::media::StreamOutputFormat output_format) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
auto* format = output_format.mutable_format_details();
if (!format->has_domain() || !format->domain().is_video() ||
!format->domain().video().is_uncompressed()) {
@@ -421,6 +541,8 @@ void FuchsiaVideoDecoder::OnStreamProcessorOutputFormat(
void FuchsiaVideoDecoder::OnStreamProcessorOutputPacket(
StreamProcessorHelper::IoPacket output_packet) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
fuchsia::sysmem::PixelFormatType sysmem_pixel_format =
output_format_.image_format.pixel_format.type;
@@ -475,7 +597,8 @@ void FuchsiaVideoDecoder::OnStreamProcessorOutputPacket(
gpu::GpuMemoryBufferImpl::DestructionCallback());
output_mailboxes_[buffer_index] =
- new OutputMailbox(raster_context_provider_, std::move(gmb));
+ new OutputMailbox(raster_context_provider_, std::move(gmb),
+ current_config_.color_space_info().ToGfxColorSpace());
} else {
raster_context_provider_->SharedImageInterface()->UpdateSharedImage(
gpu::SyncToken(), output_mailboxes_[buffer_index]->mailbox());
@@ -484,7 +607,7 @@ void FuchsiaVideoDecoder::OnStreamProcessorOutputPacket(
auto display_rect = gfx::Rect(output_format_.primary_display_width_pixels,
output_format_.primary_display_height_pixels);
- VideoAspectRatio aspect_ratio = container_aspect_ratio_;
+ VideoAspectRatio aspect_ratio = current_config_.aspect_ratio();
if (!aspect_ratio.IsValid() && output_format_.has_pixel_aspect_ratio) {
aspect_ratio =
VideoAspectRatio::PAR(output_format_.pixel_aspect_ratio_width,
@@ -510,6 +633,12 @@ void FuchsiaVideoDecoder::OnStreamProcessorOutputPacket(
base::BindOnce(&FuchsiaVideoDecoder::ReleaseOutputPacket,
base::Unretained(this), std::move(output_packet)));
+ VkSamplerYcbcrModelConversion ycbcr_conversion =
+ (current_config_.color_space_info().matrix ==
+ VideoColorSpace::MatrixID::BT709)
+ ? VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709
+ : VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601;
+
// Currently sysmem doesn't specify location of chroma samples relative to
// luma (see fxbug.dev/13677). Assume they are cosited with luma. YCbCr info
// here must match the values passed for the same buffer in
@@ -517,8 +646,7 @@ void FuchsiaVideoDecoder::OnStreamProcessorOutputPacket(
// ui/ozone/platform/scenic/sysmem_buffer_collection.cc). |format_features|
// are resolved later in the GPU process before this info is passed to Skia.
frame->set_ycbcr_info(gpu::VulkanYCbCrInfo(
- vk_format, /*external_format=*/0,
- VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709,
+ vk_format, /*external_format=*/0, ycbcr_conversion,
VK_SAMPLER_YCBCR_RANGE_ITU_NARROW, VK_CHROMA_LOCATION_COSITED_EVEN,
VK_CHROMA_LOCATION_COSITED_EVEN, /*format_features=*/0));
@@ -534,12 +662,15 @@ void FuchsiaVideoDecoder::OnStreamProcessorOutputPacket(
}
void FuchsiaVideoDecoder::OnStreamProcessorNoKey() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
// Decoder is not expected to produce NoKey() error.
DLOG(ERROR) << "Video decoder failed with DECRYPTOR_NO_KEY expectedly";
OnError();
}
void FuchsiaVideoDecoder::OnStreamProcessorError() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
OnError();
}
@@ -565,12 +696,11 @@ bool FuchsiaVideoDecoder::DropInputQueue(DecoderStatus status) {
sysmem_buffer_stream_->Reset();
}
- auto weak_this = weak_this_;
+ // Get a fresh WeakPtr, to use to check whether any DecodeCB deletes |this|.
+ auto weak_this = decode_callbacks_weak_factory_.GetWeakPtr();
for (auto& cb : decode_callbacks_) {
std::move(cb).Run(status);
-
- // DecodeCB may destroy |this|.
if (!weak_this)
return false;
}
diff --git a/chromium/media/fuchsia/video/fuchsia_video_decoder.h b/chromium/media/fuchsia/video/fuchsia_video_decoder.h
index 22a115f339c..3664e24c13a 100644
--- a/chromium/media/fuchsia/video/fuchsia_video_decoder.h
+++ b/chromium/media/fuchsia/video/fuchsia_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,6 +17,8 @@
#include "media/base/video_decoder_config.h"
#include "media/fuchsia/common/sysmem_buffer_stream.h"
#include "media/fuchsia/common/sysmem_client.h"
+#include "media/fuchsia/mojom/fuchsia_media_resource_provider.mojom.h"
+#include "mojo/public/cpp/bindings/shared_remote.h"
#include "ui/gfx/native_pixmap_handle.h"
namespace gfx {
@@ -29,17 +31,15 @@ class RasterContextProvider;
namespace media {
-namespace mojom {
-class FuchsiaMediaResourceProvider;
-} // namespace mojom
-
class MEDIA_EXPORT FuchsiaVideoDecoder : public VideoDecoder,
public SysmemBufferStream::Sink,
public StreamProcessorHelper::Client {
public:
FuchsiaVideoDecoder(
scoped_refptr<viz::RasterContextProvider> raster_context_provider,
- media::mojom::FuchsiaMediaResourceProvider* media_resource_provider);
+ const mojo::SharedRemote<media::mojom::FuchsiaMediaResourceProvider>&
+ media_resource_provider,
+ bool allow_overlays);
~FuchsiaVideoDecoder() override;
FuchsiaVideoDecoder(const FuchsiaVideoDecoder&) = delete;
@@ -113,16 +113,13 @@ class MEDIA_EXPORT FuchsiaVideoDecoder : public VideoDecoder,
void ReleaseOutputBuffers();
const scoped_refptr<viz::RasterContextProvider> raster_context_provider_;
- media::mojom::FuchsiaMediaResourceProvider* media_resource_provider_;
-
+ const mojo::SharedRemote<media::mojom::FuchsiaMediaResourceProvider>
+ media_resource_provider_;
const bool use_overlays_for_video_;
OutputCB output_cb_;
WaitingCB waiting_cb_;
- // Aspect ratio specified in container.
- VideoAspectRatio container_aspect_ratio_;
-
std::unique_ptr<SysmemBufferStream> sysmem_buffer_stream_;
// Initialized in InitializeSysmemBufferStream()
@@ -149,8 +146,7 @@ class MEDIA_EXPORT FuchsiaVideoDecoder : public VideoDecoder,
size_t num_used_output_buffers_ = 0;
- base::WeakPtr<FuchsiaVideoDecoder> weak_this_;
- base::WeakPtrFactory<FuchsiaVideoDecoder> weak_factory_{this};
+ SEQUENCE_CHECKER(sequence_checker_);
// WeakPtrFactory used to schedule CallNextDecodeCallbacks(). These pointers
// are discarded in DropInputQueue() in order to avoid calling
diff --git a/chromium/media/fuchsia/video/fuchsia_video_decoder_unittest.cc b/chromium/media/fuchsia/video/fuchsia_video_decoder_unittest.cc
index fbc6f3dbbbb..792d53831a6 100644
--- a/chromium/media/fuchsia/video/fuchsia_video_decoder_unittest.cc
+++ b/chromium/media/fuchsia/video/fuchsia_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -26,6 +26,7 @@
#include "media/base/video_decoder.h"
#include "media/base/video_frame.h"
#include "media/fuchsia/mojom/fuchsia_media_resource_provider.mojom.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/gpu_fence.h"
#include "ui/gfx/gpu_memory_buffer.h"
@@ -178,18 +179,22 @@ class TestSharedImageInterface : public gpu::SharedImageInterface {
EXPECT_FALSE(collection);
collection = std::make_unique<TestBufferCollection>(std::move(token));
}
+
void ReleaseSysmemBufferCollection(
gfx::SysmemBufferCollectionId id) override {
EXPECT_EQ(sysmem_buffer_collections_.erase(id), 1U);
}
gpu::SyncToken GenVerifiedSyncToken() override {
- ADD_FAILURE();
- return gpu::SyncToken();
+ gpu::SyncToken token(gpu::CommandBufferNamespace::GPU_IO,
+ gpu::CommandBufferId(33), 1);
+ token.SetVerifyFlush();
+ return token;
}
+
gpu::SyncToken GenUnverifiedSyncToken() override {
- return gpu::SyncToken(gpu::CommandBufferNamespace::GPU_IO,
- gpu::CommandBufferId(33), 1);
+ ADD_FAILURE();
+ return gpu::SyncToken();
}
void WaitSyncToken(const gpu::SyncToken& sync_token) override {
@@ -300,10 +305,11 @@ class TestFuchsiaMediaResourceProvider
}
void CreateVideoDecoder(
media::VideoCodec codec,
- bool secure_memory,
+ media::mojom::VideoDecoderSecureMemoryMode secure_mode,
fidl::InterfaceRequest<fuchsia::media::StreamProcessor>
stream_processor_request) final {
- EXPECT_FALSE(secure_memory);
+ EXPECT_TRUE(secure_mode ==
+ media::mojom::VideoDecoderSecureMemoryMode::CLEAR);
fuchsia::mediacodec::CreateDecoder_Params decoder_params;
decoder_params.mutable_input_details()->set_format_details_version_ordinal(
@@ -332,6 +338,8 @@ class TestFuchsiaMediaResourceProvider
decoder_factory->CreateDecoder(std::move(decoder_params),
std::move(stream_processor_request));
}
+
+ mojo::Receiver<media::mojom::FuchsiaMediaResourceProvider> receiver_{this};
};
} // namespace
@@ -343,7 +351,10 @@ class FuchsiaVideoDecoderTest : public testing::Test {
base::MakeRefCounted<TestRasterContextProvider>()),
decoder_(std::make_unique<FuchsiaVideoDecoder>(
raster_context_provider_.get(),
- &test_media_resource_provider_)) {}
+ mojo::SharedRemote<media::mojom::FuchsiaMediaResourceProvider>(
+ test_media_resource_provider_.receiver_
+ .BindNewPipeAndPassRemote()),
+ /*allow_overlays=*/false)) {}
FuchsiaVideoDecoderTest(const FuchsiaVideoDecoderTest&) = delete;
FuchsiaVideoDecoderTest& operator=(const FuchsiaVideoDecoderTest&) = delete;
diff --git a/chromium/media/gpu/BUILD.gn b/chromium/media/gpu/BUILD.gn
index 622adc0cdc6..0ee3b898918 100644
--- a/chromium/media/gpu/BUILD.gn
+++ b/chromium/media/gpu/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -56,6 +56,7 @@ component("gpu") {
"//media/gpu/vaapi/*",
"//media/mojo/*",
"//remoting/codec:encoder",
+ "//third_party/blink/renderer/modules:unit_tests",
# TODO(crbug.com/1184041): Remove //remoting/host:common when the usage is removed.
"//remoting/host:common",
diff --git a/chromium/media/gpu/OWNERS b/chromium/media/gpu/OWNERS
index 07a34f0d708..2530348a614 100644
--- a/chromium/media/gpu/OWNERS
+++ b/chromium/media/gpu/OWNERS
@@ -10,4 +10,3 @@ hiroh@chromium.org
jcliang@chromium.org
jkardatzke@chromium.org
mcasas@chromium.org
-posciak@chromium.org
diff --git a/chromium/media/gpu/accelerated_video_decoder.h b/chromium/media/gpu/accelerated_video_decoder.h
index 5cf9e48d09c..97b2a302925 100644
--- a/chromium/media/gpu/accelerated_video_decoder.h
+++ b/chromium/media/gpu/accelerated_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/android_video_encode_accelerator.cc b/chromium/media/gpu/android/android_video_encode_accelerator.cc
index 7a1890b67ba..44058854472 100644
--- a/chromium/media/gpu/android/android_video_encode_accelerator.cc
+++ b/chromium/media/gpu/android/android_video_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/android_video_encode_accelerator.h b/chromium/media/gpu/android/android_video_encode_accelerator.h
index e4166931641..c9ed49068d2 100644
--- a/chromium/media/gpu/android/android_video_encode_accelerator.h
+++ b/chromium/media/gpu/android/android_video_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/android_video_surface_chooser.cc b/chromium/media/gpu/android/android_video_surface_chooser.cc
index dc038a884aa..c5f4a3d0e82 100644
--- a/chromium/media/gpu/android/android_video_surface_chooser.cc
+++ b/chromium/media/gpu/android/android_video_surface_chooser.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/android_video_surface_chooser.h b/chromium/media/gpu/android/android_video_surface_chooser.h
index 0d108a16f40..acae9bf56e7 100644
--- a/chromium/media/gpu/android/android_video_surface_chooser.h
+++ b/chromium/media/gpu/android/android_video_surface_chooser.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/android_video_surface_chooser_impl.cc b/chromium/media/gpu/android/android_video_surface_chooser_impl.cc
index 110fad5bbc5..02e67c13881 100644
--- a/chromium/media/gpu/android/android_video_surface_chooser_impl.cc
+++ b/chromium/media/gpu/android/android_video_surface_chooser_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/android_video_surface_chooser_impl.h b/chromium/media/gpu/android/android_video_surface_chooser_impl.h
index ab66ff01a82..0086bc0205e 100644
--- a/chromium/media/gpu/android/android_video_surface_chooser_impl.h
+++ b/chromium/media/gpu/android/android_video_surface_chooser_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/android_video_surface_chooser_impl_unittest.cc b/chromium/media/gpu/android/android_video_surface_chooser_impl_unittest.cc
index 47d814a3d42..c479aaf3527 100644
--- a/chromium/media/gpu/android/android_video_surface_chooser_impl_unittest.cc
+++ b/chromium/media/gpu/android/android_video_surface_chooser_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_allocator.cc b/chromium/media/gpu/android/codec_allocator.cc
index 1b2afd194b8..07d4477859d 100644
--- a/chromium/media/gpu/android/codec_allocator.cc
+++ b/chromium/media/gpu/android/codec_allocator.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,12 +6,12 @@
#include <stddef.h>
-#include <algorithm>
#include <memory>
#include "base/callback_helpers.h"
#include "base/logging.h"
#include "base/no_destructor.h"
+#include "base/ranges/algorithm.h"
#include "base/task/task_runner_util.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
@@ -215,8 +215,8 @@ base::SequencedTaskRunner* CodecAllocator::SelectCodecTaskRunner() {
void CodecAllocator::CompletePendingOperation(base::TimeTicks start_time) {
// Note: This intentionally only erases the first instance, since there may be
// multiple instances of the same value.
- pending_operations_.erase(std::find(pending_operations_.begin(),
- pending_operations_.end(), start_time));
+ pending_operations_.erase(
+ base::ranges::find(pending_operations_, start_time));
}
} // namespace media
diff --git a/chromium/media/gpu/android/codec_allocator.h b/chromium/media/gpu/android/codec_allocator.h
index 1043198ca45..be14c88e6ba 100644
--- a/chromium/media/gpu/android/codec_allocator.h
+++ b/chromium/media/gpu/android/codec_allocator.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_allocator_unittest.cc b/chromium/media/gpu/android/codec_allocator_unittest.cc
index 12db243408b..60285e80e06 100644
--- a/chromium/media/gpu/android/codec_allocator_unittest.cc
+++ b/chromium/media/gpu/android/codec_allocator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_buffer_wait_coordinator.cc b/chromium/media/gpu/android/codec_buffer_wait_coordinator.cc
index 5a497a9d758..458bbc2356c 100644
--- a/chromium/media/gpu/android/codec_buffer_wait_coordinator.cc
+++ b/chromium/media/gpu/android/codec_buffer_wait_coordinator.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_buffer_wait_coordinator.h b/chromium/media/gpu/android/codec_buffer_wait_coordinator.h
index 8c621a990d1..c45890c1fe7 100644
--- a/chromium/media/gpu/android/codec_buffer_wait_coordinator.h
+++ b/chromium/media/gpu/android/codec_buffer_wait_coordinator.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_image.cc b/chromium/media/gpu/android/codec_image.cc
index 7bb06e065cc..bf8d3d73cd5 100644
--- a/chromium/media/gpu/android/codec_image.cc
+++ b/chromium/media/gpu/android/codec_image.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include "base/android/scoped_hardware_buffer_fence_sync.h"
#include "base/callback_helpers.h"
+#include "base/debug/dump_without_crashing.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/config/gpu_finch_features.h"
@@ -117,6 +118,18 @@ bool CodecImage::CopyTexImage(unsigned target) {
return false;
}
+ // Our hypothesis is that in actuality the rendering to the front buffer and
+ // binding of the image, if possible, have always already occurred by the time
+ // that this method is called. The below DumpWithoutCrashing() call serves to
+ // verify whether this hypothesis is correct. See crbug.com/1310020 for
+ // details.
+ // TODO(crbug.com/1310020): Remove this code as part of removing this entire
+ // function once we have verified that it is indeed no longer needed.
+ if (!output_buffer_renderer_
+ ->render_to_front_buffer_will_be_noop_for_debugging()) {
+ base::debug::DumpWithoutCrashing();
+ }
+
// On some devices GL_TEXTURE_BINDING_EXTERNAL_OES is not supported as
// glGetIntegerv() parameter. In this case the value of |texture_id| will be
// zero and we assume that it is properly bound to TextureOwner's texture id.
@@ -259,10 +272,6 @@ CodecImage::GetAHardwareBuffer() {
return output_buffer_renderer_->texture_owner()->GetAHardwareBuffer();
}
-bool CodecImage::HasMutableState() const {
- return false;
-}
-
CodecImageHolder::CodecImageHolder(
scoped_refptr<base::SequencedTaskRunner> task_runner,
scoped_refptr<CodecImage> codec_image,
diff --git a/chromium/media/gpu/android/codec_image.h b/chromium/media/gpu/android/codec_image.h
index e8a70fc51ab..39888744888 100644
--- a/chromium/media/gpu/android/codec_image.h
+++ b/chromium/media/gpu/android/codec_image.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -86,12 +86,6 @@ class MEDIA_GPU_EXPORT CodecImage
std::unique_ptr<base::android::ScopedHardwareBufferFenceSync>
GetAHardwareBuffer() override;
- // If we re-use one CodecImage with different output buffers, then we must
- // not claim to have mutable state. Otherwise, CopyTexImage is only called
- // once. For pooled shared images, this must return false. For single-use
- // images, it works either way.
- bool HasMutableState() const override;
-
// Notify us that we're no longer in-use for display, and may be pointed at
// another output buffer via a call to Initialize.
void NotifyUnused();
diff --git a/chromium/media/gpu/android/codec_image_group.cc b/chromium/media/gpu/android/codec_image_group.cc
index 24b3916928f..d1ad681870c 100644
--- a/chromium/media/gpu/android/codec_image_group.cc
+++ b/chromium/media/gpu/android/codec_image_group.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_image_group.h b/chromium/media/gpu/android/codec_image_group.h
index 942b5dd7265..43c437c6fff 100644
--- a/chromium/media/gpu/android/codec_image_group.h
+++ b/chromium/media/gpu/android/codec_image_group.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_image_group_unittest.cc b/chromium/media/gpu/android/codec_image_group_unittest.cc
index f711af31559..a08abc4f2eb 100644
--- a/chromium/media/gpu/android/codec_image_group_unittest.cc
+++ b/chromium/media/gpu/android/codec_image_group_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_image_unittest.cc b/chromium/media/gpu/android/codec_image_unittest.cc
index e80a5039647..ab0ca2ecc32 100644
--- a/chromium/media/gpu/android/codec_image_unittest.cc
+++ b/chromium/media/gpu/android/codec_image_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_output_buffer_renderer.cc b/chromium/media/gpu/android/codec_output_buffer_renderer.cc
index a588df80a0f..c9030a5fb06 100644
--- a/chromium/media/gpu/android/codec_output_buffer_renderer.cc
+++ b/chromium/media/gpu/android/codec_output_buffer_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_output_buffer_renderer.h b/chromium/media/gpu/android/codec_output_buffer_renderer.h
index b2e24d379d9..439f2811e6b 100644
--- a/chromium/media/gpu/android/codec_output_buffer_renderer.h
+++ b/chromium/media/gpu/android/codec_output_buffer_renderer.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,6 +69,16 @@ class MEDIA_GPU_EXPORT CodecOutputBufferRenderer
return phase_ == Phase::kInFrontBuffer;
}
+ // Whether a call to RenderTextureOwnerFrontBuffer() will be a no-op. Present
+ // for debugging whether there are cases in which CodecImage::CopyTexImage()
+ // results in actual rendering happening.
+ // TODO(crbug.com/1310020): Remove this method once that issue is resolved.
+ bool render_to_front_buffer_will_be_noop_for_debugging() const {
+ AssertAcquiredDrDcLock();
+ return was_rendered_to_front_buffer() || !codec_buffer_wait_coordinator_ ||
+ phase_ == Phase::kInvalidated;
+ }
+
gfx::Size size() const { return output_buffer_->size(); }
// Color space of the image.
diff --git a/chromium/media/gpu/android/codec_surface_bundle.cc b/chromium/media/gpu/android/codec_surface_bundle.cc
index c1a4049dc3b..3d8c8d2e7e1 100644
--- a/chromium/media/gpu/android/codec_surface_bundle.cc
+++ b/chromium/media/gpu/android/codec_surface_bundle.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_surface_bundle.h b/chromium/media/gpu/android/codec_surface_bundle.h
index fd017cdca8c..4a390a2e9e5 100644
--- a/chromium/media/gpu/android/codec_surface_bundle.h
+++ b/chromium/media/gpu/android/codec_surface_bundle.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_wrapper.cc b/chromium/media/gpu/android/codec_wrapper.cc
index 85ffc4c457c..9d10297c92b 100644
--- a/chromium/media/gpu/android/codec_wrapper.cc
+++ b/chromium/media/gpu/android/codec_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_wrapper.h b/chromium/media/gpu/android/codec_wrapper.h
index 0637d85291a..a14025c0191 100644
--- a/chromium/media/gpu/android/codec_wrapper.h
+++ b/chromium/media/gpu/android/codec_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/codec_wrapper_unittest.cc b/chromium/media/gpu/android/codec_wrapper_unittest.cc
index 7fc605625eb..74392c22468 100644
--- a/chromium/media/gpu/android/codec_wrapper_unittest.cc
+++ b/chromium/media/gpu/android/codec_wrapper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/device_info.cc b/chromium/media/gpu/android/device_info.cc
index cea21938e93..d45a26ed58c 100644
--- a/chromium/media/gpu/android/device_info.cc
+++ b/chromium/media/gpu/android/device_info.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/device_info.h b/chromium/media/gpu/android/device_info.h
index 54f53fe80a3..773c609f172 100644
--- a/chromium/media/gpu/android/device_info.h
+++ b/chromium/media/gpu/android/device_info.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/direct_shared_image_video_provider.cc b/chromium/media/gpu/android/direct_shared_image_video_provider.cc
index bbb4287be62..dc445d33d01 100644
--- a/chromium/media/gpu/android/direct_shared_image_video_provider.cc
+++ b/chromium/media/gpu/android/direct_shared_image_video_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,7 +13,6 @@
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/single_thread_task_runner.h"
-#include "base/task/task_runner_util.h"
#include "gpu/command_buffer/service/abstract_texture.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/shared_image/android_video_image_backing.h"
@@ -219,13 +218,12 @@ bool GpuSharedImageVideoFactory::CreateImageInternal(
kPremul_SkAlphaType, std::move(image), std::move(shared_context),
std::move(drdc_lock));
- // Register it with shared image mailbox as well as legacy mailbox. This
- // keeps |shared_image| around until its destruction cb is called.
- // NOTE: Currently none of the video mailbox consumer uses shared image
- // mailbox.
+ // Register it with shared image mailbox. This keeps |shared_image| around
+ // until its destruction cb is called. NOTE: Currently none of the video
+ // mailbox consumer uses shared image mailbox.
DCHECK(stub_->channel()->gpu_channel_manager()->shared_image_manager());
stub_->channel()->shared_image_stub()->factory()->RegisterBacking(
- std::move(shared_image), /*allow_legacy_mailbox=*/false);
+ std::move(shared_image));
return true;
}
diff --git a/chromium/media/gpu/android/direct_shared_image_video_provider.h b/chromium/media/gpu/android/direct_shared_image_video_provider.h
index 5c6676345a3..faee971c193 100644
--- a/chromium/media/gpu/android/direct_shared_image_video_provider.h
+++ b/chromium/media/gpu/android/direct_shared_image_video_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/fake_codec_allocator.cc b/chromium/media/gpu/android/fake_codec_allocator.cc
index 612dfc04a62..c62baef0171 100644
--- a/chromium/media/gpu/android/fake_codec_allocator.cc
+++ b/chromium/media/gpu/android/fake_codec_allocator.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/fake_codec_allocator.h b/chromium/media/gpu/android/fake_codec_allocator.h
index da1c58ea6cd..b68866aa3cb 100644
--- a/chromium/media/gpu/android/fake_codec_allocator.h
+++ b/chromium/media/gpu/android/fake_codec_allocator.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/frame_info_helper.cc b/chromium/media/gpu/android/frame_info_helper.cc
index 95b9c26df3f..13aebe5c6df 100644
--- a/chromium/media/gpu/android/frame_info_helper.cc
+++ b/chromium/media/gpu/android/frame_info_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/frame_info_helper.h b/chromium/media/gpu/android/frame_info_helper.h
index f338ce24e84..3473fd79ffd 100644
--- a/chromium/media/gpu/android/frame_info_helper.h
+++ b/chromium/media/gpu/android/frame_info_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/frame_info_helper_unittest.cc b/chromium/media/gpu/android/frame_info_helper_unittest.cc
index 00d530d18fd..8cac2582e62 100644
--- a/chromium/media/gpu/android/frame_info_helper_unittest.cc
+++ b/chromium/media/gpu/android/frame_info_helper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/maybe_render_early_manager.cc b/chromium/media/gpu/android/maybe_render_early_manager.cc
index 85a4c103b96..a522325472c 100644
--- a/chromium/media/gpu/android/maybe_render_early_manager.cc
+++ b/chromium/media/gpu/android/maybe_render_early_manager.cc
@@ -1,11 +1,10 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/gpu/android/maybe_render_early_manager.h"
-#include <algorithm>
-
+#include "base/containers/contains.h"
#include "base/containers/cxx20_erase.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/sequence_bound.h"
@@ -35,8 +34,7 @@ class GpuMaybeRenderEarlyImpl {
codec_image_holder->codec_image_raw()->AddUnusedCB(base::BindOnce(
&GpuMaybeRenderEarlyImpl::OnImageUnused, weak_factory_.GetWeakPtr()));
- DCHECK(std::find(images_.begin(), images_.end(),
- codec_image_holder->codec_image_raw()) == images_.end());
+ DCHECK(!base::Contains(images_, codec_image_holder->codec_image_raw()));
images_.push_back(codec_image_holder->codec_image_raw());
// Add |image| to our current image group. This makes sure that any overlay
@@ -53,7 +51,7 @@ class GpuMaybeRenderEarlyImpl {
private:
void OnImageUnused(CodecImage* image) {
// |image| is no longer used, so try to render a new image speculatively.
- DCHECK(std::find(images_.begin(), images_.end(), image) != images_.end());
+ DCHECK(base::Contains(images_, image));
// Remember that |image_group_| might not be the same one that |image|
// belongs to.
base::Erase(images_, image);
diff --git a/chromium/media/gpu/android/maybe_render_early_manager.h b/chromium/media/gpu/android/maybe_render_early_manager.h
index ddded864534..046cd551c92 100644
--- a/chromium/media/gpu/android/maybe_render_early_manager.h
+++ b/chromium/media/gpu/android/maybe_render_early_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/maybe_render_early_manager_unittest.cc b/chromium/media/gpu/android/maybe_render_early_manager_unittest.cc
index 66df21a11f0..066c3adeabf 100644
--- a/chromium/media/gpu/android/maybe_render_early_manager_unittest.cc
+++ b/chromium/media/gpu/android/maybe_render_early_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/media_codec_video_decoder.cc b/chromium/media/gpu/android/media_codec_video_decoder.cc
index 94215b3ede7..8813b14b8ff 100644
--- a/chromium/media/gpu/android/media_codec_video_decoder.cc
+++ b/chromium/media/gpu/android/media_codec_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -141,17 +141,25 @@ std::vector<SupportedVideoDecoderConfig> GetSupportedConfigsInternal(
}
if (device_info->IsAv1DecoderAvailable()) {
- // Technically we should check which profiles are supported, but since we
- // don't have an AV1 SW decoder, just allow them all. See notes below for
- // H264 profiles on the reasons why.
- supported_configs.emplace_back(AV1PROFILE_MIN, AV1PROFILE_MAX,
- gfx::Size(0, 0), gfx::Size(3840, 2160),
- true, // allow_encrypted
- false); // require_encrypted
- supported_configs.emplace_back(AV1PROFILE_MIN, AV1PROFILE_MAX,
- gfx::Size(0, 0), gfx::Size(2160, 3840),
- true, // allow_encrypted
- false); // require_encrypted
+ if (device_info->IsDecoderKnownUnaccelerated(VideoCodec::kAV1)) {
+ supported_configs.emplace_back(AV1PROFILE_MIN, AV1PROFILE_MAX,
+ gfx::Size(0, 0), gfx::Size(3840, 2160),
+ true, // allow_encrypted
+ true); // require_encrypted
+ supported_configs.emplace_back(AV1PROFILE_MIN, AV1PROFILE_MAX,
+ gfx::Size(0, 0), gfx::Size(2160, 3840),
+ true, // allow_encrypted
+ true); // require_encrypted
+ } else {
+ supported_configs.emplace_back(AV1PROFILE_MIN, AV1PROFILE_MAX,
+ gfx::Size(0, 0), gfx::Size(3840, 2160),
+ true, // allow_encrypted
+ false); // require_encrypted
+ supported_configs.emplace_back(AV1PROFILE_MIN, AV1PROFILE_MAX,
+ gfx::Size(0, 0), gfx::Size(2160, 3840),
+ true, // allow_encrypted
+ false); // require_encrypted
+ }
}
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
diff --git a/chromium/media/gpu/android/media_codec_video_decoder.h b/chromium/media/gpu/android/media_codec_video_decoder.h
index c8277943fce..16563ead1cd 100644
--- a/chromium/media/gpu/android/media_codec_video_decoder.h
+++ b/chromium/media/gpu/android/media_codec_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/media_codec_video_decoder_unittest.cc b/chromium/media/gpu/android/media_codec_video_decoder_unittest.cc
index dc96001eaf5..64b01068d0d 100644
--- a/chromium/media/gpu/android/media_codec_video_decoder_unittest.cc
+++ b/chromium/media/gpu/android/media_codec_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mediacodec.sigs b/chromium/media/gpu/android/mediacodec.sigs
index 6dea818af67..3ecae57e3be 100644
--- a/chromium/media/gpu/android/mediacodec.sigs
+++ b/chromium/media/gpu/android/mediacodec.sigs
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_android_video_surface_chooser.cc b/chromium/media/gpu/android/mock_android_video_surface_chooser.cc
index f490acf8834..2b25b4eac2e 100644
--- a/chromium/media/gpu/android/mock_android_video_surface_chooser.cc
+++ b/chromium/media/gpu/android/mock_android_video_surface_chooser.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_android_video_surface_chooser.h b/chromium/media/gpu/android/mock_android_video_surface_chooser.h
index 33c4b41c162..ac36c021487 100644
--- a/chromium/media/gpu/android/mock_android_video_surface_chooser.h
+++ b/chromium/media/gpu/android/mock_android_video_surface_chooser.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.cc b/chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.cc
index c3ab80eb1b9..8f687beb3d1 100644
--- a/chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.cc
+++ b/chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.h b/chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.h
index 08f69bbda13..48415172b30 100644
--- a/chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.h
+++ b/chromium/media/gpu/android/mock_codec_buffer_wait_coordinator.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -31,7 +31,7 @@ class MockCodecBufferWaitCoordinator : public CodecBufferWaitCoordinator {
bool expecting_frame_available;
protected:
- ~MockCodecBufferWaitCoordinator();
+ ~MockCodecBufferWaitCoordinator() override;
};
} // namespace media
diff --git a/chromium/media/gpu/android/mock_codec_image.cc b/chromium/media/gpu/android/mock_codec_image.cc
index d36005e9812..0674b0cf0d6 100644
--- a/chromium/media/gpu/android/mock_codec_image.cc
+++ b/chromium/media/gpu/android/mock_codec_image.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_codec_image.h b/chromium/media/gpu/android/mock_codec_image.h
index 632dc53a682..4ab1a09b2c5 100644
--- a/chromium/media/gpu/android/mock_codec_image.h
+++ b/chromium/media/gpu/android/mock_codec_image.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_device_info.cc b/chromium/media/gpu/android/mock_device_info.cc
index 14a668e64a4..aa9ef423242 100644
--- a/chromium/media/gpu/android/mock_device_info.cc
+++ b/chromium/media/gpu/android/mock_device_info.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_device_info.h b/chromium/media/gpu/android/mock_device_info.h
index b6632f7b3b1..8a0cfd24867 100644
--- a/chromium/media/gpu/android/mock_device_info.h
+++ b/chromium/media/gpu/android/mock_device_info.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_promotion_hint_aggregator.cc b/chromium/media/gpu/android/mock_promotion_hint_aggregator.cc
index c97c9344bfa..4e630349103 100644
--- a/chromium/media/gpu/android/mock_promotion_hint_aggregator.cc
+++ b/chromium/media/gpu/android/mock_promotion_hint_aggregator.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_promotion_hint_aggregator.h b/chromium/media/gpu/android/mock_promotion_hint_aggregator.h
index 7470d929035..f8e27051de1 100644
--- a/chromium/media/gpu/android/mock_promotion_hint_aggregator.h
+++ b/chromium/media/gpu/android/mock_promotion_hint_aggregator.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_shared_image_video_provider.cc b/chromium/media/gpu/android/mock_shared_image_video_provider.cc
index ecde0e54d2a..84b1c6ecf97 100644
--- a/chromium/media/gpu/android/mock_shared_image_video_provider.cc
+++ b/chromium/media/gpu/android/mock_shared_image_video_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/mock_shared_image_video_provider.h b/chromium/media/gpu/android/mock_shared_image_video_provider.h
index 4412dc95185..c64ae030e9c 100644
--- a/chromium/media/gpu/android/mock_shared_image_video_provider.h
+++ b/chromium/media/gpu/android/mock_shared_image_video_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,9 +16,9 @@ namespace media {
class MockSharedImageVideoProvider : public SharedImageVideoProvider {
public:
MockSharedImageVideoProvider();
- ~MockSharedImageVideoProvider();
+ ~MockSharedImageVideoProvider() override;
- void Initialize(GpuInitCB gpu_init_cb) {
+ void Initialize(GpuInitCB gpu_init_cb) override {
Initialize_(gpu_init_cb);
gpu_init_cb_ = std::move(gpu_init_cb);
}
diff --git a/chromium/media/gpu/android/ndk_constants.cc b/chromium/media/gpu/android/ndk_constants.cc
index 7e833eed5b8..b754667acb3 100644
--- a/chromium/media/gpu/android/ndk_constants.cc
+++ b/chromium/media/gpu/android/ndk_constants.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/ndk_video_encode_accelerator.cc b/chromium/media/gpu/android/ndk_video_encode_accelerator.cc
index e8f192207ce..478cc88fd6a 100644
--- a/chromium/media/gpu/android/ndk_video_encode_accelerator.cc
+++ b/chromium/media/gpu/android/ndk_video_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -90,8 +90,9 @@ MediaFormatPtr CreateVideoFormat(const std::string& mime,
return result;
}
-const base::Feature kAndroidNdkVideoEncoder{"AndroidNdkVideoEncoder",
- base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kAndroidNdkVideoEncoder,
+ "AndroidNdkVideoEncoder",
+ base::FEATURE_ENABLED_BY_DEFAULT);
static bool InitMediaCodec() {
// We need at least Android P for AMediaCodec_getInputFormat(), but in
diff --git a/chromium/media/gpu/android/ndk_video_encode_accelerator.h b/chromium/media/gpu/android/ndk_video_encode_accelerator.h
index de5bda1a610..151988023fb 100644
--- a/chromium/media/gpu/android/ndk_video_encode_accelerator.h
+++ b/chromium/media/gpu/android/ndk_video_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/ndk_video_encode_accelerator_tests.cc b/chromium/media/gpu/android/ndk_video_encode_accelerator_tests.cc
index 3e714755753..5d694e785ba 100644
--- a/chromium/media/gpu/android/ndk_video_encode_accelerator_tests.cc
+++ b/chromium/media/gpu/android/ndk_video_encode_accelerator_tests.cc
@@ -1,14 +1,15 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <algorithm>
#include <map>
#include <vector>
#include "base/android/build_info.h"
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "media/base/bitstream_buffer.h"
@@ -47,11 +48,8 @@ class NdkVideoEncoderAcceleratorTest
pixel_format_ = args.pixel_format;
auto profiles = MakeNdkAccelerator()->GetSupportedProfiles();
- bool codec_supported =
- std::any_of(profiles.begin(), profiles.end(),
- [this](VideoEncodeAccelerator::SupportedProfile p) {
- return p.profile == profile_;
- });
+ bool codec_supported = base::Contains(
+ profiles, profile_, &VideoEncodeAccelerator::SupportedProfile::profile);
if (!codec_supported) {
GTEST_SKIP() << "Device doesn't have hw encoder for: "
@@ -116,17 +114,19 @@ class NdkVideoEncoderAcceleratorTest
auto y = color & 0xFF;
auto u = (color >> 8) & 0xFF;
auto v = (color >> 16) & 0xFF;
- libyuv::I420Rect(
- frame->data(VideoFrame::kYPlane), frame->stride(VideoFrame::kYPlane),
- frame->data(VideoFrame::kUPlane), frame->stride(VideoFrame::kUPlane),
- frame->data(VideoFrame::kVPlane), frame->stride(VideoFrame::kVPlane),
- 0, // left
- 0, // top
- frame->visible_rect().width(), // right
- frame->visible_rect().height(), // bottom
- y, // Y color
- u, // U color
- v); // V color
+ libyuv::I420Rect(frame->writable_data(VideoFrame::kYPlane),
+ frame->stride(VideoFrame::kYPlane),
+ frame->writable_data(VideoFrame::kUPlane),
+ frame->stride(VideoFrame::kUPlane),
+ frame->writable_data(VideoFrame::kVPlane),
+ frame->stride(VideoFrame::kVPlane),
+ 0, // left
+ 0, // top
+ frame->visible_rect().width(), // right
+ frame->visible_rect().height(), // bottom
+ y, // Y color
+ u, // U color
+ v); // V color
return frame;
}
@@ -147,7 +147,7 @@ class NdkVideoEncoderAcceleratorTest
auto frame = VideoFrame::CreateFrame(PIXEL_FORMAT_XRGB, size,
gfx::Rect(size), size, timestamp);
- libyuv::ARGBRect(frame->data(VideoFrame::kARGBPlane),
+ libyuv::ARGBRect(frame->writable_data(VideoFrame::kARGBPlane),
frame->stride(VideoFrame::kARGBPlane),
0, // left
0, // top
@@ -291,7 +291,7 @@ TEST_P(NdkVideoEncoderAcceleratorTest, EncodeSeveralFrames) {
EXPECT_GT(output.md.payload_size_bytes, 0u);
auto span = mapping.GetMemoryAsSpan<uint8_t>();
bool found_not_zero =
- std::any_of(span.begin(), span.end(), [](uint8_t x) { return x != 0; });
+ base::ranges::any_of(span, [](uint8_t x) { return x != 0; });
EXPECT_TRUE(found_not_zero);
}
}
diff --git a/chromium/media/gpu/android/pooled_shared_image_video_provider.cc b/chromium/media/gpu/android/pooled_shared_image_video_provider.cc
index 07f08c8e2eb..1d97773d5d2 100644
--- a/chromium/media/gpu/android/pooled_shared_image_video_provider.cc
+++ b/chromium/media/gpu/android/pooled_shared_image_video_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/pooled_shared_image_video_provider.h b/chromium/media/gpu/android/pooled_shared_image_video_provider.h
index 24204631018..f940484b72a 100644
--- a/chromium/media/gpu/android/pooled_shared_image_video_provider.h
+++ b/chromium/media/gpu/android/pooled_shared_image_video_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/pooled_shared_image_video_provider_unittest.cc b/chromium/media/gpu/android/pooled_shared_image_video_provider_unittest.cc
index 9641a1123de..6228728fae0 100644
--- a/chromium/media/gpu/android/pooled_shared_image_video_provider_unittest.cc
+++ b/chromium/media/gpu/android/pooled_shared_image_video_provider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/promotion_hint_aggregator.h b/chromium/media/gpu/android/promotion_hint_aggregator.h
index eca6f51bbb3..5ba33c64e7c 100644
--- a/chromium/media/gpu/android/promotion_hint_aggregator.h
+++ b/chromium/media/gpu/android/promotion_hint_aggregator.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/promotion_hint_aggregator_impl.cc b/chromium/media/gpu/android/promotion_hint_aggregator_impl.cc
index 2e9c0d8d17f..8b4bbbc97f0 100644
--- a/chromium/media/gpu/android/promotion_hint_aggregator_impl.cc
+++ b/chromium/media/gpu/android/promotion_hint_aggregator_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/promotion_hint_aggregator_impl.h b/chromium/media/gpu/android/promotion_hint_aggregator_impl.h
index 99ffe2a79f7..4a859a4ca6a 100644
--- a/chromium/media/gpu/android/promotion_hint_aggregator_impl.h
+++ b/chromium/media/gpu/android/promotion_hint_aggregator_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/promotion_hint_aggregator_impl_unittest.cc b/chromium/media/gpu/android/promotion_hint_aggregator_impl_unittest.cc
index 048ddc7b158..fb9d956eaac 100644
--- a/chromium/media/gpu/android/promotion_hint_aggregator_impl_unittest.cc
+++ b/chromium/media/gpu/android/promotion_hint_aggregator_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/shared_image_video_provider.cc b/chromium/media/gpu/android/shared_image_video_provider.cc
index 49ef289a384..410495d815e 100644
--- a/chromium/media/gpu/android/shared_image_video_provider.cc
+++ b/chromium/media/gpu/android/shared_image_video_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/shared_image_video_provider.h b/chromium/media/gpu/android/shared_image_video_provider.h
index c12b851def7..ccbbd6fa3fe 100644
--- a/chromium/media/gpu/android/shared_image_video_provider.h
+++ b/chromium/media/gpu/android/shared_image_video_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/surface_chooser_helper.cc b/chromium/media/gpu/android/surface_chooser_helper.cc
index 9aa4c12b8fc..2a3d92f9712 100644
--- a/chromium/media/gpu/android/surface_chooser_helper.cc
+++ b/chromium/media/gpu/android/surface_chooser_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/surface_chooser_helper.h b/chromium/media/gpu/android/surface_chooser_helper.h
index 0fb39f727b0..3003056222c 100644
--- a/chromium/media/gpu/android/surface_chooser_helper.h
+++ b/chromium/media/gpu/android/surface_chooser_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/surface_chooser_helper_unittest.cc b/chromium/media/gpu/android/surface_chooser_helper_unittest.cc
index 0b02b27bfe6..7eacffd4bb8 100644
--- a/chromium/media/gpu/android/surface_chooser_helper_unittest.cc
+++ b/chromium/media/gpu/android/surface_chooser_helper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/texture_pool_unittest.cc b/chromium/media/gpu/android/texture_pool_unittest.cc
index 299af558dfe..be55c36d973 100644
--- a/chromium/media/gpu/android/texture_pool_unittest.cc
+++ b/chromium/media/gpu/android/texture_pool_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/video_frame_factory.h b/chromium/media/gpu/android/video_frame_factory.h
index 1e60affdf95..0b72923c880 100644
--- a/chromium/media/gpu/android/video_frame_factory.h
+++ b/chromium/media/gpu/android/video_frame_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/video_frame_factory_impl.cc b/chromium/media/gpu/android/video_frame_factory_impl.cc
index f03da5443c4..b5345a1ba57 100644
--- a/chromium/media/gpu/android/video_frame_factory_impl.cc
+++ b/chromium/media/gpu/android/video_frame_factory_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,7 +14,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/task/single_thread_task_runner.h"
-#include "base/task/task_runner_util.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/service/abstract_texture.h"
#include "gpu/command_buffer/service/shared_context_state.h"
diff --git a/chromium/media/gpu/android/video_frame_factory_impl.h b/chromium/media/gpu/android/video_frame_factory_impl.h
index 42109782db7..8a16485d906 100644
--- a/chromium/media/gpu/android/video_frame_factory_impl.h
+++ b/chromium/media/gpu/android/video_frame_factory_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/android/video_frame_factory_impl_unittest.cc b/chromium/media/gpu/android/video_frame_factory_impl_unittest.cc
index 47ef2f65e0c..9365112d7db 100644
--- a/chromium/media/gpu/android/video_frame_factory_impl_unittest.cc
+++ b/chromium/media/gpu/android/video_frame_factory_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/args.gni b/chromium/media/gpu/args.gni
index da3ea5a5dc9..813657af180 100644
--- a/chromium/media/gpu/args.gni
+++ b/chromium/media/gpu/args.gni
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -18,7 +18,8 @@ declare_args() {
# Indicates if Video4Linux2 codec is used. This is used for all CrOS
# platforms which have v4l2 hardware encoder / decoder.
- use_v4l2_codec = false
+ use_v4l2_codec =
+ is_chromeos_lacros && (target_cpu == "arm" || target_cpu == "arm64")
# Indicates if Video4Linux2 AML encoder is used. This is used for AML
# platforms which have v4l2 hardware encoder
diff --git a/chromium/media/gpu/av1_decoder.cc b/chromium/media/gpu/av1_decoder.cc
index 761759e90ce..31322bd36b1 100644
--- a/chromium/media/gpu/av1_decoder.cc
+++ b/chromium/media/gpu/av1_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/av1_decoder.h b/chromium/media/gpu/av1_decoder.h
index 5598f49d668..ff32d4236d6 100644
--- a/chromium/media/gpu/av1_decoder.h
+++ b/chromium/media/gpu/av1_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,6 +14,7 @@
#include "media/base/video_color_space.h"
#include "media/base/video_types.h"
#include "media/gpu/accelerated_video_decoder.h"
+#include "media/gpu/av1_picture.h"
#include "media/gpu/media_gpu_export.h"
#include "third_party/libgav1/src/src/utils/constants.h"
@@ -32,7 +33,6 @@ class Vector;
} // namespace libgav1
namespace media {
-class AV1Picture;
using AV1ReferenceFrameVector =
std::array<scoped_refptr<AV1Picture>, libgav1::kNumReferenceFrameTypes>;
diff --git a/chromium/media/gpu/av1_decoder_fuzzertest.cc b/chromium/media/gpu/av1_decoder_fuzzertest.cc
index 6b98e508660..4c1600e8b68 100644
--- a/chromium/media/gpu/av1_decoder_fuzzertest.cc
+++ b/chromium/media/gpu/av1_decoder_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/av1_decoder_unittest.cc b/chromium/media/gpu/av1_decoder_unittest.cc
index 862669080fd..4327a04654b 100644
--- a/chromium/media/gpu/av1_decoder_unittest.cc
+++ b/chromium/media/gpu/av1_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
+#include "base/ranges/algorithm.h"
#include "base/stl_util.h"
#include "media/base/decoder_buffer.h"
#include "media/base/test_data_util.h"
@@ -715,11 +716,11 @@ TEST_F(AV1DecoderTest, InconsistentReferenceFrameState) {
// And to be consistent, all the reference frames tracked by the AV1Decoder
// should also be valid and they should be pointing to the only AV1Picture
// so far.
- EXPECT_TRUE(
- std::all_of(internal_ref_frames.begin(), internal_ref_frames.end(),
- [&av1_picture](const scoped_refptr<AV1Picture>& ref_frame) {
- return ref_frame.get() == av1_picture.get();
- }));
+ EXPECT_TRUE(base::ranges::all_of(
+ internal_ref_frames,
+ [&av1_picture](const scoped_refptr<AV1Picture>& ref_frame) {
+ return ref_frame.get() == av1_picture.get();
+ }));
testing::Mock::VerifyAndClearExpectations(mock_accelerator_);
}
diff --git a/chromium/media/gpu/av1_picture.cc b/chromium/media/gpu/av1_picture.cc
index 393f1072d51..1e1c027a549 100644
--- a/chromium/media/gpu/av1_picture.cc
+++ b/chromium/media/gpu/av1_picture.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/av1_picture.h b/chromium/media/gpu/av1_picture.h
index d770f9f3f37..2d01d6288f0 100644
--- a/chromium/media/gpu/av1_picture.h
+++ b/chromium/media/gpu/av1_picture.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include "third_party/libgav1/src/src/utils/types.h"
namespace media {
+
// AV1Picture carries the parsed frame header needed for decoding an AV1 frame.
// It also owns the decoded frame itself.
class MEDIA_GPU_EXPORT AV1Picture : public CodecPicture {
diff --git a/chromium/media/gpu/buffer_validation.cc b/chromium/media/gpu/buffer_validation.cc
index 66499f0b3e0..94e2f4b4717 100644
--- a/chromium/media/gpu/buffer_validation.cc
+++ b/chromium/media/gpu/buffer_validation.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/buffer_validation.h b/chromium/media/gpu/buffer_validation.h
index a63526d9676..2ddc301693b 100644
--- a/chromium/media/gpu/buffer_validation.h
+++ b/chromium/media/gpu/buffer_validation.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/buffer_validation_unittest.cc b/chromium/media/gpu/buffer_validation_unittest.cc
index 1e3144d87b0..eadda4e1077 100644
--- a/chromium/media/gpu/buffer_validation_unittest.cc
+++ b/chromium/media/gpu/buffer_validation_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/BUILD.gn b/chromium/media/gpu/chromeos/BUILD.gn
index 455435bbad9..2b1f70c225b 100644
--- a/chromium/media/gpu/chromeos/BUILD.gn
+++ b/chromium/media/gpu/chromeos/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/chromeos_status.h b/chromium/media/gpu/chromeos/chromeos_status.h
index 8b5d7d90965..015c502ca51 100644
--- a/chromium/media/gpu/chromeos/chromeos_status.h
+++ b/chromium/media/gpu/chromeos/chromeos_status.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/decoder_buffer_transcryptor.cc b/chromium/media/gpu/chromeos/decoder_buffer_transcryptor.cc
index e3cd31df09c..238785fbb21 100644
--- a/chromium/media/gpu/chromeos/decoder_buffer_transcryptor.cc
+++ b/chromium/media/gpu/chromeos/decoder_buffer_transcryptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/decoder_buffer_transcryptor.h b/chromium/media/gpu/chromeos/decoder_buffer_transcryptor.h
index f5c157b3cdb..f604f6323a2 100644
--- a/chromium/media/gpu/chromeos/decoder_buffer_transcryptor.h
+++ b/chromium/media/gpu/chromeos/decoder_buffer_transcryptor.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/dmabuf_video_frame_pool.cc b/chromium/media/gpu/chromeos/dmabuf_video_frame_pool.cc
index 3091f90f8c6..1a4bc69e523 100644
--- a/chromium/media/gpu/chromeos/dmabuf_video_frame_pool.cc
+++ b/chromium/media/gpu/chromeos/dmabuf_video_frame_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/dmabuf_video_frame_pool.h b/chromium/media/gpu/chromeos/dmabuf_video_frame_pool.h
index 74b0b79e770..51c236bf1b9 100644
--- a/chromium/media/gpu/chromeos/dmabuf_video_frame_pool.h
+++ b/chromium/media/gpu/chromeos/dmabuf_video_frame_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/fourcc.cc b/chromium/media/gpu/chromeos/fourcc.cc
index dced21fc507..3f3c3338768 100644
--- a/chromium/media/gpu/chromeos/fourcc.cc
+++ b/chromium/media/gpu/chromeos/fourcc.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/fourcc.h b/chromium/media/gpu/chromeos/fourcc.h
index c4b233ac645..8919591641e 100644
--- a/chromium/media/gpu/chromeos/fourcc.h
+++ b/chromium/media/gpu/chromeos/fourcc.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/fourcc_unittests.cc b/chromium/media/gpu/chromeos/fourcc_unittests.cc
index 90854296db8..96947ebb824 100644
--- a/chromium/media/gpu/chromeos/fourcc_unittests.cc
+++ b/chromium/media/gpu/chromeos/fourcc_unittests.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.cc b/chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.cc
index 0993f923bc7..1883444f68b 100644
--- a/chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.cc
+++ b/chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,11 +6,11 @@
#include <sys/mman.h>
-#include <algorithm>
#include <utility>
#include <vector>
#include "base/bind.h"
+#include "base/containers/contains.h"
#include "base/memory/ptr_util.h"
#include "media/gpu/macros.h"
@@ -83,8 +83,7 @@ bool IsFormatSupported(VideoPixelFormat format) {
// Compressed format.
PIXEL_FORMAT_MJPEG,
};
- return std::find(std::cbegin(supported_formats), std::cend(supported_formats),
- format) != std::cend(supported_formats);
+ return base::Contains(supported_formats, format);
}
} // namespace
diff --git a/chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.h b/chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.h
index 0ab5b4b4fa1..cc62781a69d 100644
--- a/chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.h
+++ b/chromium/media/gpu/chromeos/generic_dmabuf_video_frame_mapper.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/gl_image_processor_backend.cc b/chromium/media/gpu/chromeos/gl_image_processor_backend.cc
index bfc68162a06..6fc4958d90f 100644
--- a/chromium/media/gpu/chromeos/gl_image_processor_backend.cc
+++ b/chromium/media/gpu/chromeos/gl_image_processor_backend.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -262,7 +262,8 @@ bool GLImageProcessorBackend::InitializeTask() {
// Create a shader program to convert an MM21 buffer into an NV12 buffer.
GLuint program = glCreateProgram();
constexpr GLchar kVertexShader[] =
- "#version 300 es\n"
+ "#version 320 es\n"
+ "#extension GL_ARM_internal : enable\n"
"out vec2 texPos;\n"
"void main() {\n"
" vec2 pos[4];\n"
@@ -292,43 +293,49 @@ bool GLImageProcessorBackend::InitializeTask() {
// detiled coordinates. In practice, this second sample pass usually hits the
// GPU's cache, so this doesn't influence DRAM bandwidth too negatively.
constexpr GLchar kFragmentShader[] =
- R"(#version 300 es
+ R"(#version 320 es
#extension GL_EXT_YUV_target : require
- precision highp float;
- precision highp int;
+ #extension GL_ARM_internal : enable
+ #pragma disable_alpha_to_coverage
+ precision mediump float;
+ precision mediump int;
uniform __samplerExternal2DY2YEXT tex;
- const ivec2 kYTileDims = ivec2(16, 32);
- const ivec2 kUVTileDims = ivec2(8, 16);
- uniform int width;
- uniform int height;
+ const uvec2 kYTileDims = uvec2(16, 32);
+ const uvec2 kUVTileDims = uvec2(8, 16);
+ uniform uint width;
+ uniform uint height;
in vec2 texPos;
layout(yuv) out vec4 fragColor;
void main() {
- int col = int(round(texPos.x*float(width)));
- int row = int(round(texPos.y*float(height)));
- ivec2 iCoord = ivec2(col, row);
- ivec2 tileCoords = iCoord / kYTileDims;
- int numTilesPerRow = width / kYTileDims.x;
- int tileIdx = (tileCoords.y * numTilesPerRow) + tileCoords.x;
- ivec2 inTileCoord = iCoord % kYTileDims;
- int offsetInTile = (inTileCoord.y * kYTileDims.x) + inTileCoord.x;
- int linearIndex = tileIdx * kYTileDims.x * kYTileDims.y + offsetInTile;
- int detiledY = linearIndex / width;
- int detiledX = linearIndex % width;
+ uvec2 iCoord = uvec2(gl_FragPositionARM.xy);
+ uvec2 tileCoords = iCoord / kYTileDims;
+ uint numTilesPerRow = width / kYTileDims.x;
+ uint tileIdx = (tileCoords.y * numTilesPerRow) + tileCoords.x;
+ uvec2 inTileCoord = iCoord % kYTileDims;
+ uint offsetInTile = (inTileCoord.y * kYTileDims.x) + inTileCoord.x;
+ highp uint linearIndex = tileIdx;
+ linearIndex = linearIndex * kYTileDims.x;
+ linearIndex = linearIndex * kYTileDims.y;
+ linearIndex = linearIndex + offsetInTile;
+ uint detiledY = linearIndex / width;
+ uint detiledX = linearIndex % width;
fragColor = vec4(0, 0, 0, 1);
fragColor.r = texelFetch(tex, ivec2(detiledX, detiledY), 0).r;
- iCoord = iCoord / 2;
+ iCoord = iCoord / uint(2);
tileCoords = iCoord / kUVTileDims;
- int uvWidth = width / 2;
+ uint uvWidth = width / uint(2);
numTilesPerRow = uvWidth / kUVTileDims.x;
tileIdx = (tileCoords.y * numTilesPerRow) + tileCoords.x;
inTileCoord = iCoord % kUVTileDims;
offsetInTile = (inTileCoord.y * kUVTileDims.x) + inTileCoord.x;
- linearIndex = tileIdx * kUVTileDims.x * kUVTileDims.y + offsetInTile;
+ linearIndex = tileIdx;
+ linearIndex = linearIndex * kUVTileDims.x;
+ linearIndex = linearIndex * kUVTileDims.y;
+ linearIndex = linearIndex + offsetInTile;
detiledY = linearIndex / uvWidth;
detiledX = linearIndex % uvWidth;
- detiledY = detiledY * 2;
- detiledX = detiledX * 2;
+ detiledY = detiledY * uint(2);
+ detiledX = detiledX * uint(2);
fragColor.gb = texelFetch(tex, ivec2(detiledX, detiledY), 0).gb;
})";
if (!CreateAndAttachShader(program, GL_FRAGMENT_SHADER, kFragmentShader,
@@ -359,10 +366,10 @@ bool GLImageProcessorBackend::InitializeTask() {
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glUniform1i(glGetUniformLocation(program, "tex"), 0);
- glUniform1i(glGetUniformLocation(program, "width"),
- ALIGN(output_visible_size.width(), kTileWidth));
- glUniform1i(glGetUniformLocation(program, "height"),
- ALIGN(output_visible_size.height(), kTileHeight));
+ glUniform1ui(glGetUniformLocation(program, "width"),
+ ALIGN(output_visible_size.width(), kTileWidth));
+ glUniform1ui(glGetUniformLocation(program, "height"),
+ ALIGN(output_visible_size.height(), kTileHeight));
glViewport(0, 0, output_visible_size.width(), output_visible_size.height());
// This glGetError() blocks until all the commands above have executed. This
diff --git a/chromium/media/gpu/chromeos/gl_image_processor_backend.h b/chromium/media/gpu/chromeos/gl_image_processor_backend.h
index e5c2d38f5b1..fbd5948292f 100644
--- a/chromium/media/gpu/chromeos/gl_image_processor_backend.h
+++ b/chromium/media/gpu/chromeos/gl_image_processor_backend.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/gpu_buffer_layout.cc b/chromium/media/gpu/chromeos/gpu_buffer_layout.cc
index 578884f536b..fe34f4ca960 100644
--- a/chromium/media/gpu/chromeos/gpu_buffer_layout.cc
+++ b/chromium/media/gpu/chromeos/gpu_buffer_layout.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/gpu_buffer_layout.h b/chromium/media/gpu/chromeos/gpu_buffer_layout.h
index 3e415a04926..492f326b988 100644
--- a/chromium/media/gpu/chromeos/gpu_buffer_layout.h
+++ b/chromium/media/gpu/chromeos/gpu_buffer_layout.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.cc b/chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.cc
index fb0cb05441c..7445e5d84ef 100644
--- a/chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.cc
+++ b/chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.h b/chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.h
index 4b662444d87..6514ce8a74b 100644
--- a/chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.h
+++ b/chromium/media/gpu/chromeos/gpu_memory_buffer_video_frame_mapper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/image_processor.cc b/chromium/media/gpu/chromeos/image_processor.cc
index d959d91a2ed..90731414775 100644
--- a/chromium/media/gpu/chromeos/image_processor.cc
+++ b/chromium/media/gpu/chromeos/image_processor.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/image_processor.h b/chromium/media/gpu/chromeos/image_processor.h
index a8f4918fb77..58ebc68fcd8 100644
--- a/chromium/media/gpu/chromeos/image_processor.h
+++ b/chromium/media/gpu/chromeos/image_processor.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/image_processor_backend.cc b/chromium/media/gpu/chromeos/image_processor_backend.cc
index 529ffb44abd..441de7cc631 100644
--- a/chromium/media/gpu/chromeos/image_processor_backend.cc
+++ b/chromium/media/gpu/chromeos/image_processor_backend.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/image_processor_backend.h b/chromium/media/gpu/chromeos/image_processor_backend.h
index 80a20be6fbf..f07f8119c1d 100644
--- a/chromium/media/gpu/chromeos/image_processor_backend.h
+++ b/chromium/media/gpu/chromeos/image_processor_backend.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/image_processor_factory.cc b/chromium/media/gpu/chromeos/image_processor_factory.cc
index aad3664c864..f44dd98bb90 100644
--- a/chromium/media/gpu/chromeos/image_processor_factory.cc
+++ b/chromium/media/gpu/chromeos/image_processor_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/image_processor_factory.h b/chromium/media/gpu/chromeos/image_processor_factory.h
index 6439bcdf18f..7bcb841670b 100644
--- a/chromium/media/gpu/chromeos/image_processor_factory.h
+++ b/chromium/media/gpu/chromeos/image_processor_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/image_processor_test.cc b/chromium/media/gpu/chromeos/image_processor_test.cc
index bbf844b886a..52e5a41ff28 100644
--- a/chromium/media/gpu/chromeos/image_processor_test.cc
+++ b/chromium/media/gpu/chromeos/image_processor_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/image_processor_with_pool.cc b/chromium/media/gpu/chromeos/image_processor_with_pool.cc
index 0550d5a3da8..b6c599eacce 100644
--- a/chromium/media/gpu/chromeos/image_processor_with_pool.cc
+++ b/chromium/media/gpu/chromeos/image_processor_with_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/image_processor_with_pool.h b/chromium/media/gpu/chromeos/image_processor_with_pool.h
index e83de420cda..1054729576c 100644
--- a/chromium/media/gpu/chromeos/image_processor_with_pool.h
+++ b/chromium/media/gpu/chromeos/image_processor_with_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/libyuv_image_processor_backend.cc b/chromium/media/gpu/chromeos/libyuv_image_processor_backend.cc
index 03e1e73994c..56e0eec9cef 100644
--- a/chromium/media/gpu/chromeos/libyuv_image_processor_backend.cc
+++ b/chromium/media/gpu/chromeos/libyuv_image_processor_backend.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -384,6 +384,14 @@ int LibYUVImageProcessorBackend::DoConversion(const VideoFrame* const input,
fr->visible_data(VideoFrame::kUPlane), fr->stride(VideoFrame::kUPlane), \
fr->visible_data(VideoFrame::kVPlane), fr->stride(VideoFrame::kVPlane)
+#define Y_U_V_DATA_W(fr) \
+ fr->GetWritableVisibleData(VideoFrame::kYPlane), \
+ fr->stride(VideoFrame::kYPlane), \
+ fr->GetWritableVisibleData(VideoFrame::kUPlane), \
+ fr->stride(VideoFrame::kUPlane), \
+ fr->GetWritableVisibleData(VideoFrame::kVPlane), \
+ fr->stride(VideoFrame::kVPlane)
+
#define Y_V_U_DATA(fr) \
fr->visible_data(VideoFrame::kYPlane), fr->stride(VideoFrame::kYPlane), \
fr->visible_data(VideoFrame::kVPlane), fr->stride(VideoFrame::kVPlane), \
@@ -393,6 +401,12 @@ int LibYUVImageProcessorBackend::DoConversion(const VideoFrame* const input,
fr->visible_data(VideoFrame::kYPlane), fr->stride(VideoFrame::kYPlane), \
fr->visible_data(VideoFrame::kUVPlane), fr->stride(VideoFrame::kUVPlane)
+#define Y_UV_DATA_W(fr) \
+ fr->GetWritableVisibleData(VideoFrame::kYPlane), \
+ fr->stride(VideoFrame::kYPlane), \
+ fr->GetWritableVisibleData(VideoFrame::kUVPlane), \
+ fr->stride(VideoFrame::kUVPlane)
+
#define YUY2_DATA(fr) \
fr->visible_data(VideoFrame::kYPlane), fr->stride(VideoFrame::kYPlane)
@@ -403,14 +417,26 @@ int LibYUVImageProcessorBackend::DoConversion(const VideoFrame* const input,
if (output->format() == PIXEL_FORMAT_NV12) {
switch (input->format()) {
case PIXEL_FORMAT_I420:
- return LIBYUV_FUNC(I420ToNV12, Y_U_V_DATA(input), Y_UV_DATA(output));
+ return LIBYUV_FUNC(I420ToNV12, Y_U_V_DATA(input), Y_UV_DATA_W(output));
case PIXEL_FORMAT_YV12:
- return LIBYUV_FUNC(I420ToNV12, Y_V_U_DATA(input), Y_UV_DATA(output));
+ return LIBYUV_FUNC(I420ToNV12, Y_V_U_DATA(input), Y_UV_DATA_W(output));
case PIXEL_FORMAT_NV12:
// MM21 mode.
- if (input_config_.fourcc == Fourcc(Fourcc::MM21))
- return LIBYUV_FUNC(MM21ToNV12, Y_UV_DATA(input), Y_UV_DATA(output));
+ if (input_config_.fourcc == Fourcc(Fourcc::MM21)) {
+ // The X and Y of the input rectangle seem to have a more complicated
+ // relationship with the channel offsets. This is what we have managed
+ // to figure out. (b/248991039)
+ const int luma_offset =
+ input->visible_rect().x() * (input->visible_rect().y() - 1);
+ const int chroma_offset = luma_offset / 2 - input->visible_rect().y();
+ return libyuv::MM21ToNV12(
+ input->visible_data(VideoFrame::kYPlane) + luma_offset,
+ input->stride(VideoFrame::kYPlane),
+ input->visible_data(VideoFrame::kUVPlane) + chroma_offset,
+ input->stride(VideoFrame::kUVPlane), Y_UV_DATA_W(output),
+ output->visible_rect().width(), output->visible_rect().height());
+ }
// Rotation mode.
if (relative_rotation_ != VIDEO_ROTATION_0) {
@@ -420,24 +446,25 @@ int LibYUVImageProcessorBackend::DoConversion(const VideoFrame* const input,
// temporary U and V planes for I420 data. Although
// |intermediate_frame_->data(0)| is much larger than the required
// size, we use the frame to simplify the code.
- return NV12Rotate(intermediate_frame_->data(0), Y_UV_DATA(input),
- Y_UV_DATA(output), input->visible_rect().width(),
+ return NV12Rotate(intermediate_frame_->writable_data(0),
+ Y_UV_DATA(input), Y_UV_DATA_W(output),
+ input->visible_rect().width(),
input->visible_rect().height(), relative_rotation_);
}
// Scaling mode.
return libyuv::NV12Scale(
Y_UV_DATA(input), input->visible_rect().width(),
- input->visible_rect().height(), Y_UV_DATA(output),
+ input->visible_rect().height(), Y_UV_DATA_W(output),
output->visible_rect().width(), output->visible_rect().height(),
libyuv::kFilterBilinear);
case PIXEL_FORMAT_YUY2:
if (input->visible_rect().size() == output->visible_rect().size()) {
- return LIBYUV_FUNC(YUY2ToNV12, YUY2_DATA(input), Y_UV_DATA(output));
+ return LIBYUV_FUNC(YUY2ToNV12, YUY2_DATA(input), Y_UV_DATA_W(output));
} else {
DCHECK_EQ(intermediate_frame_->format(), PIXEL_FORMAT_NV12);
int ret = libyuv::YUY2ToNV12(
- YUY2_DATA(input), Y_UV_DATA(intermediate_frame_),
+ YUY2_DATA(input), Y_UV_DATA_W(intermediate_frame_),
intermediate_frame_->visible_rect().width(),
intermediate_frame_->visible_rect().height());
if (ret != 0)
@@ -445,17 +472,18 @@ int LibYUVImageProcessorBackend::DoConversion(const VideoFrame* const input,
return libyuv::NV12Scale(
Y_UV_DATA(intermediate_frame_),
intermediate_frame_->visible_rect().width(),
- intermediate_frame_->visible_rect().height(), Y_UV_DATA(output),
+ intermediate_frame_->visible_rect().height(), Y_UV_DATA_W(output),
output->visible_rect().width(), output->visible_rect().height(),
libyuv::kFilterBilinear);
}
case PIXEL_FORMAT_I422:
if (input->visible_rect().size() == output->visible_rect().size()) {
- return LIBYUV_FUNC(I422ToNV21, Y_V_U_DATA(input), Y_UV_DATA(output));
+ return LIBYUV_FUNC(I422ToNV21, Y_V_U_DATA(input),
+ Y_UV_DATA_W(output));
} else {
DCHECK_EQ(intermediate_frame_->format(), PIXEL_FORMAT_NV12);
int ret = libyuv::I422ToNV21(
- Y_V_U_DATA(input), Y_UV_DATA(intermediate_frame_),
+ Y_V_U_DATA(input), Y_UV_DATA_W(intermediate_frame_),
intermediate_frame_->visible_rect().width(),
intermediate_frame_->visible_rect().height());
if (ret != 0)
@@ -463,7 +491,7 @@ int LibYUVImageProcessorBackend::DoConversion(const VideoFrame* const input,
return libyuv::NV12Scale(
Y_UV_DATA(intermediate_frame_),
intermediate_frame_->visible_rect().width(),
- intermediate_frame_->visible_rect().height(), Y_UV_DATA(output),
+ intermediate_frame_->visible_rect().height(), Y_UV_DATA_W(output),
output->visible_rect().width(), output->visible_rect().height(),
libyuv::kFilterBilinear);
}
@@ -478,16 +506,17 @@ int LibYUVImageProcessorBackend::DoConversion(const VideoFrame* const input,
case PIXEL_FORMAT_I420:
return libyuv::I420Scale(
Y_U_V_DATA(input), input->visible_rect().width(),
- input->visible_rect().height(), Y_U_V_DATA(output),
+ input->visible_rect().height(), Y_U_V_DATA_W(output),
output->visible_rect().width(), output->visible_rect().height(),
libyuv::kFilterBilinear);
case PIXEL_FORMAT_YUY2:
if (input->visible_rect().size() == output->visible_rect().size()) {
- return LIBYUV_FUNC(YUY2ToI420, YUY2_DATA(input), Y_U_V_DATA(output));
+ return LIBYUV_FUNC(YUY2ToI420, YUY2_DATA(input),
+ Y_U_V_DATA_W(output));
} else {
DCHECK_EQ(intermediate_frame_->format(), PIXEL_FORMAT_I420);
int ret = libyuv::YUY2ToI420(
- YUY2_DATA(input), Y_U_V_DATA(intermediate_frame_),
+ YUY2_DATA(input), Y_U_V_DATA_W(intermediate_frame_),
intermediate_frame_->visible_rect().width(),
intermediate_frame_->visible_rect().height());
if (ret != 0)
@@ -495,17 +524,18 @@ int LibYUVImageProcessorBackend::DoConversion(const VideoFrame* const input,
return libyuv::I420Scale(
Y_U_V_DATA(intermediate_frame_),
intermediate_frame_->visible_rect().width(),
- intermediate_frame_->visible_rect().height(), Y_U_V_DATA(output),
- output->visible_rect().width(), output->visible_rect().height(),
- libyuv::kFilterBilinear);
+ intermediate_frame_->visible_rect().height(),
+ Y_U_V_DATA_W(output), output->visible_rect().width(),
+ output->visible_rect().height(), libyuv::kFilterBilinear);
}
case PIXEL_FORMAT_I422:
if (input->visible_rect().size() == output->visible_rect().size()) {
- return LIBYUV_FUNC(I422ToI420, Y_U_V_DATA(input), Y_U_V_DATA(output));
+ return LIBYUV_FUNC(I422ToI420, Y_U_V_DATA(input),
+ Y_U_V_DATA_W(output));
} else {
DCHECK_EQ(intermediate_frame_->format(), PIXEL_FORMAT_I420);
int ret = libyuv::I422ToI420(
- Y_U_V_DATA(input), Y_U_V_DATA(intermediate_frame_),
+ Y_U_V_DATA(input), Y_U_V_DATA_W(intermediate_frame_),
intermediate_frame_->visible_rect().width(),
intermediate_frame_->visible_rect().height());
if (ret != 0)
@@ -513,9 +543,9 @@ int LibYUVImageProcessorBackend::DoConversion(const VideoFrame* const input,
return libyuv::I420Scale(
Y_U_V_DATA(intermediate_frame_),
intermediate_frame_->visible_rect().width(),
- intermediate_frame_->visible_rect().height(), Y_U_V_DATA(output),
- output->visible_rect().width(), output->visible_rect().height(),
- libyuv::kFilterBilinear);
+ intermediate_frame_->visible_rect().height(),
+ Y_U_V_DATA_W(output), output->visible_rect().width(),
+ output->visible_rect().height(), libyuv::kFilterBilinear);
}
default:
VLOGF(1) << "Unexpected input format: " << input->format();
diff --git a/chromium/media/gpu/chromeos/libyuv_image_processor_backend.h b/chromium/media/gpu/chromeos/libyuv_image_processor_backend.h
index df0b441126e..7a4de18f6ee 100644
--- a/chromium/media/gpu/chromeos/libyuv_image_processor_backend.h
+++ b/chromium/media/gpu/chromeos/libyuv_image_processor_backend.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/mailbox_video_frame_converter.cc b/chromium/media/gpu/chromeos/mailbox_video_frame_converter.cc
index 5acedfac78e..1577c1b07f9 100644
--- a/chromium/media/gpu/chromeos/mailbox_video_frame_converter.cc
+++ b/chromium/media/gpu/chromeos/mailbox_video_frame_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,6 @@
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/task/single_thread_task_runner.h"
-#include "base/task/task_runner_util.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/scheduler.h"
@@ -454,7 +453,7 @@ bool MailboxVideoFrameConverter::GenerateSharedImageOnGPUThread(
// The allocated SharedImages should be usable for the (Display) compositor
// and, potentially, for overlays (Scanout).
uint32_t shared_image_usage =
- gpu::SHARED_IMAGE_USAGE_DISPLAY | gpu::SHARED_IMAGE_USAGE_SCANOUT;
+ gpu::SHARED_IMAGE_USAGE_DISPLAY_READ | gpu::SHARED_IMAGE_USAGE_SCANOUT;
if (enable_unsafe_webgpu_ && video_frame->metadata().is_webgpu_compatible)
shared_image_usage |= gpu::SHARED_IMAGE_USAGE_WEBGPU;
diff --git a/chromium/media/gpu/chromeos/mailbox_video_frame_converter.h b/chromium/media/gpu/chromeos/mailbox_video_frame_converter.h
index 89f76c55600..39e8ad61e41 100644
--- a/chromium/media/gpu/chromeos/mailbox_video_frame_converter.h
+++ b/chromium/media/gpu/chromeos/mailbox_video_frame_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/mailbox_video_frame_converter_unittest.cc b/chromium/media/gpu/chromeos/mailbox_video_frame_converter_unittest.cc
index d89eba95cbc..f05c73838d6 100644
--- a/chromium/media/gpu/chromeos/mailbox_video_frame_converter_unittest.cc
+++ b/chromium/media/gpu/chromeos/mailbox_video_frame_converter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/oop_video_decoder.cc b/chromium/media/gpu/chromeos/oop_video_decoder.cc
index 471e077aba7..2b939e3b1e5 100644
--- a/chromium/media/gpu/chromeos/oop_video_decoder.cc
+++ b/chromium/media/gpu/chromeos/oop_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -164,7 +164,7 @@ void OOPVideoDecoder::Initialize(const VideoDecoderConfig& config,
InitCB init_cb,
const OutputCB& output_cb,
const WaitingCB& waiting_cb) {
- VLOGF(2);
+ DVLOGF(2) << config.AsHumanReadableString();
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CHECK(!init_cb_);
@@ -222,7 +222,8 @@ void OOPVideoDecoder::OnInitializeDone(const DecoderStatus& status,
CHECK(!has_error_);
if (!status.is_ok() ||
- (decoder_type != VideoDecoderType::kVaapi &&
+ (decoder_type != VideoDecoderType::kVda &&
+ decoder_type != VideoDecoderType::kVaapi &&
decoder_type != VideoDecoderType::kV4L2) ||
(decoder_type_ != VideoDecoderType::kUnknown &&
decoder_type_ != decoder_type)) {
@@ -235,7 +236,7 @@ void OOPVideoDecoder::OnInitializeDone(const DecoderStatus& status,
void OOPVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
DecodeCB decode_cb) {
- VLOGF(2);
+ DVLOGF(4);
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CHECK(!init_cb_);
@@ -279,6 +280,7 @@ void OOPVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
void OOPVideoDecoder::OnDecodeDone(uint64_t decode_id,
bool is_flushing,
const DecoderStatus& status) {
+ DVLOGF(4);
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CHECK(!has_error_);
@@ -306,7 +308,7 @@ void OOPVideoDecoder::OnDecodeDone(uint64_t decode_id,
}
void OOPVideoDecoder::Reset(base::OnceClosure reset_cb) {
- VLOGF(2);
+ DVLOGF(2);
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CHECK(!init_cb_);
@@ -427,7 +429,7 @@ void OOPVideoDecoder::OnVideoFrameDecoded(
const scoped_refptr<VideoFrame>& frame,
bool can_read_without_stalling,
const base::UnguessableToken& release_token) {
- VLOGF(2);
+ DVLOGF(4);
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CHECK(!has_error_);
@@ -451,7 +453,7 @@ void OOPVideoDecoder::OnVideoFrameDecoded(
}
void OOPVideoDecoder::OnWaiting(WaitingReason reason) {
- VLOGF(2);
+ DVLOGF(4);
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CHECK(!has_error_);
diff --git a/chromium/media/gpu/chromeos/oop_video_decoder.h b/chromium/media/gpu/chromeos/oop_video_decoder.h
index 0ca038a1766..7ec4bddd714 100644
--- a/chromium/media/gpu/chromeos/oop_video_decoder.h
+++ b/chromium/media/gpu/chromeos/oop_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/platform_video_frame_pool.cc b/chromium/media/gpu/chromeos/platform_video_frame_pool.cc
index 1f077cdaf67..882d2e5a0e0 100644
--- a/chromium/media/gpu/chromeos/platform_video_frame_pool.cc
+++ b/chromium/media/gpu/chromeos/platform_video_frame_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/platform_video_frame_pool.h b/chromium/media/gpu/chromeos/platform_video_frame_pool.h
index e16e9e4419f..9bcfefeb13d 100644
--- a/chromium/media/gpu/chromeos/platform_video_frame_pool.h
+++ b/chromium/media/gpu/chromeos/platform_video_frame_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/platform_video_frame_pool_unittest.cc b/chromium/media/gpu/chromeos/platform_video_frame_pool_unittest.cc
index 2428ae9465f..3452e85a838 100644
--- a/chromium/media/gpu/chromeos/platform_video_frame_pool_unittest.cc
+++ b/chromium/media/gpu/chromeos/platform_video_frame_pool_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/platform_video_frame_utils.cc b/chromium/media/gpu/chromeos/platform_video_frame_utils.cc
index 3b5fdac923c..602d88b801b 100644
--- a/chromium/media/gpu/chromeos/platform_video_frame_utils.cc
+++ b/chromium/media/gpu/chromeos/platform_video_frame_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/platform_video_frame_utils.h b/chromium/media/gpu/chromeos/platform_video_frame_utils.h
index af278c8ce3d..96cd0b1c335 100644
--- a/chromium/media/gpu/chromeos/platform_video_frame_utils.h
+++ b/chromium/media/gpu/chromeos/platform_video_frame_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/platform_video_frame_utils_unittest.cc b/chromium/media/gpu/chromeos/platform_video_frame_utils_unittest.cc
index fe3ff628261..d4c22b0c717 100644
--- a/chromium/media/gpu/chromeos/platform_video_frame_utils_unittest.cc
+++ b/chromium/media/gpu/chromeos/platform_video_frame_utils_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/vd_video_decode_accelerator.cc b/chromium/media/gpu/chromeos/vd_video_decode_accelerator.cc
index 804c99262ea..aec2ce99ad2 100644
--- a/chromium/media/gpu/chromeos/vd_video_decode_accelerator.cc
+++ b/chromium/media/gpu/chromeos/vd_video_decode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/memory/unsafe_shared_memory_region.h"
+#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "media/base/format_utils.h"
#include "media/base/media_util.h"
@@ -241,7 +242,10 @@ bool VdVideoDecodeAccelerator::Initialize(const Config& config,
if (!vd_) {
std::unique_ptr<VdaVideoFramePool> frame_pool =
std::make_unique<VdaVideoFramePool>(weak_this_, client_task_runner_);
- vd_ = create_vd_cb_.Run(client_task_runner_, std::move(frame_pool),
+ // TODO(b/238684141): Wire a meaningful GpuDriverBugWorkarounds or remove
+ // its use.
+ vd_ = create_vd_cb_.Run(gpu::GpuDriverBugWorkarounds(), client_task_runner_,
+ std::move(frame_pool),
std::make_unique<VideoFrameConverter>(),
std::make_unique<NullMediaLog>(),
/*oop_video_decoder=*/{});
@@ -532,13 +536,12 @@ void VdVideoDecodeAccelerator::ImportBufferForPicture(
gmb_handle));
auto buffer_format = VideoPixelFormatToGfxBufferFormat(pixel_format);
CHECK(buffer_format);
- // Usage is SCANOUT_VDA_WRITE because we are just wrapping the dmabuf in a
- // GpuMemoryBuffer. This buffer is just for decoding purposes, so having
- // the dmabufs mmapped is not necessary.
+ // Usage is SCANOUT_CPU_READ_WRITE because we may need to map the buffer in
+ // order to use the LibYUVImageProcessorBackend.
std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer =
gpu::GpuMemoryBufferSupport().CreateGpuMemoryBufferImplFromHandle(
std::move(gmb_handle), layout_->coded_size(), *buffer_format,
- gfx::BufferUsage::SCANOUT_VDA_WRITE, base::NullCallback());
+ gfx::BufferUsage::SCANOUT_CPU_READ_WRITE, base::NullCallback());
if (!gpu_memory_buffer) {
VLOGF(1) << "Failed to create GpuMemoryBuffer. format: "
<< gfx::BufferFormatToString(*buffer_format)
diff --git a/chromium/media/gpu/chromeos/vd_video_decode_accelerator.h b/chromium/media/gpu/chromeos/vd_video_decode_accelerator.h
index 264df424276..c901c245a58 100644
--- a/chromium/media/gpu/chromeos/vd_video_decode_accelerator.h
+++ b/chromium/media/gpu/chromeos/vd_video_decode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,6 +21,7 @@
#include "media/gpu/chromeos/dmabuf_video_frame_pool.h"
#include "media/gpu/chromeos/fourcc.h"
#include "media/gpu/chromeos/vda_video_frame_pool.h"
+#include "media/gpu/chromeos/video_decoder_pipeline.h"
#include "media/gpu/chromeos/video_frame_converter.h"
#include "media/gpu/media_gpu_export.h"
#include "media/mojo/mojom/stable/stable_video_decoder.mojom.h"
@@ -30,7 +31,6 @@
namespace media {
-class MediaLog;
class VideoFrame;
// Implements the VideoDecodeAccelerator backed by a VideoDecoder.
@@ -49,12 +49,7 @@ class MEDIA_GPU_EXPORT VdVideoDecodeAccelerator
public:
// Callback for creating VideoDecoder instance.
using CreateVideoDecoderCb =
- base::RepeatingCallback<std::unique_ptr<VideoDecoder>(
- scoped_refptr<base::SequencedTaskRunner>,
- std::unique_ptr<DmabufVideoFramePool>,
- std::unique_ptr<VideoFrameConverter>,
- std::unique_ptr<MediaLog>,
- mojo::PendingRemote<stable::mojom::StableVideoDecoder>)>;
+ base::RepeatingCallback<decltype(VideoDecoderPipeline::Create)>;
// Create VdVideoDecodeAccelerator instance, and call Initialize().
// Return nullptr if Initialize() failed.
diff --git a/chromium/media/gpu/chromeos/vda_video_frame_pool.cc b/chromium/media/gpu/chromeos/vda_video_frame_pool.cc
index 3c43957b04d..be0f22e8dff 100644
--- a/chromium/media/gpu/chromeos/vda_video_frame_pool.cc
+++ b/chromium/media/gpu/chromeos/vda_video_frame_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/vda_video_frame_pool.h b/chromium/media/gpu/chromeos/vda_video_frame_pool.h
index e23d36d705b..c2e467dc97e 100644
--- a/chromium/media/gpu/chromeos/vda_video_frame_pool.h
+++ b/chromium/media/gpu/chromeos/vda_video_frame_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/video_decoder_pipeline.cc b/chromium/media/gpu/chromeos/video_decoder_pipeline.cc
index c491e5f5ac8..c3143c5cfe6 100644
--- a/chromium/media/gpu/chromeos/video_decoder_pipeline.cc
+++ b/chromium/media/gpu/chromeos/video_decoder_pipeline.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,7 +18,6 @@
#include "base/task/thread_pool.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
-#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "media/base/async_destroy_video_decoder.h"
#include "media/base/bind_to_current_loop.h"
#include "media/base/limits.h"
@@ -47,10 +46,6 @@ namespace {
using PixelLayoutCandidate = ImageProcessor::PixelLayoutCandidate;
-// The number of requested frames used for the image processor should be the
-// number of frames in media::Pipeline plus the current processing frame.
-constexpr size_t kNumFramesForImageProcessor = limits::kMaxVideoFrames + 1;
-
// Preferred output formats in order of preference.
// TODO(mcasas): query the platform for its preferred formats and modifiers.
constexpr Fourcc kPreferredRenderableFourccs[] = {
@@ -185,6 +180,7 @@ bool VideoDecoderMixin::NeedsTranscryption() {
// static
std::unique_ptr<VideoDecoder> VideoDecoderPipeline::Create(
+ const gpu::GpuDriverBugWorkarounds& workarounds,
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter,
@@ -199,16 +195,17 @@ std::unique_ptr<VideoDecoder> VideoDecoderPipeline::Create(
create_decoder_function_cb =
base::BindOnce(&OOPVideoDecoder::Create, std::move(oop_video_decoder));
} else {
- create_decoder_function_cb =
#if BUILDFLAG(USE_VAAPI)
- base::BindOnce(&VaapiVideoDecoder::Create);
-#elif BUILDFLAG(USE_V4L2_CODEC)
- base::BindOnce(&V4L2VideoDecoder::Create);
+ create_decoder_function_cb = base::BindOnce(&VaapiVideoDecoder::Create);
+#elif BUILDFLAG(USE_V4L2_CODEC) && BUILDFLAG(IS_CHROMEOS_ASH)
+ create_decoder_function_cb = base::BindOnce(&V4L2VideoDecoder::Create);
+#else
+ return nullptr;
#endif
}
auto* pipeline = new VideoDecoderPipeline(
- std::move(client_task_runner), std::move(frame_pool),
+ workarounds, std::move(client_task_runner), std::move(frame_pool),
std::move(frame_converter), std::move(media_log),
std::move(create_decoder_function_cb));
return std::make_unique<AsyncDestroyVideoDecoder<VideoDecoderPipeline>>(
@@ -256,12 +253,14 @@ VideoDecoderPipeline::GetSupportedConfigs(
}
VideoDecoderPipeline::VideoDecoderPipeline(
+ const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter,
std::unique_ptr<MediaLog> media_log,
CreateDecoderFunctionCB create_decoder_function_cb)
- : client_task_runner_(std::move(client_task_runner)),
+ : gpu_workarounds_(gpu_workarounds),
+ client_task_runner_(std::move(client_task_runner)),
decoder_task_runner_(DecoderThreadPool::CreateTaskRunner()),
main_frame_pool_(std::move(frame_pool)),
frame_converter_(std::move(frame_converter)),
@@ -333,7 +332,9 @@ int VideoDecoderPipeline::GetMaxDecodeRequests() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
// TODO(mcasas): query |decoder_| instead.
- return 4;
+ // This value comes from the number of buffers in the input queue in
+ // V4L2VideoDecoder.
+ return 8;
}
bool VideoDecoderPipeline::FramesHoldExternalResources() const {
@@ -388,6 +389,25 @@ void VideoDecoderPipeline::Initialize(const VideoDecoderConfig& config,
}
#endif // !BUILDFLAG(USE_CHROMEOS_PROTECTED_MEDIA)
+ // Make sure that the configuration requested is supported by the driver,
+ // which must provide such information.
+ const auto supported_configs =
+ supported_configs_for_testing_.empty()
+ ? VideoDecoderPipeline::GetSupportedConfigs(gpu_workarounds_)
+ : supported_configs_for_testing_;
+ if (!supported_configs.has_value()) {
+ std::move(init_cb).Run(DecoderStatus::Codes::kUnsupportedConfig);
+ return;
+ }
+ if (!IsVideoDecoderConfigSupported(supported_configs.value(), config)) {
+ VLOGF(1) << "Video configuration is not supported: "
+ << config.AsHumanReadableString();
+ MEDIA_LOG(INFO, media_log_) << "Video configuration is not supported: "
+ << config.AsHumanReadableString();
+ std::move(init_cb).Run(DecoderStatus::Codes::kUnsupportedConfig);
+ return;
+ }
+
needs_bitstream_conversion_ = (config.codec() == VideoCodec::kH264) ||
(config.codec() == VideoCodec::kHEVC);
@@ -812,12 +832,12 @@ VideoDecoderPipeline::PickDecoderOutputFormat(
candidates,
/*input_visible_rect=*/decoder_visible_rect,
output_size ? *output_size : decoder_visible_rect.size(),
- kNumFramesForImageProcessor);
+ num_of_pictures);
} else {
image_processor = ImageProcessorFactory::CreateWithInputCandidates(
candidates, /*input_visible_rect=*/decoder_visible_rect,
output_size ? *output_size : decoder_visible_rect.size(),
- kNumFramesForImageProcessor, decoder_task_runner_,
+ num_of_pictures, decoder_task_runner_,
base::BindRepeating(&PickRenderableFourcc),
BindToCurrentLoop(base::BindRepeating(&VideoDecoderPipeline::OnError,
decoder_weak_this_,
@@ -858,8 +878,8 @@ VideoDecoderPipeline::PickDecoderOutputFormat(
// TODO(b/203240043): Add CHECKs to verify that the image processor is being
// created for only valid use cases. Writing to a linear output buffer, e.g.
auto status_or_image_processor = ImageProcessorWithPool::Create(
- std::move(image_processor), main_frame_pool_.get(),
- kNumFramesForImageProcessor, use_protected, decoder_task_runner_);
+ std::move(image_processor), main_frame_pool_.get(), num_of_pictures,
+ use_protected, decoder_task_runner_);
if (status_or_image_processor.has_error()) {
DVLOGF(2) << "Unable to create ImageProcessorWithPool.";
return std::move(status_or_image_processor).error();
diff --git a/chromium/media/gpu/chromeos/video_decoder_pipeline.h b/chromium/media/gpu/chromeos/video_decoder_pipeline.h
index 2435f8abf21..750154095ad 100644
--- a/chromium/media/gpu/chromeos/video_decoder_pipeline.h
+++ b/chromium/media/gpu/chromeos/video_decoder_pipeline.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "base/sequence_checker.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "media/base/cdm_context.h"
#include "media/base/supported_video_decoder_config.h"
#include "media/base/video_decoder.h"
@@ -34,10 +35,6 @@ namespace base {
class SequencedTaskRunner;
}
-namespace gpu {
-class GpuDriverBugWorkarounds;
-}
-
namespace media {
class DmabufVideoFramePool;
@@ -142,6 +139,7 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder,
// Creates a VideoDecoderPipeline instance that allocates VideoFrames from
// |frame_pool| and converts the decoded VideoFrames using |frame_converter|.
static std::unique_ptr<VideoDecoder> Create(
+ const gpu::GpuDriverBugWorkarounds& workarounds,
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter,
@@ -191,6 +189,7 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder,
#endif
VideoDecoderPipeline(
+ const gpu::GpuDriverBugWorkarounds& workarounds,
scoped_refptr<base::SequencedTaskRunner> client_task_runner,
std::unique_ptr<DmabufVideoFramePool> frame_pool,
std::unique_ptr<VideoFrameConverter> frame_converter,
@@ -239,6 +238,11 @@ class MEDIA_GPU_EXPORT VideoDecoderPipeline : public VideoDecoder,
DecodeCB decode_callback);
#endif // BUILDFLAG(IS_CHROMEOS)
+ // Used to figure out the supported configurations in Initialize().
+ const gpu::GpuDriverBugWorkarounds gpu_workarounds_;
+
+ SupportedVideoDecoderConfigs supported_configs_for_testing_;
+
// The client task runner and its sequence checker. All public methods should
// run on this task runner.
const scoped_refptr<base::SequencedTaskRunner> client_task_runner_;
diff --git a/chromium/media/gpu/chromeos/video_decoder_pipeline_unittest.cc b/chromium/media/gpu/chromeos/video_decoder_pipeline_unittest.cc
index b3875cb258b..3db87ad67d5 100644
--- a/chromium/media/gpu/chromeos/video_decoder_pipeline_unittest.cc
+++ b/chromium/media/gpu/chromeos/video_decoder_pipeline_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,6 +14,7 @@
#include "base/test/task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
+#include "gpu/config/gpu_driver_bug_workarounds.h"
#include "media/base/cdm_context.h"
#include "media/base/media_util.h"
#include "media/base/mock_filters.h"
@@ -72,8 +73,6 @@ class MockVideoFramePool : public DmabufVideoFramePool {
bool IsFakeVideoFramePool() override { return true; }
};
-constexpr gfx::Size kCodedSize(48, 36);
-
class MockDecoder : public VideoDecoderMixin {
public:
MockDecoder()
@@ -156,6 +155,16 @@ struct DecoderPipelineTestParams {
DecoderStatus::Codes status_code;
};
+constexpr gfx::Size kMinSupportedResolution(64, 64);
+constexpr gfx::Size kMaxSupportedResolution(2048, 1088);
+constexpr gfx::Size kCodedSize(128, 128);
+
+static_assert(kMinSupportedResolution.width() <= kCodedSize.width() &&
+ kMinSupportedResolution.height() <= kCodedSize.height() &&
+ kCodedSize.width() <= kMaxSupportedResolution.width() &&
+ kCodedSize.height() <= kMaxSupportedResolution.height(),
+ "kCodedSize must be within the supported resolutions.");
+
class VideoDecoderPipelineTest
: public testing::TestWithParam<DecoderPipelineTestParams> {
public:
@@ -174,10 +183,18 @@ class VideoDecoderPipelineTest
auto pool = std::make_unique<MockVideoFramePool>();
pool_ = pool.get();
decoder_ = base::WrapUnique(new VideoDecoderPipeline(
- base::ThreadTaskRunnerHandle::Get(), std::move(pool),
- std::move(converter_), std::make_unique<MockMediaLog>(),
+ gpu::GpuDriverBugWorkarounds(), base::ThreadTaskRunnerHandle::Get(),
+ std::move(pool), std::move(converter_),
+ std::make_unique<MockMediaLog>(),
// This callback needs to be configured in the individual tests.
base::BindOnce(&VideoDecoderPipelineTest::CreateNullMockDecoder)));
+
+ SetSupportedVideoDecoderConfigs({SupportedVideoDecoderConfig(
+ /*profile_min,=*/VP8PROFILE_ANY,
+ /*profile_max=*/VP8PROFILE_ANY, kMinSupportedResolution,
+ kMaxSupportedResolution,
+ /*allow_encrypted=*/true,
+ /*require_encrypted=*/false)});
}
~VideoDecoderPipelineTest() override = default;
@@ -310,6 +327,11 @@ class VideoDecoderPipelineTest
return decoder_->decoder_.get();
}
+ void SetSupportedVideoDecoderConfigs(
+ const SupportedVideoDecoderConfigs& configs) {
+ decoder_->supported_configs_for_testing_ = configs;
+ }
+
void DetachDecoderSequenceChecker() NO_THREAD_SAFETY_ANALYSIS {
// |decoder_| will be destroyed on its |decoder_task_runner| via
// DestroyAsync(). This will trip its |decoder_sequence_checker_| if it has
@@ -399,6 +421,24 @@ INSTANTIATE_TEST_SUITE_P(All,
VideoDecoderPipelineTest,
testing::ValuesIn(kDecoderPipelineTestParams));
+// Verifies that trying to Initialize() with a non-supported config fails.
+TEST_F(VideoDecoderPipelineTest, InitializeFailsDueToNotSupportedConfig) {
+ // Configure the supported configs to something that we know is not supported,
+ // e.g. making the smallest supported resolution larger than the |config_|
+ // we'll be requesting.
+ SetSupportedVideoDecoderConfigs({SupportedVideoDecoderConfig(
+ /*profile_min=*/config_.profile(),
+ /*profile_max=*/config_.profile(),
+ /*coded_size_min=*/config_.coded_size() + gfx::Size(1, 1),
+ kMaxSupportedResolution,
+ /*allow_encrypted=*/true,
+ /*require_encrypted=*/false)});
+
+ InitializeDecoder(
+ base::BindOnce(&VideoDecoderPipelineTest::CreateGoodMockDecoder),
+ DecoderStatus::Codes::kUnsupportedConfig);
+}
+
// Verifies the Reset sequence.
TEST_F(VideoDecoderPipelineTest, Reset) {
InitializeDecoder(
diff --git a/chromium/media/gpu/chromeos/video_frame_converter.cc b/chromium/media/gpu/chromeos/video_frame_converter.cc
index 3482e082c8a..6f191713114 100644
--- a/chromium/media/gpu/chromeos/video_frame_converter.cc
+++ b/chromium/media/gpu/chromeos/video_frame_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/chromeos/video_frame_converter.h b/chromium/media/gpu/chromeos/video_frame_converter.h
index bbd86818a01..5ccd2b665f3 100644
--- a/chromium/media/gpu/chromeos/video_frame_converter.h
+++ b/chromium/media/gpu/chromeos/video_frame_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/codec_picture.cc b/chromium/media/gpu/codec_picture.cc
index e42bd5096df..db36c663a7e 100644
--- a/chromium/media/gpu/codec_picture.cc
+++ b/chromium/media/gpu/codec_picture.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/codec_picture.h b/chromium/media/gpu/codec_picture.h
index 285131119cc..872920992c4 100644
--- a/chromium/media/gpu/codec_picture.h
+++ b/chromium/media/gpu/codec_picture.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/command_buffer_helper.cc b/chromium/media/gpu/command_buffer_helper.cc
index 175adf521d4..adfe94f7f3f 100644
--- a/chromium/media/gpu/command_buffer_helper.cc
+++ b/chromium/media/gpu/command_buffer_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -184,19 +184,6 @@ class CommandBufferHelperImpl
return decoder_helper_->CreateMailbox(textures_[service_id].get());
}
- void ProduceTexture(const gpu::Mailbox& mailbox, GLuint service_id) override {
- DVLOG(2) << __func__ << "(" << mailbox.ToDebugString() << ", " << service_id
- << ")";
- DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
-
- if (!decoder_helper_)
- return;
-
- DCHECK(textures_.count(service_id));
- return decoder_helper_->ProduceTexture(mailbox,
- textures_[service_id].get());
- }
-
void WaitForSyncToken(gpu::SyncToken sync_token,
base::OnceClosure done_cb) override {
DVLOG(2) << __func__;
diff --git a/chromium/media/gpu/command_buffer_helper.h b/chromium/media/gpu/command_buffer_helper.h
index 1b45ba3420f..43e034c32ad 100644
--- a/chromium/media/gpu/command_buffer_helper.h
+++ b/chromium/media/gpu/command_buffer_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -122,11 +122,6 @@ class MEDIA_GPU_EXPORT CommandBufferHelper
// be to add a HasStub() method, and not define behavior when it is false.
virtual gpu::Mailbox CreateMailbox(GLuint service_id) = 0;
- // Produce a texture into a mailbox. The context does not have to be current.
- // However, this will fail if the stub has been destroyed.
- virtual void ProduceTexture(const gpu::Mailbox& mailbox,
- GLuint service_id) = 0;
-
// Waits for a SyncToken, then runs |done_cb|.
//
// |done_cb| may be destructed without running if the stub is destroyed.
diff --git a/chromium/media/gpu/decode_surface_handler.h b/chromium/media/gpu/decode_surface_handler.h
index 76f953d4b57..9721bcf8b5b 100644
--- a/chromium/media/gpu/decode_surface_handler.h
+++ b/chromium/media/gpu/decode_surface_handler.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/gles2_decoder_helper.cc b/chromium/media/gpu/gles2_decoder_helper.cc
index 8d6317d5e04..0722cd80b7f 100644
--- a/chromium/media/gpu/gles2_decoder_helper.cc
+++ b/chromium/media/gpu/gles2_decoder_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -88,12 +88,6 @@ class GLES2DecoderHelperImpl : public GLES2DecoderHelper {
return mailbox;
}
- void ProduceTexture(const gpu::Mailbox& mailbox,
- AbstractTexture* texture) override {
- DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
- mailbox_manager_->ProduceTexture(mailbox, texture->GetTextureBase());
- }
-
private:
raw_ptr<gpu::DecoderContext> decoder_;
raw_ptr<gpu::MailboxManager> mailbox_manager_;
diff --git a/chromium/media/gpu/gles2_decoder_helper.h b/chromium/media/gpu/gles2_decoder_helper.h
index 0c84e31bed9..c3fe8d45dce 100644
--- a/chromium/media/gpu/gles2_decoder_helper.h
+++ b/chromium/media/gpu/gles2_decoder_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -61,10 +61,6 @@ class MEDIA_GPU_EXPORT GLES2DecoderHelper {
// Creates a mailbox for a texture.
virtual gpu::Mailbox CreateMailbox(
gpu::gles2::AbstractTexture* texture_ref) = 0;
-
- // Produce a texture into a mailbox.
- virtual void ProduceTexture(const gpu::Mailbox& mailbox,
- gpu::gles2::AbstractTexture* texture_ref) = 0;
};
} // namespace media
diff --git a/chromium/media/gpu/gpu_video_accelerator_util.cc b/chromium/media/gpu/gpu_video_accelerator_util.cc
index b6fceed7346..effec2494ce 100644
--- a/chromium/media/gpu/gpu_video_accelerator_util.cc
+++ b/chromium/media/gpu/gpu_video_accelerator_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/gpu_video_accelerator_util.h b/chromium/media/gpu/gpu_video_accelerator_util.h
index c365165f259..2af646790da 100644
--- a/chromium/media/gpu/gpu_video_accelerator_util.h
+++ b/chromium/media/gpu/gpu_video_accelerator_util.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc b/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc
index 4785d49e88b..92b9fcde813 100644
--- a/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc
+++ b/chromium/media/gpu/gpu_video_decode_accelerator_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -27,7 +27,7 @@
#if BUILDFLAG(USE_VAAPI)
#include "media/gpu/vaapi/vaapi_video_decode_accelerator.h"
#include "ui/gl/gl_implementation.h"
-#elif BUILDFLAG(USE_V4L2_CODEC)
+#elif BUILDFLAG(USE_V4L2_CODEC) && BUILDFLAG(IS_CHROMEOS_ASH)
#include "media/gpu/v4l2/v4l2_device.h"
#include "media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h"
#include "media/gpu/v4l2/v4l2_video_decode_accelerator.h"
@@ -60,7 +60,7 @@ gpu::VideoDecodeAcceleratorCapabilities GetDecoderCapabilitiesInternal(
#if BUILDFLAG(USE_VAAPI)
capabilities.supported_profiles =
VaapiVideoDecodeAccelerator::GetSupportedProfiles();
-#elif BUILDFLAG(USE_V4L2_CODEC)
+#elif BUILDFLAG(USE_V4L2_CODEC) && BUILDFLAG(IS_CHROMEOS_ASH)
GpuVideoAcceleratorUtil::InsertUniqueDecodeProfiles(
V4L2VideoDecodeAccelerator::GetSupportedProfiles(),
&capabilities.supported_profiles);
@@ -99,7 +99,7 @@ GpuVideoDecodeAcceleratorFactory::GetDecoderCapabilities(
static gpu::VideoDecodeAcceleratorCapabilities capabilities =
GetDecoderCapabilitiesInternal(gpu_preferences, workarounds);
-#if BUILDFLAG(USE_V4L2_CODEC)
+#if BUILDFLAG(USE_V4L2_CODEC) && BUILDFLAG(IS_CHROMEOS_ASH)
// V4L2-only: the decoder devices may not be visible at the time the GPU
// process is starting. If the capabilities vector is empty, try to query the
// devices again in the hope that they will have appeared in the meantime.
@@ -144,7 +144,7 @@ GpuVideoDecodeAcceleratorFactory::CreateVDA(
// both. In those cases prefer the VA creation function.
#if BUILDFLAG(USE_VAAPI)
&GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA,
-#elif BUILDFLAG(USE_V4L2_CODEC)
+#elif BUILDFLAG(USE_V4L2_CODEC) && BUILDFLAG(IS_CHROMEOS_ASH)
&GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA,
&GpuVideoDecodeAcceleratorFactory::CreateV4L2SliceVDA,
#endif
@@ -191,7 +191,7 @@ GpuVideoDecodeAcceleratorFactory::CreateVaapiVDA(
gl_client_.bind_image));
return decoder;
}
-#elif BUILDFLAG(USE_V4L2_CODEC)
+#elif BUILDFLAG(USE_V4L2_CODEC) && BUILDFLAG(IS_CHROMEOS_ASH)
std::unique_ptr<VideoDecodeAccelerator>
GpuVideoDecodeAcceleratorFactory::CreateV4L2VDA(
const gpu::GpuDriverBugWorkarounds& /*workarounds*/,
diff --git a/chromium/media/gpu/gpu_video_decode_accelerator_factory.h b/chromium/media/gpu/gpu_video_decode_accelerator_factory.h
index b2e1390c5f0..7f3bb5d86a6 100644
--- a/chromium/media/gpu/gpu_video_decode_accelerator_factory.h
+++ b/chromium/media/gpu/gpu_video_decode_accelerator_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -99,7 +99,7 @@ class MEDIA_GPU_EXPORT GpuVideoDecodeAcceleratorFactory {
const gpu::GpuDriverBugWorkarounds& workarounds,
const gpu::GpuPreferences& gpu_preferences,
MediaLog* media_log) const;
-#elif BUILDFLAG(USE_V4L2_CODEC)
+#elif BUILDFLAG(USE_V4L2_CODEC) && BUILDFLAG(IS_CHROMEOS_ASH)
std::unique_ptr<VideoDecodeAccelerator> CreateV4L2VDA(
const gpu::GpuDriverBugWorkarounds& workarounds,
const gpu::GpuPreferences& gpu_preferences,
diff --git a/chromium/media/gpu/gpu_video_decode_accelerator_helpers.cc b/chromium/media/gpu/gpu_video_decode_accelerator_helpers.cc
index 2de95be733c..98223ba1ee2 100644
--- a/chromium/media/gpu/gpu_video_decode_accelerator_helpers.cc
+++ b/chromium/media/gpu/gpu_video_decode_accelerator_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/gpu_video_decode_accelerator_helpers.h b/chromium/media/gpu/gpu_video_decode_accelerator_helpers.h
index 9cb4c981c27..ccab7912905 100644
--- a/chromium/media/gpu/gpu_video_decode_accelerator_helpers.h
+++ b/chromium/media/gpu/gpu_video_decode_accelerator_helpers.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/gpu_video_encode_accelerator_factory.cc b/chromium/media/gpu/gpu_video_encode_accelerator_factory.cc
index 84fc5725b5e..03dd1e84d45 100644
--- a/chromium/media/gpu/gpu_video_encode_accelerator_factory.cc
+++ b/chromium/media/gpu/gpu_video_encode_accelerator_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -137,8 +137,7 @@ std::vector<VEAFactoryFunction> GetVEAFactoryFunctions(
VideoEncodeAccelerator::SupportedProfiles GetSupportedProfilesInternal(
const gpu::GpuPreferences& gpu_preferences,
const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
- const gpu::GPUInfo::GPUDevice& gpu_device,
- bool populate_extended_info) {
+ const gpu::GPUInfo::GPUDevice& gpu_device) {
if (gpu_preferences.disable_accelerated_video_encode)
return VideoEncodeAccelerator::SupportedProfiles();
@@ -148,9 +147,7 @@ VideoEncodeAccelerator::SupportedProfiles GetSupportedProfilesInternal(
auto vea = std::move(create_vea).Run();
if (!vea)
continue;
- auto vea_profiles = populate_extended_info
- ? vea->GetSupportedProfiles()
- : vea->GetSupportedProfilesLight();
+ auto vea_profiles = vea->GetSupportedProfiles();
GpuVideoAcceleratorUtil::InsertUniqueEncodeProfiles(vea_profiles,
&profiles);
}
@@ -192,22 +189,12 @@ MEDIA_GPU_EXPORT VideoEncodeAccelerator::SupportedProfiles
GpuVideoEncodeAcceleratorFactory::GetSupportedProfiles(
const gpu::GpuPreferences& gpu_preferences,
const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
- const gpu::GPUInfo::GPUDevice& gpu_device,
- bool populate_extended_info) {
+ const gpu::GPUInfo::GPUDevice& gpu_device) {
// Cache the supported profiles so that they will not be computed more than
// once per GPU process. It is assumed that |gpu_preferences| do not change
// between calls.
- VideoEncodeAccelerator::SupportedProfiles* profiles_ptr = nullptr;
- if (populate_extended_info) {
- static auto profiles = GetSupportedProfilesInternal(
- gpu_preferences, gpu_workarounds, gpu_device, true);
- profiles_ptr = &profiles;
-
- } else {
- static auto profiles = GetSupportedProfilesInternal(
- gpu_preferences, gpu_workarounds, gpu_device, false);
- profiles_ptr = &profiles;
- }
+ static auto profiles = GetSupportedProfilesInternal(
+ gpu_preferences, gpu_workarounds, gpu_device);
#if BUILDFLAG(USE_V4L2_CODEC)
// V4L2-only: the encoder devices may not be visible at the time the GPU
@@ -215,39 +202,45 @@ GpuVideoEncodeAcceleratorFactory::GetSupportedProfiles(
// devices again in the hope that they will have appeared in the meantime.
// TODO(crbug.com/948147): trigger query when an device add/remove event
// (e.g. via udev) has happened instead.
- if (profiles_ptr->empty()) {
+ if (profiles.empty()) {
VLOGF(1) << "Supported profiles empty, querying again...";
- *profiles_ptr = GetSupportedProfilesInternal(
- gpu_preferences, gpu_workarounds, gpu_device, populate_extended_info);
+ profiles = GetSupportedProfilesInternal(gpu_preferences, gpu_workarounds, gpu_device);
}
#endif
+ if (gpu_workarounds.disable_accelerated_av1_encode) {
+ base::EraseIf(profiles, [](const auto& vea_profile) {
+ return vea_profile.profile >= AV1PROFILE_PROFILE_MAIN &&
+ vea_profile.profile <= AV1PROFILE_PROFILE_PRO;
+ });
+ }
+
if (gpu_workarounds.disable_accelerated_vp8_encode) {
- base::EraseIf(*profiles_ptr, [](const auto& vea_profile) {
+ base::EraseIf(profiles, [](const auto& vea_profile) {
return vea_profile.profile == VP8PROFILE_ANY;
});
}
if (gpu_workarounds.disable_accelerated_vp9_encode) {
- base::EraseIf(*profiles_ptr, [](const auto& vea_profile) {
+ base::EraseIf(profiles, [](const auto& vea_profile) {
return vea_profile.profile >= VP9PROFILE_PROFILE0 &&
vea_profile.profile <= VP9PROFILE_PROFILE3;
});
}
if (gpu_workarounds.disable_accelerated_h264_encode) {
- base::EraseIf(*profiles_ptr, [](const auto& vea_profile) {
+ base::EraseIf(profiles, [](const auto& vea_profile) {
return vea_profile.profile >= H264PROFILE_MIN &&
vea_profile.profile <= H264PROFILE_MAX;
});
}
- base::EraseIf(*profiles_ptr, [](const auto& vea_profile) {
+ base::EraseIf(profiles, [](const auto& vea_profile) {
return vea_profile.profile >= HEVCPROFILE_MIN &&
vea_profile.profile <= HEVCPROFILE_MAX;
});
- return *profiles_ptr;
+ return profiles;
}
} // namespace media
diff --git a/chromium/media/gpu/gpu_video_encode_accelerator_factory.h b/chromium/media/gpu/gpu_video_encode_accelerator_factory.h
index 87d487cec54..83456d75849 100644
--- a/chromium/media/gpu/gpu_video_encode_accelerator_factory.h
+++ b/chromium/media/gpu/gpu_video_encode_accelerator_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -38,13 +38,10 @@ class MEDIA_GPU_EXPORT GpuVideoEncodeAcceleratorFactory {
std::unique_ptr<MediaLog> media_log = nullptr);
// Gets the supported codec profiles for video encoding on the platform.
- // If |populate_extended_info| it false, this function will only populate:
- // codec, framerate range and resolution range. It's faster.
static VideoEncodeAccelerator::SupportedProfiles GetSupportedProfiles(
const gpu::GpuPreferences& gpu_preferences,
const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
- const gpu::GPUInfo::GPUDevice& gpu_device,
- bool populate_extended_info = true);
+ const gpu::GPUInfo::GPUDevice& gpu_device);
};
} // namespace media
diff --git a/chromium/media/gpu/gpu_video_encode_accelerator_helpers.cc b/chromium/media/gpu/gpu_video_encode_accelerator_helpers.cc
index f9221bf18da..13fe64ddcb2 100644
--- a/chromium/media/gpu/gpu_video_encode_accelerator_helpers.cc
+++ b/chromium/media/gpu/gpu_video_encode_accelerator_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/gpu_video_encode_accelerator_helpers.h b/chromium/media/gpu/gpu_video_encode_accelerator_helpers.h
index 32d88109e28..9d0de9f041b 100644
--- a/chromium/media/gpu/gpu_video_encode_accelerator_helpers.h
+++ b/chromium/media/gpu/gpu_video_encode_accelerator_helpers.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/h264_decoder.cc b/chromium/media/gpu/h264_decoder.cc
index 389c29f0cee..6dc535f4ce9 100644
--- a/chromium/media/gpu/h264_decoder.cc
+++ b/chromium/media/gpu/h264_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -152,8 +152,8 @@ void H264Decoder::Reset() {
accelerator_->Reset();
last_output_poc_ = std::numeric_limits<int>::min();
- encrypted_sei_nalus_.clear();
- sei_subsamples_.clear();
+ prior_cencv1_nalus_.clear();
+ prior_cencv1_subsamples_.clear();
recovery_frame_num_.reset();
recovery_frame_cnt_.reset();
@@ -1294,15 +1294,27 @@ H264Decoder::H264Accelerator::Status H264Decoder::ProcessEncryptedSliceHeader(
const std::vector<SubsampleEntry>& subsamples) {
DCHECK(curr_nalu_);
DCHECK(curr_slice_hdr_);
- std::vector<base::span<const uint8_t>> spans(encrypted_sei_nalus_.size() + 1);
- spans.assign(encrypted_sei_nalus_.begin(), encrypted_sei_nalus_.end());
+ std::vector<base::span<const uint8_t>> spans(prior_cencv1_nalus_.begin(),
+ prior_cencv1_nalus_.end());
spans.emplace_back(curr_nalu_->data, curr_nalu_->size);
- std::vector<SubsampleEntry> all_subsamples(sei_subsamples_.size() + 1);
- all_subsamples.assign(sei_subsamples_.begin(), sei_subsamples_.end());
+ std::vector<SubsampleEntry> all_subsamples(prior_cencv1_subsamples_.begin(),
+ prior_cencv1_subsamples_.end());
all_subsamples.insert(all_subsamples.end(), subsamples.begin(),
subsamples.end());
- return accelerator_->ParseEncryptedSliceHeader(spans, all_subsamples,
- curr_slice_hdr_.get());
+ auto rv = accelerator_->ParseEncryptedSliceHeader(spans, all_subsamples,
+ curr_slice_hdr_.get());
+ // Return now if this isn't fully processed and don't store the NALU info
+ // since we will get called again in the kTryAgain case, and on an error we
+ // want to exist.
+ if (rv != H264Accelerator::Status::kOk)
+ return rv;
+
+ // Insert this encrypted slice data as well in case this is a multi-slice
+ // picture.
+ prior_cencv1_nalus_.emplace_back(curr_nalu_->data, curr_nalu_->size);
+ prior_cencv1_subsamples_.insert(prior_cencv1_subsamples_.end(),
+ subsamples.begin(), subsamples.end());
+ return rv;
}
H264Decoder::H264Accelerator::Status H264Decoder::PreprocessCurrentSlice() {
@@ -1405,8 +1417,8 @@ void H264Decoder::SetStream(int32_t id, const DecoderBuffer& decoder_buffer) {
current_stream_ = ptr;
current_stream_size_ = size;
current_stream_has_been_changed_ = true;
- encrypted_sei_nalus_.clear();
- sei_subsamples_.clear();
+ prior_cencv1_nalus_.clear();
+ prior_cencv1_subsamples_.clear();
if (decrypt_config) {
parser_.SetEncryptedStream(ptr, size, decrypt_config->subsamples());
current_decrypt_config_ = decrypt_config->Clone();
@@ -1504,8 +1516,6 @@ H264Decoder::DecodeResult H264Decoder::Decode() {
CHECK_ACCELERATOR_RESULT(ProcessEncryptedSliceHeader(subsamples));
parsed_header = true;
curr_slice_hdr_->pic_parameter_set_id = last_parsed_pps_id_;
- encrypted_sei_nalus_.clear();
- sei_subsamples_.clear();
}
}
if (!parsed_header) {
@@ -1610,10 +1620,10 @@ H264Decoder::DecodeResult H264Decoder::Decode() {
const std::vector<SubsampleEntry>& subsamples =
parser_.GetCurrentSubsamples();
if (!subsamples.empty()) {
- encrypted_sei_nalus_.emplace_back(curr_nalu_->data,
- curr_nalu_->size);
+ prior_cencv1_nalus_.emplace_back(curr_nalu_->data,
+ curr_nalu_->size);
DCHECK_EQ(1u, subsamples.size());
- sei_subsamples_.push_back(subsamples[0]);
+ prior_cencv1_subsamples_.push_back(subsamples[0]);
// Since the SEI is encrypted, do not try to parse it below as it
// may fail or yield incorrect results.
DVLOG(3) << "Skipping parsing of encrypted SEI NALU";
@@ -1761,7 +1771,10 @@ bool H264Decoder::IsNewPrimaryCodedPicture(const H264Picture* curr_pic,
// but some encoders neglect changing idr_pic_id for two consecutive
// IDRs. Work around this by checking if the next slice contains the
// zeroth macroblock, i.e. data that belongs to the next picture.
- slice_hdr.first_mb_in_slice == 0)))
+ // Do not perform this check for CENCv1 encrypted content as the
+ // first_mb_in_slice field is not correctly populated in that case.
+ (slice_hdr.first_mb_in_slice == 0 &&
+ !slice_hdr.full_sample_encryption))))
return true;
if (!sps)
diff --git a/chromium/media/gpu/h264_decoder.h b/chromium/media/gpu/h264_decoder.h
index 3f7643fba2b..d17afbef695 100644
--- a/chromium/media/gpu/h264_decoder.h
+++ b/chromium/media/gpu/h264_decoder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -390,11 +390,11 @@ class MEDIA_GPU_EXPORT H264Decoder : public AcceleratedVideoDecoder {
std::unique_ptr<H264NALU> curr_nalu_;
std::unique_ptr<H264SliceHeader> curr_slice_hdr_;
- // Encrypted SEI NALUs preceding a fully encrypted slice NALU. We need to
+ // Encrypted NALUs preceding a fully encrypted (CENCv1) slice NALU. We need to
// save these that are part of a single sample so they can all be decrypted
// together.
- std::vector<base::span<const uint8_t>> encrypted_sei_nalus_;
- std::vector<SubsampleEntry> sei_subsamples_;
+ std::vector<base::span<const uint8_t>> prior_cencv1_nalus_;
+ std::vector<SubsampleEntry> prior_cencv1_subsamples_;
// These are absl::nullopt unless get recovery point SEI message after Reset.
// A frame_num of the frame at output order that is correct in content.
diff --git a/chromium/media/gpu/h264_decoder_unittest.cc b/chromium/media/gpu/h264_decoder_unittest.cc
index 823e8780d7f..7636eb20f2c 100644
--- a/chromium/media/gpu/h264_decoder_unittest.cc
+++ b/chromium/media/gpu/h264_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/h264_dpb.cc b/chromium/media/gpu/h264_dpb.cc
index 6a677547fdc..f7ec30fc6a8 100644
--- a/chromium/media/gpu/h264_dpb.cc
+++ b/chromium/media/gpu/h264_dpb.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/h264_dpb.h b/chromium/media/gpu/h264_dpb.h
index a68b96baeec..8b9aa812a25 100644
--- a/chromium/media/gpu/h264_dpb.h
+++ b/chromium/media/gpu/h264_dpb.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/gpu/h265_decoder.cc b/chromium/media/gpu/h265_decoder.cc
index f9f9d7bb75e..7ae6ff43b05 100644
--- a/chromium/media/gpu/h265_decoder.cc
+++ b/chromium/media/gpu/h265_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/h265_decoder.h b/chromium/media/gpu/h265_decoder.h
index 973b130199a..59c4aac56ef 100644
--- a/chromium/media/gpu/h265_decoder.h
+++ b/chromium/media/gpu/h265_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/h265_decoder_fuzzertest.cc b/chromium/media/gpu/h265_decoder_fuzzertest.cc
index fd25e61adeb..1be447c7a4f 100644
--- a/chromium/media/gpu/h265_decoder_fuzzertest.cc
+++ b/chromium/media/gpu/h265_decoder_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/h265_decoder_unittest.cc b/chromium/media/gpu/h265_decoder_unittest.cc
index 7a6150901fa..56904f5375b 100644
--- a/chromium/media/gpu/h265_decoder_unittest.cc
+++ b/chromium/media/gpu/h265_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/h265_dpb.cc b/chromium/media/gpu/h265_dpb.cc
index 1a7f40158f0..e060bcee7e0 100644
--- a/chromium/media/gpu/h265_dpb.cc
+++ b/chromium/media/gpu/h265_dpb.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/h265_dpb.h b/chromium/media/gpu/h265_dpb.h
index 9d55528f85e..64f0f1b5bd5 100644
--- a/chromium/media/gpu/h265_dpb.h
+++ b/chromium/media/gpu/h265_dpb.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/client/BUILD.gn b/chromium/media/gpu/ipc/client/BUILD.gn
index b91049428bc..29164df39cb 100644
--- a/chromium/media/gpu/ipc/client/BUILD.gn
+++ b/chromium/media/gpu/ipc/client/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc b/chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc
index bdbbd77cb1c..91df424e703 100644
--- a/chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc
+++ b/chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.h b/chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.h
index b1bf1b01fc8..29e919732e3 100644
--- a/chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.h
+++ b/chromium/media/gpu/ipc/client/gpu_video_decode_accelerator_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/common/BUILD.gn b/chromium/media/gpu/ipc/common/BUILD.gn
index 226bfe81015..416ab6220f0 100644
--- a/chromium/media/gpu/ipc/common/BUILD.gn
+++ b/chromium/media/gpu/ipc/common/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/common/media_param_traits.cc b/chromium/media/gpu/ipc/common/media_param_traits.cc
index e7f057acf8a..82698589cc9 100644
--- a/chromium/media/gpu/ipc/common/media_param_traits.cc
+++ b/chromium/media/gpu/ipc/common/media_param_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/common/media_param_traits.h b/chromium/media/gpu/ipc/common/media_param_traits.h
index 8d8bb1dc80b..48fe6865332 100644
--- a/chromium/media/gpu/ipc/common/media_param_traits.h
+++ b/chromium/media/gpu/ipc/common/media_param_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/common/media_param_traits_macros.h b/chromium/media/gpu/ipc/common/media_param_traits_macros.h
index a15d8d03cd6..02f43993f72 100644
--- a/chromium/media/gpu/ipc/common/media_param_traits_macros.h
+++ b/chromium/media/gpu/ipc/common/media_param_traits_macros.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/service/BUILD.gn b/chromium/media/gpu/ipc/service/BUILD.gn
index 90d8ccdb66f..8542b352c23 100644
--- a/chromium/media/gpu/ipc/service/BUILD.gn
+++ b/chromium/media/gpu/ipc/service/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.cc b/chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
index 0c203bef158..05816d5cb90 100644
--- a/chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
+++ b/chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.h b/chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.h
index f45fa83f8e5..75472c9acb0 100644
--- a/chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.h
+++ b/chromium/media/gpu/ipc/service/gpu_video_decode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/service/media_gpu_channel.cc b/chromium/media/gpu/ipc/service/media_gpu_channel.cc
index 885d9db8d36..75b7296de64 100644
--- a/chromium/media/gpu/ipc/service/media_gpu_channel.cc
+++ b/chromium/media/gpu/ipc/service/media_gpu_channel.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/service/media_gpu_channel.h b/chromium/media/gpu/ipc/service/media_gpu_channel.h
index 41b48a38ec0..cd91d970130 100644
--- a/chromium/media/gpu/ipc/service/media_gpu_channel.h
+++ b/chromium/media/gpu/ipc/service/media_gpu_channel.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/service/media_gpu_channel_manager.cc b/chromium/media/gpu/ipc/service/media_gpu_channel_manager.cc
index abe2700d9a0..4a5d387f098 100644
--- a/chromium/media/gpu/ipc/service/media_gpu_channel_manager.cc
+++ b/chromium/media/gpu/ipc/service/media_gpu_channel_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/service/media_gpu_channel_manager.h b/chromium/media/gpu/ipc/service/media_gpu_channel_manager.h
index c9ebef04022..fbc76409769 100644
--- a/chromium/media/gpu/ipc/service/media_gpu_channel_manager.h
+++ b/chromium/media/gpu/ipc/service/media_gpu_channel_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/ipc/service/picture_buffer_manager.cc b/chromium/media/gpu/ipc/service/picture_buffer_manager.cc
index 47229a7365a..933ae35b8e0 100644
--- a/chromium/media/gpu/ipc/service/picture_buffer_manager.cc
+++ b/chromium/media/gpu/ipc/service/picture_buffer_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,6 +15,11 @@
#include "base/thread_annotations.h"
#include "components/viz/common/resources/resource_format_utils.h"
#include "gpu/command_buffer/common/mailbox_holder.h"
+#include "ui/gfx/gpu_memory_buffer.h"
+
+#if BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC)
+#include "media/gpu/chromeos/platform_video_frame_utils.h"
+#endif // BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC)
namespace media {
@@ -29,9 +34,10 @@ int32_t NextID(int32_t* counter) {
class PictureBufferManagerImpl : public PictureBufferManager {
public:
- explicit PictureBufferManagerImpl(
- ReusePictureBufferCB reuse_picture_buffer_cb)
- : reuse_picture_buffer_cb_(std::move(reuse_picture_buffer_cb)) {
+ PictureBufferManagerImpl(bool allocate_gpu_memory_buffers,
+ ReusePictureBufferCB reuse_picture_buffer_cb)
+ : allocate_gpu_memory_buffers_(allocate_gpu_memory_buffers),
+ reuse_picture_buffer_cb_(std::move(reuse_picture_buffer_cb)) {
DVLOG(1) << __func__;
}
PictureBufferManagerImpl(const PictureBufferManagerImpl&) = delete;
@@ -71,7 +77,8 @@ class PictureBufferManagerImpl : public PictureBufferManager {
return !has_assigned_picture_buffer;
}
- std::vector<PictureBuffer> CreatePictureBuffers(
+ std::vector<std::pair<PictureBuffer, gfx::GpuMemoryBufferHandle>>
+ CreatePictureBuffers(
uint32_t count,
VideoPixelFormat pixel_format,
uint32_t planes,
@@ -84,6 +91,9 @@ class PictureBufferManagerImpl : public PictureBufferManager {
DCHECK(count);
DCHECK(planes);
DCHECK_LE(planes, static_cast<uint32_t>(VideoFrame::kMaxPlanes));
+ DCHECK(!allocate_gpu_memory_buffers_ ||
+ mode == VideoDecodeAccelerator::TextureAllocationMode::
+ kDoNotAllocateGLTextures);
// TODO(sandersd): Consider requiring that CreatePictureBuffers() is
// called with the context current.
@@ -91,11 +101,12 @@ class PictureBufferManagerImpl : public PictureBufferManager {
VideoDecodeAccelerator::TextureAllocationMode::kAllocateGLTextures) {
if (!command_buffer_helper_->MakeContextCurrent()) {
DVLOG(1) << "Failed to make context current";
- return std::vector<PictureBuffer>();
+ return {};
}
}
- std::vector<PictureBuffer> picture_buffers;
+ std::vector<std::pair<PictureBuffer, gfx::GpuMemoryBufferHandle>>
+ picture_buffers_and_gmbs;
for (uint32_t i = 0; i < count; i++) {
PictureBufferData picture_data = {pixel_format, texture_size};
if (mode ==
@@ -132,6 +143,46 @@ class PictureBufferManagerImpl : public PictureBufferManager {
}
}
+ gfx::GpuMemoryBufferHandle gmb_handle;
+ if (allocate_gpu_memory_buffers_) {
+#if BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC)
+ scoped_refptr<VideoFrame> gpu_memory_buffer_video_frame =
+ CreateGpuMemoryBufferVideoFrame(
+ pixel_format, texture_size, gfx::Rect(texture_size),
+ texture_size, base::TimeDelta(),
+ gfx::BufferUsage::SCANOUT_VDA_WRITE);
+ if (!gpu_memory_buffer_video_frame)
+ return {};
+ if (gpu_memory_buffer_video_frame->format() != pixel_format) {
+ // There is a mismatch (maybe deliberate) between
+ // VideoPixelFormatToGfxBufferFormat() and
+ // GfxBufferFormatToVideoPixelFormat(). For PIXEL_FORMAT_XBGR, the
+ // former returns gfx::BufferFormat::RGBX_8888, but for
+ // gfx::BufferFormat::RGBX_8888, the latter returns PIXEL_FORMAT_XRGB.
+ // Just fail if the allocated format doesn't match the requested
+ // format.
+ //
+ // TODO(andrescj): does this mismatch need to be fixed or is it
+ // intentional?
+ return {};
+ }
+
+ gfx::GpuMemoryBuffer* gmb =
+ gpu_memory_buffer_video_frame->GetGpuMemoryBuffer();
+ DCHECK(gmb);
+ gmb_handle = gmb->CloneHandle();
+ if (gmb_handle.type != gfx::NATIVE_PIXMAP ||
+ gmb_handle.native_pixmap_handle.planes.empty()) {
+ return {};
+ }
+ picture_data.gpu_memory_buffer_video_frame =
+ std::move(gpu_memory_buffer_video_frame);
+#else
+ NOTREACHED();
+ return {};
+#endif // BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC)
+ }
+
// Generate a picture buffer ID and record the picture buffer.
int32_t picture_buffer_id = NextID(&picture_buffer_id_);
{
@@ -145,12 +196,13 @@ class PictureBufferManagerImpl : public PictureBufferManager {
//
// TODO(sandersd): Refactor the bind image callback to use service IDs so
// that we can get rid of the client IDs altogether.
- picture_buffers.emplace_back(
- picture_buffer_id, texture_size, picture_data.texture_sizes,
- picture_data.service_ids, picture_data.service_ids, texture_target,
- pixel_format);
+ picture_buffers_and_gmbs.emplace_back(
+ PictureBuffer{picture_buffer_id, texture_size,
+ picture_data.texture_sizes, picture_data.service_ids,
+ picture_data.service_ids, texture_target, pixel_format},
+ std::move(gmb_handle));
}
- return picture_buffers;
+ return picture_buffers_and_gmbs;
}
bool DismissPictureBuffer(int32_t picture_buffer_id) override {
@@ -236,15 +288,31 @@ class PictureBufferManagerImpl : public PictureBufferManager {
}
// Create and return a VideoFrame for the picture buffer.
- scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTextures(
- picture_buffer_data.pixel_format, picture_buffer_data.mailbox_holders,
- base::BindOnce(&PictureBufferManagerImpl::OnVideoFrameDestroyed, this,
- picture_buffer_id),
- picture_buffer_data.texture_size, visible_rect, natural_size,
- timestamp);
- if (!frame) {
- DLOG(ERROR) << "Failed to create VideoFrame for picture.";
- return nullptr;
+ scoped_refptr<VideoFrame> frame;
+ if (picture_buffer_data.gpu_memory_buffer_video_frame) {
+ frame = VideoFrame::WrapVideoFrame(
+ picture_buffer_data.gpu_memory_buffer_video_frame,
+ picture_buffer_data.gpu_memory_buffer_video_frame->format(),
+ visible_rect, natural_size);
+ if (!frame) {
+ DLOG(ERROR) << "Failed to create VideoFrame for picture.";
+ return nullptr;
+ }
+ frame->set_timestamp(timestamp);
+ frame->AddDestructionObserver(
+ base::BindOnce(&PictureBufferManagerImpl::OnVideoFrameDestroyed, this,
+ picture_buffer_id, gpu::SyncToken()));
+ } else {
+ frame = VideoFrame::WrapNativeTextures(
+ picture_buffer_data.pixel_format, picture_buffer_data.mailbox_holders,
+ base::BindOnce(&PictureBufferManagerImpl::OnVideoFrameDestroyed, this,
+ picture_buffer_id),
+ picture_buffer_data.texture_size, visible_rect, natural_size,
+ timestamp);
+ if (!frame) {
+ DLOG(ERROR) << "Failed to create VideoFrame for picture.";
+ return nullptr;
+ }
}
frame->set_color_space(picture.color_space());
@@ -263,7 +331,8 @@ class PictureBufferManagerImpl : public PictureBufferManager {
private:
~PictureBufferManagerImpl() override {
DVLOG(1) << __func__;
- DCHECK(picture_buffers_.empty() || !command_buffer_helper_->HasStub());
+ DCHECK(picture_buffers_.empty() ||
+ (!command_buffer_helper_ || !command_buffer_helper_->HasStub()));
}
void OnVideoFrameDestroyed(int32_t picture_buffer_id,
@@ -280,14 +349,21 @@ class PictureBufferManagerImpl : public PictureBufferManager {
it->second.output_count--;
it->second.waiting_for_synctoken_count++;
- // Wait for the SyncToken release.
- gpu_task_runner_->PostTask(
- FROM_HERE,
- base::BindOnce(
- &CommandBufferHelper::WaitForSyncToken, command_buffer_helper_,
- sync_token,
- base::BindOnce(&PictureBufferManagerImpl::OnSyncTokenReleased, this,
- picture_buffer_id)));
+ if (command_buffer_helper_) {
+ // Wait for the SyncToken release.
+ gpu_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(
+ &CommandBufferHelper::WaitForSyncToken, command_buffer_helper_,
+ sync_token,
+ base::BindOnce(&PictureBufferManagerImpl::OnSyncTokenReleased,
+ this, picture_buffer_id)));
+ } else {
+ gpu_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(&PictureBufferManagerImpl::OnSyncTokenReleased, this,
+ picture_buffer_id));
+ }
}
void OnSyncTokenReleased(int32_t picture_buffer_id) {
@@ -353,6 +429,7 @@ class PictureBufferManagerImpl : public PictureBufferManager {
command_buffer_helper_->DestroyTexture(service_id);
}
+ const bool allocate_gpu_memory_buffers_;
ReusePictureBufferCB reuse_picture_buffer_cb_;
scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_;
@@ -369,6 +446,7 @@ class PictureBufferManagerImpl : public PictureBufferManager {
std::array<scoped_refptr<Picture::ScopedSharedImage>,
VideoFrame::kMaxPlanes>
scoped_shared_images;
+ scoped_refptr<VideoFrame> gpu_memory_buffer_video_frame;
bool dismissed = false;
// The same picture buffer can be output from the VDA multiple times
@@ -393,9 +471,10 @@ class PictureBufferManagerImpl : public PictureBufferManager {
// static
scoped_refptr<PictureBufferManager> PictureBufferManager::Create(
+ bool allocate_gpu_memory_buffers,
ReusePictureBufferCB reuse_picture_buffer_cb) {
return base::MakeRefCounted<PictureBufferManagerImpl>(
- std::move(reuse_picture_buffer_cb));
+ allocate_gpu_memory_buffers, std::move(reuse_picture_buffer_cb));
}
} // namespace media
diff --git a/chromium/media/gpu/ipc/service/picture_buffer_manager.h b/chromium/media/gpu/ipc/service/picture_buffer_manager.h
index 20452605397..dd6cbb20853 100644
--- a/chromium/media/gpu/ipc/service/picture_buffer_manager.h
+++ b/chromium/media/gpu/ipc/service/picture_buffer_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,6 +22,10 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
+namespace gfx {
+struct GpuMemoryBufferHandle;
+} // namespace gfx
+
namespace media {
class PictureBufferManager
@@ -33,9 +37,14 @@ class PictureBufferManager
// Creates a PictureBufferManager.
//
+ // |allocate_gpu_memory_buffers|: If true, the PictureBufferManager will
+ // allocate a GpuMemoryBuffer for each PictureBuffer in
+ // CreatePictureBuffers(), and CreateVideoFrame() will return VideoFrames
+ // backed by the allocated GpuMemoryBuffers.
// |reuse_picture_buffer_cb|: Called when a picture is returned to the pool
// after its VideoFrame has been destructed.
static scoped_refptr<PictureBufferManager> Create(
+ bool allocate_gpu_memory_buffers,
ReusePictureBufferCB reuse_picture_buffer_cb);
// Provides access to a CommandBufferHelper. This must be done before calling
@@ -53,7 +62,8 @@ class PictureBufferManager
// preroll than to hang waiting for an output that can never come.
virtual bool CanReadWithoutStalling() = 0;
- // Creates and returns a vector of picture buffers, or an empty vector on
+ // Creates and returns a vector of picture buffers and the corresponding
+ // GpuMemoryBuffer (if applicable, see constructor), or an empty vector on
// failure.
//
// |count|: Number of picture buffers to create.
@@ -72,13 +82,13 @@ class PictureBufferManager
// are not automatically allocated.)
// TODO(sandersd): The current implementation makes the context current.
// Consider requiring that the context is already current.
- virtual std::vector<PictureBuffer> CreatePictureBuffers(
- uint32_t count,
- VideoPixelFormat pixel_format,
- uint32_t planes,
- gfx::Size texture_size,
- uint32_t texture_target,
- VideoDecodeAccelerator::TextureAllocationMode mode) = 0;
+ virtual std::vector<std::pair<PictureBuffer, gfx::GpuMemoryBufferHandle>>
+ CreatePictureBuffers(uint32_t count,
+ VideoPixelFormat pixel_format,
+ uint32_t planes,
+ gfx::Size texture_size,
+ uint32_t texture_target,
+ VideoDecodeAccelerator::TextureAllocationMode mode) = 0;
// Dismisses a picture buffer from the pool.
//
diff --git a/chromium/media/gpu/ipc/service/picture_buffer_manager_unittest.cc b/chromium/media/gpu/ipc/service/picture_buffer_manager_unittest.cc
index ef2098bb70e..0a12715412d 100644
--- a/chromium/media/gpu/ipc/service/picture_buffer_manager_unittest.cc
+++ b/chromium/media/gpu/ipc/service/picture_buffer_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,7 +22,8 @@ class PictureBufferManagerImplTest : public testing::Test {
// TODO(sandersd): Use a separate thread for the GPU task runner.
cbh_ = base::MakeRefCounted<FakeCommandBufferHelper>(
environment_.GetMainThreadTaskRunner());
- pbm_ = PictureBufferManager::Create(reuse_cb_.Get());
+ pbm_ = PictureBufferManager::Create(/*allocate_gpu_memory_buffers=*/false,
+ reuse_cb_.Get());
}
PictureBufferManagerImplTest(const PictureBufferManagerImplTest&) = delete;
@@ -47,8 +48,15 @@ class PictureBufferManagerImplTest : public testing::Test {
uint32_t count,
VideoDecodeAccelerator::TextureAllocationMode mode =
VideoDecodeAccelerator::TextureAllocationMode::kAllocateGLTextures) {
- return pbm_->CreatePictureBuffers(count, PIXEL_FORMAT_ARGB, 1,
- gfx::Size(320, 240), GL_TEXTURE_2D, mode);
+ std::vector<std::pair<PictureBuffer, gfx::GpuMemoryBufferHandle>>
+ picture_buffers_and_gmbs = pbm_->CreatePictureBuffers(
+ count, PIXEL_FORMAT_ARGB, 1, gfx::Size(320, 240), GL_TEXTURE_2D,
+ mode);
+ std::vector<PictureBuffer> picture_buffers;
+ for (const auto& picture_buffer_and_gmb : picture_buffers_and_gmbs) {
+ picture_buffers.push_back(picture_buffer_and_gmb.first);
+ }
+ return picture_buffers;
}
PictureBuffer CreateARGBPictureBuffer(
diff --git a/chromium/media/gpu/ipc/service/vda_video_decoder.cc b/chromium/media/gpu/ipc/service/vda_video_decoder.cc
index ccf7b1fd7f6..73633231502 100644
--- a/chromium/media/gpu/ipc/service/vda_video_decoder.cc
+++ b/chromium/media/gpu/ipc/service/vda_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -74,14 +74,19 @@ std::unique_ptr<VideoDecodeAccelerator> CreateAndInitializeVda(
MediaLog* media_log,
const VideoDecodeAccelerator::Config& config) {
GpuVideoDecodeGLClient gl_client;
- gl_client.get_context = base::BindRepeating(
- &CommandBufferHelper::GetGLContext, command_buffer_helper);
- gl_client.make_context_current = base::BindRepeating(
- &CommandBufferHelper::MakeContextCurrent, command_buffer_helper);
- gl_client.bind_image = base::BindRepeating(&BindImage, command_buffer_helper);
- gl_client.is_passthrough = command_buffer_helper->IsPassthrough();
- gl_client.supports_arb_texture_rectangle =
- command_buffer_helper->SupportsTextureRectangle();
+ // |command_buffer_helper| is nullptr in IMPORT mode in which case, we
+ // shouldn't need to do any GL calls.
+ if (command_buffer_helper) {
+ gl_client.get_context = base::BindRepeating(
+ &CommandBufferHelper::GetGLContext, command_buffer_helper);
+ gl_client.make_context_current = base::BindRepeating(
+ &CommandBufferHelper::MakeContextCurrent, command_buffer_helper);
+ gl_client.bind_image =
+ base::BindRepeating(&BindImage, command_buffer_helper);
+ gl_client.is_passthrough = command_buffer_helper->IsPassthrough();
+ gl_client.supports_arb_texture_rectangle =
+ command_buffer_helper->SupportsTextureRectangle();
+ }
std::unique_ptr<GpuVideoDecodeAcceleratorFactory> factory =
GpuVideoDecodeAcceleratorFactory::Create(gl_client);
@@ -119,17 +124,23 @@ std::unique_ptr<VideoDecoder> VdaVideoDecoder::Create(
const gfx::ColorSpace& target_color_space,
const gpu::GpuPreferences& gpu_preferences,
const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
- GetStubCB get_stub_cb) {
+ GetStubCB get_stub_cb,
+ VideoDecodeAccelerator::Config::OutputMode output_mode) {
auto* decoder = new VdaVideoDecoder(
std::move(parent_task_runner), std::move(gpu_task_runner),
std::move(media_log), target_color_space,
- base::BindOnce(&PictureBufferManager::Create),
- base::BindOnce(&CreateCommandBufferHelper, std::move(get_stub_cb)),
+ base::BindOnce(&PictureBufferManager::Create,
+ /*allocate_gpu_memory_buffers=*/output_mode ==
+ VideoDecodeAccelerator::Config::OutputMode::IMPORT),
+ output_mode == VideoDecodeAccelerator::Config::OutputMode::ALLOCATE
+ ? base::BindOnce(&CreateCommandBufferHelper, std::move(get_stub_cb))
+ : base::NullCallback(),
base::BindRepeating(&CreateAndInitializeVda, gpu_preferences,
gpu_workarounds),
GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeCapabilities(
GpuVideoDecodeAcceleratorFactory::GetDecoderCapabilities(
- gpu_preferences, gpu_workarounds)));
+ gpu_preferences, gpu_workarounds)),
+ output_mode);
return std::make_unique<AsyncDestroyVideoDecoder<VdaVideoDecoder>>(
base::WrapUnique(decoder));
@@ -143,7 +154,8 @@ VdaVideoDecoder::VdaVideoDecoder(
CreatePictureBufferManagerCB create_picture_buffer_manager_cb,
CreateCommandBufferHelperCB create_command_buffer_helper_cb,
CreateAndInitializeVdaCB create_and_initialize_vda_cb,
- const VideoDecodeAccelerator::Capabilities& vda_capabilities)
+ const VideoDecodeAccelerator::Capabilities& vda_capabilities,
+ VideoDecodeAccelerator::Config::OutputMode output_mode)
: parent_task_runner_(std::move(parent_task_runner)),
gpu_task_runner_(std::move(gpu_task_runner)),
media_log_(std::move(media_log)),
@@ -152,6 +164,7 @@ VdaVideoDecoder::VdaVideoDecoder(
std::move(create_command_buffer_helper_cb)),
create_and_initialize_vda_cb_(std::move(create_and_initialize_vda_cb)),
vda_capabilities_(vda_capabilities),
+ output_mode_(output_mode),
timestamps_(128) {
DVLOG(1) << __func__;
DCHECK(parent_task_runner_->BelongsToCurrentThread());
@@ -262,7 +275,10 @@ void VdaVideoDecoder::Initialize(const VideoDecoderConfig& config,
// TODO(sandersd): Change this to a capability if any VDA starts supporting
// alpha channels. This is believed to be impossible right now because VPx
// alpha channel data is passed in side data, which isn't sent to VDAs.
- if (config.alpha_mode() != VideoDecoderConfig::AlphaMode::kIsOpaque) {
+ // HEVC is the codec that only has platform hardware decoder support, and
+ // macOS currently support HEVC with alpha, so don't block HEVC here.
+ if (config.alpha_mode() != VideoDecoderConfig::AlphaMode::kIsOpaque &&
+ config.codec() != VideoCodec::kHEVC) {
MEDIA_LOG(INFO, media_log_) << "Alpha formats are not supported";
EnterErrorState();
return;
@@ -339,13 +355,16 @@ void VdaVideoDecoder::InitializeOnGpuThread() {
// Set up |command_buffer_helper_|.
if (!reinitializing_) {
- command_buffer_helper_ = std::move(create_command_buffer_helper_cb_).Run();
- if (!command_buffer_helper_) {
- parent_task_runner_->PostTask(
- FROM_HERE,
- base::BindOnce(&VdaVideoDecoder::InitializeDone, parent_weak_this_,
- DecoderStatus::Codes::kFailed));
- return;
+ if (output_mode_ == VideoDecodeAccelerator::Config::OutputMode::ALLOCATE) {
+ command_buffer_helper_ =
+ std::move(create_command_buffer_helper_cb_).Run();
+ if (!command_buffer_helper_) {
+ parent_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(&VdaVideoDecoder::InitializeDone, parent_weak_this_,
+ DecoderStatus::Codes::kFailed));
+ return;
+ }
}
picture_buffer_manager_->Initialize(gpu_task_runner_,
@@ -365,7 +384,7 @@ void VdaVideoDecoder::InitializeOnGpuThread() {
vda_config.hdr_metadata = config_.hdr_metadata();
// vda_config.sps = [Only used by AVDA]
// vda_config.pps = [Only used by AVDA]
- // vda_config.output_mode = [Only used by ARC]
+ vda_config.output_mode = output_mode_;
// vda_config.supported_output_formats = [Only used by PPAPI]
// Create and initialize the VDA.
@@ -505,6 +524,13 @@ int VdaVideoDecoder::GetMaxDecodeRequests() const {
return 4;
}
+bool VdaVideoDecoder::FramesHoldExternalResources() const {
+ DVLOG(3) << __func__;
+ DCHECK(parent_task_runner_->BelongsToCurrentThread());
+
+ return output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT;
+}
+
void VdaVideoDecoder::NotifyInitializationComplete(DecoderStatus status) {
DVLOG(2) << __func__ << "(" << static_cast<int>(status.code()) << ")";
DCHECK(gpu_task_runner_->BelongsToCurrentThread());
@@ -531,6 +557,27 @@ void VdaVideoDecoder::ProvidePictureBuffers(uint32_t requested_num_of_buffers,
textures_per_buffer, dimensions, texture_target));
}
+void VdaVideoDecoder::ProvidePictureBuffersWithVisibleRect(
+ uint32_t requested_num_of_buffers,
+ VideoPixelFormat format,
+ uint32_t textures_per_buffer,
+ const gfx::Size& dimensions,
+ const gfx::Rect& visible_rect,
+ uint32_t texture_target) {
+ if (output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT) {
+ // In IMPORT mode, we (as the client of the underlying VDA) are responsible
+ // for buffer allocation with no textures (i.e., |texture_target| is
+ // irrelevant). Therefore, the logic in the base version of
+ // ProvidePictureBuffersWithVisibleRect() is not applicable.
+ ProvidePictureBuffers(requested_num_of_buffers, format, textures_per_buffer,
+ dimensions, texture_target);
+ return;
+ }
+ VideoDecodeAccelerator::Client::ProvidePictureBuffersWithVisibleRect(
+ requested_num_of_buffers, format, textures_per_buffer, dimensions,
+ visible_rect, texture_target);
+}
+
void VdaVideoDecoder::ProvidePictureBuffersAsync(uint32_t count,
VideoPixelFormat pixel_format,
uint32_t planes,
@@ -547,11 +594,14 @@ void VdaVideoDecoder::ProvidePictureBuffersAsync(uint32_t count,
if (pixel_format == PIXEL_FORMAT_UNKNOWN)
pixel_format = PIXEL_FORMAT_XRGB;
- std::vector<PictureBuffer> picture_buffers =
- picture_buffer_manager_->CreatePictureBuffers(
+ std::vector<std::pair<PictureBuffer, gfx::GpuMemoryBufferHandle>>
+ picture_buffers_and_gmbs = picture_buffer_manager_->CreatePictureBuffers(
count, pixel_format, planes, texture_size, texture_target,
- vda_->GetSharedImageTextureAllocationMode());
- if (picture_buffers.empty()) {
+ output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT
+ ? VideoDecodeAccelerator::TextureAllocationMode::
+ kDoNotAllocateGLTextures
+ : vda_->GetSharedImageTextureAllocationMode());
+ if (picture_buffers_and_gmbs.empty()) {
parent_task_runner_->PostTask(
FROM_HERE,
base::BindOnce(&VdaVideoDecoder::EnterErrorState, parent_weak_this_));
@@ -559,7 +609,19 @@ void VdaVideoDecoder::ProvidePictureBuffersAsync(uint32_t count,
}
DCHECK(gpu_weak_vda_);
+ std::vector<PictureBuffer> picture_buffers;
+ for (const auto& picture_buffer_and_gmb : picture_buffers_and_gmbs) {
+ picture_buffers.push_back(picture_buffer_and_gmb.first);
+ }
vda_->AssignPictureBuffers(std::move(picture_buffers));
+
+ if (output_mode_ == VideoDecodeAccelerator::Config::OutputMode::IMPORT) {
+ for (auto& picture_buffer_and_gmb : picture_buffers_and_gmbs) {
+ vda_->ImportBufferForPicture(picture_buffer_and_gmb.first.id(),
+ pixel_format,
+ std::move(picture_buffer_and_gmb.second));
+ }
+ }
}
void VdaVideoDecoder::DismissPictureBuffer(int32_t picture_buffer_id) {
@@ -771,10 +833,12 @@ void VdaVideoDecoder::NotifyError(VideoDecodeAccelerator::Error error) {
}
gpu::SharedImageStub* VdaVideoDecoder::GetSharedImageStub() const {
+ DCHECK_EQ(output_mode_, VideoDecodeAccelerator::Config::OutputMode::ALLOCATE);
return command_buffer_helper_->GetSharedImageStub();
}
CommandBufferHelper* VdaVideoDecoder::GetCommandBufferHelper() const {
+ DCHECK_EQ(output_mode_, VideoDecodeAccelerator::Config::OutputMode::ALLOCATE);
return command_buffer_helper_.get();
}
diff --git a/chromium/media/gpu/ipc/service/vda_video_decoder.h b/chromium/media/gpu/ipc/service/vda_video_decoder.h
index 83b8653094c..12f0b1ac23e 100644
--- a/chromium/media/gpu/ipc/service/vda_video_decoder.h
+++ b/chromium/media/gpu/ipc/service/vda_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -59,8 +59,9 @@ class VdaVideoDecoder : public VideoDecoder,
// unique_ptr<VideoDecoder>.
//
// |get_stub_cb|: Callback to retrieve the CommandBufferStub that should be
- // used for allocating textures and mailboxes. This callback will be
- // called on the GPU thread.
+ // used for allocating textures and mailboxes. This is only used when
+ // |output_mode| is ALLOCATE. This callback will be called on the GPU
+ // thread.
//
// See VdaVideoDecoder() for other arguments.
static std::unique_ptr<VideoDecoder> Create(
@@ -70,7 +71,8 @@ class VdaVideoDecoder : public VideoDecoder,
const gfx::ColorSpace& target_color_space,
const gpu::GpuPreferences& gpu_preferences,
const gpu::GpuDriverBugWorkarounds& gpu_workarounds,
- GetStubCB get_stub_cb);
+ GetStubCB get_stub_cb,
+ VideoDecodeAccelerator::Config::OutputMode output_mode);
VdaVideoDecoder(const VdaVideoDecoder&) = delete;
VdaVideoDecoder& operator=(const VdaVideoDecoder&) = delete;
@@ -90,6 +92,7 @@ class VdaVideoDecoder : public VideoDecoder,
bool NeedsBitstreamConversion() const override;
bool CanReadWithoutStalling() const override;
int GetMaxDecodeRequests() const override;
+ bool FramesHoldExternalResources() const override;
private:
friend class VdaVideoDecoderTest;
@@ -102,10 +105,21 @@ class VdaVideoDecoder : public VideoDecoder,
// |media_log|: MediaLog object to log to.
// |target_color_space|: Color space of the output device.
// |create_picture_buffer_manager_cb|: PictureBufferManager factory.
- // |create_command_buffer_helper_cb|: CommandBufferHelper factory.
+ // |create_command_buffer_helper_cb|: CommandBufferHelper factory. This is
+ // only used when |output_mode| is ALLOCATE.
// |create_and_initialize_vda_cb|: VideoDecodeAccelerator factory.
// |vda_capabilities|: Capabilities of the VDA that
// |create_and_initialize_vda_cb| will produce.
+ // |output_mode|: How to manage memory for output frames:
+ // - ALLOCATE: output buffer allocation is expected to be done by a
+ // combination of the PictureBufferManager (for texture allocation,
+ // possibly) and the VDA when AssignPictureBuffers() is called. In this
+ // case, the VdaVideoDecoder will output Mailbox-backed VideoFrames.
+ // - IMPORT, output buffer allocation is done by the PictureBufferManager
+ // (to allocate GpuMemoryBuffers without textures) and these buffers are
+ // imported into the VDA by calling ImportBufferForPicture(). In this
+ // case, the VdaVideoDecoder will output GpuMemoryBuffer-backed
+ // VideoFrames.
VdaVideoDecoder(
scoped_refptr<base::SingleThreadTaskRunner> parent_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner,
@@ -114,7 +128,8 @@ class VdaVideoDecoder : public VideoDecoder,
CreatePictureBufferManagerCB create_picture_buffer_manager_cb,
CreateCommandBufferHelperCB create_command_buffer_helper_cb,
CreateAndInitializeVdaCB create_and_initialize_vda_cb,
- const VideoDecodeAccelerator::Capabilities& vda_capabilities);
+ const VideoDecodeAccelerator::Capabilities& vda_capabilities,
+ VideoDecodeAccelerator::Config::OutputMode output_mode);
// media::VideoDecodeAccelerator::Client implementation.
void NotifyInitializationComplete(DecoderStatus status) override;
@@ -123,6 +138,12 @@ class VdaVideoDecoder : public VideoDecoder,
uint32_t textures_per_buffer,
const gfx::Size& dimensions,
uint32_t texture_target) override;
+ void ProvidePictureBuffersWithVisibleRect(uint32_t requested_num_of_buffers,
+ VideoPixelFormat format,
+ uint32_t textures_per_buffer,
+ const gfx::Size& dimensions,
+ const gfx::Rect& visible_rect,
+ uint32_t texture_target) override;
void DismissPictureBuffer(int32_t picture_buffer_id) override;
void PictureReady(const Picture& picture) override;
void NotifyEndOfBitstreamBuffer(int32_t bitstream_buffer_id) override;
@@ -167,6 +188,7 @@ class VdaVideoDecoder : public VideoDecoder,
CreateCommandBufferHelperCB create_command_buffer_helper_cb_;
CreateAndInitializeVdaCB create_and_initialize_vda_cb_;
const VideoDecodeAccelerator::Capabilities vda_capabilities_;
+ const VideoDecodeAccelerator::Config::OutputMode output_mode_;
//
// Parent thread state.
diff --git a/chromium/media/gpu/ipc/service/vda_video_decoder_unittest.cc b/chromium/media/gpu/ipc/service/vda_video_decoder_unittest.cc
index 4755884b259..0a97765164c 100644
--- a/chromium/media/gpu/ipc/service/vda_video_decoder_unittest.cc
+++ b/chromium/media/gpu/ipc/service/vda_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -107,7 +107,8 @@ class VdaVideoDecoderTest : public testing::TestWithParam<bool> {
base::Unretained(this)),
base::BindRepeating(&VdaVideoDecoderTest::CreateAndInitializeVda,
base::Unretained(this)),
- GetCapabilities());
+ GetCapabilities(),
+ VideoDecodeAccelerator::Config::OutputMode::ALLOCATE);
vdavd_ = std::make_unique<AsyncDestroyVideoDecoder<VdaVideoDecoder>>(
base::WrapUnique(vdavd));
client_ = vdavd;
@@ -280,7 +281,8 @@ class VdaVideoDecoderTest : public testing::TestWithParam<bool> {
scoped_refptr<PictureBufferManager> CreatePictureBufferManager(
PictureBufferManager::ReusePictureBufferCB reuse_cb) {
DCHECK(!pbm_);
- pbm_ = PictureBufferManager::Create(std::move(reuse_cb));
+ pbm_ = PictureBufferManager::Create(/*allocate_gpu_memory_buffers=*/false,
+ std::move(reuse_cb));
return pbm_;
}
diff --git a/chromium/media/gpu/mac/BUILD.gn b/chromium/media/gpu/mac/BUILD.gn
index b537122064d..160394ce3df 100644
--- a/chromium/media/gpu/mac/BUILD.gn
+++ b/chromium/media/gpu/mac/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.cc b/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.cc
index a760ddc7509..c3cd4b4df38 100644
--- a/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.cc
+++ b/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.h b/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.h
index 5019fe81292..51a4e1a5b5d 100644
--- a/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.h
+++ b/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter_unittest.cc b/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter_unittest.cc
index 22286d7f863..91b8ed43e93 100644
--- a/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter_unittest.cc
+++ b/chromium/media/gpu/mac/vp9_super_frame_bitstream_filter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/mac/vt_config_util.h b/chromium/media/gpu/mac/vt_config_util.h
index ea86e465f56..8e4f7eaea8e 100644
--- a/chromium/media/gpu/mac/vt_config_util.h
+++ b/chromium/media/gpu/mac/vt_config_util.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/mac/vt_config_util.mm b/chromium/media/gpu/mac/vt_config_util.mm
index 5977ce5bc62..1a99fdbe34b 100644
--- a/chromium/media/gpu/mac/vt_config_util.mm
+++ b/chromium/media/gpu/mac/vt_config_util.mm
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include "base/mac/foundation_util.h"
#include "media/base/mac/color_space_util_mac.h"
+#include "ui/gfx/hdr_metadata_mac.h"
namespace {
@@ -137,10 +138,9 @@ CFStringRef GetMatrix(media::VideoColorSpace::MatrixID matrix_id) {
void SetContentLightLevelInfo(const gfx::HDRMetadata& hdr_metadata,
NSMutableDictionary<NSString*, id>* extensions) {
- SetDictionaryValue(extensions,
- kCMFormatDescriptionExtension_ContentLightLevelInfo,
- base::mac::CFToNSCast(
- media::GenerateContentLightLevelInfo(hdr_metadata)));
+ SetDictionaryValue(
+ extensions, kCMFormatDescriptionExtension_ContentLightLevelInfo,
+ base::mac::CFToNSCast(gfx::GenerateContentLightLevelInfo(hdr_metadata)));
}
void SetColorVolumeMetadata(const gfx::HDRMetadata& hdr_metadata,
@@ -148,7 +148,7 @@ void SetColorVolumeMetadata(const gfx::HDRMetadata& hdr_metadata,
SetDictionaryValue(
extensions, kCMFormatDescriptionExtension_MasteringDisplayColorVolume,
base::mac::CFToNSCast(
- media::GenerateMasteringDisplayColorVolume(hdr_metadata)));
+ gfx::GenerateMasteringDisplayColorVolume(hdr_metadata)));
}
void SetVp9CodecConfigurationBox(
diff --git a/chromium/media/gpu/mac/vt_config_util_unittest.cc b/chromium/media/gpu/mac/vt_config_util_unittest.cc
index f56c45267d0..28830391976 100644
--- a/chromium/media/gpu/mac/vt_config_util_unittest.cc
+++ b/chromium/media/gpu/mac/vt_config_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/mac/vt_video_decode_accelerator_mac.cc b/chromium/media/gpu/mac/vt_video_decode_accelerator_mac.cc
index da5ca206ed0..b3b3a4a4943 100644
--- a/chromium/media/gpu/mac/vt_video_decode_accelerator_mac.cc
+++ b/chromium/media/gpu/mac/vt_video_decode_accelerator_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,12 +10,13 @@
#include <OpenGL/gl.h>
#include <stddef.h>
-#include <algorithm>
#include <iterator>
#include <memory>
#include "base/atomic_sequence_num.h"
#include "base/bind.h"
+#include "base/containers/contains.h"
+#include "base/containers/span.h"
#include "base/cxx17_backports.h"
#include "base/logging.h"
#include "base/mac/mac_logging.h"
@@ -68,6 +69,9 @@ namespace media {
namespace {
+// Parameter sets vector contain all PPSs/SPSs(/VPSs)
+using ParameterSets = std::vector<base::span<const uint8_t>>;
+
// A sequence of ids for memory tracing.
base::AtomicSequenceNumber g_memory_dump_ids;
@@ -144,7 +148,8 @@ constexpr int kMinOutputsBeforeRASL = 5;
// Build an |image_config| dictionary for VideoToolbox initialization.
base::ScopedCFTypeRef<CFMutableDictionaryRef> BuildImageConfig(
CMVideoDimensions coded_dimensions,
- bool is_hbd) {
+ bool is_hbd,
+ bool has_alpha) {
base::ScopedCFTypeRef<CFMutableDictionaryRef> image_config;
// Note that 4:2:0 textures cannot be used directly as RGBA in OpenGL, but are
@@ -152,6 +157,11 @@ base::ScopedCFTypeRef<CFMutableDictionaryRef> BuildImageConfig(
int32_t pixel_format = is_hbd
? kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
: kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange;
+ // macOS support 8 bit (they actually only recommand main profile)
+ // HEVC with alpha layer well.
+ if (has_alpha)
+ pixel_format = kCVPixelFormatType_32BGRA;
+
#define CFINT(i) CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &i)
base::ScopedCFTypeRef<CFNumberRef> cf_pixel_format(CFINT(pixel_format));
base::ScopedCFTypeRef<CFNumberRef> cf_width(CFINT(coded_dimensions.width));
@@ -176,26 +186,20 @@ base::ScopedCFTypeRef<CFMutableDictionaryRef> BuildImageConfig(
}
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
-// Create a CMFormatDescription using the provided |pps|, |sps| and |vps|.
+// Create a CMFormatDescription using the provided |param_sets|.
base::ScopedCFTypeRef<CMFormatDescriptionRef> CreateVideoFormatHEVC(
- const std::vector<uint8_t>& vps,
- const std::vector<uint8_t>& sps,
- const std::vector<uint8_t>& pps) {
- DCHECK(!vps.empty());
- DCHECK(!sps.empty());
- DCHECK(!pps.empty());
+ ParameterSets param_sets) {
+ DCHECK(!param_sets.empty());
// Build the configuration records.
std::vector<const uint8_t*> nalu_data_ptrs;
std::vector<size_t> nalu_data_sizes;
- nalu_data_ptrs.reserve(3);
- nalu_data_sizes.reserve(3);
- nalu_data_ptrs.push_back(&vps.front());
- nalu_data_sizes.push_back(vps.size());
- nalu_data_ptrs.push_back(&sps.front());
- nalu_data_sizes.push_back(sps.size());
- nalu_data_ptrs.push_back(&pps.front());
- nalu_data_sizes.push_back(pps.size());
+ nalu_data_ptrs.reserve(param_sets.size());
+ nalu_data_sizes.reserve(param_sets.size());
+ for (auto& param : param_sets) {
+ nalu_data_ptrs.push_back(param.data());
+ nalu_data_sizes.push_back(param.size());
+ }
// For some unknown reason, even if apple has claimed that this API is
// available after macOS 10.13, however base on the result on macOS 10.15.7,
@@ -206,10 +210,10 @@ base::ScopedCFTypeRef<CMFormatDescriptionRef> CreateVideoFormatHEVC(
if (__builtin_available(macOS 11.0, *)) {
OSStatus status = CMVideoFormatDescriptionCreateFromHEVCParameterSets(
kCFAllocatorDefault,
- nalu_data_ptrs.size(), // parameter_set_count
- &nalu_data_ptrs.front(), // &parameter_set_pointers
- &nalu_data_sizes.front(), // &parameter_set_sizes
- kNALUHeaderLength, // nal_unit_header_length
+ nalu_data_ptrs.size(), // parameter_set_count
+ nalu_data_ptrs.data(), // &parameter_set_pointers
+ nalu_data_sizes.data(), // &parameter_set_sizes
+ kNALUHeaderLength, // nal_unit_header_length
NULL, format.InitializeInto());
OSSTATUS_DLOG_IF(WARNING, status != noErr, status)
<< "CMVideoFormatDescriptionCreateFromHEVCParameterSets()";
@@ -283,6 +287,7 @@ bool CreateVideoToolboxSession(
const CMFormatDescriptionRef format,
bool require_hardware,
bool is_hbd,
+ bool has_alpha,
const VTDecompressionOutputCallbackRecord* callback,
base::ScopedCFTypeRef<VTDecompressionSessionRef>* session,
gfx::Size* configured_size) {
@@ -314,7 +319,7 @@ bool CreateVideoToolboxSession(
base::ClampFloor(visible_rect.size.width),
base::ClampFloor(visible_rect.size.height)};
base::ScopedCFTypeRef<CFMutableDictionaryRef> image_config(
- BuildImageConfig(visible_dimensions, is_hbd));
+ BuildImageConfig(visible_dimensions, is_hbd, has_alpha));
if (!image_config) {
DLOG(ERROR) << "Failed to create decoder image configuration";
return false;
@@ -358,8 +363,8 @@ bool InitializeVideoToolboxInternal() {
if (!CreateVideoToolboxSession(
CreateVideoFormatH264(sps_h264_normal, std::vector<uint8_t>(),
pps_h264_normal),
- /*require_hardware=*/true, /*is_hbd=*/false, &callback, &session,
- &configured_size)) {
+ /*require_hardware=*/true, /*is_hbd=*/false, /*has_alpha=*/false,
+ &callback, &session, &configured_size)) {
DVLOG(1) << "Hardware H264 decoding with VideoToolbox is not supported";
return false;
}
@@ -375,8 +380,8 @@ bool InitializeVideoToolboxInternal() {
if (!CreateVideoToolboxSession(
CreateVideoFormatH264(sps_h264_small, std::vector<uint8_t>(),
pps_h264_small),
- /*require_hardware=*/false, /*is_hbd=*/false, &callback, &session,
- &configured_size)) {
+ /*require_hardware=*/false, /*is_hbd=*/false, /*has_alpha=*/false,
+ &callback, &session, &configured_size)) {
DVLOG(1) << "Software H264 decoding with VideoToolbox is not supported";
return false;
}
@@ -390,8 +395,8 @@ bool InitializeVideoToolboxInternal() {
if (!CreateVideoToolboxSession(
CreateVideoFormatVP9(VideoColorSpace::REC709(), VP9PROFILE_PROFILE0,
absl::nullopt, gfx::Size(720, 480)),
- /*require_hardware=*/true, /*is_hbd=*/false, &callback, &session,
- &configured_size)) {
+ /*require_hardware=*/true, /*is_hbd=*/false, /*has_alpha=*/false,
+ &callback, &session, &configured_size)) {
DVLOG(1) << "Hardware VP9 decoding with VideoToolbox is not supported";
// We don't return false here since VP9 support is optional.
@@ -424,10 +429,10 @@ bool InitializeVideoToolboxInternal() {
0xb4, 0x62, 0x40};
if (!CreateVideoToolboxSession(
- CreateVideoFormatHEVC(vps_hevc_normal, sps_hevc_normal,
- pps_hevc_normal),
- /*require_hardware=*/true, /*is_hbd=*/false, &callback, &session,
- &configured_size)) {
+ CreateVideoFormatHEVC(ParameterSets(
+ {vps_hevc_normal, sps_hevc_normal, pps_hevc_normal})),
+ /*require_hardware=*/true, /*is_hbd=*/false, /*has_alpha=*/false,
+ &callback, &session, &configured_size)) {
DVLOG(1) << "Hardware HEVC decoding with VideoToolbox is not supported";
// We don't return false here since HEVC support is optional.
@@ -453,10 +458,10 @@ bool InitializeVideoToolboxInternal() {
0xb4, 0x62, 0x40};
if (!CreateVideoToolboxSession(
- CreateVideoFormatHEVC(vps_hevc_small, sps_hevc_small,
- pps_hevc_small),
- /*require_hardware=*/false, /*is_hbd=*/false, &callback, &session,
- &configured_size)) {
+ CreateVideoFormatHEVC(ParameterSets(
+ {vps_hevc_small, sps_hevc_small, pps_hevc_small})),
+ /*require_hardware=*/false, /*is_hbd=*/false, /*has_alpha=*/false,
+ &callback, &session, &configured_size)) {
DVLOG(1) << "Software HEVC decoding with VideoToolbox is not supported";
// We don't return false here since HEVC support is optional.
@@ -736,10 +741,8 @@ bool VTVideoDecodeAccelerator::Initialize(const Config& config,
static const base::NoDestructor<VideoDecodeAccelerator::SupportedProfiles>
kActualSupportedProfiles(GetSupportedProfiles(workarounds_));
- if (std::find_if(kActualSupportedProfiles->begin(),
- kActualSupportedProfiles->end(), [config](const auto& p) {
- return p.profile == config.profile;
- }) == kActualSupportedProfiles->end()) {
+ if (!base::Contains(*kActualSupportedProfiles, config.profile,
+ &VideoDecodeAccelerator::SupportedProfile::profile)) {
DVLOG(2) << "Unsupported profile";
return false;
}
@@ -806,9 +809,17 @@ bool VTVideoDecodeAccelerator::ConfigureDecoder() {
format = CreateVideoFormatH264(active_sps_, active_spsext_, active_pps_);
break;
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
- case VideoCodec::kHEVC:
- format = CreateVideoFormatHEVC(active_vps_, active_sps_, active_pps_);
+ case VideoCodec::kHEVC: {
+ ParameterSets param_sets;
+ for (auto& it : seen_vps_)
+ param_sets.push_back(it.second);
+ for (auto& it : seen_sps_)
+ param_sets.push_back(it.second);
+ for (auto& it : seen_pps_)
+ param_sets.push_back(it.second);
+ format = CreateVideoFormatHEVC(param_sets);
break;
+ }
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
case VideoCodec::kVP9:
format = CreateVideoFormatVP9(
@@ -848,8 +859,8 @@ bool VTVideoDecodeAccelerator::ConfigureDecoder() {
const bool is_hbd = config_.profile == VP9PROFILE_PROFILE2 ||
config_.profile == HEVCPROFILE_MAIN10 ||
config_.profile == HEVCPROFILE_REXT;
- if (!CreateVideoToolboxSession(format_, require_hardware, is_hbd, &callback_,
- &session_, &configured_size_)) {
+ if (!CreateVideoToolboxSession(format_, require_hardware, is_hbd, has_alpha_,
+ &callback_, &session_, &configured_size_)) {
NotifyError(PLATFORM_FAILURE, SFT_PLATFORM_ERROR);
return false;
}
@@ -871,7 +882,13 @@ bool VTVideoDecodeAccelerator::ConfigureDecoder() {
// Record that the configuration change is complete.
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
- configured_vps_ = active_vps_;
+ // Actually seen vps/sps/pps may contain outdated parameter
+ // sets, VideoToolbox perhaps can handle this well since those
+ // outdated ones are not referenced by current pictures.
+ // Let's see what will happens in this way.
+ configured_vpss_ = seen_vps_;
+ configured_spss_ = seen_sps_;
+ configured_ppss_ = seen_pps_;
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
configured_sps_ = active_sps_;
configured_spsext_ = active_spsext_;
@@ -1176,6 +1193,9 @@ void VTVideoDecodeAccelerator::DecodeTaskH264(
return;
} else {
// Only |data| and |size| are read later, other fields are left empty.
+ // In case that their are new PPS/SPS/SPSext appears after an IDR, or
+ // videos that have multiple PPSs and we are referring to the one that
+ // is not used to create video format.
media::H264NALU sps_nalu;
sps_nalu.data = active_sps_.data();
sps_nalu.size = active_sps_.size();
@@ -1198,6 +1218,12 @@ void VTVideoDecodeAccelerator::DecodeTaskH264(
nalus.insert(nalus.begin() + first_slice_index, pps_nalu);
data_size += kNALUHeaderLength + pps_nalu.size;
first_slice_index += 1;
+
+ // Update the configured SPS/SPSext/PPS in case VT referrence to the wrong
+ // parameter sets.
+ configured_sps_ = active_sps_;
+ configured_spsext_ = active_spsext_;
+ configured_pps_ = active_pps_;
}
}
@@ -1315,6 +1341,11 @@ void VTVideoDecodeAccelerator::DecodeTaskHEVC(
// from the previous one if dependent_slice_segment_flag exists
std::unique_ptr<H265SliceHeader> curr_slice_hdr;
std::unique_ptr<H265SliceHeader> last_slice_hdr;
+ size_t first_slice_index = 0;
+ // ID of the VPS/SPS/PPS that most recently activated by an IDR.
+ int active_vps_id = 0;
+ int active_sps_id = 0;
+ int active_pps_id = 0;
hevc_parser_.SetStream(buffer->data(), buffer->data_size());
H265NALU nalu;
while (true) {
@@ -1337,13 +1368,6 @@ void VTVideoDecodeAccelerator::DecodeTaskHEVC(
return;
}
- // 8.1.2 We only want nuh_layer_id of zero.
- if (nalu.nuh_layer_id) {
- MEDIA_LOG(INFO, media_log_)
- << "Skipping NALU with nuh_layer_id=" << nalu.nuh_layer_id;
- continue;
- }
-
switch (nalu.nal_unit_type) {
case H265NALU::SPS_NUT: {
int sps_id = -1;
@@ -1382,11 +1406,6 @@ void VTVideoDecodeAccelerator::DecodeTaskHEVC(
return;
}
seen_pps_[pps_id].assign(nalu.data, nalu.data + nalu.size);
- // Pass PPS as data to the platform decoder, it helps in cases
- // when there are more than one PPS, Video Toolbox is smart enough
- // to find and recognize them there.
- nalus.push_back(nalu);
- data_size += kNALUHeaderLength + nalu.size;
break;
}
@@ -1406,6 +1425,20 @@ void VTVideoDecodeAccelerator::DecodeTaskHEVC(
seen_vps_[vps_id].assign(nalu.data, nalu.data + nalu.size);
break;
}
+
+ case H265NALU::PREFIX_SEI_NUT: {
+ H265SEIMessage sei_msg;
+ result = hevc_parser_.ParseSEI(&sei_msg);
+ if (result == H265Parser::kOk &&
+ sei_msg.type == H265SEIMessage::kSEIAlphaChannelInfo &&
+ sei_msg.alpha_channel_info.alpha_channel_cancel_flag == 0) {
+ has_alpha_ = true;
+ }
+ nalus.push_back(nalu);
+ data_size += kNALUHeaderLength + nalu.size;
+ break;
+ }
+
case H265NALU::EOS_NUT:
hevc_poc_.Reset();
nalus.push_back(nalu);
@@ -1491,12 +1524,15 @@ void VTVideoDecodeAccelerator::DecodeTaskHEVC(
}
// Record the configuration.
- DCHECK(seen_pps_.contains(curr_slice_hdr->slice_pic_parameter_set_id));
- DCHECK(seen_sps_.contains(pps->pps_seq_parameter_set_id));
- DCHECK(seen_vps_.contains(sps->sps_video_parameter_set_id));
- active_vps_ = seen_vps_[sps->sps_video_parameter_set_id];
- active_sps_ = seen_sps_[pps->pps_seq_parameter_set_id];
- active_pps_ = seen_pps_[curr_slice_hdr->slice_pic_parameter_set_id];
+ active_vps_id = sps->sps_video_parameter_set_id;
+ active_sps_id = pps->pps_seq_parameter_set_id;
+ active_pps_id = curr_slice_hdr->slice_pic_parameter_set_id;
+ DCHECK(seen_vps_.contains(active_vps_id));
+ DCHECK(seen_sps_.contains(active_sps_id));
+ DCHECK(seen_pps_.contains(active_pps_id));
+ active_vps_ = seen_vps_[active_vps_id];
+ active_sps_ = seen_sps_[active_sps_id];
+ active_pps_ = seen_pps_[active_pps_id];
// Compute and store frame properties. |image_size| gets filled in
// later, since it comes from the decoder configuration.
@@ -1509,6 +1545,8 @@ void VTVideoDecodeAccelerator::DecodeTaskHEVC(
frame->pic_order_cnt = pic_order_cnt;
frame->reorder_window = ComputeHEVCReorderWindow(vps);
+ first_slice_index = nalus.size();
+
last_slice_hdr.swap(curr_slice_hdr);
curr_slice_hdr.reset();
[[fallthrough]];
@@ -1524,7 +1562,7 @@ void VTVideoDecodeAccelerator::DecodeTaskHEVC(
waiting_for_idr_ = false;
// If no IDR has been seen yet, skip decoding. Note that Flash sends
- // configuration changes as a bitstream with only SPS/PPS; we don't print
+ // configuration changes as a bitstream with only SPS/PPS/VPS; we don't print
// error messages for those.
if (frame->has_slice && waiting_for_idr_) {
if (!missing_idr_logged_) {
@@ -1547,31 +1585,64 @@ void VTVideoDecodeAccelerator::DecodeTaskHEVC(
// Apply any configuration change, but only at an IDR. If there is no IDR, we
// just hope for the best from the decoder.
- if (frame->is_idr &&
- (configured_vps_ != active_vps_ || configured_sps_ != active_sps_ ||
- configured_pps_ != active_pps_)) {
- if (active_vps_.empty()) {
- WriteToMediaLog(MediaLogMessageLevel::kERROR,
- "Invalid configuration (no VPS)");
- NotifyError(INVALID_ARGUMENT, SFT_INVALID_STREAM);
- return;
- }
- if (active_sps_.empty()) {
- WriteToMediaLog(MediaLogMessageLevel::kERROR,
- "Invalid configuration (no SPS)");
- NotifyError(INVALID_ARGUMENT, SFT_INVALID_STREAM);
- return;
- }
- if (active_pps_.empty()) {
- WriteToMediaLog(MediaLogMessageLevel::kERROR,
- "Invalid configuration (no PPS)");
- NotifyError(INVALID_ARGUMENT, SFT_INVALID_STREAM);
- return;
- }
+ if (seen_vps_ != configured_vpss_ || seen_sps_ != configured_spss_ ||
+ seen_pps_ != configured_ppss_) {
+ if (frame->is_idr) {
+ if (seen_vps_.empty()) {
+ WriteToMediaLog(MediaLogMessageLevel::kERROR,
+ "Invalid configuration (no VPS)");
+ NotifyError(INVALID_ARGUMENT, SFT_INVALID_STREAM);
+ return;
+ }
+ if (seen_sps_.empty()) {
+ WriteToMediaLog(MediaLogMessageLevel::kERROR,
+ "Invalid configuration (no SPS)");
+ NotifyError(INVALID_ARGUMENT, SFT_INVALID_STREAM);
+ return;
+ }
+ if (seen_pps_.empty()) {
+ WriteToMediaLog(MediaLogMessageLevel::kERROR,
+ "Invalid configuration (no PPS)");
+ NotifyError(INVALID_ARGUMENT, SFT_INVALID_STREAM);
+ return;
+ }
- // ConfigureDecoder() calls NotifyError() on failure.
- if (!ConfigureDecoder()) {
- return;
+ // ConfigureDecoder() calls NotifyError() on failure.
+ if (!ConfigureDecoder()) {
+ return;
+ }
+ } else {
+ // Only |data| and |size| are read later, other fields are left empty.
+ // In case that their are new VPS/SPS/PPS appears after an IDR.
+ media::H265NALU vps_nalu;
+ vps_nalu.data = active_vps_.data();
+ vps_nalu.size = active_vps_.size();
+ nalus.insert(nalus.begin() + first_slice_index, vps_nalu);
+ data_size += kNALUHeaderLength + vps_nalu.size;
+ first_slice_index += 1;
+
+ media::H265NALU sps_nalu;
+ sps_nalu.data = active_sps_.data();
+ sps_nalu.size = active_sps_.size();
+ nalus.insert(nalus.begin() + first_slice_index, sps_nalu);
+ data_size += kNALUHeaderLength + sps_nalu.size;
+ first_slice_index += 1;
+
+ media::H265NALU pps_nalu;
+ pps_nalu.data = active_pps_.data();
+ pps_nalu.size = active_pps_.size();
+ nalus.insert(nalus.begin() + first_slice_index, pps_nalu);
+ data_size += kNALUHeaderLength + pps_nalu.size;
+ first_slice_index += 1;
+
+ // Update the configured VPSs/SPSs/PPSs in case VT referrence to the wrong
+ // parameter sets.
+ configured_vpss_[active_vps_id].assign(
+ active_vps_.data(), active_vps_.data() + active_vps_.size());
+ configured_spss_[active_sps_id].assign(
+ active_sps_.data(), active_sps_.data() + active_sps_.size());
+ configured_ppss_[active_pps_id].assign(
+ active_pps_.data(), active_pps_.data() + active_pps_.size());
}
}
@@ -2056,16 +2127,19 @@ bool VTVideoDecodeAccelerator::ProcessFrame(const Frame& frame) {
// Request new pictures.
picture_size_ = frame.image_size;
- // TODO(https://crbug.com/1210994): Remove RGBAF16 support, and expose only
- // PIXEL_FORMAT_NV12 and PIXEL_FORMAT_YUV420P10.
- picture_format_ = PIXEL_FORMAT_RGBAF16;
- if (base::FeatureList::IsEnabled(kMultiPlaneVideoToolboxSharedImages)) {
- // TODO(https://crbug.com/1233228): The UV planes of P010 frames cannot
- // be represented in the current gfx::BufferFormat.
- if (config_.profile != VP9PROFILE_PROFILE2 &&
- config_.profile != HEVCPROFILE_MAIN10 &&
- config_.profile != HEVCPROFILE_REXT)
- picture_format_ = PIXEL_FORMAT_NV12;
+ // ARGB is required to make alpha video has a non-transparent background
+ // when playing in PiP mode.
+ if (has_alpha_) {
+ buffer_format_ = gfx::BufferFormat::BGRA_8888;
+ picture_format_ = PIXEL_FORMAT_ARGB;
+ } else if (config_.profile == VP9PROFILE_PROFILE2 ||
+ config_.profile == HEVCPROFILE_MAIN10 ||
+ config_.profile == HEVCPROFILE_REXT) {
+ buffer_format_ = gfx::BufferFormat::P010;
+ picture_format_ = PIXEL_FORMAT_P016LE;
+ } else {
+ buffer_format_ = gfx::BufferFormat::YUV_420_BIPLANAR;
+ picture_format_ = PIXEL_FORMAT_NV12;
}
DVLOG(3) << "ProvidePictureBuffers(" << kNumPictureBuffers
@@ -2093,61 +2167,46 @@ bool VTVideoDecodeAccelerator::SendFrame(const Frame& frame) {
PictureInfo* picture_info = it->second.get();
DCHECK(picture_info->gl_images.empty());
- const gfx::BufferFormat buffer_format =
- config_.profile == VP9PROFILE_PROFILE2 ||
- config_.profile == HEVCPROFILE_MAIN10 ||
- config_.profile == HEVCPROFILE_REXT
- ? gfx::BufferFormat::P010
- : gfx::BufferFormat::YUV_420_BIPLANAR;
- gfx::ColorSpace color_space = GetImageBufferColorSpace(frame.image);
-
+ const gfx::ColorSpace color_space = GetImageBufferColorSpace(frame.image);
std::vector<gfx::BufferPlane> planes;
switch (picture_format_) {
case PIXEL_FORMAT_NV12:
- case PIXEL_FORMAT_YUV420P10:
+ case PIXEL_FORMAT_P016LE:
planes.push_back(gfx::BufferPlane::Y);
planes.push_back(gfx::BufferPlane::UV);
break;
- case PIXEL_FORMAT_RGBAF16:
+ case PIXEL_FORMAT_ARGB:
planes.push_back(gfx::BufferPlane::DEFAULT);
break;
default:
NOTREACHED();
break;
}
-
for (size_t plane = 0; plane < planes.size(); ++plane) {
const gfx::Size plane_size(
CVPixelBufferGetWidthOfPlane(frame.image.get(), plane),
CVPixelBufferGetHeightOfPlane(frame.image.get(), plane));
gfx::BufferFormat plane_buffer_format =
- gpu::GetPlaneBufferFormat(planes[plane], buffer_format);
- // TODO(https://crbug.com/1108909): BGRA is not an appropriate value for
- // these parameters.
+ gpu::GetPlaneBufferFormat(planes[plane], buffer_format_);
const viz::ResourceFormat viz_resource_format =
- (picture_format_ == PIXEL_FORMAT_RGBAF16)
- ? viz::ResourceFormat::RGBA_F16
- : viz::GetResourceFormat(plane_buffer_format);
+ viz::GetResourceFormat(plane_buffer_format);
const GLenum gl_format = viz::GLDataFormat(viz_resource_format);
scoped_refptr<gl::GLImageIOSurface> gl_image(
- gl::GLImageIOSurface::Create(plane_size, gl_format));
+ gl::GLImageIOSurface::Create(plane_size));
if (!gl_image->InitializeWithCVPixelBuffer(
frame.image.get(), plane,
gfx::GenericSharedMemoryId(g_cv_pixel_buffer_ids.GetNext()),
- plane_buffer_format)) {
+ plane_buffer_format, color_space)) {
NOTIFY_STATUS("Failed to initialize GLImageIOSurface", PLATFORM_FAILURE,
SFT_PLATFORM_ERROR);
}
- gl_image->DisableInUseByWindowServer();
- gl_image->SetColorSpaceForYUVToRGBConversion(color_space);
- gl_image->SetColorSpaceShallow(color_space);
if (picture_info->uses_shared_images) {
gpu::SharedImageStub* shared_image_stub = client_->GetSharedImageStub();
DCHECK(shared_image_stub);
- const uint32_t shared_image_usage =
- gpu::SHARED_IMAGE_USAGE_DISPLAY | gpu::SHARED_IMAGE_USAGE_SCANOUT;
+ const uint32_t shared_image_usage = gpu::SHARED_IMAGE_USAGE_DISPLAY_READ |
+ gpu::SHARED_IMAGE_USAGE_SCANOUT;
gpu::Mailbox mailbox = gpu::Mailbox::GenerateForSharedImage();
gpu::GLTextureImageBackingHelper::InitializeGLTextureParams gl_params;
@@ -2170,12 +2229,13 @@ bool VTVideoDecodeAccelerator::SendFrame(const Frame& frame) {
}
auto shared_image = std::make_unique<gpu::GLImageBacking>(
- gl_image, mailbox, viz_resource_format, plane_size, color_space,
- kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType, shared_image_usage,
- gl_params, gl_client_.is_passthrough);
+ gl_image, mailbox,
+ viz::SharedImageFormat::SinglePlane(viz_resource_format), plane_size,
+ color_space, kTopLeft_GrSurfaceOrigin, kOpaque_SkAlphaType,
+ shared_image_usage, gl_params, gl_client_.is_passthrough);
const bool success = shared_image_stub->factory()->RegisterBacking(
- std::move(shared_image), /*allow_legacy_mailbox=*/false);
+ std::move(shared_image));
if (!success) {
DLOG(ERROR) << "Failed to register shared image";
NotifyError(PLATFORM_FAILURE, SFT_PLATFORM_ERROR);
diff --git a/chromium/media/gpu/mac/vt_video_decode_accelerator_mac.h b/chromium/media/gpu/mac/vt_video_decode_accelerator_mac.h
index 178f21f5549..ebee56c1fae 100644
--- a/chromium/media/gpu/mac/vt_video_decode_accelerator_mac.h
+++ b/chromium/media/gpu/mac/vt_video_decode_accelerator_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -265,6 +265,9 @@ class VTVideoDecodeAccelerator : public VideoDecodeAccelerator,
// Format of the assigned picture buffers.
VideoPixelFormat picture_format_ = PIXEL_FORMAT_UNKNOWN;
+ // Corresponding GpuMemoryBuffer format.
+ gfx::BufferFormat buffer_format_ = gfx::BufferFormat::YUV_420_BIPLANAR;
+
// Frames that have not yet been decoded, keyed by bitstream ID; maintains
// ownership of Frame objects while they flow through VideoToolbox.
base::flat_map<int32_t, std::unique_ptr<Frame>> pending_frames_;
@@ -315,8 +318,13 @@ class VTVideoDecodeAccelerator : public VideoDecodeAccelerator,
base::flat_map<int, std::vector<uint8_t>> seen_vps_;
// VPS most recently activated by an IDR.
std::vector<uint8_t> active_vps_;
- // VPS the decoder is currently confgured with.
- std::vector<uint8_t> configured_vps_;
+
+ // VPSs the decoder is currently confgured with.
+ base::flat_map<int, std::vector<uint8_t>> configured_vpss_;
+ // SPSs the decoder is currently confgured with.
+ base::flat_map<int, std::vector<uint8_t>> configured_spss_;
+ // PPSs the decoder is currently confgured with.
+ base::flat_map<int, std::vector<uint8_t>> configured_ppss_;
H265POC hevc_poc_;
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
@@ -330,6 +338,10 @@ class VTVideoDecodeAccelerator : public VideoDecodeAccelerator,
bool waiting_for_idr_ = true;
bool missing_idr_logged_ = false;
+ // currently only HEVC is supported, VideoToolbox doesn't
+ // support VP9 with alpha for now.
+ bool has_alpha_ = false;
+
// Used to accumulate the output picture count as a workaround to solve
// the VT CRA/RASL bug
uint64_t output_count_for_cra_rasl_workaround_ = 0;
diff --git a/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.cc b/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.cc
index 965e3986fb0..1020df4e969 100644
--- a/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.cc
+++ b/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,11 +6,13 @@
#include <memory>
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/mac/mac_logging.h"
#include "base/memory/shared_memory_mapping.h"
#include "base/memory/unsafe_shared_memory_region.h"
+#include "base/numerics/safe_conversions.h"
#include "base/task/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
@@ -60,19 +62,60 @@ static CFStringRef VideoCodecProfileToVTProfile(VideoCodecProfile profile) {
return kVTProfileLevel_H264_Baseline_AutoLevel;
}
-} // namespace
+base::ScopedCFTypeRef<CFArrayRef> CreateRateLimitArray(const Bitrate& bitrate) {
+ std::vector<CFNumberRef> limits;
+ switch (bitrate.mode()) {
+ case Bitrate::Mode::kConstant: {
+ // CBR should be enforces with granularity of a second.
+ float target_interval = 1.0;
+ int32_t target_bitrate = bitrate.target_bps() / kBitsPerByte;
+
+ limits.push_back(
+ CFNumberCreate(nullptr, kCFNumberSInt32Type, &target_bitrate));
+ limits.push_back(
+ CFNumberCreate(nullptr, kCFNumberFloat32Type, &target_interval));
+ break;
+ }
+ case Bitrate::Mode::kVariable: {
+ // 5 seconds should be an okay interval for VBR to enforce the long-term
+ // limit.
+ float avg_interval = 5.0;
+ int32_t avg_bitrate = base::saturated_cast<int32_t>(
+ bitrate.target_bps() / kBitsPerByte * avg_interval);
+
+ // And the peak bitrate is measured per-second in a way similar to CBR.
+ float peak_interval = 1.0;
+ int32_t peak_bitrate = bitrate.peak_bps() / kBitsPerByte;
+ limits.push_back(
+ CFNumberCreate(nullptr, kCFNumberSInt32Type, &peak_bitrate));
+ limits.push_back(
+ CFNumberCreate(nullptr, kCFNumberFloat32Type, &peak_interval));
+ limits.push_back(
+ CFNumberCreate(nullptr, kCFNumberSInt32Type, &avg_bitrate));
+ limits.push_back(
+ CFNumberCreate(nullptr, kCFNumberFloat32Type, &avg_interval));
+ break;
+ }
-struct VTVideoEncodeAccelerator::InProgressFrameEncode {
- InProgressFrameEncode() = delete;
+ default:
+ NOTREACHED();
+ }
- InProgressFrameEncode(base::TimeDelta rtp_timestamp, base::TimeTicks ref_time)
- : timestamp(rtp_timestamp), reference_time(ref_time) {}
+ base::ScopedCFTypeRef<CFArrayRef> result(CFArrayCreate(
+ kCFAllocatorDefault, reinterpret_cast<const void**>(limits.data()),
+ limits.size(), &kCFTypeArrayCallBacks));
+ for (auto* number : limits)
+ CFRelease(number);
+ return result;
+}
- InProgressFrameEncode(const InProgressFrameEncode&) = delete;
- InProgressFrameEncode& operator=(const InProgressFrameEncode&) = delete;
+} // namespace
+
+struct VTVideoEncodeAccelerator::InProgressFrameEncode {
+ InProgressFrameEncode(base::TimeDelta rtp_timestamp)
+ : timestamp(rtp_timestamp) {}
const base::TimeDelta timestamp;
- const base::TimeTicks reference_time;
};
struct VTVideoEncodeAccelerator::EncodeOutput {
@@ -162,26 +205,6 @@ VTVideoEncodeAccelerator::GetSupportedProfiles() {
return profiles;
}
-VideoEncodeAccelerator::SupportedProfiles
-VTVideoEncodeAccelerator::GetSupportedProfilesLight() {
- DVLOG(3) << __func__;
- DCHECK_CALLED_ON_VALID_SEQUENCE(client_sequence_checker_);
-
- SupportedProfiles profiles;
-
- SupportedProfile profile;
- profile.max_framerate_numerator = kMaxFrameRateNumerator;
- profile.max_framerate_denominator = kMaxFrameRateDenominator;
- profile.rate_control_modes = VideoEncodeAccelerator::kConstantMode |
- VideoEncodeAccelerator::kVariableMode;
- profile.max_resolution = gfx::Size(kMaxResolutionWidth, kMaxResolutionHeight);
- for (const auto& supported_profile : kSupportedProfiles) {
- profile.profile = supported_profile;
- profiles.push_back(profile);
- }
- return profiles;
-}
-
bool VTVideoEncodeAccelerator::Initialize(const Config& config,
Client* client,
std::unique_ptr<MediaLog> media_log) {
@@ -199,8 +222,7 @@ bool VTVideoEncodeAccelerator::Initialize(const Config& config,
<< VideoPixelFormatToString(config.input_format);
return false;
}
- if (std::find(std::begin(kSupportedProfiles), std::end(kSupportedProfiles),
- config.output_profile) == std::end(kSupportedProfiles)) {
+ if (!base::Contains(kSupportedProfiles, config.output_profile)) {
MEDIA_LOG(ERROR, media_log.get()) << "Output profile not supported= "
<< GetProfileName(config.output_profile);
return false;
@@ -327,23 +349,23 @@ void VTVideoEncodeAccelerator::EncodeTask(scoped_refptr<VideoFrame> frame,
DCHECK(compression_session_);
DCHECK(frame);
- // TODO(emircan): See if we can eliminate a copy here by using
- // CVPixelBufferPool for the allocation of incoming VideoFrames.
- base::ScopedCFTypeRef<CVPixelBufferRef> pixel_buffer =
- WrapVideoFrameInCVPixelBuffer(*frame);
+ auto pixel_buffer = WrapVideoFrameInCVPixelBuffer(frame);
+ if (!pixel_buffer) {
+ DLOG(ERROR) << "WrapVideoFrameInCVPixelBuffer failed.";
+ NotifyError(kPlatformFailureError);
+ return;
+ }
base::ScopedCFTypeRef<CFDictionaryRef> frame_props =
video_toolbox::DictionaryWithKeyValue(
kVTEncodeFrameOptionKey_ForceKeyFrame,
force_keyframe ? kCFBooleanTrue : kCFBooleanFalse);
- base::TimeTicks ref_time =
- frame->metadata().reference_time.value_or(base::TimeTicks::Now());
auto timestamp_cm =
CMTimeMake(frame->timestamp().InMicroseconds(), USEC_PER_SEC);
// Wrap information we'll need after the frame is encoded in a heap object.
// We'll get the pointer back from the VideoToolbox completion callback.
std::unique_ptr<InProgressFrameEncode> request(
- new InProgressFrameEncode(frame->timestamp(), ref_time));
+ new InProgressFrameEncode(frame->timestamp()));
if (bitrate_.mode() == Bitrate::Mode::kConstant) {
// In CBR mode, we adjust bitrate before every encode based on past history
@@ -414,7 +436,7 @@ void VTVideoEncodeAccelerator::RequestEncodingParametersChangeTask(
bitrate_ = bitrate;
}
-void VTVideoEncodeAccelerator::SetAdjustedConstantBitrate(int32_t bitrate) {
+void VTVideoEncodeAccelerator::SetAdjustedConstantBitrate(uint32_t bitrate) {
DCHECK(encoder_thread_task_runner_->BelongsToCurrentThread());
if (bitrate == encoder_set_bitrate_)
@@ -424,11 +446,11 @@ void VTVideoEncodeAccelerator::SetAdjustedConstantBitrate(int32_t bitrate) {
video_toolbox::SessionPropertySetter session_property_setter(
compression_session_);
[[maybe_unused]] bool rv = session_property_setter.Set(
- kVTCompressionPropertyKey_AverageBitRate, encoder_set_bitrate_);
+ kVTCompressionPropertyKey_AverageBitRate,
+ base::saturated_cast<int32_t>(encoder_set_bitrate_));
rv &= session_property_setter.Set(
kVTCompressionPropertyKey_DataRateLimits,
- video_toolbox::ArrayWithIntegerAndFloat(
- encoder_set_bitrate_ / kBitsPerByte, 1.0f));
+ CreateRateLimitArray(Bitrate::ConstantBitrate(bitrate)));
DLOG_IF(ERROR, !rv)
<< "Couldn't change bitrate parameters of encode session.";
}
@@ -442,10 +464,8 @@ void VTVideoEncodeAccelerator::SetVariableBitrate(const Bitrate& bitrate) {
[[maybe_unused]] bool rv =
session_property_setter.Set(kVTCompressionPropertyKey_AverageBitRate,
static_cast<int32_t>(bitrate.target_bps()));
- rv &=
- session_property_setter.Set(kVTCompressionPropertyKey_DataRateLimits,
- video_toolbox::ArrayWithIntegerAndFloat(
- bitrate.peak_bps() / kBitsPerByte, 1.0f));
+ rv &= session_property_setter.Set(kVTCompressionPropertyKey_DataRateLimits,
+ CreateRateLimitArray(bitrate));
DLOG_IF(ERROR, !rv)
<< "Couldn't change bitrate parameters of encode session.";
}
diff --git a/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.h b/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.h
index 7c69134c108..b1fd86a0a7c 100644
--- a/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.h
+++ b/chromium/media/gpu/mac/vt_video_encode_accelerator_mac.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -37,8 +37,6 @@ class MEDIA_GPU_EXPORT VTVideoEncodeAccelerator
// VideoEncodeAccelerator implementation.
VideoEncodeAccelerator::SupportedProfiles GetSupportedProfiles() override;
- VideoEncodeAccelerator::SupportedProfiles GetSupportedProfilesLight()
- override;
bool Initialize(const Config& config,
Client* client,
@@ -72,7 +70,7 @@ class MEDIA_GPU_EXPORT VTVideoEncodeAccelerator
void DestroyTask();
// Helper functions to set bitrate.
- void SetAdjustedConstantBitrate(int32_t bitrate);
+ void SetAdjustedConstantBitrate(uint32_t bitrate);
void SetVariableBitrate(const Bitrate& bitrate);
// Helper function to notify the client of an error on |client_task_runner_|.
@@ -127,8 +125,8 @@ class MEDIA_GPU_EXPORT VTVideoEncodeAccelerator
// bitrate mode no adjustments are needed.
// Bitrate adjuster used to fix VideoToolbox's inconsistent bitrate issues.
webrtc::BitrateAdjuster bitrate_adjuster_;
- int32_t target_bitrate_ = 0; // User for CBR only
- int32_t encoder_set_bitrate_ = 0; // User for CBR only
+ uint32_t target_bitrate_ = 0; // User for CBR only
+ uint32_t encoder_set_bitrate_ = 0; // User for CBR only
// If True, the encoder fails initialization if setting of session's property
// kVTCompressionPropertyKey_MaxFrameDelayCount returns an error.
diff --git a/chromium/media/gpu/macros.h b/chromium/media/gpu/macros.h
index e758332eccc..9d30f09682e 100644
--- a/chromium/media/gpu/macros.h
+++ b/chromium/media/gpu/macros.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/media_gpu_export.h b/chromium/media/gpu/media_gpu_export.h
index b5b80aae5c1..8c364dc6ddd 100644
--- a/chromium/media/gpu/media_gpu_export.h
+++ b/chromium/media/gpu/media_gpu_export.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/sandbox/BUILD.gn b/chromium/media/gpu/sandbox/BUILD.gn
index d9a745c1ca4..437a0f3445b 100644
--- a/chromium/media/gpu/sandbox/BUILD.gn
+++ b/chromium/media/gpu/sandbox/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2021 The Chromium Authors. All rights reserved.
+# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/gpu/sandbox/OWNERS b/chromium/media/gpu/sandbox/OWNERS
index 70554b270ab..57df6dc7ec4 100644
--- a/chromium/media/gpu/sandbox/OWNERS
+++ b/chromium/media/gpu/sandbox/OWNERS
@@ -1,2 +1,2 @@
set noparent
-file://sandbox/OWNERS
+file://sandbox/linux/OWNERS
diff --git a/chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc b/chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
index 793be9e963e..25e31b629d2 100644
--- a/chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
+++ b/chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -72,10 +72,16 @@ bool HardwareVideoDecodingPreSandboxHook(
BrokerFilePermission::ReadOnlyRecursive(path + "/"));
}
}
+#endif // BUILDFLAG(USE_V4L2_CODEC)
- // TODO(b/195769334): for now, this is only needed for two use cases: the
- // legacy VaapiVideoDecodeAccelerator and AMD. However, we'll likely need this
- // unconditionally so that we can allocate dma-bufs.
+ // TODO(b/195769334): consider using the type of client to decide if we should
+ // allow access to the render node:
+ //
+ // - If the client is ARC++/ARCVM, the render node is only needed for two
+ // cases, the legacy VaapiVideoDecodeAccelerator and AMD.
+ //
+ // - If the client is a Chrome renderer process, the render node is needed on
+ // ChromeOS to allocate output buffers.
for (int i = 128; i <= 137; ++i) {
const std::string path = base::StringPrintf("/dev/dri/renderD%d", i);
struct stat st;
@@ -85,7 +91,6 @@ bool HardwareVideoDecodingPreSandboxHook(
: BrokerFilePermission::ReadOnly(path));
}
}
-#endif // BUILDFLAG(USE_V4L2_CODEC)
sandbox::policy::SandboxLinux::GetInstance()->StartBrokerProcess(
command_set, permissions, sandbox::policy::SandboxLinux::PreSandboxHook(),
diff --git a/chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h b/chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h
index 332c02e4d1b..7b90e3d3be7 100644
--- a/chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h
+++ b/chromium/media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/test/BUILD.gn b/chromium/media/gpu/test/BUILD.gn
index d0d079cffae..6c2eba6cbac 100644
--- a/chromium/media/gpu/test/BUILD.gn
+++ b/chromium/media/gpu/test/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -71,7 +71,6 @@ source_set("test_helpers") {
]
deps = [
"//media/gpu",
- "//media/mojo/common:mojo_shared_buffer_video_frame",
"//media/parsers",
"//mojo/public/cpp/system",
"//testing/gtest",
diff --git a/chromium/media/gpu/v4l2/BUILD.gn b/chromium/media/gpu/v4l2/BUILD.gn
index 80ebde854de..42285e35308 100644
--- a/chromium/media/gpu/v4l2/BUILD.gn
+++ b/chromium/media/gpu/v4l2/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -13,13 +13,11 @@ import("//ui/gl/features.gni")
assert(use_v4l2_codec)
-if (use_v4lplugin) {
- generate_stubs("libv4l2_stubs") {
- extra_header = "v4l2_stub_header.fragment"
- sigs = [ "v4l2.sig" ]
- output_name = "v4l2_stubs"
- deps = [ "//base" ]
- }
+generate_stubs("libv4l2_stubs") {
+ extra_header = "v4l2_stub_header.fragment"
+ sigs = [ "v4l2.sig" ]
+ output_name = "v4l2_stubs"
+ deps = [ "//base" ]
}
source_set("v4l2") {
@@ -58,6 +56,8 @@ source_set("v4l2") {
"v4l2_video_decoder_backend_stateful.h",
"v4l2_video_decoder_backend_stateless.cc",
"v4l2_video_decoder_backend_stateless.h",
+ "v4l2_video_decoder_delegate_av1.cc",
+ "v4l2_video_decoder_delegate_av1.h",
"v4l2_video_decoder_delegate_h264.cc",
"v4l2_video_decoder_delegate_h264.h",
"v4l2_video_decoder_delegate_vp8.cc",
@@ -100,6 +100,7 @@ source_set("v4l2") {
public_deps = [ "//ui/gl" ]
deps = [
+ ":libv4l2_stubs",
":v4l2_status",
"//base",
"//gpu/ipc/common",
@@ -114,10 +115,6 @@ source_set("v4l2") {
"//ui/ozone",
]
- if (use_v4lplugin) {
- deps += [ ":libv4l2_stubs" ]
- }
-
if (is_chromeos_ash) {
sources += [
"v4l2_jpeg_encode_accelerator.cc",
@@ -132,6 +129,11 @@ source_set("v4l2") {
"//media/gpu:video_frame_mapper_common",
]
}
+
+ # TODO(b/243970152): update use_libgav1_parser flag
+ if (enable_libgav1_decoder || use_libgav1_parser) {
+ deps += [ "//third_party/libgav1:libgav1" ]
+ }
}
# The v4l2 status functionality is in its own source set so that it can be
diff --git a/chromium/media/gpu/v4l2/aml_v4l2_device.cc b/chromium/media/gpu/v4l2/aml_v4l2_device.cc
index 2d28017d393..b4cd4f4662d 100644
--- a/chromium/media/gpu/v4l2/aml_v4l2_device.cc
+++ b/chromium/media/gpu/v4l2/aml_v4l2_device.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/aml_v4l2_device.h b/chromium/media/gpu/v4l2/aml_v4l2_device.h
index 7893c2131b5..fe260385933 100644
--- a/chromium/media/gpu/v4l2/aml_v4l2_device.h
+++ b/chromium/media/gpu/v4l2/aml_v4l2_device.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/gpu/v4l2/buffer_affinity_tracker.cc b/chromium/media/gpu/v4l2/buffer_affinity_tracker.cc
index 7ada30e1960..5565fbba907 100644
--- a/chromium/media/gpu/v4l2/buffer_affinity_tracker.cc
+++ b/chromium/media/gpu/v4l2/buffer_affinity_tracker.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/buffer_affinity_tracker.h b/chromium/media/gpu/v4l2/buffer_affinity_tracker.h
index 5019518967e..c94bba29565 100644
--- a/chromium/media/gpu/v4l2/buffer_affinity_tracker.h
+++ b/chromium/media/gpu/v4l2/buffer_affinity_tracker.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/generic_v4l2_device.cc b/chromium/media/gpu/v4l2/generic_v4l2_device.cc
index 475548bd743..fa9a95b957b 100644
--- a/chromium/media/gpu/v4l2/generic_v4l2_device.cc
+++ b/chromium/media/gpu/v4l2/generic_v4l2_device.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -15,9 +15,9 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
-#include <algorithm>
#include <memory>
+#include "base/containers/contains.h"
#include "base/files/scoped_file.h"
#include "base/posix/eintr_wrapper.h"
#include "base/strings/stringprintf.h"
@@ -36,15 +36,13 @@
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
-#if BUILDFLAG(USE_LIBV4L2)
// Auto-generated for dlopen libv4l2 libraries
#include "media/gpu/v4l2/v4l2_stubs.h"
#include "third_party/v4l-utils/lib/include/libv4l2.h"
-using media_gpu_v4l2::kModuleV4l2;
using media_gpu_v4l2::InitializeStubs;
+using media_gpu_v4l2::kModuleV4l2;
using media_gpu_v4l2::StubPathMap;
-#endif
namespace media {
@@ -75,9 +73,7 @@ uint32_t V4L2PixFmtToDrmFormat(uint32_t format) {
} // namespace
GenericV4L2Device::GenericV4L2Device() {
-#if BUILDFLAG(USE_LIBV4L2)
use_libv4l2_ = false;
-#endif
}
GenericV4L2Device::~GenericV4L2Device() {
@@ -86,10 +82,10 @@ GenericV4L2Device::~GenericV4L2Device() {
int GenericV4L2Device::Ioctl(int request, void* arg) {
DCHECK(device_fd_.is_valid());
-#if BUILDFLAG(USE_LIBV4L2)
+
if (use_libv4l2_)
return HANDLE_EINTR(v4l2_ioctl(device_fd_.get(), request, arg));
-#endif
+
return HANDLE_EINTR(ioctl(device_fd_.get(), request, arg));
}
@@ -230,11 +226,8 @@ bool GenericV4L2Device::CanCreateEGLImageFrom(const Fourcc fourcc) const {
#endif
};
- return std::find(
- kEGLImageDrmFmtsSupported,
- kEGLImageDrmFmtsSupported + std::size(kEGLImageDrmFmtsSupported),
- V4L2PixFmtToDrmFormat(fourcc.ToV4L2PixFmt())) !=
- kEGLImageDrmFmtsSupported + std::size(kEGLImageDrmFmtsSupported);
+ return base::Contains(kEGLImageDrmFmtsSupported,
+ V4L2PixFmtToDrmFormat(fourcc.ToV4L2PixFmt()));
}
EGLImageKHR GenericV4L2Device::CreateEGLImage(
@@ -440,42 +433,34 @@ bool GenericV4L2Device::OpenDevicePath(const std::string& path, Type type) {
if (!device_fd_.is_valid())
return false;
-#if BUILDFLAG(USE_LIBV4L2)
- if (type == Type::kEncoder &&
- HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) !=
- -1) {
- DVLOGF(3) << "Using libv4l2 for " << path;
- use_libv4l2_ = true;
+ if (V4L2Device::UseLibV4L2()) {
+ if (type == Type::kEncoder &&
+ HANDLE_EINTR(v4l2_fd_open(device_fd_.get(), V4L2_DISABLE_CONVERSION)) !=
+ -1) {
+ DVLOGF(3) << "Using libv4l2 for " << path;
+ use_libv4l2_ = true;
+ }
}
-#endif
return true;
}
void GenericV4L2Device::CloseDevice() {
DVLOGF(3);
-#if BUILDFLAG(USE_LIBV4L2)
if (use_libv4l2_ && device_fd_.is_valid())
v4l2_close(device_fd_.release());
-#endif
device_fd_.reset();
}
// static
bool GenericV4L2Device::PostSandboxInitialization() {
-#if BUILDFLAG(USE_LIBV4L2)
- static const base::FilePath::CharType kV4l2Lib[] =
-#if defined(ARCH_CPU_64_BITS)
- FILE_PATH_LITERAL("/usr/lib64/libv4l2.so");
-#else
- FILE_PATH_LITERAL("/usr/lib/libv4l2.so");
-#endif // defined(ARCH_CPU_64_BITS)
- StubPathMap paths;
- paths[kModuleV4l2].push_back(kV4l2Lib);
-
- return InitializeStubs(paths);
-#else
- return true;
-#endif
+ if (V4L2Device::UseLibV4L2()) {
+ StubPathMap paths;
+ paths[kModuleV4l2].push_back(V4L2Device::kLibV4l2Path);
+
+ return InitializeStubs(paths);
+ } else {
+ return true;
+ }
}
void GenericV4L2Device::EnumerateDevicesForType(Type type) {
@@ -556,8 +541,7 @@ std::string GenericV4L2Device::GetDevicePathFor(Type type, uint32_t pixfmt) {
const Devices& devices = GetDevicesForType(type);
for (const auto& device : devices) {
- if (std::find(device.second.begin(), device.second.end(), pixfmt) !=
- device.second.end())
+ if (base::Contains(device.second, pixfmt))
return device.first;
}
diff --git a/chromium/media/gpu/v4l2/generic_v4l2_device.h b/chromium/media/gpu/v4l2/generic_v4l2_device.h
index 09013a5cf12..63870260288 100644
--- a/chromium/media/gpu/v4l2/generic_v4l2_device.h
+++ b/chromium/media/gpu/v4l2/generic_v4l2_device.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -120,10 +120,8 @@ class GenericV4L2Device : public V4L2Device {
// interrupted.
base::ScopedFD device_poll_interrupt_fd_;
-#if BUILDFLAG(USE_LIBV4L2)
// Use libv4l2 when operating |device_fd_|.
bool use_libv4l2_;
-#endif
// Lazily initialize static data after sandbox is enabled. Return false on
// init failure.
diff --git a/chromium/media/gpu/v4l2/v4l2.sig b/chromium/media/gpu/v4l2/v4l2.sig
index 4269fb48d59..32931df3720 100644
--- a/chromium/media/gpu/v4l2/v4l2.sig
+++ b/chromium/media/gpu/v4l2/v4l2.sig
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_decode_surface.cc b/chromium/media/gpu/v4l2/v4l2_decode_surface.cc
index e7bc6953a48..8fe97c361db 100644
--- a/chromium/media/gpu/v4l2/v4l2_decode_surface.cc
+++ b/chromium/media/gpu/v4l2/v4l2_decode_surface.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_decode_surface.h b/chromium/media/gpu/v4l2/v4l2_decode_surface.h
index 2f188a1eed1..e789e4f8d84 100644
--- a/chromium/media/gpu/v4l2/v4l2_decode_surface.h
+++ b/chromium/media/gpu/v4l2/v4l2_decode_surface.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_decode_surface_handler.h b/chromium/media/gpu/v4l2/v4l2_decode_surface_handler.h
index e49cd961039..8977fe8116c 100644
--- a/chromium/media/gpu/v4l2/v4l2_decode_surface_handler.h
+++ b/chromium/media/gpu/v4l2/v4l2_decode_surface_handler.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_device.cc b/chromium/media/gpu/v4l2/v4l2_device.cc
index d24013d2eb5..8e3c87009b4 100644
--- a/chromium/media/gpu/v4l2/v4l2_device.cc
+++ b/chromium/media/gpu/v4l2/v4l2_device.cc
@@ -1,13 +1,15 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/gpu/v4l2/v4l2_device.h"
+#include <errno.h>
#include <fcntl.h>
-#include <poll.h>
#include <linux/media.h>
+#include <poll.h>
#include <sys/ioctl.h>
+#include <unistd.h>
#include <algorithm>
#include <set>
@@ -130,6 +132,20 @@ void V4L2ProcessingTrace(const struct v4l2_buffer* v4l2_buffer, bool start) {
}
}
+bool LibV4L2Exists() {
+#if BUILDFLAG(USE_LIBV4L2)
+ return true;
+#elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ if (access(V4L2Device::kLibV4l2Path, F_OK) == 0)
+ return true;
+ PLOG_IF(FATAL, errno != ENOENT)
+ << "access() failed for a reason other than ENOENT";
+ return false;
+#else
+ return false;
+#endif
+}
+
} // namespace
V4L2ExtCtrl::V4L2ExtCtrl(uint32_t id) {
@@ -593,8 +609,10 @@ bool V4L2WritableBufferRef::DoQueue(V4L2RequestRef* request_ref,
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(buffer_data_);
- if (request_ref && buffer_data_->queue_->SupportsRequests())
- request_ref->ApplyQueueBuffer(&(buffer_data_->v4l2_buffer_));
+ if (request_ref && buffer_data_->queue_->SupportsRequests() &&
+ !request_ref->ApplyQueueBuffer(&(buffer_data_->v4l2_buffer_))) {
+ return false;
+ }
bool queued = buffer_data_->QueueBuffer(std::move(video_frame));
@@ -1012,7 +1030,8 @@ V4L2Queue::~V4L2Queue() {
if (is_streaming_) {
VQLOGF(1) << "Queue is still streaming, trying to stop it...";
- Streamoff();
+ if (!Streamoff())
+ VQLOGF(1) << "Failed to stop queue";
}
DCHECK(queued_buffers_.empty());
@@ -1020,7 +1039,8 @@ V4L2Queue::~V4L2Queue() {
if (!buffers_.empty()) {
VQLOGF(1) << "Buffers are still allocated, trying to deallocate them...";
- DeallocateBuffers();
+ if (!DeallocateBuffers())
+ VQLOGF(1) << "Failed to deallocate queue buffers";
}
std::move(destroy_cb_).Run();
@@ -1166,7 +1186,8 @@ size_t V4L2Queue::AllocateBuffers(size_t count,
auto buffer = V4L2Buffer::Create(device_, type_, memory_, *format, i);
if (!buffer) {
- DeallocateBuffers();
+ if (!DeallocateBuffers())
+ VQLOGF(1) << "Failed to deallocate queue buffers";
return 0;
}
@@ -1963,6 +1984,12 @@ size_t V4L2Device::GetNumPlanesOfV4L2PixFmt(uint32_t pix_fmt) {
return 1u;
}
+// static
+bool V4L2Device::UseLibV4L2() {
+ static const bool use_libv4l2 = LibV4L2Exists();
+ return use_libv4l2;
+}
+
void V4L2Device::GetSupportedResolution(uint32_t pixelformat,
gfx::Size* min_resolution,
gfx::Size* max_resolution) {
diff --git a/chromium/media/gpu/v4l2/v4l2_device.h b/chromium/media/gpu/v4l2/v4l2_device.h
index 740667eb6e7..439414c69ee 100644
--- a/chromium/media/gpu/v4l2/v4l2_device.h
+++ b/chromium/media/gpu/v4l2/v4l2_device.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -96,7 +96,7 @@ class MEDIA_GPU_EXPORT V4L2WritableBufferRef {
// so this reference becomes invalid.
// In case of error, false is returned and the buffer is returned to the free
// list.
- bool QueueMMap(V4L2RequestRef* request_ref = nullptr) &&;
+ [[nodiscard]] bool QueueMMap(V4L2RequestRef* request_ref = nullptr) &&;
// Queue a USERPTR buffer, assigning |ptrs| as pointer for each plane.
// The size of |ptrs| must be equal to the number of planes of this buffer.
// When requests are supported, a |request_ref| can be passed along this
@@ -105,8 +105,8 @@ class MEDIA_GPU_EXPORT V4L2WritableBufferRef {
// so this reference becomes invalid.
// In case of error, false is returned and the buffer is returned to the free
// list.
- bool QueueUserPtr(const std::vector<void*>& ptrs,
- V4L2RequestRef* request_ref = nullptr) &&;
+ [[nodiscard]] bool QueueUserPtr(const std::vector<void*>& ptrs,
+ V4L2RequestRef* request_ref = nullptr) &&;
// Queue a DMABUF buffer, assigning |fds| as file descriptors for each plane.
// It is allowed the number of |fds| might be greater than the number of
// planes of this buffer. It happens when the v4l2 pixel format is single
@@ -117,8 +117,8 @@ class MEDIA_GPU_EXPORT V4L2WritableBufferRef {
// so this reference becomes invalid.
// In case of error, false is returned and the buffer is returned to the free
// list.
- bool QueueDMABuf(const std::vector<base::ScopedFD>& fds,
- V4L2RequestRef* request_ref = nullptr) &&;
+ [[nodiscard]] bool QueueDMABuf(const std::vector<base::ScopedFD>& fds,
+ V4L2RequestRef* request_ref = nullptr) &&;
// Queue a DMABUF buffer, assigning file descriptors of |planes| for planes.
// It is allowed the number of |planes| might be greater than the number of
// planes of this buffer. It happens when the v4l2 pixel format is single
@@ -129,8 +129,9 @@ class MEDIA_GPU_EXPORT V4L2WritableBufferRef {
// so this reference becomes invalid.
// In case of error, false is returned and the buffer is returned to the free
// list.
- bool QueueDMABuf(const std::vector<gfx::NativePixmapPlane>& planes,
- V4L2RequestRef* request_ref = nullptr) &&;
+ [[nodiscard]] bool QueueDMABuf(
+ const std::vector<gfx::NativePixmapPlane>& planes,
+ V4L2RequestRef* request_ref = nullptr) &&;
// Queue a |video_frame| using its file descriptors as DMABUFs. The VideoFrame
// must have been constructed from its file descriptors.
// The particularity of this method is that a reference to |video_frame| is
@@ -138,8 +139,8 @@ class MEDIA_GPU_EXPORT V4L2WritableBufferRef {
// |V4L2ReadableBufferRef::GetVideoFrame()|. |video_frame| is thus guaranteed
// to be alive until either all the |V4L2ReadableBufferRef| from the dequeued
// buffer get out of scope, or |V4L2Queue::Streamoff()| is called.
- bool QueueDMABuf(scoped_refptr<VideoFrame> video_frame,
- V4L2RequestRef* request_ref = nullptr) &&;
+ [[nodiscard]] bool QueueDMABuf(scoped_refptr<VideoFrame> video_frame,
+ V4L2RequestRef* request_ref = nullptr) &&;
// Returns the number of planes in this buffer.
size_t PlanesCount() const;
@@ -197,8 +198,8 @@ class MEDIA_GPU_EXPORT V4L2WritableBufferRef {
// filled.
// When requests are supported, a |request_ref| can be passed along this
// the buffer to be submitted.
- bool DoQueue(V4L2RequestRef* request_ref,
- scoped_refptr<VideoFrame> video_frame) &&;
+ [[nodiscard]] bool DoQueue(V4L2RequestRef* request_ref,
+ scoped_refptr<VideoFrame> video_frame) &&;
V4L2WritableBufferRef(const struct v4l2_buffer& v4l2_buffer,
base::WeakPtr<V4L2Queue> queue);
@@ -339,11 +340,11 @@ class MEDIA_GPU_EXPORT V4L2Queue
// This pair is used because not all failures to get the format are
// necessarily errors, so we need to way to let the use decide whether it
// is one or not.
- std::pair<absl::optional<struct v4l2_format>, int> GetFormat();
+ [[nodiscard]] std::pair<absl::optional<struct v4l2_format>, int> GetFormat();
// Codec-specific method to get the visible rectangle of the queue, using the
// VIDIOC_G_SELECTION ioctl if available, or VIDIOC_G_CROP as a fallback.
- absl::optional<gfx::Rect> GetVisibleRect();
+ [[nodiscard]] absl::optional<gfx::Rect> GetVisibleRect();
// Allocate |count| buffers for the current format of this queue, with a
// specific |memory| allocation, and returns the number of buffers allocated
@@ -367,27 +368,27 @@ class MEDIA_GPU_EXPORT V4L2Queue
// Deallocate all buffers previously allocated by |AllocateBuffers|. Any
// references to buffers previously allocated held by the client must be
// released, or this call will fail.
- bool DeallocateBuffers();
+ [[nodiscard]] bool DeallocateBuffers();
// Returns the memory usage of v4l2 buffers owned by this V4L2Queue which are
// mapped in user space memory.
- size_t GetMemoryUsage() const;
+ [[nodiscard]] size_t GetMemoryUsage() const;
// Returns |memory_|, memory type of last buffers allocated by this V4L2Queue.
- v4l2_memory GetMemoryType() const;
+ [[nodiscard]] v4l2_memory GetMemoryType() const;
// Return a reference to a free buffer for the caller to prepare and submit,
// or nullopt if no buffer is currently free.
//
// If the caller discards the returned reference, the underlying buffer is
// made available to clients again.
- absl::optional<V4L2WritableBufferRef> GetFreeBuffer();
+ [[nodiscard]] absl::optional<V4L2WritableBufferRef> GetFreeBuffer();
// Return the buffer at index |requested_buffer_id|, if it is available at
// this time.
//
// If the buffer is currently in use or the provided index is invalid,
// return |absl::nullopt|.
- absl::optional<V4L2WritableBufferRef> GetFreeBuffer(
+ [[nodiscard]] absl::optional<V4L2WritableBufferRef> GetFreeBuffer(
size_t requested_buffer_id);
// Return a V4L2 buffer suitable for the passed VideoFrame.
//
@@ -404,7 +405,7 @@ class MEDIA_GPU_EXPORT V4L2Queue
// since it will maximize performance in that case provided the number of
// different VideoFrames passed to this method does not exceed the number of
// V4L2 buffers allocated on the queue.
- absl::optional<V4L2WritableBufferRef> GetFreeBufferForFrame(
+ [[nodiscard]] absl::optional<V4L2WritableBufferRef> GetFreeBufferForFrame(
const VideoFrame& frame);
// Attempt to dequeue a buffer, and return a reference to it if one was
@@ -417,45 +418,46 @@ class MEDIA_GPU_EXPORT V4L2Queue
// otherwise.
// Dequeued buffers will not be reused by the driver until all references to
// them are dropped.
- std::pair<bool, V4L2ReadableBufferRef> DequeueBuffer();
+ [[nodiscard]] std::pair<bool, V4L2ReadableBufferRef> DequeueBuffer();
// Returns true if this queue is currently streaming.
- bool IsStreaming() const;
+ [[nodiscard]] bool IsStreaming() const;
// If not currently streaming, starts streaming. Returns true if we started
// streaming, or were already streaming, or false if we were not streaming
// and an error occurred when attempting to start the stream. On failure, any
// previously-queued buffers will be dequeued without processing and made
// available to the client, while any buffers held by the client will remain
// unchanged and their ownership will remain with the client.
- bool Streamon();
+ [[nodiscard]] bool Streamon();
// If currently streaming, stops streaming. Also make all queued buffers
// available to the client again regardless of the streaming state.
// If an error occurred while attempting to stop streaming, then false is
// returned and queued buffers are left untouched since the V4L2 queue may
// still be using them.
- bool Streamoff();
+ [[nodiscard]] bool Streamoff();
// Returns the number of buffers currently allocated for this queue.
- size_t AllocatedBuffersCount() const;
+ [[nodiscard]] size_t AllocatedBuffersCount() const;
// Returns the number of currently free buffers on this queue.
- size_t FreeBuffersCount() const;
+ [[nodiscard]] size_t FreeBuffersCount() const;
// Returns the number of buffers currently queued on this queue.
- size_t QueuedBuffersCount() const;
+ [[nodiscard]] size_t QueuedBuffersCount() const;
// Returns true if requests are supported by this queue.
- bool SupportsRequests();
+ [[nodiscard]] bool SupportsRequests();
// TODO (b/166275274) : Remove this once V4L2 properly supports modifiers.
// Out of band method to configure V4L2 for modifier use.
- absl::optional<struct v4l2_format> SetModifierFormat(uint64_t modifier,
- const gfx::Size& size);
+ [[nodiscard]] absl::optional<struct v4l2_format> SetModifierFormat(
+ uint64_t modifier,
+ const gfx::Size& size);
private:
~V4L2Queue();
// Called when clients request a buffer to be queued.
- bool QueueBuffer(struct v4l2_buffer* v4l2_buffer,
- scoped_refptr<VideoFrame> video_frame);
+ [[nodiscard]] bool QueueBuffer(struct v4l2_buffer* v4l2_buffer,
+ scoped_refptr<VideoFrame> video_frame);
const enum v4l2_buf_type type_;
enum v4l2_memory memory_ = V4L2_MEMORY_MMAP;
@@ -539,7 +541,7 @@ class MEDIA_GPU_EXPORT V4L2RequestRef : public V4L2RequestRefBase {
// Apply controls to the request.
bool ApplyCtrls(struct v4l2_ext_controls* ctrls) const;
// Apply buffer to the request.
- bool ApplyQueueBuffer(struct v4l2_buffer* buffer) const;
+ [[nodiscard]] bool ApplyQueueBuffer(struct v4l2_buffer* buffer) const;
// Submits the request to the driver.
absl::optional<V4L2SubmittedRequestRef> Submit() &&;
@@ -563,7 +565,7 @@ class MEDIA_GPU_EXPORT V4L2SubmittedRequestRef : public V4L2RequestRefBase {
V4L2SubmittedRequestRef& operator=(const V4L2SubmittedRequestRef&) = delete;
// Indicates if the request has completed.
- bool IsCompleted();
+ [[nodiscard]] bool IsCompleted();
private:
friend class V4L2RequestRef;
@@ -648,6 +650,17 @@ class MEDIA_GPU_EXPORT V4L2Device
kJpegEncoder,
};
+ inline static constexpr char kLibV4l2Path[] =
+#if defined(__aarch64__)
+ "/usr/lib64/libv4l2.so";
+#else
+ "/usr/lib/libv4l2.so";
+#endif
+
+ // Returns true iff libv4l2 should be used to interact with the V4L2 driver.
+ // This method is thread-safe.
+ static bool UseLibV4L2();
+
// Create and initialize an appropriate V4L2Device instance for the current
// platform, or return nullptr if not available.
static scoped_refptr<V4L2Device> Create();
@@ -655,7 +668,7 @@ class MEDIA_GPU_EXPORT V4L2Device
// Open a V4L2 device of |type| for use with |v4l2_pixfmt|.
// Return true on success.
// The device will be closed in the destructor.
- virtual bool Open(Type type, uint32_t v4l2_pixfmt) = 0;
+ [[nodiscard]] virtual bool Open(Type type, uint32_t v4l2_pixfmt) = 0;
// Returns the driver name.
std::string GetDriverName();
@@ -666,7 +679,7 @@ class MEDIA_GPU_EXPORT V4L2Device
// Parameters and return value are the same as for the standard ioctl() system
// call.
- virtual int Ioctl(int request, void* arg) = 0;
+ [[nodiscard]] virtual int Ioctl(int request, void* arg) = 0;
// This method sleeps until either:
// - SetDevicePollInterrupt() is called (on another thread),
@@ -779,11 +792,12 @@ class MEDIA_GPU_EXPORT V4L2Device
// the caller's sequence if a buffer is ready to be dequeued and/or a V4L2
// event has been posted. |error_callback| will be posted to the client's
// sequence if a polling error has occurred.
- bool StartPolling(V4L2DevicePoller::EventCallback event_callback,
- base::RepeatingClosure error_callback);
+ [[nodiscard]] bool StartPolling(
+ V4L2DevicePoller::EventCallback event_callback,
+ base::RepeatingClosure error_callback);
// Stop polling this V4L2Device if polling was active. No new events will
// be posted after this method has returned.
- bool StopPolling();
+ [[nodiscard]] bool StopPolling();
// Schedule a polling event if polling is enabled. This method is intended
// to be called from V4L2Queue, clients should not need to call it directly.
void SchedulePoll();
@@ -826,7 +840,7 @@ class MEDIA_GPU_EXPORT V4L2Device
// Perform platform-specific initialization of the device instance.
// Return true on success, false on error or if the particular implementation
// is not available.
- virtual bool Initialize() = 0;
+ [[nodiscard]] virtual bool Initialize() = 0;
// Associates a v4l2_buf_type to its queue.
base::flat_map<enum v4l2_buf_type, V4L2Queue*> queues_;
diff --git a/chromium/media/gpu/v4l2/v4l2_device_poller.cc b/chromium/media/gpu/v4l2/v4l2_device_poller.cc
index 8c5e0751eed..58fc5a5faea 100644
--- a/chromium/media/gpu/v4l2/v4l2_device_poller.cc
+++ b/chromium/media/gpu/v4l2/v4l2_device_poller.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_device_poller.h b/chromium/media/gpu/v4l2/v4l2_device_poller.h
index 9abe4416668..8469f9eb043 100644
--- a/chromium/media/gpu/v4l2/v4l2_device_poller.h
+++ b/chromium/media/gpu/v4l2/v4l2_device_poller.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_device_unittest.cc b/chromium/media/gpu/v4l2/v4l2_device_unittest.cc
index 71380430c77..2fd2b3c2867 100644
--- a/chromium/media/gpu/v4l2/v4l2_device_unittest.cc
+++ b/chromium/media/gpu/v4l2/v4l2_device_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_framerate_control.cc b/chromium/media/gpu/v4l2/v4l2_framerate_control.cc
index 8a8ed61bfc8..bc417961018 100644
--- a/chromium/media/gpu/v4l2/v4l2_framerate_control.cc
+++ b/chromium/media/gpu/v4l2/v4l2_framerate_control.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_framerate_control.h b/chromium/media/gpu/v4l2/v4l2_framerate_control.h
index b2346021a1f..a78667ff372 100644
--- a/chromium/media/gpu/v4l2/v4l2_framerate_control.h
+++ b/chromium/media/gpu/v4l2/v4l2_framerate_control.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_image_processor_backend.cc b/chromium/media/gpu/v4l2/v4l2_image_processor_backend.cc
index b90b1c9a4ac..bbf7959e21a 100644
--- a/chromium/media/gpu/v4l2/v4l2_image_processor_backend.cc
+++ b/chromium/media/gpu/v4l2/v4l2_image_processor_backend.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -152,13 +152,17 @@ void V4L2ImageProcessorBackend::Destroy() {
backend_weak_this_factory_.InvalidateWeakPtrs();
if (input_queue_) {
- input_queue_->Streamoff();
- input_queue_->DeallocateBuffers();
+ if (!input_queue_->Streamoff())
+ VLOGF(1) << "Failed to turn stream off";
+ if (!input_queue_->DeallocateBuffers())
+ VLOGF(1) << "Failed to deallocate buffers";
input_queue_ = nullptr;
}
if (output_queue_) {
- output_queue_->Streamoff();
- output_queue_->DeallocateBuffers();
+ if (!output_queue_->Streamoff())
+ VLOGF(1) << "Failed to turn stream off";
+ if (!output_queue_->DeallocateBuffers())
+ VLOGF(1) << "Failed to deallocate buffers";
output_queue_ = nullptr;
}
@@ -205,7 +209,6 @@ v4l2_memory InputStorageTypeToV4L2Memory(VideoFrame::StorageType storage_type) {
case VideoFrame::STORAGE_OWNED_MEMORY:
case VideoFrame::STORAGE_UNOWNED_MEMORY:
case VideoFrame::STORAGE_SHMEM:
- case VideoFrame::STORAGE_MOJO_SHARED_BUFFER:
return V4L2_MEMORY_USERPTR;
case VideoFrame::STORAGE_DMABUFS:
case VideoFrame::STORAGE_GPU_MEMORY_BUFFER:
@@ -921,18 +924,41 @@ bool V4L2ImageProcessorBackend::EnqueueInputRecord(
switch (input_memory_type_) {
case V4L2_MEMORY_USERPTR: {
+ VideoFrame& frame = *job_record->input_frame;
const size_t num_planes = V4L2Device::GetNumPlanesOfV4L2PixFmt(
input_config_.fourcc.ToV4L2PixFmt());
std::vector<void*> user_ptrs(num_planes);
+ if (frame.storage_type() == VideoFrame::STORAGE_SHMEM) {
+ // TODO(b/243883312): This copies the video frame to a writable buffer
+ // since the USERPTR API requires writable permission. Remove this
+ // workaround once the unreasonable permission is fixed.
+ const size_t buffer_size = frame.shm_region()->GetSize();
+ std::vector<uint8_t> writable_buffer(buffer_size);
+ std::memcpy(writable_buffer.data(), frame.data(0), buffer_size);
+ for (size_t i = 0; i < num_planes; ++i) {
+ const std::intptr_t plane_offset =
+ reinterpret_cast<std::intptr_t>(frame.data(i)) -
+ reinterpret_cast<std::intptr_t>(frame.data(0));
+ user_ptrs[i] = writable_buffer.data() + plane_offset;
+ }
+ job_record->input_frame->AddDestructionObserver(base::BindOnce(
+ [](std::vector<uint8_t>) {}, std::move(writable_buffer)));
+ } else {
+ for (size_t i = 0; i < num_planes; ++i)
+ user_ptrs[i] = frame.writable_data(i);
+ }
+
for (size_t i = 0; i < num_planes; ++i) {
int bytes_used =
- VideoFrame::PlaneSize(job_record->input_frame->format(), i,
- input_config_.size)
+ VideoFrame::PlaneSize(frame.format(), i, input_config_.size)
.GetArea();
buffer.SetPlaneBytesUsed(i, bytes_used);
- user_ptrs[i] = job_record->input_frame->data(i);
}
- std::move(buffer).QueueUserPtr(user_ptrs);
+ if (!std::move(buffer).QueueUserPtr(user_ptrs)) {
+ VPLOGF(1) << "Failed to queue a DMABUF buffer to input queue";
+ NotifyError();
+ return false;
+ }
break;
}
case V4L2_MEMORY_DMABUF: {
@@ -945,7 +971,12 @@ bool V4L2ImageProcessorBackend::EnqueueInputRecord(
FillV4L2BufferByGpuMemoryBufferHandle(
input_config_.fourcc, input_config_.size, *input_handle, &buffer);
- std::move(buffer).QueueDMABuf(input_handle->native_pixmap_handle.planes);
+ if (!std::move(buffer).QueueDMABuf(
+ input_handle->native_pixmap_handle.planes)) {
+ VPLOGF(1) << "Failed to queue a DMABUF buffer to input queue";
+ NotifyError();
+ return false;
+ }
break;
}
default:
diff --git a/chromium/media/gpu/v4l2/v4l2_image_processor_backend.h b/chromium/media/gpu/v4l2/v4l2_image_processor_backend.h
index b4fbaa911dd..b09d78dfb09 100644
--- a/chromium/media/gpu/v4l2/v4l2_image_processor_backend.h
+++ b/chromium/media/gpu/v4l2/v4l2_image_processor_backend.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.cc b/chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.cc
index 6d4e96c3d81..cdf121279ef 100644
--- a/chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.cc
+++ b/chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,7 @@
#include <sys/mman.h>
#include <memory>
+#include <tuple>
#include <utility>
#include "base/bind.h"
@@ -666,9 +667,9 @@ bool V4L2JpegEncodeAccelerator::EncodedInstance::EnqueueInputRecord() {
DCHECK(!input_record.at_device);
// Copy image from user memory to MMAP memory.
- uint8_t* src_y = job_record->input_frame->data(VideoFrame::kYPlane);
- uint8_t* src_u = job_record->input_frame->data(VideoFrame::kUPlane);
- uint8_t* src_v = job_record->input_frame->data(VideoFrame::kVPlane);
+ const uint8_t* src_y = job_record->input_frame->data(VideoFrame::kYPlane);
+ const uint8_t* src_u = job_record->input_frame->data(VideoFrame::kUPlane);
+ const uint8_t* src_v = job_record->input_frame->data(VideoFrame::kVPlane);
size_t src_y_stride = job_record->input_frame->stride(VideoFrame::kYPlane);
size_t src_u_stride = job_record->input_frame->stride(VideoFrame::kUPlane);
size_t src_v_stride = job_record->input_frame->stride(VideoFrame::kVPlane);
@@ -1193,7 +1194,7 @@ bool V4L2JpegEncodeAccelerator::EncodedInstanceDmaBuf::SetUpJpegParameters(
// Driver may not have implemented V4L2_CID_JPEG_ACTIVE_MARKER.
// Ignore any error and assume the driver implements the JPEG stream
// the way we want it.
- device_->Ioctl(VIDIOC_QUERY_EXT_CTRL, &queryctrl);
+ std::ignore = device_->Ioctl(VIDIOC_QUERY_EXT_CTRL, &queryctrl);
// Ask for JPEG markers we want. Since not all may be implemented,
// ask for the common subset of what we want and what is supported.
@@ -1201,7 +1202,7 @@ bool V4L2JpegEncodeAccelerator::EncodedInstanceDmaBuf::SetUpJpegParameters(
ctrl.value = queryctrl.maximum &
(V4L2_JPEG_ACTIVE_MARKER_APP0 | V4L2_JPEG_ACTIVE_MARKER_DQT |
V4L2_JPEG_ACTIVE_MARKER_DHT);
- device_->Ioctl(VIDIOC_S_EXT_CTRLS, &ctrls);
+ std::ignore = device_->Ioctl(VIDIOC_S_EXT_CTRLS, &ctrls);
break;
default:
diff --git a/chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.h b/chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.h
index b31ef0e2021..a11a1792b73 100644
--- a/chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.h
+++ b/chromium/media/gpu/v4l2/v4l2_jpeg_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc b/chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc
index 1ee2eba47d6..e8e1422889d 100644
--- a/chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc
+++ b/chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -900,7 +900,7 @@ bool V4L2MjpegDecodeAccelerator::ConvertOutputImage(
std::array<uint8_t*, VideoFrame::kMaxPlanes> dst_ptrs{};
std::array<int, VideoFrame::kMaxPlanes> dst_strides{};
for (size_t i = 0; i < dst_frame->layout().num_planes(); i++) {
- dst_ptrs[i] = dst_frame->visible_data(i);
+ dst_ptrs[i] = dst_frame->GetWritableVisibleData(i);
dst_strides[i] = base::checked_cast<int>(dst_frame->stride(i));
}
diff --git a/chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.h b/chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.h
index f13e5292065..f14368f6633 100644
--- a/chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.h
+++ b/chromium/media/gpu/v4l2/v4l2_mjpeg_decode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc b/chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc
index d788c3957dd..79d6be6b274 100644
--- a/chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc
+++ b/chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,9 +20,11 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
+#include "base/containers/contains.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/posix/eintr_wrapper.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -788,7 +790,8 @@ void V4L2SliceVideoDecodeAccelerator::DestroyInputBuffers() {
DCHECK(!input_queue_->IsStreaming());
- input_queue_->DeallocateBuffers();
+ if (!input_queue_->DeallocateBuffers())
+ VLOGF(1) << "Failed to deallocate V4L2 input buffers";
}
void V4L2SliceVideoDecodeAccelerator::DismissPictures(
@@ -1287,7 +1290,8 @@ bool V4L2SliceVideoDecodeAccelerator::DestroyOutputBuffers() {
output_buffer_map_.clear();
- output_queue_->DeallocateBuffers();
+ if (!output_queue_->DeallocateBuffers())
+ VLOGF(1) << "Failed to deallocate V4L2 output buffers";
return true;
}
@@ -1571,11 +1575,8 @@ void V4L2SliceVideoDecodeAccelerator::ImportBufferForPictureTask(
if (surface_set_change_pending_)
return;
- const auto iter =
- std::find_if(output_buffer_map_.begin(), output_buffer_map_.end(),
- [picture_buffer_id](const OutputRecord& output_record) {
- return output_record.picture_id == picture_buffer_id;
- });
+ const auto iter = base::ranges::find(output_buffer_map_, picture_buffer_id,
+ &OutputRecord::picture_id);
if (iter == output_buffer_map_.end()) {
// It's possible that we've already posted a DismissPictureBuffer for this
// picture, but it has not yet executed when this ImportBufferForPicture was
@@ -2249,8 +2250,7 @@ bool V4L2SliceVideoDecodeAccelerator::IsSupportedProfile(
for (const SupportedProfile& entry : profiles)
supported_profiles_.push_back(entry.profile);
}
- return std::find(supported_profiles_.begin(), supported_profiles_.end(),
- profile) != supported_profiles_.end();
+ return base::Contains(supported_profiles_, profile);
}
size_t V4L2SliceVideoDecodeAccelerator::GetNumOfOutputRecordsAtDevice() const {
diff --git a/chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h b/chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h
index 6aad0f46292..142f92b97f7 100644
--- a/chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h
+++ b/chromium/media/gpu/v4l2/v4l2_slice_video_decode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_stateful_workaround.cc b/chromium/media/gpu/v4l2/v4l2_stateful_workaround.cc
index cb52bc31795..7003bcccf22 100644
--- a/chromium/media/gpu/v4l2/v4l2_stateful_workaround.cc
+++ b/chromium/media/gpu/v4l2/v4l2_stateful_workaround.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_stateful_workaround.h b/chromium/media/gpu/v4l2/v4l2_stateful_workaround.h
index 619953c1d51..d5561272e46 100644
--- a/chromium/media/gpu/v4l2/v4l2_stateful_workaround.h
+++ b/chromium/media/gpu/v4l2/v4l2_stateful_workaround.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_stateful_workaround_unittest.cc b/chromium/media/gpu/v4l2/v4l2_stateful_workaround_unittest.cc
index 9a4dc99c5fd..86baab97eb3 100644
--- a/chromium/media/gpu/v4l2/v4l2_stateful_workaround_unittest.cc
+++ b/chromium/media/gpu/v4l2/v4l2_stateful_workaround_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_status.h b/chromium/media/gpu/v4l2/v4l2_status.h
index 3ce393f6e83..ed625bc07f8 100644
--- a/chromium/media/gpu/v4l2/v4l2_status.h
+++ b/chromium/media/gpu/v4l2/v4l2_status.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,6 +20,7 @@ enum class V4L2StatusCodes : StatusCodeType {
kFailedResourceAllocation = 7,
kBadFormat = 8,
kFailedToStartStreamQueue = 9,
+ kFailedToDestroyQueueBuffers = 10,
};
struct V4L2StatusTraits {
@@ -31,4 +32,4 @@ using V4L2Status = TypedStatus<V4L2StatusTraits>;
} // namespace media
-#endif // MEDIA_GPU_V4L2_V4L2_STATUS_H_ \ No newline at end of file
+#endif // MEDIA_GPU_V4L2_V4L2_STATUS_H_
diff --git a/chromium/media/gpu/v4l2/v4l2_utils.cc b/chromium/media/gpu/v4l2/v4l2_utils.cc
index ee4d1bd5090..4612a484450 100644
--- a/chromium/media/gpu/v4l2/v4l2_utils.cc
+++ b/chromium/media/gpu/v4l2/v4l2_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_utils.h b/chromium/media/gpu/v4l2/v4l2_utils.h
index ac463995e2d..0ab6354b89f 100644
--- a/chromium/media/gpu/v4l2/v4l2_utils.h
+++ b/chromium/media/gpu/v4l2/v4l2_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_vda_helpers.cc b/chromium/media/gpu/v4l2/v4l2_vda_helpers.cc
index f2561907703..baaca9c0ad3 100644
--- a/chromium/media/gpu/v4l2/v4l2_vda_helpers.cc
+++ b/chromium/media/gpu/v4l2/v4l2_vda_helpers.cc
@@ -1,10 +1,12 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/gpu/v4l2/v4l2_vda_helpers.h"
#include "base/bind.h"
+#include "base/containers/contains.h"
+#include "base/ranges/algorithm.h"
#include "media/base/color_plane_layout.h"
#include "media/base/video_codecs.h"
#include "media/gpu/chromeos/fourcc.h"
@@ -24,9 +26,7 @@ absl::optional<Fourcc> FindImageProcessorInputFormat(V4L2Device* vda_device) {
memset(&fmtdesc, 0, sizeof(fmtdesc));
fmtdesc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
while (vda_device->Ioctl(VIDIOC_ENUM_FMT, &fmtdesc) == 0) {
- if (std::find(processor_input_formats.begin(),
- processor_input_formats.end(),
- fmtdesc.pixelformat) != processor_input_formats.end()) {
+ if (base::Contains(processor_input_formats, fmtdesc.pixelformat)) {
DVLOGF(3) << "Image processor input format=" << fmtdesc.description;
return Fourcc::FromV4L2PixFmt(fmtdesc.pixelformat);
}
@@ -41,10 +41,8 @@ absl::optional<Fourcc> FindImageProcessorOutputFormat(V4L2Device* ip_device) {
static constexpr uint32_t kPreferredFormats[] = {V4L2_PIX_FMT_NV12,
V4L2_PIX_FMT_YVU420};
auto preferred_formats_first = [](uint32_t a, uint32_t b) -> bool {
- auto* iter_a = std::find(std::begin(kPreferredFormats),
- std::end(kPreferredFormats), a);
- auto* iter_b = std::find(std::begin(kPreferredFormats),
- std::end(kPreferredFormats), b);
+ auto* iter_a = base::ranges::find(kPreferredFormats, a);
+ auto* iter_b = base::ranges::find(kPreferredFormats, b);
return iter_a < iter_b;
};
diff --git a/chromium/media/gpu/v4l2/v4l2_vda_helpers.h b/chromium/media/gpu/v4l2/v4l2_vda_helpers.h
index ebd07cf7e5b..ec11f2f5e73 100644
--- a/chromium/media/gpu/v4l2/v4l2_vda_helpers.h
+++ b/chromium/media/gpu/v4l2/v4l2_vda_helpers.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc b/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
index c54c7356dcb..05b87395fe7 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,6 +19,7 @@
#include "base/command_line.h"
#include "base/numerics/safe_conversions.h"
#include "base/posix/eintr_wrapper.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -633,11 +634,8 @@ void V4L2VideoDecodeAccelerator::ImportBufferForPictureTask(
if (IsDestroyPending())
return;
- const auto iter =
- std::find_if(output_buffer_map_.begin(), output_buffer_map_.end(),
- [picture_buffer_id](const OutputRecord& output_record) {
- return output_record.picture_id == picture_buffer_id;
- });
+ const auto iter = base::ranges::find(output_buffer_map_, picture_buffer_id,
+ &OutputRecord::picture_id);
if (iter == output_buffer_map_.end()) {
// It's possible that we've already posted a DismissPictureBuffer for this
// picture, but it has not yet executed when this ImportBufferForPicture was
@@ -2502,7 +2500,10 @@ void V4L2VideoDecodeAccelerator::DestroyInputBuffers() {
if (!input_queue_)
return;
- input_queue_->DeallocateBuffers();
+ if (!input_queue_->DeallocateBuffers()) {
+ VLOGF(1) << "Failed deallocating V4L2 input buffers";
+ NOTIFY_ERROR(PLATFORM_FAILURE);
+ }
}
bool V4L2VideoDecodeAccelerator::DestroyOutputBuffers() {
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.h b/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.h
index 163907129a0..0eb4a81db9f 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder.cc
index ac21ea7ce03..cb8f06faf69 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -42,7 +42,10 @@ constexpr int k1080pArea = 1920 * 1088;
constexpr size_t kInputBufferMaxSizeFor1080p = 1024 * 1024;
// Input bitstream buffer size for up to 4k streams.
constexpr size_t kInputBufferMaxSizeFor4k = 4 * kInputBufferMaxSizeFor1080p;
-constexpr size_t kNumInputBuffers = 8;
+// Some H.264 test vectors (CAPCM*1_Sand_E.h264) need 16 reference frames.
+// TODO(b/249325255): reduce this number to e.g. 8 or even less when it does not
+// artificially limit the size of the CAPTURE (decoded video frames) queue.
+constexpr size_t kNumInputBuffers = 17;
// Input format V4L2 fourccs this class supports.
constexpr uint32_t kSupportedInputFourccs[] = {
@@ -50,11 +53,6 @@ constexpr uint32_t kSupportedInputFourccs[] = {
V4L2_PIX_FMT_H264, V4L2_PIX_FMT_VP8, V4L2_PIX_FMT_VP9,
};
-// Number of output buffers to use for each VD stage above what's required by
-// the decoder (e.g. DPB size, in H264). We need limits::kMaxVideoFrames to
-// fill up the GpuVideoDecode pipeline, and +1 for a frame in transit.
-constexpr size_t kDpbOutputBufferExtraCount = limits::kMaxVideoFrames + 1;
-
} // namespace
// static
@@ -126,11 +124,13 @@ V4L2VideoDecoder::~V4L2VideoDecoder() {
// Stop and Destroy device.
StopStreamV4L2Queue(true);
if (input_queue_) {
- input_queue_->DeallocateBuffers();
+ if (!input_queue_->DeallocateBuffers())
+ VLOGF(1) << "Failed to deallocate V4L2 input buffers";
input_queue_ = nullptr;
}
if (output_queue_) {
- output_queue_->DeallocateBuffers();
+ if (!output_queue_->DeallocateBuffers())
+ VLOGF(1) << "Failed to deallocate V4L2 output buffers";
output_queue_ = nullptr;
}
@@ -185,8 +185,16 @@ void V4L2VideoDecoder::Initialize(const VideoDecoderConfig& config,
return;
}
- input_queue_->DeallocateBuffers();
- output_queue_->DeallocateBuffers();
+ if (!input_queue_->DeallocateBuffers() ||
+ !output_queue_->DeallocateBuffers()) {
+ VLOGF(1) << "Failed to deallocate V4L2 buffers";
+ std::move(init_cb).Run(
+ DecoderStatus(DecoderStatus::Codes::kNotInitialized)
+ .AddCause(
+ V4L2Status(V4L2Status::Codes::kFailedToDestroyQueueBuffers)));
+ return;
+ }
+
input_queue_ = nullptr;
output_queue_ = nullptr;
@@ -624,10 +632,15 @@ bool V4L2VideoDecoder::StopStreamV4L2Queue(bool stop_input_queue) {
weak_this_for_polling_ = weak_this_for_polling_factory_.GetWeakPtr();
// Streamoff input and output queue.
- if (input_queue_ && stop_input_queue)
- input_queue_->Streamoff();
- if (output_queue_)
- output_queue_->Streamoff();
+ if (input_queue_ && stop_input_queue && !input_queue_->Streamoff()) {
+ SetState(State::kError);
+ return false;
+ }
+
+ if (output_queue_ && !output_queue_->Streamoff()) {
+ SetState(State::kError);
+ return false;
+ }
if (backend_)
backend_->OnStreamStopped(stop_input_queue);
@@ -702,8 +715,9 @@ CroStatus V4L2VideoDecoder::ContinueChangeResolution(
if (state_ != State::kFlushing)
return CroStatus::Codes::kResetRequired;
- DCHECK_GT(num_output_frames, 0u);
- num_output_frames_ = num_output_frames + kDpbOutputBufferExtraCount;
+ DCHECK_GT(num_output_frames,
+ static_cast<size_t>(limits::kMaxVideoFrames + 1));
+ num_output_frames_ = num_output_frames;
// Stateful decoders require the input queue to keep running during resolution
// changes, but stateless ones require it to be stopped.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder.h b/chromium/media/gpu/v4l2/v4l2_video_decoder.h
index 14ccc06fe0e..ef7a6a431a8 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend.cc
index a01b317e4a5..fafd1b347b6 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend.h
index d6d2973628e..28ffebaccf7 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc
index 87d4f153df5..b18d655dc68 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.cc
@@ -1,10 +1,10 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h"
-#include <cstddef>
+#include <cstddef>
#include <memory>
#include <tuple>
#include <utility>
@@ -16,6 +16,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/sequence_checker.h"
#include "base/task/sequenced_task_runner.h"
+#include "media/base/limits.h"
#include "media/base/media_switches.h"
#include "media/base/video_codecs.h"
#include "media/gpu/chromeos/dmabuf_video_frame_pool.h"
@@ -616,9 +617,10 @@ void V4L2StatefulVideoDecoderBackend::ChangeResolution() {
}
auto ctrl = device_->GetCtrl(V4L2_CID_MIN_BUFFERS_FOR_CAPTURE);
- constexpr size_t DEFAULT_NUM_OUTPUT_BUFFERS = 7;
+ constexpr size_t kDefaultNumOutputBuffers = 7;
+ constexpr size_t kPicsInPipeline = limits::kMaxVideoFrames + 1;
const size_t num_output_buffers =
- ctrl ? ctrl->value : DEFAULT_NUM_OUTPUT_BUFFERS;
+ (ctrl ? ctrl->value : kDefaultNumOutputBuffers) + kPicsInPipeline;
if (!ctrl)
VLOGF(1) << "Using default minimum number of CAPTURE buffers";
@@ -741,8 +743,7 @@ bool V4L2StatefulVideoDecoderBackend::IsSupportedProfile(
for (const auto& entry : profiles)
supported_profiles_.push_back(entry.profile);
}
- return std::find(supported_profiles_.begin(), supported_profiles_.end(),
- profile) != supported_profiles_.end();
+ return base::Contains(supported_profiles_, profile);
}
bool V4L2StatefulVideoDecoderBackend::StopInputQueueOnResChange() const {
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h
index 19370d7abf6..bb0682b5adb 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateful.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc
index ca3fd50962d..1905061c82a 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h
index 5ccd3034c37..59eeb7bb60c 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_backend_stateless.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_av1.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_av1.cc
new file mode 100644
index 00000000000..fc619a98872
--- /dev/null
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_av1.cc
@@ -0,0 +1,622 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/gpu/v4l2/v4l2_video_decoder_delegate_av1.h"
+
+#include <linux/media/av1-ctrls.h>
+
+#include "media/gpu/macros.h"
+#include "media/gpu/v4l2/v4l2_decode_surface.h"
+#include "media/gpu/v4l2/v4l2_decode_surface_handler.h"
+#include "third_party/libgav1/src/src/obu_parser.h"
+
+namespace media {
+
+using DecodeStatus = AV1Decoder::AV1Accelerator::Status;
+
+class V4L2AV1Picture : public AV1Picture {
+ public:
+ V4L2AV1Picture(scoped_refptr<V4L2DecodeSurface> dec_surface)
+ : dec_surface_(std::move(dec_surface)) {}
+
+ V4L2AV1Picture(const V4L2AV1Picture&) = delete;
+ V4L2AV1Picture& operator=(const V4L2AV1Picture&) = delete;
+
+ const scoped_refptr<V4L2DecodeSurface>& dec_surface() const {
+ return dec_surface_;
+ }
+
+ private:
+ ~V4L2AV1Picture() override = default;
+
+ scoped_refptr<AV1Picture> CreateDuplicate() override {
+ return new V4L2AV1Picture(dec_surface_);
+ }
+
+ scoped_refptr<V4L2DecodeSurface> dec_surface_;
+};
+
+namespace {
+// TODO(stevecho): Remove this when AV1 uAPI RFC v3 change
+// (crrev/c/3859126) lands.
+#ifndef BIT
+#define BIT(nr) (1U << (nr))
+#endif
+
+// Section 5.5. Sequence header OBU syntax in the AV1 spec.
+// https://aomediacodec.github.io/av1-spec
+void FillSequenceParams(v4l2_ctrl_av1_sequence& v4l2_seq_params,
+ const libgav1::ObuSequenceHeader& seq_header) {
+ if (seq_header.still_picture)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_STILL_PICTURE;
+
+ if (seq_header.use_128x128_superblock)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_USE_128X128_SUPERBLOCK;
+
+ if (seq_header.enable_filter_intra)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_FILTER_INTRA;
+
+ if (seq_header.enable_intra_edge_filter)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_INTRA_EDGE_FILTER;
+
+ if (seq_header.enable_interintra_compound)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_INTERINTRA_COMPOUND;
+
+ if (seq_header.enable_masked_compound)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_MASKED_COMPOUND;
+
+ if (seq_header.enable_warped_motion)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_WARPED_MOTION;
+
+ if (seq_header.enable_dual_filter)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_DUAL_FILTER;
+
+ if (seq_header.enable_order_hint)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_ORDER_HINT;
+
+ if (seq_header.enable_jnt_comp)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_JNT_COMP;
+
+ if (seq_header.enable_ref_frame_mvs)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_REF_FRAME_MVS;
+
+ if (seq_header.enable_superres)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_SUPERRES;
+
+ if (seq_header.enable_cdef)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_CDEF;
+
+ if (seq_header.enable_restoration)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_ENABLE_RESTORATION;
+
+ if (seq_header.color_config.is_monochrome)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_MONO_CHROME;
+
+ if (seq_header.color_config.color_range)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_COLOR_RANGE;
+
+ if (seq_header.color_config.subsampling_x)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_SUBSAMPLING_X;
+
+ if (seq_header.color_config.subsampling_y)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_SUBSAMPLING_Y;
+
+ if (seq_header.film_grain_params_present)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_FILM_GRAIN_PARAMS_PRESENT;
+
+ if (seq_header.color_config.separate_uv_delta_q)
+ v4l2_seq_params.flags |= V4L2_AV1_SEQUENCE_FLAG_SEPARATE_UV_DELTA_Q;
+
+ v4l2_seq_params.seq_profile = seq_header.profile;
+ v4l2_seq_params.order_hint_bits = seq_header.order_hint_bits;
+ v4l2_seq_params.bit_depth = seq_header.color_config.bitdepth;
+ v4l2_seq_params.max_frame_width_minus_1 = seq_header.max_frame_width - 1;
+ v4l2_seq_params.max_frame_height_minus_1 = seq_header.max_frame_height - 1;
+}
+
+// Section 5.9.11. Loop filter params syntax.
+// Note that |update_ref_delta| and |update_mode_delta| flags in the spec
+// are not needed for V4L2 AV1 API.
+void FillLoopFilterParams(v4l2_av1_loop_filter& v4l2_lf,
+ const libgav1::LoopFilter& lf) {
+ if (lf.delta_enabled)
+ v4l2_lf.flags |= V4L2_AV1_LOOP_FILTER_FLAG_DELTA_ENABLED;
+
+ if (lf.delta_update)
+ v4l2_lf.flags |= V4L2_AV1_LOOP_FILTER_FLAG_DELTA_UPDATE;
+
+ static_assert(std::size(decltype(v4l2_lf.level){}) == libgav1::kFrameLfCount,
+ "Invalid size of loop filter level (strength) array");
+ for (size_t i = 0; i < libgav1::kFrameLfCount; i++)
+ v4l2_lf.level[i] = base::checked_cast<__u8>(lf.level[i]);
+
+ v4l2_lf.sharpness = lf.sharpness;
+
+ static_assert(std::size(decltype(v4l2_lf.ref_deltas){}) ==
+ libgav1::kNumReferenceFrameTypes,
+ "Invalid size of ref deltas array");
+ for (size_t i = 0; i < libgav1::kNumReferenceFrameTypes; i++)
+ v4l2_lf.ref_deltas[i] = lf.ref_deltas[i];
+
+ static_assert(std::size(decltype(v4l2_lf.mode_deltas){}) ==
+ libgav1::kLoopFilterMaxModeDeltas,
+ "Invalid size of mode deltas array");
+ for (size_t i = 0; i < libgav1::kLoopFilterMaxModeDeltas; i++)
+ v4l2_lf.mode_deltas[i] = lf.mode_deltas[i];
+}
+
+// Section 5.9.12. Quantization params syntax
+void FillQuantizationParams(v4l2_av1_quantization& v4l2_quant,
+ const libgav1::QuantizerParameters& quant) {
+ if (quant.use_matrix)
+ v4l2_quant.flags |= V4L2_AV1_QUANTIZATION_FLAG_USING_QMATRIX;
+
+ v4l2_quant.base_q_idx = quant.base_index;
+
+ // Note that quant.delta_ac[0] is useless
+ // because it is always 0 according to libgav1.
+ v4l2_quant.delta_q_y_dc = quant.delta_dc[0];
+
+ v4l2_quant.delta_q_u_dc = quant.delta_dc[1];
+ v4l2_quant.delta_q_u_ac = quant.delta_ac[1];
+
+ v4l2_quant.delta_q_v_dc = quant.delta_dc[2];
+ v4l2_quant.delta_q_v_ac = quant.delta_ac[2];
+
+ if (!quant.use_matrix)
+ return;
+
+ v4l2_quant.qm_y = base::checked_cast<uint8_t>(quant.matrix_level[0]);
+ v4l2_quant.qm_u = base::checked_cast<uint8_t>(quant.matrix_level[1]);
+ v4l2_quant.qm_v = base::checked_cast<uint8_t>(quant.matrix_level[2]);
+}
+
+} // namespace
+
+// Section 5.9.14. Segmentation params syntax
+void FillSegmentationParams(struct v4l2_av1_segmentation& v4l2_seg,
+ const libgav1::Segmentation& seg) {
+ if (seg.enabled)
+ v4l2_seg.flags |= V4L2_AV1_SEGMENTATION_FLAG_ENABLED;
+
+ if (seg.update_map)
+ v4l2_seg.flags |= V4L2_AV1_SEGMENTATION_FLAG_UPDATE_MAP;
+
+ if (seg.temporal_update)
+ v4l2_seg.flags |= V4L2_AV1_SEGMENTATION_FLAG_TEMPORAL_UPDATE;
+
+ if (seg.update_data)
+ v4l2_seg.flags |= V4L2_AV1_SEGMENTATION_FLAG_UPDATE_DATA;
+
+ if (seg.segment_id_pre_skip)
+ v4l2_seg.flags |= V4L2_AV1_SEGMENTATION_FLAG_SEG_ID_PRE_SKIP;
+
+ static_assert(
+ std::size(decltype(v4l2_seg.feature_enabled){}) == libgav1::kMaxSegments,
+ "Invalid size of |feature_enabled| array in |v4l2_av1_segmentation| "
+ "struct");
+
+ static_assert(
+ std::size(decltype(v4l2_seg.feature_data){}) == libgav1::kMaxSegments &&
+ std::extent<decltype(v4l2_seg.feature_data), 0>::value ==
+ libgav1::kSegmentFeatureMax,
+ "Invalid size of |feature_data| array in |v4l2_av1_segmentation| struct");
+
+ for (size_t i = 0; i < libgav1::kMaxSegments; ++i) {
+ for (size_t j = 0; j < libgav1::kSegmentFeatureMax; ++j) {
+ v4l2_seg.feature_enabled[i] |= (seg.feature_enabled[i][j] << j);
+ v4l2_seg.feature_data[i][j] = seg.feature_data[i][j];
+ }
+ }
+
+ v4l2_seg.last_active_seg_id = seg.last_active_segment_id;
+}
+
+// Section 5.9.15. Tile info syntax
+void FillTileInfo(v4l2_av1_tile_info& v4l2_ti, const libgav1::TileInfo& ti) {
+ if (ti.uniform_spacing)
+ v4l2_ti.flags |= V4L2_AV1_TILE_INFO_FLAG_UNIFORM_TILE_SPACING;
+
+ static_assert(std::size(decltype(v4l2_ti.mi_col_starts){}) ==
+ (libgav1::kMaxTileColumns + 1),
+ "Size of |mi_col_starts| array in |v4l2_av1_tile_info| struct "
+ "does not match libgav1 expectation");
+
+ for (size_t i = 0; i < libgav1::kMaxTileColumns + 1; i++) {
+ v4l2_ti.mi_col_starts[i] =
+ base::checked_cast<uint32_t>(ti.tile_column_start[i]);
+ }
+ static_assert(std::size(decltype(v4l2_ti.mi_row_starts){}) ==
+ (libgav1::kMaxTileRows + 1),
+ "Size of |mi_row_starts| array in |v4l2_av1_tile_info| struct "
+ "does not match libgav1 expectation");
+ for (size_t i = 0; i < libgav1::kMaxTileRows + 1; i++) {
+ v4l2_ti.mi_row_starts[i] =
+ base::checked_cast<uint32_t>(ti.tile_row_start[i]);
+ }
+
+ if (!ti.uniform_spacing) {
+ // Confirmed that |kMaxTileColumns| is enough size for
+ // |width_in_sbs_minus_1| and |kMaxTileRows| is enough size for
+ // |height_in_sbs_minus_1|
+ // https://b.corp.google.com/issues/187828854#comment19
+ static_assert(
+ std::size(decltype(v4l2_ti.width_in_sbs_minus_1){}) ==
+ libgav1::kMaxTileColumns,
+ "Size of |width_in_sbs_minus_1| array in |v4l2_av1_tile_info| struct "
+ "does not match libgav1 expectation");
+ for (size_t i = 0; i < libgav1::kMaxTileColumns; i++) {
+ if (ti.tile_column_width_in_superblocks[i] >= 1) {
+ v4l2_ti.width_in_sbs_minus_1[i] = base::checked_cast<uint32_t>(
+ ti.tile_column_width_in_superblocks[i] - 1);
+ }
+ }
+
+ static_assert(
+ std::size(decltype(v4l2_ti.height_in_sbs_minus_1){}) ==
+ libgav1::kMaxTileRows,
+ "Size of |height_in_sbs_minus_1| array in |v4l2_av1_tile_info| struct "
+ "does not match libgav1 expectation");
+ for (size_t i = 0; i < libgav1::kMaxTileRows; i++) {
+ if (ti.tile_row_height_in_superblocks[i] >= 1) {
+ v4l2_ti.height_in_sbs_minus_1[i] = base::checked_cast<uint32_t>(
+ ti.tile_row_height_in_superblocks[i] - 1);
+ }
+ }
+ }
+
+ v4l2_ti.tile_size_bytes = ti.tile_size_bytes;
+ v4l2_ti.context_update_tile_id = ti.context_update_id;
+ v4l2_ti.tile_cols = ti.tile_columns;
+ v4l2_ti.tile_rows = ti.tile_rows;
+}
+
+// Section 5.9.17. Quantizer index delta parameters syntax
+void FillQuantizerIndexDeltaParams(struct v4l2_av1_quantization& v4l2_quant,
+ const libgav1::ObuSequenceHeader& seq_header,
+ const libgav1::ObuFrameHeader& frm_header) {
+ // |diff_uv_delta| in the spec doesn't exist in libgav1,
+ // because libgav1 infers it using the following logic.
+ const bool diff_uv_delta = (frm_header.quantizer.base_index != 0) &&
+ (!seq_header.color_config.is_monochrome) &&
+ (seq_header.color_config.separate_uv_delta_q);
+ if (diff_uv_delta)
+ v4l2_quant.flags |= V4L2_AV1_QUANTIZATION_FLAG_DIFF_UV_DELTA;
+
+ if (frm_header.delta_q.present)
+ v4l2_quant.flags |= V4L2_AV1_QUANTIZATION_FLAG_DELTA_Q_PRESENT;
+
+ // |scale| is used to store |delta_q_res| value. This is because libgav1 uses
+ // the same struct |Delta| both for quantizer index delta parameters and loop
+ // filter delta parameters.
+ v4l2_quant.delta_q_res = frm_header.delta_q.scale;
+}
+
+// Section 5.9.18. Loop filter delta parameters syntax.
+// Note that |delta_lf_res| in |v4l2_av1_loop_filter| corresponds to
+// |delta_lf.scale| in the frame header defined in libgav1.
+void FillLoopFilterDeltaParams(struct v4l2_av1_loop_filter& v4l2_lf,
+ const libgav1::Delta& delta_lf) {
+ if (delta_lf.present)
+ v4l2_lf.flags |= V4L2_AV1_LOOP_FILTER_FLAG_DELTA_LF_PRESENT;
+
+ if (delta_lf.multi)
+ v4l2_lf.flags |= V4L2_AV1_LOOP_FILTER_FLAG_DELTA_LF_MULTI;
+
+ v4l2_lf.delta_lf_res = delta_lf.scale;
+}
+
+// Section 5.9.19. CDEF params syntax
+void FillCdefParams(struct v4l2_av1_cdef& v4l2_cdef,
+ const libgav1::Cdef& cdef,
+ uint8_t color_bitdepth) {
+ // Damping value parsed in libgav1 is from the spec + (bitdepth - 8).
+ // All the strength values parsed in libgav1 are from the spec and left
+ // shifted by (bitdepth - 8).
+ CHECK_GE(color_bitdepth, 8u);
+ const uint8_t coeff_shift = color_bitdepth - 8u;
+
+ v4l2_cdef.damping_minus_3 =
+ base::checked_cast<uint8_t>(cdef.damping - coeff_shift - 3u);
+
+ v4l2_cdef.bits = cdef.bits;
+
+ static_assert(std::size(decltype(v4l2_cdef.y_pri_strength){}) ==
+ libgav1::kMaxCdefStrengths,
+ "Invalid size of cdef y_pri_strength strength");
+
+ static_assert(std::size(decltype(v4l2_cdef.y_sec_strength){}) ==
+ libgav1::kMaxCdefStrengths,
+ "Invalid size of cdef y_sec_strength strength");
+
+ static_assert(std::size(decltype(v4l2_cdef.uv_pri_strength){}) ==
+ libgav1::kMaxCdefStrengths,
+ "Invalid size of cdef uv_pri_strength strength");
+
+ static_assert(std::size(decltype(v4l2_cdef.uv_sec_strength){}) ==
+ libgav1::kMaxCdefStrengths,
+ "Invalid size of cdef uv_sec_strength strength");
+
+ SafeArrayMemcpy(v4l2_cdef.y_pri_strength, cdef.y_primary_strength);
+ SafeArrayMemcpy(v4l2_cdef.y_sec_strength, cdef.y_secondary_strength);
+ SafeArrayMemcpy(v4l2_cdef.uv_pri_strength, cdef.uv_primary_strength);
+ SafeArrayMemcpy(v4l2_cdef.uv_sec_strength, cdef.uv_secondary_strength);
+}
+
+// 5.9.20. Loop restoration params syntax
+void FillLoopRestorationParams(v4l2_av1_loop_restoration& v4l2_lr,
+ const libgav1::LoopRestoration& lr) {
+ for (size_t i = 0; i < V4L2_AV1_NUM_PLANES_MAX; i++) {
+ switch (lr.type[i]) {
+ case libgav1::LoopRestorationType::kLoopRestorationTypeNone:
+ v4l2_lr.frame_restoration_type[i] = V4L2_AV1_FRAME_RESTORE_NONE;
+ break;
+ case libgav1::LoopRestorationType::kLoopRestorationTypeWiener:
+ v4l2_lr.frame_restoration_type[i] = V4L2_AV1_FRAME_RESTORE_WIENER;
+ break;
+ case libgav1::LoopRestorationType::kLoopRestorationTypeSgrProj:
+ v4l2_lr.frame_restoration_type[i] = V4L2_AV1_FRAME_RESTORE_SGRPROJ;
+ break;
+ case libgav1::LoopRestorationType::kLoopRestorationTypeSwitchable:
+ v4l2_lr.frame_restoration_type[i] = V4L2_AV1_FRAME_RESTORE_SWITCHABLE;
+ break;
+ default:
+ NOTREACHED() << "Invalid loop restoration type";
+ }
+
+ if (v4l2_lr.frame_restoration_type[i] != V4L2_AV1_FRAME_RESTORE_NONE) {
+ if (true)
+ v4l2_lr.flags |= V4L2_AV1_LOOP_RESTORATION_FLAG_USES_LR;
+
+ if (i > 0)
+ v4l2_lr.flags |= V4L2_AV1_LOOP_RESTORATION_FLAG_USES_CHROMA_LR;
+ }
+ }
+
+ const bool use_loop_restoration =
+ std::find_if(std::begin(lr.type),
+ std::begin(lr.type) + libgav1::kMaxPlanes,
+ [](const auto type) {
+ return type != libgav1::kLoopRestorationTypeNone;
+ }) != (lr.type + libgav1::kMaxPlanes);
+
+ if (!use_loop_restoration)
+ return;
+
+ DCHECK_GE(lr.unit_size_log2[0], lr.unit_size_log2[1]);
+ DCHECK_LE(lr.unit_size_log2[0] - lr.unit_size_log2[1], 1);
+ v4l2_lr.lr_unit_shift = lr.unit_size_log2[0] - 6;
+ v4l2_lr.lr_uv_shift = lr.unit_size_log2[0] - lr.unit_size_log2[1];
+
+ // AV1 spec (p.52) uses this formula with hard coded value 2.
+ // https://aomediacodec.github.io/av1-spec/#loop-restoration-params-syntax
+ v4l2_lr.loop_restoration_size[0] =
+ V4L2_AV1_RESTORATION_TILESIZE_MAX >> (2 - v4l2_lr.lr_unit_shift);
+ v4l2_lr.loop_restoration_size[1] =
+ v4l2_lr.loop_restoration_size[0] >> v4l2_lr.lr_uv_shift;
+ v4l2_lr.loop_restoration_size[2] =
+ v4l2_lr.loop_restoration_size[0] >> v4l2_lr.lr_uv_shift;
+}
+
+V4L2VideoDecoderDelegateAV1::V4L2VideoDecoderDelegateAV1(
+ V4L2DecodeSurfaceHandler* surface_handler,
+ V4L2Device* device)
+ : surface_handler_(surface_handler), device_(device) {
+ VLOGF(1);
+ DCHECK(surface_handler_);
+ DCHECK(device_);
+}
+
+V4L2VideoDecoderDelegateAV1::~V4L2VideoDecoderDelegateAV1() = default;
+
+scoped_refptr<AV1Picture> V4L2VideoDecoderDelegateAV1::CreateAV1Picture(
+ bool apply_grain) {
+ scoped_refptr<V4L2DecodeSurface> dec_surface =
+ surface_handler_->CreateSurface();
+ if (!dec_surface)
+ return nullptr;
+
+ return new V4L2AV1Picture(std::move(dec_surface));
+}
+
+DecodeStatus V4L2VideoDecoderDelegateAV1::SubmitDecode(
+ const AV1Picture& pic,
+ const libgav1::ObuSequenceHeader& sequence_header,
+ const AV1ReferenceFrameVector& ref_frames,
+ const libgav1::Vector<libgav1::TileBuffer>& tile_buffers,
+ base::span<const uint8_t> data) {
+ struct v4l2_ctrl_av1_sequence v4l2_seq_params = {};
+ FillSequenceParams(v4l2_seq_params, sequence_header);
+
+ const libgav1::ObuFrameHeader& frame_header = pic.frame_header;
+
+ struct v4l2_av1_loop_filter v4l2_lf = {};
+ FillLoopFilterParams(v4l2_lf, frame_header.loop_filter);
+
+ FillLoopFilterDeltaParams(v4l2_lf, frame_header.delta_lf);
+
+ struct v4l2_av1_quantization v4l2_quant = {};
+ FillQuantizationParams(v4l2_quant, frame_header.quantizer);
+
+ FillQuantizerIndexDeltaParams(v4l2_quant, sequence_header, frame_header);
+
+ struct v4l2_av1_segmentation v4l2_seg = {};
+ FillSegmentationParams(v4l2_seg, frame_header.segmentation);
+
+ const auto color_bitdepth = sequence_header.color_config.bitdepth;
+ struct v4l2_av1_cdef v4l2_cdef = {};
+ FillCdefParams(v4l2_cdef, frame_header.cdef,
+ base::strict_cast<int8_t>(color_bitdepth));
+
+ struct v4l2_av1_loop_restoration v4l2_lr = {};
+ FillLoopRestorationParams(v4l2_lr, frame_header.loop_restoration);
+
+ struct v4l2_av1_tile_info v4l2_ti = {};
+ FillTileInfo(v4l2_ti, frame_header.tile_info);
+
+ struct v4l2_ctrl_av1_frame v4l2_frame_params = {};
+ if (frame_header.show_frame)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_SHOW_FRAME;
+ if (frame_header.showable_frame)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_SHOWABLE_FRAME;
+ if (frame_header.error_resilient_mode)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_ERROR_RESILIENT_MODE;
+ if (frame_header.enable_cdf_update == false)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_DISABLE_CDF_UPDATE;
+ if (frame_header.allow_screen_content_tools)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_ALLOW_SCREEN_CONTENT_TOOLS;
+ if (frame_header.force_integer_mv)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_FORCE_INTEGER_MV;
+ if (frame_header.allow_intrabc)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_ALLOW_INTRABC;
+ if (frame_header.use_superres)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_USE_SUPERRES;
+ if (frame_header.allow_high_precision_mv)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_ALLOW_HIGH_PRECISION_MV;
+ if (frame_header.is_motion_mode_switchable)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_IS_MOTION_MODE_SWITCHABLE;
+ if (frame_header.use_ref_frame_mvs)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_USE_REF_FRAME_MVS;
+ if (frame_header.enable_frame_end_update_cdf == false)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_DISABLE_FRAME_END_UPDATE_CDF;
+ if (frame_header.tile_info.uniform_spacing)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_UNIFORM_TILE_SPACING;
+ if (frame_header.allow_warped_motion)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_ALLOW_WARPED_MOTION;
+ if (frame_header.reference_mode_select)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_REFERENCE_SELECT;
+ if (frame_header.reduced_tx_set)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_REDUCED_TX_SET;
+ if (frame_header.skip_mode_frame[0] > 0)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_SKIP_MODE_ALLOWED;
+ if (frame_header.skip_mode_present)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_SKIP_MODE_PRESENT;
+ if (frame_header.frame_size_override_flag)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_FRAME_SIZE_OVERRIDE;
+ // libgav1 header doesn't have |buffer_removal_time_present_flag|.
+ if (frame_header.buffer_removal_time[0] > 0)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_BUFFER_REMOVAL_TIME_PRESENT;
+ if (frame_header.frame_refs_short_signaling)
+ v4l2_frame_params.flags |= V4L2_AV1_FRAME_FLAG_FRAME_REFS_SHORT_SIGNALING;
+
+ switch (frame_header.frame_type) {
+ case libgav1::kFrameKey:
+ v4l2_frame_params.frame_type = V4L2_AV1_KEY_FRAME;
+ break;
+ case libgav1::kFrameInter:
+ v4l2_frame_params.frame_type = V4L2_AV1_INTER_FRAME;
+ break;
+ case libgav1::kFrameIntraOnly:
+ v4l2_frame_params.frame_type = V4L2_AV1_INTRA_ONLY_FRAME;
+ break;
+ case libgav1::kFrameSwitch:
+ v4l2_frame_params.frame_type = V4L2_AV1_SWITCH_FRAME;
+ break;
+ default:
+ NOTREACHED() << "Invalid frame type, " << frame_header.frame_type;
+ }
+
+ v4l2_frame_params.order_hint = frame_header.order_hint;
+ v4l2_frame_params.superres_denom = frame_header.superres_scale_denominator;
+ v4l2_frame_params.upscaled_width = frame_header.upscaled_width;
+
+ switch (frame_header.interpolation_filter) {
+ case libgav1::kInterpolationFilterEightTap:
+ v4l2_frame_params.interpolation_filter =
+ V4L2_AV1_INTERPOLATION_FILTER_EIGHTTAP;
+ break;
+ case libgav1::kInterpolationFilterEightTapSmooth:
+ v4l2_frame_params.interpolation_filter =
+ V4L2_AV1_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH;
+ break;
+ case libgav1::kInterpolationFilterEightTapSharp:
+ v4l2_frame_params.interpolation_filter =
+ V4L2_AV1_INTERPOLATION_FILTER_EIGHTTAP_SHARP;
+ break;
+ case libgav1::kInterpolationFilterBilinear:
+ v4l2_frame_params.interpolation_filter =
+ V4L2_AV1_INTERPOLATION_FILTER_BILINEAR;
+ break;
+ case libgav1::kInterpolationFilterSwitchable:
+ v4l2_frame_params.interpolation_filter =
+ V4L2_AV1_INTERPOLATION_FILTER_SWITCHABLE;
+ break;
+ default:
+ NOTREACHED() << "Invalid interpolation filter, "
+ << frame_header.interpolation_filter;
+ }
+
+ switch (frame_header.tx_mode) {
+ case libgav1::kTxModeOnly4x4:
+ v4l2_frame_params.tx_mode = V4L2_AV1_TX_MODE_ONLY_4X4;
+ break;
+ case libgav1::kTxModeLargest:
+ v4l2_frame_params.tx_mode = V4L2_AV1_TX_MODE_LARGEST;
+ break;
+ case libgav1::kTxModeSelect:
+ v4l2_frame_params.tx_mode = V4L2_AV1_TX_MODE_SELECT;
+ break;
+ default:
+ NOTREACHED() << "Invalid tx mode, " << frame_header.tx_mode;
+ }
+
+ v4l2_frame_params.frame_width_minus_1 = frame_header.width - 1;
+ v4l2_frame_params.frame_height_minus_1 = frame_header.height - 1;
+ v4l2_frame_params.render_width_minus_1 = frame_header.render_width - 1;
+ v4l2_frame_params.render_height_minus_1 = frame_header.render_height - 1;
+
+ v4l2_frame_params.current_frame_id = frame_header.current_frame_id;
+ v4l2_frame_params.primary_ref_frame = frame_header.primary_reference_frame;
+ SafeArrayMemcpy(v4l2_frame_params.buffer_removal_time,
+ frame_header.buffer_removal_time);
+ v4l2_frame_params.refresh_frame_flags = frame_header.refresh_frame_flags;
+
+ // TODO(b/248602457): Enable code for |order_hints| setup
+ // after |ref_order_hint| maintenance is implemented.
+
+ // These params looks duplicated with |ref_frame_idx|, but they are required
+ // and used when |frame_refs_short_signaling| is set according to the AV1
+ // spec. https://aomediacodec.github.io/av1-spec/#uncompressed-header-syntax
+ v4l2_frame_params.last_frame_idx =
+ frame_header.reference_frame_index[libgav1::kReferenceFrameLast];
+ v4l2_frame_params.gold_frame_idx =
+ frame_header.reference_frame_index[libgav1::kReferenceFrameGolden];
+
+ for (size_t i = 0; i < libgav1::kNumReferenceFrameTypes; ++i) {
+ const auto* v4l2_ref_pic =
+ static_cast<const V4L2AV1Picture*>(ref_frames[i].get());
+
+ v4l2_frame_params.reference_frame_ts[i] =
+ v4l2_ref_pic->dec_surface()->GetReferenceID();
+ }
+
+ static_assert(std::size(decltype(v4l2_frame_params.ref_frame_idx){}) ==
+ libgav1::kNumInterReferenceFrameTypes,
+ "Invalid size of |ref_frame_idx| array");
+ for (size_t i = 0; i < libgav1::kNumInterReferenceFrameTypes; i++)
+ v4l2_frame_params.ref_frame_idx[i] =
+ base::checked_cast<__u8>(frame_header.reference_frame_index[i]);
+
+ v4l2_frame_params.skip_mode_frame[0] =
+ base::checked_cast<__u8>(frame_header.skip_mode_frame[0]);
+ v4l2_frame_params.skip_mode_frame[1] =
+ base::checked_cast<__u8>(frame_header.skip_mode_frame[1]);
+
+ NOTIMPLEMENTED();
+
+ return DecodeStatus::kFail;
+}
+
+bool V4L2VideoDecoderDelegateAV1::OutputPicture(const AV1Picture& pic) {
+ VLOGF(3);
+ const auto* v4l2_pic = static_cast<const V4L2AV1Picture*>(&pic);
+
+ surface_handler_->SurfaceReady(
+ v4l2_pic->dec_surface(), v4l2_pic->bitstream_id(),
+ v4l2_pic->visible_rect(), v4l2_pic->get_colorspace());
+
+ return true;
+}
+
+} // namespace media
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_av1.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_av1.h
new file mode 100644
index 00000000000..43894385a57
--- /dev/null
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_av1.h
@@ -0,0 +1,48 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_GPU_V4L2_V4L2_VIDEO_DECODER_DELEGATE_AV1_H_
+#define MEDIA_GPU_V4L2_V4L2_VIDEO_DECODER_DELEGATE_AV1_H_
+
+#include "media/gpu/av1_decoder.h"
+
+#ifndef V4L2_AV1_RESTORATION_TILESIZE_MAX
+#define V4L2_AV1_RESTORATION_TILESIZE_MAX 256
+#endif
+
+namespace media {
+
+class V4L2DecodeSurfaceHandler;
+class V4L2Device;
+
+class V4L2VideoDecoderDelegateAV1 : public AV1Decoder::AV1Accelerator {
+ public:
+ V4L2VideoDecoderDelegateAV1(V4L2DecodeSurfaceHandler* surface_handler,
+ V4L2Device* device);
+
+ V4L2VideoDecoderDelegateAV1(const V4L2VideoDecoderDelegateAV1&) = delete;
+ V4L2VideoDecoderDelegateAV1& operator=(const V4L2VideoDecoderDelegateAV1&) =
+ delete;
+
+ ~V4L2VideoDecoderDelegateAV1() override;
+
+ // AV1Decoder::AV1Accelerator implementation.
+ scoped_refptr<AV1Picture> CreateAV1Picture(bool apply_grain) override;
+
+ Status SubmitDecode(const AV1Picture& pic,
+ const libgav1::ObuSequenceHeader& sequence_header,
+ const AV1ReferenceFrameVector& ref_frames,
+ const libgav1::Vector<libgav1::TileBuffer>& tile_buffers,
+ base::span<const uint8_t> data) override;
+
+ bool OutputPicture(const AV1Picture& pic) override;
+
+ private:
+ V4L2DecodeSurfaceHandler* const surface_handler_;
+ V4L2Device* const device_;
+};
+
+} // namespace media
+
+#endif // MEDIA_GPU_V4L2_V4L2_VIDEO_DECODER_DELEGATE_AV1_H_
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.cc
index 9f37ddcc7bf..a392c11ca95 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.h
index 308ef7f36de..2309dcaf9dd 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.cc
index 2957beeb8c5..bf8823d8958 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.h
index 21483799727..802755e518d 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_h264_legacy.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.cc
index 3523c83446f..52e888dac09 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.h
index 77bc2b9c890..880e92636a3 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.cc
index 674e31c57a9..c8dfebfff2b 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.h
index 41867dd6746..dd623cd3e1d 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp8_legacy.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.cc
index be3008d586b..6d5fa99d12e 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.h
index f5725496dac..51540d412f3 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.cc b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.cc
index 227eef09d18..a8d06890b7d 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.h b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.h
index 6943ec590bb..7efe7bb86ab 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_decoder_delegate_vp9_legacy.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.cc b/chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
index 8b6f57bcab9..58c78cee265 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
+++ b/chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -399,10 +399,10 @@ void V4L2VideoEncodeAccelerator::InitializeTask(const Config& config) {
// Notify VideoEncoderInfo after initialization.
VideoEncoderInfo encoder_info;
encoder_info.implementation_name = "V4L2VideoEncodeAccelerator";
- encoder_info.has_trusted_rate_controller = true;
- encoder_info.is_hardware_accelerated = true;
- encoder_info.supports_native_handle = true;
- encoder_info.supports_simulcast = false;
+ DCHECK(!encoder_info.has_trusted_rate_controller);
+ DCHECK(encoder_info.is_hardware_accelerated);
+ DCHECK(encoder_info.supports_native_handle);
+ DCHECK(!encoder_info.supports_simulcast);
// V4L2VideoEncodeAccelerator doesn't support either temporal-SVC or
// spatial-SVC. A single stream shall be output at the desired FPS.
@@ -431,7 +431,7 @@ bool V4L2VideoEncodeAccelerator::CreateImageProcessor(
VideoFrame::StorageType input_storage_type =
native_input_mode_ ? VideoFrame::STORAGE_GPU_MEMORY_BUFFER
- : VideoFrame::STORAGE_MOJO_SHARED_BUFFER;
+ : VideoFrame::STORAGE_SHMEM;
auto input_config = VideoFrameLayoutToPortConfig(
*ip_input_layout, input_visible_rect, {input_storage_type});
if (!input_config) {
@@ -617,6 +617,14 @@ void V4L2VideoEncodeAccelerator::Flush(FlushCallback flush_callback) {
void V4L2VideoEncodeAccelerator::FlushTask(FlushCallback flush_callback) {
DCHECK_CALLED_ON_VALID_SEQUENCE(encoder_sequence_checker_);
+ if (encoder_state_ == kInitialized) {
+ // Flush() is called before either Encode() or UseOutputBitstreamBuffer() is
+ // called. Just return as successful.
+ child_task_runner_->PostTask(
+ FROM_HERE, base::BindOnce(std::move(flush_callback), true));
+ return;
+ }
+
if (flush_callback_ || encoder_state_ != kEncoding) {
VLOGF(1) << "Flush failed: there is a pending flush, "
<< "or VideoEncodeAccelerator is not in kEncoding state";
@@ -776,7 +784,7 @@ void V4L2VideoEncodeAccelerator::EncodeTask(scoped_refptr<VideoFrame> frame,
const bool is_expected_storage_type =
native_input_mode_
? frame->storage_type() == VideoFrame::STORAGE_GPU_MEMORY_BUFFER
- : frame->IsMappable();
+ : frame->storage_type() == VideoFrame::STORAGE_SHMEM;
if (!is_expected_storage_type) {
VLOGF(1) << "Unexpected storage: "
<< VideoFrame::StorageTypeToString(frame->storage_type());
@@ -793,6 +801,12 @@ void V4L2VideoEncodeAccelerator::EncodeTask(scoped_refptr<VideoFrame> frame,
// not been called yet.
if (input_buffer_map_.empty() && !CreateInputBuffers())
return;
+
+ if (encoder_state_ == kInitialized) {
+ if (!StartDevicePoll())
+ return;
+ encoder_state_ = kEncoding;
+ }
}
if (image_processor_) {
@@ -1157,8 +1171,14 @@ void V4L2VideoEncodeAccelerator::Enqueue() {
DCHECK(!output_queue_->IsStreaming() && !input_queue_->IsStreaming());
// When VIDIOC_STREAMON can be executed in OUTPUT queue, it is fine to call
// STREAMON in CAPTURE queue.
- output_queue_->Streamon();
- input_queue_->Streamon();
+ if (!output_queue_->Streamon()) {
+ NOTIFY_ERROR(kPlatformFailureError);
+ return;
+ }
+ if (!input_queue_->Streamon()) {
+ NOTIFY_ERROR(kPlatformFailureError);
+ return;
+ }
}
}
@@ -1368,14 +1388,44 @@ bool V4L2VideoEncodeAccelerator::EnqueueInputRecord(
switch (input_buf.Memory()) {
case V4L2_MEMORY_USERPTR: {
- std::vector<void*> user_ptrs;
- for (size_t i = 0; i < num_planes; ++i)
- user_ptrs.push_back(frame->data(i));
- std::move(input_buf).QueueUserPtr(std::move(user_ptrs));
+ if (frame->storage_type() != VideoFrame::STORAGE_SHMEM) {
+ VLOGF(1) << "VideoFrame doesn't have shared memory";
+ NOTIFY_ERROR(kPlatformFailureError);
+ }
+
+ // TODO(b/243883312): This copies the video frame to a writable buffer
+ // since the USERPTR API requires writable permission. Remove this
+ // workaround once the unreasonable permission is fixed.
+ const size_t buffer_size = frame->shm_region()->GetSize();
+ std::vector<uint8_t> writable_buffer(buffer_size);
+ std::memcpy(writable_buffer.data(), frame->data(0), buffer_size);
+ std::vector<void*> user_ptrs(num_planes);
+ for (size_t i = 0; i < num_planes; ++i) {
+ const std::intptr_t plane_offset =
+ reinterpret_cast<std::intptr_t>(frame->data(i)) -
+ reinterpret_cast<std::intptr_t>(frame->data(0));
+ user_ptrs[i] = writable_buffer.data() + plane_offset;
+ }
+
+ if (!std::move(input_buf).QueueUserPtr(std::move(user_ptrs))) {
+ VPLOGF(1) << "Failed to queue a USRPTR buffer to input queue";
+ NOTIFY_ERROR(kPlatformFailureError);
+ return false;
+ }
+ frame->AddDestructionObserver(base::BindOnce([](std::vector<uint8_t>) {},
+ std::move(writable_buffer)));
break;
}
case V4L2_MEMORY_DMABUF: {
- std::move(input_buf).QueueDMABuf(gmb_handle.native_pixmap_handle.planes);
+ if (!std::move(input_buf).QueueDMABuf(
+ gmb_handle.native_pixmap_handle.planes)) {
+ VPLOGF(1) << "Failed queue a DMABUF buffer to input queue";
+ return false;
+ }
+ // Keep |gmb_handle| alive as long as |frame| is alive so that fds passed
+ // to the driver are valid during encoding.
+ frame->AddDestructionObserver(base::BindOnce(
+ [](gfx::GpuMemoryBufferHandle) {}, std::move(gmb_handle)));
break;
}
default:
@@ -1384,11 +1434,6 @@ bool V4L2VideoEncodeAccelerator::EnqueueInputRecord(
return false;
}
- // Keep |gmb_handle| alive as long as |frame| is alive so that fds passed
- // to the driver are valid during encoding.
- frame->AddDestructionObserver(
- base::BindOnce([](gfx::GpuMemoryBufferHandle) {}, std::move(gmb_handle)));
-
InputRecord& input_record = input_buffer_map_[buffer_id];
input_record.frame = frame;
input_record.ip_output_buffer_index = frame_info.ip_output_buffer_index;
@@ -1969,7 +2014,9 @@ void V4L2VideoEncodeAccelerator::DestroyInputBuffers() {
return;
DCHECK(!input_queue_->IsStreaming());
- input_queue_->DeallocateBuffers();
+ if (!input_queue_->DeallocateBuffers())
+ VLOGF(1) << "Failed to deallocate V4L2 input buffers";
+
input_buffer_map_.clear();
}
@@ -1981,7 +2028,8 @@ void V4L2VideoEncodeAccelerator::DestroyOutputBuffers() {
return;
DCHECK(!output_queue_->IsStreaming());
- output_queue_->DeallocateBuffers();
+ if (!output_queue_->DeallocateBuffers())
+ VLOGF(1) << "Failed to deallocate V4L2 output buffers";
}
} // namespace media
diff --git a/chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.h b/chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.h
index 686b3c29fbe..e3dfdf392ab 100644
--- a/chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.h
+++ b/chromium/media/gpu/v4l2/v4l2_video_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/BUILD.gn b/chromium/media/gpu/vaapi/BUILD.gn
index 8fbc73ddac3..29aa09bb597 100644
--- a/chromium/media/gpu/vaapi/BUILD.gn
+++ b/chromium/media/gpu/vaapi/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.cc b/chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.cc
index 7c7214d5a1a..53e4d89e7f4 100644
--- a/chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -738,6 +738,7 @@ AV1VaapiVideoDecoderDelegate::~AV1VaapiVideoDecoderDelegate() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!picture_params_);
DCHECK(!crypto_params_);
+ DCHECK(!protected_params_);
}
scoped_refptr<AV1Picture> AV1VaapiVideoDecoderDelegate::CreateAV1Picture(
@@ -852,22 +853,47 @@ DecodeStatus AV1VaapiVideoDecoderDelegate::SubmitDecode(
// also be adjusted.
// Create VASliceData buffer |encoded_data| every frame so that decoding can
// be more asynchronous than reusing the buffer.
- auto encoded_data =
- vaapi_wrapper_->CreateVABuffer(VASliceDataBufferType, data.size_bytes());
- if (!encoded_data)
- return DecodeStatus::kFail;
+ std::unique_ptr<ScopedVABuffer> encoded_data;
std::vector<std::pair<VABufferID, VaapiWrapper::VABufferDescriptor>> buffers =
{{picture_params_->id(),
- {picture_params_->type(), picture_params_->size(), &pic_param}},
- {encoded_data->id(),
- {encoded_data->type(), encoded_data->size(), data.data()}}};
- for (size_t i = 0; i < slice_params.size(); ++i) {
- buffers.push_back({slice_params_va_buffers[i]->id(),
- {slice_params_va_buffers[i]->type(),
- slice_params_va_buffers[i]->size(), &slice_params[i]}});
- }
+ {picture_params_->type(), picture_params_->size(), &pic_param}}};
+ buffers.reserve(3 + slice_params.size());
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+ if (IsTranscrypted()) {
+ CHECK(decrypt_config);
+ CHECK_EQ(decrypt_config->subsamples().size(), 2u);
+ if (!protected_params_) {
+ protected_params_ = vaapi_wrapper_->CreateVABuffer(
+ VAProtectedSliceDataBufferType, decrypt_config->key_id().length());
+ if (!protected_params_)
+ return DecodeStatus::kFail;
+ }
+ DCHECK_EQ(decrypt_config->key_id().length(), protected_params_->size());
+ buffers.push_back({protected_params_->id(),
+ {protected_params_->type(), protected_params_->size(),
+ decrypt_config->key_id().data()}});
+ encoded_data = vaapi_wrapper_->CreateVABuffer(
+ VASliceDataBufferType,
+ base::strict_cast<size_t>(
+ decrypt_config->subsamples()[0].cypher_bytes));
+ if (!encoded_data)
+ return DecodeStatus::kFail;
+ buffers.push_back(
+ {encoded_data->id(),
+ {encoded_data->type(), encoded_data->size(),
+ data.data() + decrypt_config->subsamples()[0].clear_bytes}});
+ } else {
+#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+ encoded_data = vaapi_wrapper_->CreateVABuffer(VASliceDataBufferType,
+ data.size_bytes());
+ if (!encoded_data)
+ return DecodeStatus::kFail;
+ buffers.push_back(
+ {encoded_data->id(),
+ {encoded_data->type(), encoded_data->size(), data.data()}});
#if BUILDFLAG(IS_CHROMEOS_ASH)
+ }
if (uses_crypto) {
buffers.push_back(
{crypto_params_->id(),
@@ -875,6 +901,12 @@ DecodeStatus AV1VaapiVideoDecoderDelegate::SubmitDecode(
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+ for (size_t i = 0; i < slice_params.size(); ++i) {
+ buffers.push_back({slice_params_va_buffers[i]->id(),
+ {slice_params_va_buffers[i]->type(),
+ slice_params_va_buffers[i]->size(), &slice_params[i]}});
+ }
+
const auto* vaapi_pic = static_cast<const VaapiAV1Picture*>(&pic);
const bool success = vaapi_wrapper_->MapAndCopyAndExecute(
vaapi_pic->reconstruct_va_surface()->id(), buffers);
@@ -892,5 +924,6 @@ void AV1VaapiVideoDecoderDelegate::OnVAContextDestructionSoon() {
// that will be destroyed soon.
picture_params_.reset();
crypto_params_.reset();
+ protected_params_.reset();
}
} // namespace media
diff --git a/chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.h b/chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.h
index 31fd5a4f2f6..7468f5821ba 100644
--- a/chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.h
+++ b/chromium/media/gpu/vaapi/av1_vaapi_video_decoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -44,6 +44,7 @@ class AV1VaapiVideoDecoderDelegate : public AV1Decoder::AV1Accelerator,
private:
std::unique_ptr<ScopedVABuffer> picture_params_;
std::unique_ptr<ScopedVABuffer> crypto_params_;
+ std::unique_ptr<ScopedVABuffer> protected_params_;
};
} // namespace media
#endif // MEDIA_GPU_VAAPI_AV1_VAAPI_VIDEO_DECODER_DELEGATE_H_
diff --git a/chromium/media/gpu/vaapi/fuzzers/jpeg_decoder/BUILD.gn b/chromium/media/gpu/vaapi/fuzzers/jpeg_decoder/BUILD.gn
index 37b7d6f0387..031785b1c16 100644
--- a/chromium/media/gpu/vaapi/fuzzers/jpeg_decoder/BUILD.gn
+++ b/chromium/media/gpu/vaapi/fuzzers/jpeg_decoder/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.cc b/chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.cc
index 5999fa5b38f..186a1808384 100644
--- a/chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.h b/chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.h
index 191f609cada..1cad17eb26d 100644
--- a/chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.h
+++ b/chromium/media/gpu/vaapi/h264_vaapi_video_decoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc b/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc
index 904767443ab..d8871537603 100644
--- a/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h b/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h
index c6f0badf8d3..55ad4bea8c0 100644
--- a/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h
+++ b/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate_unittest.cc b/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate_unittest.cc
index 93569661f1c..61928fce47a 100644
--- a/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate_unittest.cc
+++ b/chromium/media/gpu/vaapi/h264_vaapi_video_encoder_delegate_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.cc b/chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.cc
index ed283709f74..5819efb541b 100644
--- a/chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.h b/chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.h
index 9c699998131..e33bad7fc87 100644
--- a/chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.h
+++ b/chromium/media/gpu/vaapi/h265_vaapi_video_decoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/test_utils.cc b/chromium/media/gpu/vaapi/test_utils.cc
index f578bae1071..0233870fcbe 100644
--- a/chromium/media/gpu/vaapi/test_utils.cc
+++ b/chromium/media/gpu/vaapi/test_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/test_utils.h b/chromium/media/gpu/vaapi/test_utils.h
index c05be315a8d..e08a1ab54c3 100644
--- a/chromium/media/gpu/vaapi/test_utils.h
+++ b/chromium/media/gpu/vaapi/test_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/va.sigs b/chromium/media/gpu/vaapi/va.sigs
index a735f310edd..f08976bef0e 100644
--- a/chromium/media/gpu/vaapi/va.sigs
+++ b/chromium/media/gpu/vaapi/va.sigs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/va_drm.sigs b/chromium/media/gpu/vaapi/va_drm.sigs
index 093e36c8851..295921d1f18 100644
--- a/chromium/media/gpu/vaapi/va_drm.sigs
+++ b/chromium/media/gpu/vaapi/va_drm.sigs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/va_prot.sigs b/chromium/media/gpu/vaapi/va_prot.sigs
index dd13dafef1a..183319bbd72 100644
--- a/chromium/media/gpu/vaapi/va_prot.sigs
+++ b/chromium/media/gpu/vaapi/va_prot.sigs
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/va_surface.cc b/chromium/media/gpu/vaapi/va_surface.cc
index 64d213c050f..c07ff15d8f5 100644
--- a/chromium/media/gpu/vaapi/va_surface.cc
+++ b/chromium/media/gpu/vaapi/va_surface.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/va_surface.h b/chromium/media/gpu/vaapi/va_surface.h
index 813fb725fd3..60c41b26e9f 100644
--- a/chromium/media/gpu/vaapi/va_surface.h
+++ b/chromium/media/gpu/vaapi/va_surface.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/gpu/vaapi/va_x11.sigs b/chromium/media/gpu/vaapi/va_x11.sigs
index d87356b5c20..748e11c2dbb 100644
--- a/chromium/media/gpu/vaapi/va_x11.sigs
+++ b/chromium/media/gpu/vaapi/va_x11.sigs
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_common.cc b/chromium/media/gpu/vaapi/vaapi_common.cc
index 92e42b6a99c..5cb6f08d76c 100644
--- a/chromium/media/gpu/vaapi/vaapi_common.cc
+++ b/chromium/media/gpu/vaapi/vaapi_common.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_common.h b/chromium/media/gpu/vaapi/vaapi_common.h
index 169eec95581..72a2fd66f79 100644
--- a/chromium/media/gpu/vaapi/vaapi_common.h
+++ b/chromium/media/gpu/vaapi/vaapi_common.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_GPU_VAAPI_VAAPI_COMMON_H_
diff --git a/chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.cc b/chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.cc
index c838ec3a850..fecf199136b 100644
--- a/chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.cc
+++ b/chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.h b/chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.h
index 4d31db21280..76c6742bd22 100644
--- a/chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.h
+++ b/chromium/media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.cc b/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.cc
index b49e8fc9a1d..296057a598b 100644
--- a/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.cc
+++ b/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.h b/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.h
index 02387be35fe..16d98de9e7a 100644
--- a/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.h
+++ b/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc b/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc
index 640c4d76900..47295cdbe0f 100644
--- a/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc
+++ b/chromium/media/gpu/vaapi/vaapi_image_decode_accelerator_worker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_image_decoder.cc b/chromium/media/gpu/vaapi/vaapi_image_decoder.cc
index 91b26f9ebd2..3b045ff3bbf 100644
--- a/chromium/media/gpu/vaapi/vaapi_image_decoder.cc
+++ b/chromium/media/gpu/vaapi/vaapi_image_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_image_decoder.h b/chromium/media/gpu/vaapi/vaapi_image_decoder.h
index 524f4a051ec..fcbb0e0561d 100644
--- a/chromium/media/gpu/vaapi/vaapi_image_decoder.h
+++ b/chromium/media/gpu/vaapi/vaapi_image_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.cc b/chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.cc
index d34c9712253..960239e0dae 100644
--- a/chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.cc
+++ b/chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.h b/chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.h
index 753bacb5941..31c1f37493a 100644
--- a/chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.h
+++ b/chromium/media/gpu/vaapi/vaapi_image_decoder_test_common.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_image_processor_backend.cc b/chromium/media/gpu/vaapi/vaapi_image_processor_backend.cc
index 6c8cd3d38b5..030c0327f7b 100644
--- a/chromium/media/gpu/vaapi/vaapi_image_processor_backend.cc
+++ b/chromium/media/gpu/vaapi/vaapi_image_processor_backend.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_image_processor_backend.h b/chromium/media/gpu/vaapi/vaapi_image_processor_backend.h
index e2180506fef..a8f0decbdb5 100644
--- a/chromium/media/gpu/vaapi/vaapi_image_processor_backend.h
+++ b/chromium/media/gpu/vaapi/vaapi_image_processor_backend.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_jpeg_decoder.cc b/chromium/media/gpu/vaapi/vaapi_jpeg_decoder.cc
index 7c3e8e8b316..ea55c923df3 100644
--- a/chromium/media/gpu/vaapi/vaapi_jpeg_decoder.cc
+++ b/chromium/media/gpu/vaapi/vaapi_jpeg_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_jpeg_decoder.h b/chromium/media/gpu/vaapi/vaapi_jpeg_decoder.h
index 61ea4be387a..1ba5e96350c 100644
--- a/chromium/media/gpu/vaapi/vaapi_jpeg_decoder.h
+++ b/chromium/media/gpu/vaapi/vaapi_jpeg_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_jpeg_decoder_unittest.cc b/chromium/media/gpu/vaapi/vaapi_jpeg_decoder_unittest.cc
index 730dcb94b6f..2c76f0747c5 100644
--- a/chromium/media/gpu/vaapi/vaapi_jpeg_decoder_unittest.cc
+++ b/chromium/media/gpu/vaapi/vaapi_jpeg_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.cc b/chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.cc
index 72993a3a017..563fc294f38 100644
--- a/chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.cc
+++ b/chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.h b/chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.h
index ab8932c7df6..42777b85ee1 100644
--- a/chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.h
+++ b/chromium/media/gpu/vaapi/vaapi_jpeg_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_jpeg_encoder.cc b/chromium/media/gpu/vaapi/vaapi_jpeg_encoder.cc
index 90619a021a2..7226b21efa6 100644
--- a/chromium/media/gpu/vaapi/vaapi_jpeg_encoder.cc
+++ b/chromium/media/gpu/vaapi/vaapi_jpeg_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_jpeg_encoder.h b/chromium/media/gpu/vaapi/vaapi_jpeg_encoder.h
index a01fc7448b4..adfbb0ee1b6 100644
--- a/chromium/media/gpu/vaapi/vaapi_jpeg_encoder.h
+++ b/chromium/media/gpu/vaapi/vaapi_jpeg_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc b/chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc
index e56098a8758..44769d5d06e 100644
--- a/chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc
+++ b/chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.h b/chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.h
index 9d420769dde..d16821d98ac 100644
--- a/chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.h
+++ b/chromium/media/gpu/vaapi/vaapi_mjpeg_decode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture.cc b/chromium/media/gpu/vaapi/vaapi_picture.cc
index c9d5d22e9cc..101226ab9e8 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture.cc
+++ b/chromium/media/gpu/vaapi/vaapi_picture.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture.h b/chromium/media/gpu/vaapi/vaapi_picture.h
index a599253cf04..fa74aa23177 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture.h
+++ b/chromium/media/gpu/vaapi/vaapi_picture.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_factory.cc b/chromium/media/gpu/vaapi/vaapi_picture_factory.cc
index 62e3a429239..54825cd693a 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_factory.cc
+++ b/chromium/media/gpu/vaapi/vaapi_picture_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_factory.h b/chromium/media/gpu/vaapi/vaapi_picture_factory.h
index 804bdcbdc22..169038d2334 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_factory.h
+++ b/chromium/media/gpu/vaapi/vaapi_picture_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.cc b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.cc
index 941f24cc595..18c6c2234b0 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.cc
+++ b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.h b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.h
index 71ced2dcf56..60e87754c56 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.h
+++ b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc
index 929c7492403..a21495d9567 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc
+++ b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.h b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.h
index d80bb4eb6c2..0d0d3eb052c 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.h
+++ b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_angle.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.cc b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.cc
index 17d70682b06..f17221a38dd 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.cc
+++ b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.h b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.h
index 39c1e4369f7..234da305c58 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.h
+++ b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_egl.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc
index a53056a32c4..5437b2fa848 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc
+++ b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h
index e75a5ccd1ab..aa67b10a996 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h
+++ b/chromium/media/gpu/vaapi/vaapi_picture_native_pixmap_ozone.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_tfp.cc b/chromium/media/gpu/vaapi/vaapi_picture_tfp.cc
index b23c42052bd..87c9b918e65 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_tfp.cc
+++ b/chromium/media/gpu/vaapi/vaapi_picture_tfp.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_picture_tfp.h b/chromium/media/gpu/vaapi/vaapi_picture_tfp.h
index 37d6e947a42..6d1ff0f0923 100644
--- a/chromium/media/gpu/vaapi/vaapi_picture_tfp.h
+++ b/chromium/media/gpu/vaapi/vaapi_picture_tfp.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_status.h b/chromium/media/gpu/vaapi/vaapi_status.h
index 73041944d61..2bc7abedcc0 100644
--- a/chromium/media/gpu/vaapi/vaapi_status.h
+++ b/chromium/media/gpu/vaapi/vaapi_status.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_unittest.cc b/chromium/media/gpu/vaapi/vaapi_unittest.cc
index 8658dc7749d..558f5108355 100644
--- a/chromium/media/gpu/vaapi/vaapi_unittest.cc
+++ b/chromium/media/gpu/vaapi/vaapi_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_utils.cc b/chromium/media/gpu/vaapi/vaapi_utils.cc
index 0e57649173b..1fe2a259114 100644
--- a/chromium/media/gpu/vaapi/vaapi_utils.cc
+++ b/chromium/media/gpu/vaapi/vaapi_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_utils.h b/chromium/media/gpu/vaapi/vaapi_utils.h
index 1f0e5ac384e..c47564188b0 100644
--- a/chromium/media/gpu/vaapi/vaapi_utils.h
+++ b/chromium/media/gpu/vaapi/vaapi_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_utils_unittest.cc b/chromium/media/gpu/vaapi/vaapi_utils_unittest.cc
index a06db699e14..71d5435f3bf 100644
--- a/chromium/media/gpu/vaapi/vaapi_utils_unittest.cc
+++ b/chromium/media/gpu/vaapi/vaapi_utils_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc b/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
index bf791d813b4..37e3520f12f 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
+++ b/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.h b/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.h
index 3444ebf2d6c..82a4a49b3ed 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.h
+++ b/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc b/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc
index 9f7c69007f5..2b0c061c0f5 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc
+++ b/chromium/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_video_decoder.cc b/chromium/media/gpu/vaapi/vaapi_video_decoder.cc
index 551b8aa70b6..7ed209ad9b9 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_decoder.cc
+++ b/chromium/media/gpu/vaapi/vaapi_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_video_decoder.h b/chromium/media/gpu/vaapi/vaapi_video_decoder.h
index a3ecd231fbd..c76b2c5df2e 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_decoder.h
+++ b/chromium/media/gpu/vaapi/vaapi_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.cc b/chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.cc
index 4e2dc91c33a..a4401587e9b 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.h b/chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.h
index 075ccf28987..c4febb525f4 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.h
+++ b/chromium/media/gpu/vaapi/vaapi_video_decoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.cc b/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.cc
index c97d6952f1c..85903cfaebf 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.cc
+++ b/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include <memory>
#include <type_traits>
#include <utility>
+#include <variant>
#include "base/bind.h"
#include "base/bits.h"
@@ -127,7 +128,7 @@ VaapiVideoEncodeAccelerator::VaapiVideoEncodeAccelerator()
// The default value of VideoEncoderInfo of VaapiVideoEncodeAccelerator.
encoder_info_.implementation_name = "VaapiVideoEncodeAccelerator";
- encoder_info_.has_trusted_rate_controller = true;
+ DCHECK(!encoder_info_.has_trusted_rate_controller);
DCHECK(encoder_info_.is_hardware_accelerated);
DCHECK(encoder_info_.supports_native_handle);
DCHECK(!encoder_info_.supports_simulcast);
@@ -570,6 +571,9 @@ bool VaapiVideoEncodeAccelerator::CreateSurfacesForGpuMemoryBufferEncoding(
return false;
}
+ if (spatial_layer_resolutions.empty())
+ return false;
+
scoped_refptr<VASurface> source_surface;
{
TRACE_EVENT0("media,gpu", "VAVEA::ImportGpuMemoryBufferToVASurface");
@@ -593,30 +597,36 @@ bool VaapiVideoEncodeAccelerator::CreateSurfacesForGpuMemoryBufferEncoding(
// Create input and reconstructed surfaces.
TRACE_EVENT1("media,gpu", "VAVEA::ConstructSurfaces", "layers",
spatial_layer_resolutions.size());
- input_surfaces->reserve(spatial_layer_resolutions.size());
- reconstructed_surfaces->reserve(spatial_layer_resolutions.size());
- for (const gfx::Size& encode_size : spatial_layer_resolutions) {
- const bool engage_vpp = frame.visible_rect() != gfx::Rect(encode_size);
+ input_surfaces->resize(spatial_layer_resolutions.size());
+ reconstructed_surfaces->resize(spatial_layer_resolutions.size());
+
+ // Process from uppermost layer, then use immediate upper layer as vpp source
+ // surface if applicable.
+ auto source_rect = frame.visible_rect();
+ for (size_t i = spatial_layer_resolutions.size() - 1; i != std::variant_npos;
+ --i) {
+ const gfx::Size& encode_size = spatial_layer_resolutions[i];
+ const bool engage_vpp = source_rect != gfx::Rect(encode_size);
+
// Crop and Scale input surface to a surface whose size is |encode_size|.
// The size of a reconstructed surface is also |encode_size|.
if (engage_vpp) {
- auto blit_surface = ExecuteBlitSurface(*source_surface,
- frame.visible_rect(), encode_size);
- if (!blit_surface)
- return false;
-
- input_surfaces->push_back(std::move(blit_surface));
+ if (i + 1 < spatial_layer_resolutions.size()) {
+ source_surface = input_surfaces->at(i + 1);
+ source_rect = gfx::Rect(source_surface->size());
+ }
+ input_surfaces->at(i) =
+ ExecuteBlitSurface(*source_surface, source_rect, encode_size);
} else {
- input_surfaces->emplace_back(source_surface);
+ input_surfaces->at(i) = source_surface;
}
- reconstructed_surfaces->emplace_back(CreateEncodeSurface(encode_size));
- if (!reconstructed_surfaces->back())
+ reconstructed_surfaces->at(i) = CreateEncodeSurface(encode_size);
+
+ if (!input_surfaces->at(i) || !reconstructed_surfaces->at(i))
return false;
}
- DCHECK(!base::Contains(*input_surfaces, nullptr));
- DCHECK(!base::Contains(*reconstructed_surfaces, nullptr));
return true;
}
diff --git a/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.h b/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.h
index 13a062f2a27..30730c9cc52 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.h
+++ b/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator_unittest.cc b/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator_unittest.cc
index e73e47997af..b45f172223f 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator_unittest.cc
+++ b/chromium/media/gpu/vaapi/vaapi_video_encode_accelerator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -126,14 +126,14 @@ MATCHER_P2(MatchesEncoderInfo,
}
}
return arg.implementation_name == "VaapiVideoEncodeAccelerator" &&
- arg.supports_native_handle && arg.has_trusted_rate_controller &&
+ arg.supports_native_handle && !arg.has_trusted_rate_controller &&
arg.is_hardware_accelerated && !arg.supports_simulcast;
}
class MockVideoEncodeAcceleratorClient : public VideoEncodeAccelerator::Client {
public:
MockVideoEncodeAcceleratorClient() = default;
- virtual ~MockVideoEncodeAcceleratorClient() = default;
+ ~MockVideoEncodeAcceleratorClient() override = default;
MOCK_METHOD3(RequireBitstreamBuffers,
void(unsigned int, const gfx::Size&, size_t));
@@ -506,7 +506,7 @@ class VaapiVideoEncodeAcceleratorTest
std::vector<gfx::Size> svc_resolutions =
GetDefaultSVCResolutions(num_spatial_layers);
// Create Surfaces.
- for (size_t i = 0; i < num_spatial_layers; ++i) {
+ for (size_t i = num_spatial_layers - 1; i != std::variant_npos; --i) {
if (i < num_spatial_layers - 1) {
if (va_vpp_dest_surface_ids_[i] == VA_INVALID_ID) {
EXPECT_CALL(
@@ -529,10 +529,10 @@ class VaapiVideoEncodeAcceleratorTest
return va_surfaces;
}));
}
- absl::optional<gfx::Rect> default_rect = gfx::Rect(kDefaultEncodeSize);
+ absl::optional<gfx::Rect> src_rect = gfx::Rect(svc_resolutions[i + 1]);
absl::optional<gfx::Rect> layer_rect = gfx::Rect(svc_resolutions[i]);
EXPECT_CALL(*mock_vpp_vaapi_wrapper_,
- DoBlitSurface(_, _, default_rect, layer_rect,
+ DoBlitSurface(_, _, src_rect, layer_rect,
VideoRotation::VIDEO_ROTATION_0))
.WillOnce(Return(true));
}
@@ -565,9 +565,6 @@ class VaapiVideoEncodeAcceleratorTest
}
}
- for (size_t i = 0; i < num_spatial_layers; ++i) {
- }
-
// Create CodedBuffers in creating EncodeJobs.
constexpr VABufferID kCodedBufferIds[] = {123, 124, 125};
for (size_t i = 0; i < num_spatial_layers; ++i) {
diff --git a/chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.cc b/chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.cc
index 21e8ca9e82a..b01a7b15efd 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.h b/chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.h
index 995347c55a5..1af498e4d87 100644
--- a/chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.h
+++ b/chromium/media/gpu/vaapi/vaapi_video_encoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_webp_decoder.cc b/chromium/media/gpu/vaapi/vaapi_webp_decoder.cc
index afb71b35daa..48800522df5 100644
--- a/chromium/media/gpu/vaapi/vaapi_webp_decoder.cc
+++ b/chromium/media/gpu/vaapi/vaapi_webp_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_webp_decoder.h b/chromium/media/gpu/vaapi/vaapi_webp_decoder.h
index 35839e631e3..2a96492d8fe 100644
--- a/chromium/media/gpu/vaapi/vaapi_webp_decoder.h
+++ b/chromium/media/gpu/vaapi/vaapi_webp_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_webp_decoder_unittest.cc b/chromium/media/gpu/vaapi/vaapi_webp_decoder_unittest.cc
index 49342d29c97..3c11defedef 100644
--- a/chromium/media/gpu/vaapi/vaapi_webp_decoder_unittest.cc
+++ b/chromium/media/gpu/vaapi/vaapi_webp_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vaapi_wrapper.cc b/chromium/media/gpu/vaapi/vaapi_wrapper.cc
index dc1b731ea25..cc1c86fde9f 100644
--- a/chromium/media/gpu/vaapi/vaapi_wrapper.cc
+++ b/chromium/media/gpu/vaapi/vaapi_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,7 +16,6 @@
#include <va/va_version.h>
#include <xf86drm.h>
-#include <algorithm>
#include <string>
#include <type_traits>
#include <utility>
@@ -35,6 +34,7 @@
#include "base/numerics/checked_math.h"
#include "base/numerics/safe_conversions.h"
#include "base/posix/eintr_wrapper.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/pattern.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -622,10 +622,8 @@ bool IsVAProfileSupported(VAProfile va_profile) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
va_profile == VAProfileProtected ||
#endif
- std::find_if(profiles.begin(), profiles.end(),
- [va_profile](const auto& entry) {
- return entry.second == va_profile;
- }) != profiles.end();
+ base::Contains(profiles, va_profile,
+ &ProfileCodecMap::value_type::second);
}
bool IsBlockedDriver(VaapiWrapper::CodecMode mode, VAProfile va_profile) {
@@ -1164,8 +1162,8 @@ const VASupportedProfiles::ProfileInfo* VASupportedProfiles::IsProfileSupported(
VaapiWrapper::CodecMode mode,
VAProfile va_profile,
VAEntrypoint va_entrypoint) const {
- auto iter = std::find_if(
- supported_profiles_[mode].begin(), supported_profiles_[mode].end(),
+ auto iter = base::ranges::find_if(
+ supported_profiles_[mode],
[va_profile, va_entrypoint](const ProfileInfo& profile) {
return profile.va_profile == va_profile &&
(va_entrypoint == kVAEntrypointInvalid ||
@@ -1470,11 +1468,8 @@ const VASupportedImageFormats& VASupportedImageFormats::Get() {
bool VASupportedImageFormats::IsImageFormatSupported(
const VAImageFormat& va_image_format) const {
- auto it = std::find_if(supported_formats_.begin(), supported_formats_.end(),
- [&va_image_format](const VAImageFormat& format) {
- return format.fourcc == va_image_format.fourcc;
- });
- return it != supported_formats_.end();
+ return base::Contains(supported_formats_, va_image_format.fourcc,
+ &VAImageFormat::fourcc);
}
const std::vector<VAImageFormat>&
@@ -1552,10 +1547,9 @@ bool VASupportedImageFormats::InitSupportedImageFormats_Locked(
// assume that IYUV/I420 is supported. However, it's not currently being
// reported. See https://gitlab.freedesktop.org/mesa/mesa/commit/b0a44f10.
// Remove this workaround once b/128340287 is resolved.
- if (std::find_if(supported_formats_.cbegin(), supported_formats_.cend(),
- [](const VAImageFormat& format) {
- return format.fourcc == VA_FOURCC_I420;
- }) == supported_formats_.cend()) {
+ if (!base::Contains(supported_formats_,
+ static_cast<unsigned int>(VA_FOURCC_I420),
+ &VAImageFormat::fourcc)) {
VAImageFormat i420_format{};
i420_format.fourcc = VA_FOURCC_I420;
supported_formats_.push_back(i420_format);
diff --git a/chromium/media/gpu/vaapi/vaapi_wrapper.h b/chromium/media/gpu/vaapi/vaapi_wrapper.h
index c59f9798f07..84c25547f5a 100644
--- a/chromium/media/gpu/vaapi/vaapi_wrapper.h
+++ b/chromium/media/gpu/vaapi/vaapi_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/gpu/vaapi/vaapi_wrapper_unittest.cc b/chromium/media/gpu/vaapi/vaapi_wrapper_unittest.cc
index cded354e7e8..ff8caa3bcc6 100644
--- a/chromium/media/gpu/vaapi/vaapi_wrapper_unittest.cc
+++ b/chromium/media/gpu/vaapi/vaapi_wrapper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.cc b/chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.cc
index e9433bedcf3..cac6d9af10d 100644
--- a/chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.h b/chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.h
index 644e8a9cf2a..af857d70460 100644
--- a/chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.h
+++ b/chromium/media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.cc b/chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.cc
index 1b0de54c241..6edd9b0f026 100644
--- a/chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -32,12 +32,11 @@ constexpr uint8_t kMinQP = 4;
// resolution (180p).
constexpr uint8_t kMaxQP = 117;
-// The upper limitation of the quantization parameter for the software rate
-// controller. This is larger than |kMaxQP| because a driver might ignore the
-// specified maximum quantization parameter when the driver determines the
-// value, but it doesn't ignore the quantization parameter by the software rate
-// controller.
-constexpr uint8_t kMaxQPForSoftwareRateCtrl = 127;
+// WebRTC's default qp values are 15 and 106 for screen sharing, respectively,
+// Set smaller qp values for zero hertz tab sharing, which is triggered when qp
+// values are consecutively less than or equal to 15.
+constexpr uint8_t kScreenMinQP = 8;
+constexpr uint8_t kScreenMaxQP = 106;
// Convert Qindex, whose range is 0-127, to the quantizer parameter used in
// libvpx vp8 rate control, whose range is 0-63.
@@ -319,7 +318,11 @@ bool VP8VaapiVideoEncoderDelegate::Initialize(
else
initial_bitrate_allocation.SetBitrate(0, 0, config.bitrate.target_bps());
- current_params_.max_qp = kMaxQPForSoftwareRateCtrl;
+ if (config.content_type ==
+ VideoEncodeAccelerator::Config::ContentType::kDisplay) {
+ current_params_.min_qp = kScreenMinQP;
+ current_params_.max_qp = kScreenMaxQP;
+ }
// |rate_ctrl_| might be injected for tests.
if (!rate_ctrl_) {
diff --git a/chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.h b/chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.h
index 732eebe8667..27ee737c5bd 100644
--- a/chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.h
+++ b/chromium/media/gpu/vaapi/vp8_vaapi_video_encoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.cc b/chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.cc
index a1ea410276f..f2c8bd269e3 100644
--- a/chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.h b/chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.h
index f3f81122243..0abe7312811 100644
--- a/chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.h
+++ b/chromium/media/gpu/vaapi/vp9_vaapi_video_decoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.cc b/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.cc
index a58e65942ec..aa64ca838f2 100644
--- a/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.cc
+++ b/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.h b/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.h
index d135b0beea1..414c6cc538f 100644
--- a/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.h
+++ b/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate_unittest.cc b/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate_unittest.cc
index d966194387e..9a911e06057 100644
--- a/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate_unittest.cc
+++ b/chromium/media/gpu/vaapi/vp9_vaapi_video_encoder_delegate_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/video_decode_accelerator_perf_tests.cc b/chromium/media/gpu/video_decode_accelerator_perf_tests.cc
index 0d83e25237c..d0fcbd9e216 100644
--- a/chromium/media/gpu/video_decode_accelerator_perf_tests.cc
+++ b/chromium/media/gpu/video_decode_accelerator_perf_tests.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -472,8 +472,8 @@ int main(int argc, char** argv) {
bool use_legacy = false;
bool use_vd_vda = false;
bool linear_output = false;
- std::vector<base::Feature> disabled_features;
- std::vector<base::Feature> enabled_features;
+ std::vector<base::test::FeatureRef> disabled_features;
+ std::vector<base::test::FeatureRef> enabled_features;
#if defined(ARCH_CPU_ARM_FAMILY)
enabled_features.push_back(media::kPreferLibYuvImageProcessor);
diff --git a/chromium/media/gpu/video_decode_accelerator_tests.cc b/chromium/media/gpu/video_decode_accelerator_tests.cc
index e1fadd70895..712b82306ca 100644
--- a/chromium/media/gpu/video_decode_accelerator_tests.cc
+++ b/chromium/media/gpu/video_decode_accelerator_tests.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -544,8 +544,8 @@ int main(int argc, char** argv) {
bool use_legacy = false;
bool use_vd_vda = false;
bool linear_output = false;
- std::vector<base::Feature> disabled_features;
- std::vector<base::Feature> enabled_features;
+ std::vector<base::test::FeatureRef> disabled_features;
+ std::vector<base::test::FeatureRef> enabled_features;
#if defined(ARCH_CPU_ARM_FAMILY)
enabled_features.push_back(media::kPreferLibYuvImageProcessor);
diff --git a/chromium/media/gpu/video_encode_accelerator_perf_tests.cc b/chromium/media/gpu/video_encode_accelerator_perf_tests.cc
index 7275b26d6ce..2ed2028ce05 100644
--- a/chromium/media/gpu/video_encode_accelerator_perf_tests.cc
+++ b/chromium/media/gpu/video_encode_accelerator_perf_tests.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -791,7 +791,7 @@ int main(int argc, char** argv) {
media::Bitrate::Mode bitrate_mode = media::Bitrate::Mode::kConstant;
bool reverse = false;
absl::optional<uint32_t> encode_bitrate;
- std::vector<base::Feature> disabled_features;
+ std::vector<base::test::FeatureRef> disabled_features;
// Parse command line arguments.
base::FilePath::StringType output_folder = media::test::kDefaultOutputFolder;
diff --git a/chromium/media/gpu/video_encode_accelerator_tests.cc b/chromium/media/gpu/video_encode_accelerator_tests.cc
index 6208f2821c5..2b48c653f20 100644
--- a/chromium/media/gpu/video_encode_accelerator_tests.cc
+++ b/chromium/media/gpu/video_encode_accelerator_tests.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -871,7 +871,7 @@ int main(int argc, char** argv) {
media::test::FrameOutputConfig frame_output_config;
base::FilePath output_folder =
base::FilePath(base::FilePath::kCurrentDirectory);
- std::vector<base::Feature> disabled_features;
+ std::vector<base::test::FeatureRef> disabled_features;
// Parse command line arguments.
bool enable_bitstream_validator = true;
diff --git a/chromium/media/gpu/video_frame_mapper.h b/chromium/media/gpu/video_frame_mapper.h
index cc8f9564090..ad257152092 100644
--- a/chromium/media/gpu/video_frame_mapper.h
+++ b/chromium/media/gpu/video_frame_mapper.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/video_frame_mapper_factory.cc b/chromium/media/gpu/video_frame_mapper_factory.cc
index 28b10541fa2..27c98d0baae 100644
--- a/chromium/media/gpu/video_frame_mapper_factory.cc
+++ b/chromium/media/gpu/video_frame_mapper_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/video_frame_mapper_factory.h b/chromium/media/gpu/video_frame_mapper_factory.h
index ba1fc28bc7c..657a5e94667 100644
--- a/chromium/media/gpu/video_frame_mapper_factory.h
+++ b/chromium/media/gpu/video_frame_mapper_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/video_rate_control.cc b/chromium/media/gpu/video_rate_control.cc
index 90ce36256ad..e56b62e8a86 100644
--- a/chromium/media/gpu/video_rate_control.cc
+++ b/chromium/media/gpu/video_rate_control.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/video_rate_control.h b/chromium/media/gpu/video_rate_control.h
index c5666505d61..88da1ff72ed 100644
--- a/chromium/media/gpu/video_rate_control.h
+++ b/chromium/media/gpu/video_rate_control.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp8_decoder.cc b/chromium/media/gpu/vp8_decoder.cc
index c499357fbc2..d91a16fe47e 100644
--- a/chromium/media/gpu/vp8_decoder.cc
+++ b/chromium/media/gpu/vp8_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp8_decoder.h b/chromium/media/gpu/vp8_decoder.h
index a1acdcbd9d3..09ef7d64a04 100644
--- a/chromium/media/gpu/vp8_decoder.h
+++ b/chromium/media/gpu/vp8_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp8_decoder_unittest.cc b/chromium/media/gpu/vp8_decoder_unittest.cc
index 25ebc0f80ce..1cab3ab7b9d 100644
--- a/chromium/media/gpu/vp8_decoder_unittest.cc
+++ b/chromium/media/gpu/vp8_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp8_picture.cc b/chromium/media/gpu/vp8_picture.cc
index 366ad8354dd..3e7159921ed 100644
--- a/chromium/media/gpu/vp8_picture.cc
+++ b/chromium/media/gpu/vp8_picture.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp8_picture.h b/chromium/media/gpu/vp8_picture.h
index cb30ef8ca8b..84865c8d263 100644
--- a/chromium/media/gpu/vp8_picture.h
+++ b/chromium/media/gpu/vp8_picture.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp8_reference_frame_vector.cc b/chromium/media/gpu/vp8_reference_frame_vector.cc
index 1012a1350c1..d1ca7864604 100644
--- a/chromium/media/gpu/vp8_reference_frame_vector.cc
+++ b/chromium/media/gpu/vp8_reference_frame_vector.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp8_reference_frame_vector.h b/chromium/media/gpu/vp8_reference_frame_vector.h
index 8e0e2e8a0e0..8eaa18937da 100644
--- a/chromium/media/gpu/vp8_reference_frame_vector.h
+++ b/chromium/media/gpu/vp8_reference_frame_vector.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp9_decoder.cc b/chromium/media/gpu/vp9_decoder.cc
index fbac517457b..ca87587c32d 100644
--- a/chromium/media/gpu/vp9_decoder.cc
+++ b/chromium/media/gpu/vp9_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp9_decoder.h b/chromium/media/gpu/vp9_decoder.h
index cc0c6f61e18..e76472c8178 100644
--- a/chromium/media/gpu/vp9_decoder.h
+++ b/chromium/media/gpu/vp9_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp9_picture.cc b/chromium/media/gpu/vp9_picture.cc
index 477443d661b..7a32a2b3d00 100644
--- a/chromium/media/gpu/vp9_picture.cc
+++ b/chromium/media/gpu/vp9_picture.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp9_picture.h b/chromium/media/gpu/vp9_picture.h
index 1ce652dca19..8937400e582 100644
--- a/chromium/media/gpu/vp9_picture.h
+++ b/chromium/media/gpu/vp9_picture.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp9_reference_frame_vector.cc b/chromium/media/gpu/vp9_reference_frame_vector.cc
index f4541bf53bd..9481cbbb4e0 100644
--- a/chromium/media/gpu/vp9_reference_frame_vector.cc
+++ b/chromium/media/gpu/vp9_reference_frame_vector.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp9_reference_frame_vector.h b/chromium/media/gpu/vp9_reference_frame_vector.h
index 0d18d15430d..b0807cfd75d 100644
--- a/chromium/media/gpu/vp9_reference_frame_vector.h
+++ b/chromium/media/gpu/vp9_reference_frame_vector.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp9_svc_layers.cc b/chromium/media/gpu/vp9_svc_layers.cc
index 919531c018d..6b2774c4cb6 100644
--- a/chromium/media/gpu/vp9_svc_layers.cc
+++ b/chromium/media/gpu/vp9_svc_layers.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp9_svc_layers.h b/chromium/media/gpu/vp9_svc_layers.h
index 47d87bc3c4f..a5709c1b571 100644
--- a/chromium/media/gpu/vp9_svc_layers.h
+++ b/chromium/media/gpu/vp9_svc_layers.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/vp9_svc_layers_unittest.cc b/chromium/media/gpu/vp9_svc_layers_unittest.cc
index b4aa85e6ceb..254d658a22b 100644
--- a/chromium/media/gpu/vp9_svc_layers_unittest.cc
+++ b/chromium/media/gpu/vp9_svc_layers_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/av1_guids.h b/chromium/media/gpu/windows/av1_guids.h
index 9f0d9232ffa..404cab7d0f9 100644
--- a/chromium/media/gpu/windows/av1_guids.h
+++ b/chromium/media/gpu/windows/av1_guids.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_av1_accelerator.cc b/chromium/media/gpu/windows/d3d11_av1_accelerator.cc
index 6493c3de286..3d1b65b552d 100644
--- a/chromium/media/gpu/windows/d3d11_av1_accelerator.cc
+++ b/chromium/media/gpu/windows/d3d11_av1_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -560,12 +560,19 @@ void D3D11AV1Accelerator::FillPicParams(
pp->film_grain.ar_coeffs_cb[i] = fg.auto_regression_coeff_u[i] + 128;
pp->film_grain.ar_coeffs_cr[i] = fg.auto_regression_coeff_v[i] + 128;
}
- pp->film_grain.cb_mult = fg.u_multiplier;
- pp->film_grain.cb_luma_mult = fg.u_luma_multiplier;
- pp->film_grain.cb_offset = fg.u_offset;
- pp->film_grain.cr_mult = fg.v_multiplier;
- pp->film_grain.cr_luma_mult = fg.v_luma_multiplier;
- pp->film_grain.cr_offset = fg.v_offset;
+ // libgav1 will provide the multipliers by subtracting 128 and the offsets
+ // by subtracting 256. Restore values as DXVA spec requires values without
+ // subtraction.
+ if (fg.num_u_points > 0) {
+ pp->film_grain.cb_mult = fg.u_multiplier + 128;
+ pp->film_grain.cb_luma_mult = fg.u_luma_multiplier + 128;
+ pp->film_grain.cb_offset = fg.u_offset + 256;
+ }
+ if (fg.num_v_points > 0) {
+ pp->film_grain.cr_mult = fg.v_multiplier + 128;
+ pp->film_grain.cr_luma_mult = fg.v_luma_multiplier + 128;
+ pp->film_grain.cr_offset = fg.v_offset + 256;
+ }
}
// StatusReportFeedbackNumber "should not be equal to 0"... but it crashes :|
diff --git a/chromium/media/gpu/windows/d3d11_av1_accelerator.h b/chromium/media/gpu/windows/d3d11_av1_accelerator.h
index a8fbe9205cf..df8b9847496 100644
--- a/chromium/media/gpu/windows/d3d11_av1_accelerator.h
+++ b/chromium/media/gpu/windows/d3d11_av1_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_com_defs.h b/chromium/media/gpu/windows/d3d11_com_defs.h
index 97735df0003..cc7fd85b5b2 100644
--- a/chromium/media/gpu/windows/d3d11_com_defs.h
+++ b/chromium/media/gpu/windows/d3d11_com_defs.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_copying_texture_wrapper.cc b/chromium/media/gpu/windows/d3d11_copying_texture_wrapper.cc
index 95a7084e745..15162d016d2 100644
--- a/chromium/media/gpu/windows/d3d11_copying_texture_wrapper.cc
+++ b/chromium/media/gpu/windows/d3d11_copying_texture_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -77,18 +77,7 @@ D3D11Status CopyingTexture2DWrapper::ProcessTexture(
*previous_input_color_space_ != input_color_space) {
previous_input_color_space_ = input_color_space;
- // The VideoProcessor doesn't support tone mapping of HLG content, so treat
- // treat it as gamma 2.2 since HLG is designed to look okay that way.
- auto adjusted_color_space = input_color_space;
- if (input_color_space.GetTransferID() == gfx::ColorSpace::TransferID::HLG &&
- !copy_color_space.IsHDR()) {
- adjusted_color_space = gfx::ColorSpace(
- input_color_space.GetPrimaryID(),
- gfx::ColorSpace::TransferID::GAMMA22, input_color_space.GetMatrixID(),
- input_color_space.GetRangeID());
- }
-
- video_processor_->SetStreamColorSpace(adjusted_color_space);
+ video_processor_->SetStreamColorSpace(input_color_space);
video_processor_->SetOutputColorSpace(copy_color_space);
}
diff --git a/chromium/media/gpu/windows/d3d11_copying_texture_wrapper.h b/chromium/media/gpu/windows/d3d11_copying_texture_wrapper.h
index 95c5ebeee0b..47a5f21be78 100644
--- a/chromium/media/gpu/windows/d3d11_copying_texture_wrapper.h
+++ b/chromium/media/gpu/windows/d3d11_copying_texture_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_copying_texture_wrapper_unittest.cc b/chromium/media/gpu/windows/d3d11_copying_texture_wrapper_unittest.cc
index db1a84af106..687cc0200ff 100644
--- a/chromium/media/gpu/windows/d3d11_copying_texture_wrapper_unittest.cc
+++ b/chromium/media/gpu/windows/d3d11_copying_texture_wrapper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_decoder_configurator.cc b/chromium/media/gpu/windows/d3d11_decoder_configurator.cc
index a88e8a371b4..8b43e325e54 100644
--- a/chromium/media/gpu/windows/d3d11_decoder_configurator.cc
+++ b/chromium/media/gpu/windows/d3d11_decoder_configurator.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_decoder_configurator.h b/chromium/media/gpu/windows/d3d11_decoder_configurator.h
index 7814bf535da..04a3b2327dc 100644
--- a/chromium/media/gpu/windows/d3d11_decoder_configurator.h
+++ b/chromium/media/gpu/windows/d3d11_decoder_configurator.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_decoder_configurator_unittest.cc b/chromium/media/gpu/windows/d3d11_decoder_configurator_unittest.cc
index a75f6e123d9..ee790be215c 100644
--- a/chromium/media/gpu/windows/d3d11_decoder_configurator_unittest.cc
+++ b/chromium/media/gpu/windows/d3d11_decoder_configurator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_h264_accelerator.cc b/chromium/media/gpu/windows/d3d11_h264_accelerator.cc
index 48e827bee83..4f3f901444c 100644
--- a/chromium/media/gpu/windows/d3d11_h264_accelerator.cc
+++ b/chromium/media/gpu/windows/d3d11_h264_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -21,7 +21,6 @@
#include "ui/gfx/color_space.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_image_dxgi.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/scoped_binders.h"
diff --git a/chromium/media/gpu/windows/d3d11_h264_accelerator.h b/chromium/media/gpu/windows/d3d11_h264_accelerator.h
index d9d9d6dc35b..8bf45046e1a 100644
--- a/chromium/media/gpu/windows/d3d11_h264_accelerator.h
+++ b/chromium/media/gpu/windows/d3d11_h264_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_h265_accelerator.cc b/chromium/media/gpu/windows/d3d11_h265_accelerator.cc
index d0ba1214ec9..ad15bf5216a 100644
--- a/chromium/media/gpu/windows/d3d11_h265_accelerator.cc
+++ b/chromium/media/gpu/windows/d3d11_h265_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,7 +23,6 @@
#include "ui/gfx/color_space.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_image_dxgi.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/scoped_binders.h"
@@ -407,12 +406,12 @@ void D3D11H265Accelerator::PicParamsFromSliceHeader(
// IDR_W_RADL and IDR_N_LP NALUs do not contain st_rps in slice header.
// Otherwise if short_term_ref_pic_set_sps_flag is 1, host decoder
// shall set ucNumDeltaPocsOfRefRpsIdx to 0.
- if (slice_hdr->short_term_ref_pic_set_sps_flag || !slice_hdr->st_rps_bits) {
+ if (slice_hdr->short_term_ref_pic_set_sps_flag) {
pic_param->main.ucNumDeltaPocsOfRefRpsIdx = 0;
pic_param->main.wNumBitsForShortTermRPSInSlice = 0;
} else {
pic_param->main.ucNumDeltaPocsOfRefRpsIdx =
- slice_hdr->GetStRefPicSet(sps).num_delta_pocs;
+ slice_hdr->st_ref_pic_set.rps_idx_num_delta_pocs;
pic_param->main.wNumBitsForShortTermRPSInSlice = slice_hdr->st_rps_bits;
}
pic_param->main.IrapPicFlag = slice_hdr->irap_pic;
diff --git a/chromium/media/gpu/windows/d3d11_h265_accelerator.h b/chromium/media/gpu/windows/d3d11_h265_accelerator.h
index f094b9c6a05..cf7924a530d 100644
--- a/chromium/media/gpu/windows/d3d11_h265_accelerator.h
+++ b/chromium/media/gpu/windows/d3d11_h265_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_picture_buffer.cc b/chromium/media/gpu/windows/d3d11_picture_buffer.cc
index 4e22aa5b602..e0929db67b8 100644
--- a/chromium/media/gpu/windows/d3d11_picture_buffer.cc
+++ b/chromium/media/gpu/windows/d3d11_picture_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_picture_buffer.h b/chromium/media/gpu/windows/d3d11_picture_buffer.h
index e63b92316e5..266840f8866 100644
--- a/chromium/media/gpu/windows/d3d11_picture_buffer.h
+++ b/chromium/media/gpu/windows/d3d11_picture_buffer.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_picture_buffer_unittest.cc b/chromium/media/gpu/windows/d3d11_picture_buffer_unittest.cc
index 546dee28ca3..8366b49127a 100644
--- a/chromium/media/gpu/windows/d3d11_picture_buffer_unittest.cc
+++ b/chromium/media/gpu/windows/d3d11_picture_buffer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_status.h b/chromium/media/gpu/windows/d3d11_status.h
index 1642050216f..f2c76496e79 100644
--- a/chromium/media/gpu/windows/d3d11_status.h
+++ b/chromium/media/gpu/windows/d3d11_status.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_texture_selector.cc b/chromium/media/gpu/windows/d3d11_texture_selector.cc
index 7c9d135f580..cd12c5c8eec 100644
--- a/chromium/media/gpu/windows/d3d11_texture_selector.cc
+++ b/chromium/media/gpu/windows/d3d11_texture_selector.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -122,23 +122,10 @@ std::unique_ptr<TextureSelector> TextureSelector::Create(
output_dxgi_format = DXGI_FORMAT_B8G8R8A8_UNORM;
output_pixel_format = PIXEL_FORMAT_ARGB;
- if (input_color_space.GetTransferID() ==
- gfx::ColorSpace::TransferID::HLG) {
- // VideoProcessor do good HLG tone mappping between different gpu
- // vendors if we change input transfer from hlg to Gamma2.2 (Windows
- // does not support DXGI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020
- // well, see: https://crbug.com/1144260#c6) and output color space
- // to sRGB.
- output_color_space = gfx::ColorSpace::CreateSRGB();
- } else {
- // VideoProcessor do poor PQ tone mapping between different
- // gpu vendors, no matter if
- // D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10 feature caps is
- // supported or not. but gfx::ColorTransform indeed handle PQ content
- // well, so reset colorspace to use gfx do tone mapping and the result
- // is pretty good indeed.
- output_color_space.reset();
- }
+ // Gfx::ColorTransform now can handle both PQ/HLG content well for
+ // all gpu vendors and also has a better performance when compared with
+ // video processor, reset colorspace to use gfx do tone mapping.
+ output_color_space.reset();
MEDIA_LOG(INFO, media_log) << "D3D11VideoDecoder: Selected ARGB";
} else if (!needs_texture_copy || supports_fmt(DXGI_FORMAT_P010)) {
diff --git a/chromium/media/gpu/windows/d3d11_texture_selector.h b/chromium/media/gpu/windows/d3d11_texture_selector.h
index 4e16e450fdc..18d1a7fd346 100644
--- a/chromium/media/gpu/windows/d3d11_texture_selector.h
+++ b/chromium/media/gpu/windows/d3d11_texture_selector.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_texture_selector_unittest.cc b/chromium/media/gpu/windows/d3d11_texture_selector_unittest.cc
index 0b25774bd70..c7055215846 100644
--- a/chromium/media/gpu/windows/d3d11_texture_selector_unittest.cc
+++ b/chromium/media/gpu/windows/d3d11_texture_selector_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,7 +25,7 @@ class D3D11TextureSelectorUnittest : public ::testing::Test {
class MockFormatSupportChecker : public FormatSupportChecker {
public:
MockFormatSupportChecker() : FormatSupportChecker(nullptr) {}
- ~MockFormatSupportChecker() = default;
+ ~MockFormatSupportChecker() override = default;
bool Initialize() override { return true; }
MOCK_CONST_METHOD1(CheckOutputFormatSupport, bool(DXGI_FORMAT));
diff --git a/chromium/media/gpu/windows/d3d11_texture_wrapper.cc b/chromium/media/gpu/windows/d3d11_texture_wrapper.cc
index fa6989ecf37..263fdd3b756 100644
--- a/chromium/media/gpu/windows/d3d11_texture_wrapper.cc
+++ b/chromium/media/gpu/windows/d3d11_texture_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -215,7 +215,7 @@ DefaultTexture2DWrapper::GpuResources::GpuResources(
// decode, and allow webgl/canvas access.
constexpr uint32_t usage =
gpu::SHARED_IMAGE_USAGE_VIDEO_DECODE | gpu::SHARED_IMAGE_USAGE_GLES2 |
- gpu::SHARED_IMAGE_USAGE_RASTER | gpu::SHARED_IMAGE_USAGE_DISPLAY |
+ gpu::SHARED_IMAGE_USAGE_RASTER | gpu::SHARED_IMAGE_USAGE_DISPLAY_READ |
gpu::SHARED_IMAGE_USAGE_SCANOUT;
scoped_refptr<gpu::DXGISharedHandleState> dxgi_shared_handle_state;
diff --git a/chromium/media/gpu/windows/d3d11_texture_wrapper.h b/chromium/media/gpu/windows/d3d11_texture_wrapper.h
index 12d442741de..1e0fde475c3 100644
--- a/chromium/media/gpu/windows/d3d11_texture_wrapper.h
+++ b/chromium/media/gpu/windows/d3d11_texture_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,7 +24,6 @@
#include "ui/gfx/hdr_metadata.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_image_dxgi.h"
#include "ui/gl/gl_surface_egl.h"
#include "ui/gl/scoped_binders.h"
diff --git a/chromium/media/gpu/windows/d3d11_texture_wrapper_unittest.cc b/chromium/media/gpu/windows/d3d11_texture_wrapper_unittest.cc
index 4a7cfb19f98..0774789f8a6 100644
--- a/chromium/media/gpu/windows/d3d11_texture_wrapper_unittest.cc
+++ b/chromium/media/gpu/windows/d3d11_texture_wrapper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_context_wrapper.cc b/chromium/media/gpu/windows/d3d11_video_context_wrapper.cc
index f1073892fa7..45d89fa5982 100644
--- a/chromium/media/gpu/windows/d3d11_video_context_wrapper.cc
+++ b/chromium/media/gpu/windows/d3d11_video_context_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_context_wrapper.h b/chromium/media/gpu/windows/d3d11_video_context_wrapper.h
index cbdd6b4e80c..30beeb950a9 100644
--- a/chromium/media/gpu/windows/d3d11_video_context_wrapper.h
+++ b/chromium/media/gpu/windows/d3d11_video_context_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_decoder.cc b/chromium/media/gpu/windows/d3d11_video_decoder.cc
index 485515a8111..72a1b6fbf90 100644
--- a/chromium/media/gpu/windows/d3d11_video_decoder.cc
+++ b/chromium/media/gpu/windows/d3d11_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -94,7 +94,7 @@ std::unique_ptr<VideoDecoder> D3D11VideoDecoder::Create(
base::RepeatingCallback<gpu::CommandBufferStub*()> get_stub_cb,
D3D11VideoDecoder::GetD3D11DeviceCB get_d3d11_device_cb,
SupportedConfigs supported_configs,
- bool is_hdr_supported) {
+ bool system_hdr_enabled) {
// We create |impl_| on the wrong thread, but we never use it here.
// Note that the output callback will hop to our thread, post the video
// frame, and along with a callback that will hop back to the impl thread
@@ -111,7 +111,7 @@ std::unique_ptr<VideoDecoder> D3D11VideoDecoder::Create(
base::SequenceBound<D3D11VideoDecoderImpl>(
gpu_task_runner, std::move(cloned_media_log), get_helper_cb),
get_helper_cb, std::move(get_d3d11_device_cb),
- std::move(supported_configs), is_hdr_supported));
+ std::move(supported_configs), system_hdr_enabled));
}
D3D11VideoDecoder::D3D11VideoDecoder(
@@ -123,7 +123,7 @@ D3D11VideoDecoder::D3D11VideoDecoder(
base::RepeatingCallback<scoped_refptr<CommandBufferHelper>()> get_helper_cb,
GetD3D11DeviceCB get_d3d11_device_cb,
SupportedConfigs supported_configs,
- bool is_hdr_supported)
+ bool system_hdr_enabled)
: media_log_(std::move(media_log)),
impl_(std::move(impl)),
gpu_task_runner_(std::move(gpu_task_runner)),
@@ -134,7 +134,7 @@ D3D11VideoDecoder::D3D11VideoDecoder(
get_d3d11_device_cb_(std::move(get_d3d11_device_cb)),
get_helper_cb_(std::move(get_helper_cb)),
supported_configs_(std::move(supported_configs)),
- is_hdr_supported_(is_hdr_supported) {
+ system_hdr_enabled_(system_hdr_enabled) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(media_log_);
}
@@ -256,8 +256,8 @@ D3D11Status::Or<ComD3D11VideoDecoder> D3D11VideoDecoder::CreateD3D11Decoder() {
texture_selector_ = TextureSelector::Create(
gpu_preferences_, gpu_workarounds_,
decoder_configurator_->TextureFormat(),
- is_hdr_supported_ ? TextureSelector::HDRMode::kSDROrHDR
- : TextureSelector::HDRMode::kSDROnly,
+ system_hdr_enabled_ ? TextureSelector::HDRMode::kSDROrHDR
+ : TextureSelector::HDRMode::kSDROnly,
&format_checker, video_device_, device_context_, media_log_.get(),
config_.color_space_info().ToGfxColorSpace(), use_shared_handle);
if (!texture_selector_)
@@ -812,7 +812,10 @@ void D3D11VideoDecoder::CreatePictureBuffers() {
// order of these calls is important, and we must set the display metadata
// if we set the stream metadata, else it can crash on some AMD cards.
if (display_metadata) {
- if (config_.hdr_metadata() ||
+ // If system hdr is not enabled, don't set metadata can help us avoid
+ // video processor's tone mapping (if gpu vendor is intel), since we
+ // always want to use gfx::ColorTransform do PQ tone-mapping.
+ if ((config_.hdr_metadata() && system_hdr_enabled_) ||
gpu_workarounds_.use_empty_video_hdr_metadata) {
// It's okay if this has an empty-initialized metadata.
picture_buffers_[i]->texture_wrapper()->SetStreamHDRMetadata(
diff --git a/chromium/media/gpu/windows/d3d11_video_decoder.h b/chromium/media/gpu/windows/d3d11_video_decoder.h
index f7749719570..60aedc519fe 100644
--- a/chromium/media/gpu/windows/d3d11_video_decoder.h
+++ b/chromium/media/gpu/windows/d3d11_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -68,7 +68,7 @@ class MEDIA_GPU_EXPORT D3D11VideoDecoder : public VideoDecoder,
base::RepeatingCallback<gpu::CommandBufferStub*()> get_stub_cb,
GetD3D11DeviceCB get_d3d11_device_cb,
SupportedConfigs supported_configs,
- bool is_hdr_supported);
+ bool system_hdr_enabled);
D3D11VideoDecoder(const D3D11VideoDecoder&) = delete;
D3D11VideoDecoder& operator=(const D3D11VideoDecoder&) = delete;
@@ -125,7 +125,7 @@ class MEDIA_GPU_EXPORT D3D11VideoDecoder : public VideoDecoder,
get_helper_cb,
GetD3D11DeviceCB get_d3d11_device_cb,
SupportedConfigs supported_configs,
- bool is_hdr_supported);
+ bool system_hdr_enabled);
// Receive |buffer|, that is now unused by the client.
void ReceivePictureBufferFromClient(scoped_refptr<D3D11PictureBuffer> buffer);
@@ -308,7 +308,7 @@ class MEDIA_GPU_EXPORT D3D11VideoDecoder : public VideoDecoder,
SupportedConfigs supported_configs_;
// Should we assume that we're outputting to an HDR display?
- bool is_hdr_supported_ = false;
+ bool system_hdr_enabled_ = false;
// Should we use multiple single textures for the decoder output (true) or one
// texture with multiple array slices (false)?
diff --git a/chromium/media/gpu/windows/d3d11_video_decoder_client.h b/chromium/media/gpu/windows/d3d11_video_decoder_client.h
index efd0d711d4a..aeeb694b0fb 100644
--- a/chromium/media/gpu/windows/d3d11_video_decoder_client.h
+++ b/chromium/media/gpu/windows/d3d11_video_decoder_client.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_decoder_impl.cc b/chromium/media/gpu/windows/d3d11_video_decoder_impl.cc
index 719e7b516fe..954a4404ccf 100644
--- a/chromium/media/gpu/windows/d3d11_video_decoder_impl.cc
+++ b/chromium/media/gpu/windows/d3d11_video_decoder_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_decoder_impl.h b/chromium/media/gpu/windows/d3d11_video_decoder_impl.h
index 61320d864cc..53b71395162 100644
--- a/chromium/media/gpu/windows/d3d11_video_decoder_impl.h
+++ b/chromium/media/gpu/windows/d3d11_video_decoder_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_decoder_unittest.cc b/chromium/media/gpu/windows/d3d11_video_decoder_unittest.cc
index 897ec022ddd..4a50aa78827 100644
--- a/chromium/media/gpu/windows/d3d11_video_decoder_unittest.cc
+++ b/chromium/media/gpu/windows/d3d11_video_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -204,7 +204,7 @@ class D3D11VideoDecoderTest : public ::testing::Test {
gpu_task_runner_, std::make_unique<NullMediaLog>(),
gpu_preferences_, gpu_workarounds_, std::move(impl),
base::RepeatingCallback<scoped_refptr<CommandBufferHelper>()>(),
- get_device_cb, *supported_configs, is_hdr_supported_));
+ get_device_cb, *supported_configs, system_hdr_enabled_));
}
void InitializeDecoder(const VideoDecoderConfig& config, bool expectSuccess) {
@@ -250,8 +250,8 @@ class D3D11VideoDecoderTest : public ::testing::Test {
Microsoft::WRL::ComPtr<DXGIDeviceMock> mock_dxgi_device_;
Microsoft::WRL::ComPtr<DXGIAdapterMock> mock_dxgi_adapter_;
- // Used by CreateDecoder() to tell D3D11VideoDecoder about HDR support.
- bool is_hdr_supported_ = true;
+ // Used by CreateDecoder() to tell D3D11VideoDecoder about if HDR is enabled.
+ bool system_hdr_enabled_ = true;
DXGI_ADAPTER_DESC mock_adapter_desc_;
diff --git a/chromium/media/gpu/windows/d3d11_video_device_format_support.cc b/chromium/media/gpu/windows/d3d11_video_device_format_support.cc
index 7436f418f9d..f35411baaa4 100644
--- a/chromium/media/gpu/windows/d3d11_video_device_format_support.cc
+++ b/chromium/media/gpu/windows/d3d11_video_device_format_support.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_device_format_support.h b/chromium/media/gpu/windows/d3d11_video_device_format_support.h
index 8472044c358..ab752f0d7b8 100644
--- a/chromium/media/gpu/windows/d3d11_video_device_format_support.h
+++ b/chromium/media/gpu/windows/d3d11_video_device_format_support.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_device_format_support_unittest.cc b/chromium/media/gpu/windows/d3d11_video_device_format_support_unittest.cc
index 6c03b082f69..2f5b7b9d0b9 100644
--- a/chromium/media/gpu/windows/d3d11_video_device_format_support_unittest.cc
+++ b/chromium/media/gpu/windows/d3d11_video_device_format_support_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_processor_proxy.cc b/chromium/media/gpu/windows/d3d11_video_processor_proxy.cc
index deb7182dd7b..3d8c07318df 100644
--- a/chromium/media/gpu/windows/d3d11_video_processor_proxy.cc
+++ b/chromium/media/gpu/windows/d3d11_video_processor_proxy.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_processor_proxy.h b/chromium/media/gpu/windows/d3d11_video_processor_proxy.h
index 8bd0d360e9c..b4fe2fb2818 100644
--- a/chromium/media/gpu/windows/d3d11_video_processor_proxy.h
+++ b/chromium/media/gpu/windows/d3d11_video_processor_proxy.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_video_processor_proxy_unittest.cc b/chromium/media/gpu/windows/d3d11_video_processor_proxy_unittest.cc
index 1ddc97ca178..50e71223a38 100644
--- a/chromium/media/gpu/windows/d3d11_video_processor_proxy_unittest.cc
+++ b/chromium/media/gpu/windows/d3d11_video_processor_proxy_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_vp9_accelerator.cc b/chromium/media/gpu/windows/d3d11_vp9_accelerator.cc
index 5de9677ca47..2054e2418ff 100644
--- a/chromium/media/gpu/windows/d3d11_vp9_accelerator.cc
+++ b/chromium/media/gpu/windows/d3d11_vp9_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_vp9_accelerator.h b/chromium/media/gpu/windows/d3d11_vp9_accelerator.h
index 4dd398502c7..d5498c5f18f 100644
--- a/chromium/media/gpu/windows/d3d11_vp9_accelerator.h
+++ b/chromium/media/gpu/windows/d3d11_vp9_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_vp9_picture.cc b/chromium/media/gpu/windows/d3d11_vp9_picture.cc
index 913fefec589..997e07f96cb 100644
--- a/chromium/media/gpu/windows/d3d11_vp9_picture.cc
+++ b/chromium/media/gpu/windows/d3d11_vp9_picture.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/d3d11_vp9_picture.h b/chromium/media/gpu/windows/d3d11_vp9_picture.h
index 02b50c5d7bb..2caeca464d7 100644
--- a/chromium/media/gpu/windows/d3d11_vp9_picture.h
+++ b/chromium/media/gpu/windows/d3d11_vp9_picture.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/dxva_picture_buffer_win.cc b/chromium/media/gpu/windows/dxva_picture_buffer_win.cc
index fa4837b645f..726bd6a136c 100644
--- a/chromium/media/gpu/windows/dxva_picture_buffer_win.cc
+++ b/chromium/media/gpu/windows/dxva_picture_buffer_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/dxva_picture_buffer_win.h b/chromium/media/gpu/windows/dxva_picture_buffer_win.h
index 1fbb8494813..e3c5783f699 100644
--- a/chromium/media/gpu/windows/dxva_picture_buffer_win.h
+++ b/chromium/media/gpu/windows/dxva_picture_buffer_win.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/dxva_video_decode_accelerator_win.cc b/chromium/media/gpu/windows/dxva_video_decode_accelerator_win.cc
index 3c85ccad3ab..7b71280afe5 100644
--- a/chromium/media/gpu/windows/dxva_video_decode_accelerator_win.cc
+++ b/chromium/media/gpu/windows/dxva_video_decode_accelerator_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -3235,7 +3235,7 @@ DXVAVideoDecodeAccelerator::GetSharedImagesFromPictureBuffer(
// to decode, and allow webgl/canvas access.
constexpr uint32_t shared_image_usage =
gpu::SHARED_IMAGE_USAGE_VIDEO_DECODE | gpu::SHARED_IMAGE_USAGE_GLES2 |
- gpu::SHARED_IMAGE_USAGE_RASTER | gpu::SHARED_IMAGE_USAGE_DISPLAY |
+ gpu::SHARED_IMAGE_USAGE_RASTER | gpu::SHARED_IMAGE_USAGE_DISPLAY_READ |
gpu::SHARED_IMAGE_USAGE_SCANOUT;
// Create a shared image
@@ -3274,8 +3274,8 @@ DXVAVideoDecodeAccelerator::GetSharedImagesFromPictureBuffer(
gpu::SharedImageStub* shared_image_stub = client_->GetSharedImageStub();
DCHECK(shared_image_stub);
- const bool success = shared_image_stub->factory()->RegisterBacking(
- std::move(shared_image), /* legacy_mailbox */ true);
+ const bool success =
+ shared_image_stub->factory()->RegisterBacking(std::move(shared_image));
if (!success) {
RETURN_AND_NOTIFY_ON_FAILURE(false, "Failed to register shared image",
PLATFORM_FAILURE, {});
diff --git a/chromium/media/gpu/windows/dxva_video_decode_accelerator_win.h b/chromium/media/gpu/windows/dxva_video_decode_accelerator_win.h
index 8ca4d60b155..04f03a441ac 100644
--- a/chromium/media/gpu/windows/dxva_video_decode_accelerator_win.h
+++ b/chromium/media/gpu/windows/dxva_video_decode_accelerator_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/init_guid.cc b/chromium/media/gpu/windows/init_guid.cc
index 51e49af265f..ed8fd5e41f3 100644
--- a/chromium/media/gpu/windows/init_guid.cc
+++ b/chromium/media/gpu/windows/init_guid.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc b/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
index 3b424904e2e..fab1ff9def5 100644
--- a/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
+++ b/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -79,6 +79,12 @@ constexpr const wchar_t* const kMediaFoundationVideoEncoderDLLs[] = {
L"mfplat.dll",
};
+static const CLSID kIntelAV1HybridEncoderCLSID = {
+ 0x62c053ce,
+ 0x5357,
+ 0x4794,
+ {0x8c, 0x5a, 0xfb, 0xef, 0xfe, 0xff, 0xb8, 0x2d}};
+
eAVEncH264VProfile GetH264VProfile(VideoCodecProfile profile,
bool is_constrained_h264) {
switch (profile) {
@@ -115,6 +121,8 @@ bool IsSvcSupported(IMFActivate* activate) {
// More info: https://crbug.com/1253748
return false;
#else
+ // crbug.com/1350257
+ TRACE_EVENT0("catan_investigation", "IsSvcSupported");
Microsoft::WRL::ComPtr<IMFTransform> encoder;
Microsoft::WRL::ComPtr<ICodecAPI> codec_api;
HRESULT hr = activate->ActivateObject(IID_PPV_ARGS(&encoder));
@@ -229,6 +237,33 @@ uint32_t EnumerateHardwareEncoders(VideoCodec codec,
return count;
}
+// Per
+// https://learn.microsoft.com/en-us/windows/win32/medfound/handling-stream-changes,
+// encoders should only accept an input type that matches the currently
+// configured output type. If we want to change the frame rate, a
+// stream restart flow is needed, which in turn generates a key-frame on the
+// stream restart. This is not friendly for WebRTC encoding, which adjusts the
+// encoding frame rate frequently.
+// To mitigate this, we only configure the frame rate during HMFT
+// initialization. On subsequent frame rate update request, if new frame rate is
+// larger than currently configured frame rate and bitrate is kept unchanged,
+// this implies average encoded frame size should decrease proportionally. Since
+// we don't actually configure the new frame rate into HMFT(to avoid stream
+// restart), we emulate this average frame size decrease by proportionally
+// decreasing the target/peak bitrate(which does not require stream restart).
+// This is similar for frame rate update request that is lower than currently
+// configured, by increasing bitrate to emulate average frame size increase.
+// See https://crbug.com/1295815 for more details.
+uint32_t AdjustBitrateToFrameRate(uint32_t bitrate,
+ uint32_t configured_framerate,
+ uint32_t requested_framerate) {
+ if (requested_framerate == 0u) {
+ return 0u;
+ }
+
+ return bitrate * configured_framerate / requested_framerate;
+}
+
} // namespace
class MediaFoundationVideoEncodeAccelerator::EncodeOutput {
@@ -282,8 +317,6 @@ MediaFoundationVideoEncodeAccelerator::MediaFoundationVideoEncodeAccelerator(
CHROME_LUID luid)
: compatible_with_win7_(
gpu_preferences.enable_media_foundation_vea_on_windows7),
- disable_dynamic_framerate_update_(
- gpu_workarounds.disable_dynamic_video_encode_framerate_update),
frame_rate_(kMaxFrameRateNumerator / kMaxFrameRateDenominator),
bitrate_(Bitrate::ConstantBitrate(kDefaultTargetBitrate)),
input_required_(false),
@@ -314,26 +347,7 @@ MediaFoundationVideoEncodeAccelerator::GetSupportedProfiles() {
SupportedProfiles profiles;
for (auto codec : {VideoCodec::kH264, VideoCodec::kVP9, VideoCodec::kAV1}) {
- auto codec_profiles = GetSupportedProfilesForCodec(codec, true);
- profiles.insert(profiles.end(), codec_profiles.begin(),
- codec_profiles.end());
- }
-
- ReleaseEncoderResources();
- return profiles;
-}
-
-VideoEncodeAccelerator::SupportedProfiles
-MediaFoundationVideoEncodeAccelerator::GetSupportedProfilesLight() {
- TRACE_EVENT0(
- "gpu,startup",
- "MediaFoundationVideoEncodeAccelerator::GetSupportedProfilesLight");
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
-
- SupportedProfiles profiles;
-
- for (auto codec : {VideoCodec::kH264, VideoCodec::kVP9, VideoCodec::kAV1}) {
- auto codec_profiles = GetSupportedProfilesForCodec(codec, false);
+ auto codec_profiles = GetSupportedProfilesForCodec(codec);
profiles.insert(profiles.end(), codec_profiles.begin(),
codec_profiles.end());
}
@@ -344,8 +358,7 @@ MediaFoundationVideoEncodeAccelerator::GetSupportedProfilesLight() {
VideoEncodeAccelerator::SupportedProfiles
MediaFoundationVideoEncodeAccelerator::GetSupportedProfilesForCodec(
- VideoCodec codec,
- bool populate_svc_info) {
+ VideoCodec codec) {
SupportedProfiles profiles;
if ((codec == VideoCodec::kVP9 &&
!base::FeatureList::IsEnabled(kMediaFoundationVP9Encoding)) ||
@@ -367,10 +380,8 @@ MediaFoundationVideoEncodeAccelerator::GetSupportedProfilesForCodec(
if (pp_activate) {
for (UINT32 i = 0; i < encoder_count; i++) {
if (pp_activate[i]) {
- if (populate_svc_info && !svc_supported &&
- IsSvcSupported(pp_activate[i])) {
+ if (!svc_supported && IsSvcSupported(pp_activate[i]))
svc_supported = true;
- }
// Release the enumerated instances if any.
// According to Windows Dev Center,
@@ -460,7 +471,7 @@ bool MediaFoundationVideoEncodeAccelerator::Initialize(
std::make_unique<base::WeakPtrFactory<Client>>(client);
main_client_ = main_client_weak_factory_->GetWeakPtr();
input_visible_size_ = config.input_visible_size;
- if (config.initial_framerate.has_value())
+ if (config.initial_framerate.has_value() && config.initial_framerate.value())
frame_rate_ = config.initial_framerate.value();
else
frame_rate_ = kMaxFrameRateNumerator / kMaxFrameRateDenominator;
@@ -558,7 +569,7 @@ void MediaFoundationVideoEncodeAccelerator::EncoderInitializeTask(
VideoEncoderInfo encoder_info;
encoder_info.implementation_name = "MediaFoundationVideoEncodeAccelerator";
- encoder_info.has_trusted_rate_controller = true;
+ encoder_info.has_trusted_rate_controller = false;
DCHECK(encoder_info.is_hardware_accelerated);
DCHECK(encoder_info.supports_native_handle);
DCHECK(!encoder_info.supports_simulcast);
@@ -682,52 +693,52 @@ bool MediaFoundationVideoEncodeAccelerator::ActivateAsyncEncoder(
// Try to create the encoder with priority according to merit value.
HRESULT hr = E_FAIL;
for (UINT32 i = 0; i < encoder_count; i++) {
- if (FAILED(hr)) {
- DCHECK(!encoder_);
- DCHECK(!activate_);
- hr = pp_activate[i]->ActivateObject(IID_PPV_ARGS(&encoder_));
- if (encoder_.Get() != nullptr) {
- DCHECK(SUCCEEDED(hr));
- auto vendor = GetDriverVendor(pp_activate[i]);
-
- // Skip NVIDIA GPU due to https://crbug.com/1088650 for constrained
- // baseline profile H.264 encoding, and go to the next instance
- // according to merit value.
- if (codec_ == VideoCodec::kH264 && is_constrained_h264) {
- // Get the vendor id.
- base::win::ScopedCoMem<WCHAR> vendor_id;
- UINT32 id_length;
- pp_activate[i]->GetAllocatedString(
- MFT_ENUM_HARDWARE_VENDOR_ID_Attribute, &vendor_id, &id_length);
- if (!_wcsnicmp(vendor_id, L"VEN_10DE", id_length)) {
- DLOG(WARNING)
- << "Skipped NVIDIA GPU due to https://crbug.com/1088650";
- pp_activate[i]->ShutdownObject();
- encoder_.Reset();
- hr = E_FAIL;
- continue;
- }
- }
+ auto vendor = GetDriverVendor(pp_activate[i]);
+ // Skip flawky Intel hybrid AV1 encoder.
+ if (codec_ == VideoCodec::kAV1 && vendor == DriverVendor::kIntel) {
+ // Get the CLSID GUID of the HMFT.
+ GUID mft_guid = {0};
+ pp_activate[i]->GetGUID(MFT_TRANSFORM_CLSID_Attribute, &mft_guid);
+ if (mft_guid == kIntelAV1HybridEncoderCLSID) {
+ DLOG(WARNING) << "Skipped Intel hybrid AV1 encoder MFT.";
+ continue;
+ }
+ }
- activate_ = pp_activate[i];
- vendor_ = vendor;
- pp_activate[i] = nullptr;
+ // Skip NVIDIA GPU due to https://crbug.com/1088650 for constrained
+ // baseline profile H.264 encoding, and go to the next instance according
+ // to merit value.
+ if (codec_ == VideoCodec::kH264 && is_constrained_h264 &&
+ vendor == DriverVendor::kNvidia) {
+ DLOG(WARNING) << "Skipped NVIDIA GPU due to https://crbug.com/1088650";
+ continue;
+ }
- // Print the friendly name.
- base::win::ScopedCoMem<WCHAR> friendly_name;
- UINT32 name_length;
- activate_->GetAllocatedString(MFT_FRIENDLY_NAME_Attribute,
- &friendly_name, &name_length);
- DVLOG(3) << "Selected asynchronous hardware encoder's friendly name: "
- << friendly_name;
- } else {
- DCHECK(FAILED(hr));
+ DCHECK(!encoder_);
+ DCHECK(!activate_);
+ hr = pp_activate[i]->ActivateObject(IID_PPV_ARGS(&encoder_));
+ if (encoder_.Get() != nullptr) {
+ DCHECK(SUCCEEDED(hr));
+ activate_ = pp_activate[i];
+ vendor_ = vendor;
+ pp_activate[i] = nullptr;
+
+ // Print the friendly name.
+ base::win::ScopedCoMem<WCHAR> friendly_name;
+ UINT32 name_length;
+ activate_->GetAllocatedString(MFT_FRIENDLY_NAME_Attribute, &friendly_name,
+ &name_length);
+ DVLOG(3) << "Selected asynchronous hardware encoder's friendly name: "
+ << friendly_name;
+ // Encoder is successfully activated.
+ break;
+ } else {
+ DCHECK(FAILED(hr));
- // The component that calls ActivateObject is
- // responsible for calling ShutdownObject,
- // https://docs.microsoft.com/en-us/windows/win32/api/mfobjects/nf-mfobjects-imfactivate-shutdownobject.
- pp_activate[i]->ShutdownObject();
- }
+ // The component that calls ActivateObject is
+ // responsible for calling ShutdownObject,
+ // https://docs.microsoft.com/en-us/windows/win32/api/mfobjects/nf-mfobjects-imfactivate-shutdownobject.
+ pp_activate[i]->ShutdownObject();
}
}
@@ -803,11 +814,15 @@ bool MediaFoundationVideoEncodeAccelerator::InitializeInputOutputParameters(
hr = imf_output_media_type_->SetGUID(MF_MT_SUBTYPE,
VideoCodecToMFSubtype(codec_));
RETURN_ON_HR_FAILURE(hr, "Couldn't set video format", false);
- hr = imf_output_media_type_->SetUINT32(MF_MT_AVG_BITRATE,
- bitrate_.target_bps());
+
+ hr = imf_output_media_type_->SetUINT32(
+ MF_MT_AVG_BITRATE, AdjustBitrateToFrameRate(bitrate_.target_bps(),
+ frame_rate_, frame_rate_));
RETURN_ON_HR_FAILURE(hr, "Couldn't set bitrate", false);
+ configured_frame_rate_ = frame_rate_;
+
hr = MFSetAttributeRatio(imf_output_media_type_.Get(), MF_MT_FRAME_RATE,
- frame_rate_, 1);
+ configured_frame_rate_, 1);
RETURN_ON_HR_FAILURE(hr, "Couldn't set frame rate", false);
hr = MFSetAttributeSize(imf_output_media_type_.Get(), MF_MT_FRAME_SIZE,
input_visible_size_.width(),
@@ -837,7 +852,7 @@ bool MediaFoundationVideoEncodeAccelerator::InitializeInputOutputParameters(
hr = imf_input_media_type_->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_NV12);
RETURN_ON_HR_FAILURE(hr, "Couldn't set video format", false);
hr = MFSetAttributeRatio(imf_input_media_type_.Get(), MF_MT_FRAME_RATE,
- frame_rate_, 1);
+ configured_frame_rate_, 1);
RETURN_ON_HR_FAILURE(hr, "Couldn't set frame rate", false);
hr = MFSetAttributeSize(imf_input_media_type_.Get(), MF_MT_FRAME_SIZE,
input_visible_size_.width(),
@@ -891,14 +906,16 @@ bool MediaFoundationVideoEncodeAccelerator::SetEncoderModes() {
}
}
- var.ulVal = bitrate_.target_bps();
+ var.ulVal = AdjustBitrateToFrameRate(bitrate_.target_bps(),
+ configured_frame_rate_, frame_rate_);
hr = codec_api_->SetValue(&CODECAPI_AVEncCommonMeanBitRate, &var);
if (!compatible_with_win7_) {
RETURN_ON_HR_FAILURE(hr, "Couldn't set bitrate", false);
}
if (bitrate_.mode() == Bitrate::Mode::kVariable) {
- var.ulVal = bitrate_.peak_bps();
+ var.ulVal = AdjustBitrateToFrameRate(bitrate_.peak_bps(),
+ configured_frame_rate_, frame_rate_);
hr = codec_api_->SetValue(&CODECAPI_AVEncCommonMaxBitRate, &var);
if (!compatible_with_win7_) {
RETURN_ON_HR_FAILURE(hr, "Couldn't set bitrate", false);
@@ -1468,78 +1485,21 @@ void MediaFoundationVideoEncodeAccelerator::RequestEncodingParametersChangeTask(
framerate = base::clamp(framerate, 1u, uint32_t{kMaxFrameRateNumerator});
- if (frame_rate_ != framerate) {
- // When dynamic framerate update is disabled, fallback from current encoder.
- if (disable_dynamic_framerate_update_) {
- DLOG(ERROR) << "Dynamic encode framerate update disabled.";
- NotifyError(kPlatformFailureError);
- }
- HRESULT hr = MFSetAttributeRatio(imf_output_media_type_.Get(),
- MF_MT_FRAME_RATE, framerate, 1);
- RETURN_ON_HR_FAILURE(hr, "Couldn't set frame rate for output type", );
-
- imf_output_media_type_->SetUINT32(MF_MT_AVG_BITRATE, bitrate.target_bps());
- RETURN_ON_HR_FAILURE(hr, "Couldn't set average bitrate for output type", );
-
- hr = MFSetAttributeRatio(imf_input_media_type_.Get(), MF_MT_FRAME_RATE,
- framerate, 1);
- RETURN_ON_HR_FAILURE(hr, "Couldn't set frame rate for input type", );
-
- // Some HMFTs will reject output type change with MF_E_INVALIDTYPE due
- // to temporary mismatch between output/input media types, so we always
- // clear the input/output media types before reconfiguring them
- // dynamically.
- hr = encoder_->ProcessMessage(MFT_MESSAGE_COMMAND_DRAIN, 0);
- RETURN_ON_HR_FAILURE(
- hr, "Couldn't process message MFT_MESSAGE_COMMAND_DRAIN", );
-
- DrainPendingOutputs();
-
- hr = encoder_->ProcessMessage(MFT_MESSAGE_NOTIFY_END_OF_STREAM, 0);
- RETURN_ON_HR_FAILURE(
- hr, "Couldn't process message MFT_MESSAGE_NOTIFY_END_OF_STREAM", );
-
- hr = encoder_->ProcessMessage(MFT_MESSAGE_NOTIFY_END_STREAMING, 0);
- RETURN_ON_HR_FAILURE(
- hr, "Couldn't process message MFT_MESSAGE_NOTIFY_END_STREAMING", );
-
- hr = encoder_->SetInputType(input_stream_id_, nullptr, 0);
- RETURN_ON_HR_FAILURE(hr, "Couldn't clear input media type.", );
-
- hr = encoder_->SetOutputType(output_stream_id_, nullptr, 0);
- RETURN_ON_HR_FAILURE(hr, "Couldn't clear ouput media type.", );
-
- hr = encoder_->SetOutputType(output_stream_id_,
- imf_output_media_type_.Get(), 0);
- RETURN_ON_HR_FAILURE(hr, "Couldn't set output media type", );
-
- hr = encoder_->SetInputType(input_stream_id_, imf_input_media_type_.Get(),
- 0);
- RETURN_ON_HR_FAILURE(hr, "Couldn't set input media type", );
-
- hr = encoder_->ProcessMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, 0);
- RETURN_ON_HR_FAILURE(
- hr, "Couldn't process message MFT_MESSAGE_NOTIFY_BEGIN_STREAMING", );
-
- hr = encoder_->ProcessMessage(MFT_MESSAGE_NOTIFY_START_OF_STREAM, 0);
- RETURN_ON_HR_FAILURE(
- hr, "Couldn't process message MFT_MESSAGE_NOTIFY_START_OF_STREAM", );
-
- frame_rate_ = framerate;
- }
-
- if (bitrate_ != bitrate) {
+ if (bitrate_ != bitrate || frame_rate_ != framerate) {
bitrate_ = bitrate;
+ frame_rate_ = framerate;
VARIANT var;
var.vt = VT_UI4;
- var.ulVal = bitrate.target_bps();
+ var.ulVal = AdjustBitrateToFrameRate(bitrate.target_bps(),
+ configured_frame_rate_, framerate);
HRESULT hr = codec_api_->SetValue(&CODECAPI_AVEncCommonMeanBitRate, &var);
if (!compatible_with_win7_) {
RETURN_ON_HR_FAILURE(hr, "Couldn't update mean bitrate", );
}
if (bitrate.mode() == Bitrate::Mode::kVariable) {
- var.ulVal = bitrate.peak_bps();
+ var.ulVal = AdjustBitrateToFrameRate(bitrate.peak_bps(),
+ configured_frame_rate_, framerate);
hr = codec_api_->SetValue(&CODECAPI_AVEncCommonMaxBitRate, &var);
if (!compatible_with_win7_) {
RETURN_ON_HR_FAILURE(hr, "Couldn't set max bitrate", );
@@ -1739,22 +1699,4 @@ HRESULT MediaFoundationVideoEncodeAccelerator::PerformD3DScaling(
return hr;
}
-void MediaFoundationVideoEncodeAccelerator::DrainPendingOutputs() {
- Microsoft::WRL::ComPtr<IMFMediaEvent> media_event;
-
- while ((SUCCEEDED(
- event_generator_->GetEvent(MF_EVENT_FLAG_NO_WAIT, &media_event)))) {
- MediaEventType event_type;
- HRESULT hr = media_event->GetType(&event_type);
- if (FAILED(hr)) {
- DLOG(ERROR) << "Failed to get the type of media event.";
- continue;
- }
-
- if (event_type == METransformHaveOutput) {
- ProcessOutput();
- }
- }
-}
-
} // namespace media
diff --git a/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.h b/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.h
index be7dd3ac671..c95c815e1d9 100644
--- a/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.h
+++ b/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -52,8 +52,6 @@ class MEDIA_GPU_EXPORT MediaFoundationVideoEncodeAccelerator
// VideoEncodeAccelerator implementation.
VideoEncodeAccelerator::SupportedProfiles GetSupportedProfiles() override;
- VideoEncodeAccelerator::SupportedProfiles GetSupportedProfilesLight()
- override;
bool Initialize(const Config& config,
Client* client,
std::unique_ptr<MediaLog> media_log) override;
@@ -82,8 +80,7 @@ class MEDIA_GPU_EXPORT MediaFoundationVideoEncodeAccelerator
// Get supported profiles for specific codec.
VideoEncodeAccelerator::SupportedProfiles GetSupportedProfilesForCodec(
- VideoCodec codec,
- bool populate_svc_info);
+ VideoCodec codec);
// Activates the asynchronous encoder instance |encoder_| according to codec
// merit.
@@ -126,9 +123,6 @@ class MEDIA_GPU_EXPORT MediaFoundationVideoEncodeAccelerator
// Checks for and copies encoded output on |encoder_thread_task_runner_|.
void ProcessOutput();
- // Drains pending output samples on |encoder_thread_task_runner_|.
- void DrainPendingOutputs();
-
// Tries to deliver the input frame to the encoder.
bool TryToDeliverInputFrame(scoped_refptr<VideoFrame> frame,
bool force_keyframe);
@@ -161,7 +155,6 @@ class MEDIA_GPU_EXPORT MediaFoundationVideoEncodeAccelerator
HRESULT PerformD3DScaling(ID3D11Texture2D* input_texture);
const bool compatible_with_win7_;
- const bool disable_dynamic_framerate_update_;
// Bitstream buffers ready to be used to return encoded output as a FIFO.
base::circular_deque<std::unique_ptr<BitstreamBufferRef>>
@@ -180,6 +173,9 @@ class MEDIA_GPU_EXPORT MediaFoundationVideoEncodeAccelerator
gfx::Size input_visible_size_;
size_t bitstream_buffer_size_;
uint32_t frame_rate_;
+ // For recording configured frame rate as we don't dynamically change it.
+ // The default value here will be overridden during initialization.
+ uint32_t configured_frame_rate_ = 30;
Bitrate bitrate_;
bool low_latency_mode_;
int num_temporal_layers_ = 1;
diff --git a/chromium/media/gpu/windows/mf_audio_encoder.cc b/chromium/media/gpu/windows/mf_audio_encoder.cc
index bd39b655768..049cef50193 100644
--- a/chromium/media/gpu/windows/mf_audio_encoder.cc
+++ b/chromium/media/gpu/windows/mf_audio_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,9 +12,11 @@
#include <string.h>
#include <wmcodecdsp.h>
#include <wrl/client.h>
+
#include <utility>
#include "base/bind.h"
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/task/single_thread_task_runner.h"
@@ -78,8 +80,7 @@ EncoderStatus::Codes ValidateInputOptions(const AudioEncoder::Options& options,
if (options.codec != AudioCodec::kAAC)
return EncoderStatus::Codes::kEncoderUnsupportedCodec;
- if (std::find(kSupportedSampleRates.begin(), kSupportedSampleRates.end(),
- options.sample_rate) == kSupportedSampleRates.end()) {
+ if (!base::Contains(kSupportedSampleRates, options.sample_rate)) {
return EncoderStatus::Codes::kEncoderUnsupportedConfig;
}
@@ -102,8 +103,7 @@ EncoderStatus::Codes ValidateInputOptions(const AudioEncoder::Options& options,
}
*bitrate = options.bitrate.value_or(kDefaultBitrate);
- if (std::find(kSupportedBitrates.begin(), kSupportedBitrates.end(),
- *bitrate) == kSupportedBitrates.end()) {
+ if (!base::Contains(kSupportedBitrates, *bitrate)) {
return EncoderStatus::Codes::kEncoderUnsupportedConfig;
}
@@ -470,9 +470,9 @@ void MFAudioEncoder::Initialize(const Options& options,
}
channel_count_ = options_.channels;
- audio_params_ =
- AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
- options_.sample_rate, kSamplesPerFrame);
+ audio_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ {channel_layout, channel_count_},
+ options_.sample_rate, kSamplesPerFrame);
input_timestamp_tracker_ =
std::make_unique<AudioTimestampHelper>(options_.sample_rate);
output_timestamp_tracker_ =
diff --git a/chromium/media/gpu/windows/mf_audio_encoder.h b/chromium/media/gpu/windows/mf_audio_encoder.h
index f7f3e9c17ed..c257f31e3ae 100644
--- a/chromium/media/gpu/windows/mf_audio_encoder.h
+++ b/chromium/media/gpu/windows/mf_audio_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/output_with_release_mailbox_cb.h b/chromium/media/gpu/windows/output_with_release_mailbox_cb.h
index 9fcfcb509e2..feb4c396933 100644
--- a/chromium/media/gpu/windows/output_with_release_mailbox_cb.h
+++ b/chromium/media/gpu/windows/output_with_release_mailbox_cb.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/supported_profile_helpers.cc b/chromium/media/gpu/windows/supported_profile_helpers.cc
index 47cbb84d13f..a95e4b778e5 100644
--- a/chromium/media/gpu/windows/supported_profile_helpers.cc
+++ b/chromium/media/gpu/windows/supported_profile_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/supported_profile_helpers.h b/chromium/media/gpu/windows/supported_profile_helpers.h
index e99379be3f0..2dd3f019f38 100644
--- a/chromium/media/gpu/windows/supported_profile_helpers.h
+++ b/chromium/media/gpu/windows/supported_profile_helpers.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/gpu/windows/supported_profile_helpers_unittest.cc b/chromium/media/gpu/windows/supported_profile_helpers_unittest.cc
index 87adc2cdcbb..e127d6785ff 100644
--- a/chromium/media/gpu/windows/supported_profile_helpers_unittest.cc
+++ b/chromium/media/gpu/windows/supported_profile_helpers_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -332,19 +332,8 @@ TEST_F(SupportedResolutionResolverTest, AV1ProfileProSupports8k) {
#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
TEST_F(SupportedResolutionResolverTest, H265Supports8kIfEnabled) {
DONT_RUN_ON_WIN_7();
-
EnableDecoders({D3D11_DECODER_PROFILE_HEVC_VLD_MAIN});
- base::test::ScopedFeatureList scoped_feature_list;
-
- // Test the supported resolutions before enabling the feature:
- const auto no_feature_resolutions = GetSupportedD3D11VideoDecoderResolutions(
- mock_d3d11_device_, gpu_workarounds_);
- // Should only have the three h264 default resolutions.
- ASSERT_EQ(3u, no_feature_resolutions.size());
-
- // enable the feature and try again
SetMaxResolution(D3D11_DECODER_PROFILE_HEVC_VLD_MAIN, kSquare8k);
- scoped_feature_list.InitAndEnableFeature(kPlatformHEVCDecoderSupport);
const auto resolutions_for_feature = GetSupportedD3D11VideoDecoderResolutions(
mock_d3d11_device_, gpu_workarounds_);
ASSERT_EQ(4u, resolutions_for_feature.size());
diff --git a/chromium/media/learning/BUILD.gn b/chromium/media/learning/BUILD.gn
index 41586901db6..edeff3a56c3 100644
--- a/chromium/media/learning/BUILD.gn
+++ b/chromium/media/learning/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/learning/common/BUILD.gn b/chromium/media/learning/common/BUILD.gn
index bddcb62c8cd..c5257e23c83 100644
--- a/chromium/media/learning/common/BUILD.gn
+++ b/chromium/media/learning/common/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/learning/common/feature_dictionary.cc b/chromium/media/learning/common/feature_dictionary.cc
index 1f36725fa88..0e1d0c2b346 100644
--- a/chromium/media/learning/common/feature_dictionary.cc
+++ b/chromium/media/learning/common/feature_dictionary.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/feature_dictionary.h b/chromium/media/learning/common/feature_dictionary.h
index 36641555876..c115907686f 100644
--- a/chromium/media/learning/common/feature_dictionary.h
+++ b/chromium/media/learning/common/feature_dictionary.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/feature_dictionary_unittest.cc b/chromium/media/learning/common/feature_dictionary_unittest.cc
index 9d4a00fab6e..529cebc25b4 100644
--- a/chromium/media/learning/common/feature_dictionary_unittest.cc
+++ b/chromium/media/learning/common/feature_dictionary_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/feature_library.cc b/chromium/media/learning/common/feature_library.cc
index 0fa286d59dc..dc10b47bc86 100644
--- a/chromium/media/learning/common/feature_library.cc
+++ b/chromium/media/learning/common/feature_library.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/feature_library.h b/chromium/media/learning/common/feature_library.h
index e544da71798..8a6b6f3d90f 100644
--- a/chromium/media/learning/common/feature_library.h
+++ b/chromium/media/learning/common/feature_library.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/labelled_example.cc b/chromium/media/learning/common/labelled_example.cc
index 0d0da630009..e84585c7dad 100644
--- a/chromium/media/learning/common/labelled_example.cc
+++ b/chromium/media/learning/common/labelled_example.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/labelled_example.h b/chromium/media/learning/common/labelled_example.h
index 9ee57d77b5d..85918a5d836 100644
--- a/chromium/media/learning/common/labelled_example.h
+++ b/chromium/media/learning/common/labelled_example.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/labelled_example_unittest.cc b/chromium/media/learning/common/labelled_example_unittest.cc
index 59ef70d79c4..fcd94caf6d4 100644
--- a/chromium/media/learning/common/labelled_example_unittest.cc
+++ b/chromium/media/learning/common/labelled_example_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/learning_session.cc b/chromium/media/learning/common/learning_session.cc
index e54d57e9dfe..5119887b633 100644
--- a/chromium/media/learning/common/learning_session.cc
+++ b/chromium/media/learning/common/learning_session.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/learning_session.h b/chromium/media/learning/common/learning_session.h
index 23929e892b8..36f35a3741a 100644
--- a/chromium/media/learning/common/learning_session.h
+++ b/chromium/media/learning/common/learning_session.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/learning_task.cc b/chromium/media/learning/common/learning_task.cc
index 75c0ae59eb8..4bf91ca1fc4 100644
--- a/chromium/media/learning/common/learning_task.cc
+++ b/chromium/media/learning/common/learning_task.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/learning_task.h b/chromium/media/learning/common/learning_task.h
index 90a19a131c9..709578ecae1 100644
--- a/chromium/media/learning/common/learning_task.h
+++ b/chromium/media/learning/common/learning_task.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/learning_task_controller.h b/chromium/media/learning/common/learning_task_controller.h
index 7e1222cb186..285e1e509f3 100644
--- a/chromium/media/learning/common/learning_task_controller.h
+++ b/chromium/media/learning/common/learning_task_controller.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/media_learning_tasks.cc b/chromium/media/learning/common/media_learning_tasks.cc
index e579028e441..f42aab128ef 100644
--- a/chromium/media/learning/common/media_learning_tasks.cc
+++ b/chromium/media/learning/common/media_learning_tasks.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/media_learning_tasks.h b/chromium/media/learning/common/media_learning_tasks.h
index 5491df357e3..b6b0c78f622 100644
--- a/chromium/media/learning/common/media_learning_tasks.h
+++ b/chromium/media/learning/common/media_learning_tasks.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/media_learning_tasks_unittest.cc b/chromium/media/learning/common/media_learning_tasks_unittest.cc
index dc9d6547652..6eeeb5bb658 100644
--- a/chromium/media/learning/common/media_learning_tasks_unittest.cc
+++ b/chromium/media/learning/common/media_learning_tasks_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/target_histogram.cc b/chromium/media/learning/common/target_histogram.cc
index 4d2068fbf02..e037b84c5b0 100644
--- a/chromium/media/learning/common/target_histogram.cc
+++ b/chromium/media/learning/common/target_histogram.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/target_histogram.h b/chromium/media/learning/common/target_histogram.h
index b173f44bba6..0a78c5fbc1e 100644
--- a/chromium/media/learning/common/target_histogram.h
+++ b/chromium/media/learning/common/target_histogram.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/target_histogram_unittest.cc b/chromium/media/learning/common/target_histogram_unittest.cc
index bf5e2a27ae9..b6cfba52174 100644
--- a/chromium/media/learning/common/target_histogram_unittest.cc
+++ b/chromium/media/learning/common/target_histogram_unittest.cc
@@ -1,5 +1,4 @@
-
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/value.cc b/chromium/media/learning/common/value.cc
index b3fedfb7f68..8a753e974f1 100644
--- a/chromium/media/learning/common/value.cc
+++ b/chromium/media/learning/common/value.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/value.h b/chromium/media/learning/common/value.h
index 1b7e3db1f5b..b23b1cf5a6a 100644
--- a/chromium/media/learning/common/value.h
+++ b/chromium/media/learning/common/value.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/common/value_unittest.cc b/chromium/media/learning/common/value_unittest.cc
index 8306875bdc3..8d459c0f7d8 100644
--- a/chromium/media/learning/common/value_unittest.cc
+++ b/chromium/media/learning/common/value_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/BUILD.gn b/chromium/media/learning/impl/BUILD.gn
index 2b70ebc46a1..ff04eef6c04 100644
--- a/chromium/media/learning/impl/BUILD.gn
+++ b/chromium/media/learning/impl/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/learning/impl/distribution_reporter.cc b/chromium/media/learning/impl/distribution_reporter.cc
index 6c5b0434875..d36da9800a8 100644
--- a/chromium/media/learning/impl/distribution_reporter.cc
+++ b/chromium/media/learning/impl/distribution_reporter.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/distribution_reporter.h b/chromium/media/learning/impl/distribution_reporter.h
index 840e79340ff..d6b40a9b4e6 100644
--- a/chromium/media/learning/impl/distribution_reporter.h
+++ b/chromium/media/learning/impl/distribution_reporter.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/distribution_reporter_unittest.cc b/chromium/media/learning/impl/distribution_reporter_unittest.cc
index 3e968c5061e..5020246468e 100644
--- a/chromium/media/learning/impl/distribution_reporter_unittest.cc
+++ b/chromium/media/learning/impl/distribution_reporter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/extra_trees_trainer.cc b/chromium/media/learning/impl/extra_trees_trainer.cc
index 03cb8e6e814..7e8d90c9444 100644
--- a/chromium/media/learning/impl/extra_trees_trainer.cc
+++ b/chromium/media/learning/impl/extra_trees_trainer.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/extra_trees_trainer.h b/chromium/media/learning/impl/extra_trees_trainer.h
index 80def539cc6..2ed5a718cb3 100644
--- a/chromium/media/learning/impl/extra_trees_trainer.h
+++ b/chromium/media/learning/impl/extra_trees_trainer.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/extra_trees_trainer_unittest.cc b/chromium/media/learning/impl/extra_trees_trainer_unittest.cc
index ed8d1679e3c..f7c35a45a9a 100644
--- a/chromium/media/learning/impl/extra_trees_trainer_unittest.cc
+++ b/chromium/media/learning/impl/extra_trees_trainer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/feature_provider.cc b/chromium/media/learning/impl/feature_provider.cc
index 2408b4d0465..122b2315243 100644
--- a/chromium/media/learning/impl/feature_provider.cc
+++ b/chromium/media/learning/impl/feature_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/feature_provider.h b/chromium/media/learning/impl/feature_provider.h
index 0496811f430..34cc9e2bfaf 100644
--- a/chromium/media/learning/impl/feature_provider.h
+++ b/chromium/media/learning/impl/feature_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/fisher_iris_dataset.cc b/chromium/media/learning/impl/fisher_iris_dataset.cc
index 36859787c03..00bac50342d 100644
--- a/chromium/media/learning/impl/fisher_iris_dataset.cc
+++ b/chromium/media/learning/impl/fisher_iris_dataset.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/fisher_iris_dataset.h b/chromium/media/learning/impl/fisher_iris_dataset.h
index 6117ddf54b6..2c487cf7f2b 100644
--- a/chromium/media/learning/impl/fisher_iris_dataset.h
+++ b/chromium/media/learning/impl/fisher_iris_dataset.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_fuzzertest.cc b/chromium/media/learning/impl/learning_fuzzertest.cc
index d6d00b9efcc..0520970598c 100644
--- a/chromium/media/learning/impl/learning_fuzzertest.cc
+++ b/chromium/media/learning/impl/learning_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_session_impl.cc b/chromium/media/learning/impl/learning_session_impl.cc
index 7070ca08af4..4f690216cd3 100644
--- a/chromium/media/learning/impl/learning_session_impl.cc
+++ b/chromium/media/learning/impl/learning_session_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_session_impl.h b/chromium/media/learning/impl/learning_session_impl.h
index 315a82a6661..025400fb04f 100644
--- a/chromium/media/learning/impl/learning_session_impl.h
+++ b/chromium/media/learning/impl/learning_session_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_session_impl_unittest.cc b/chromium/media/learning/impl/learning_session_impl_unittest.cc
index d288cf4507e..f8582479ae6 100644
--- a/chromium/media/learning/impl/learning_session_impl_unittest.cc
+++ b/chromium/media/learning/impl/learning_session_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_task_controller_helper.cc b/chromium/media/learning/impl/learning_task_controller_helper.cc
index 37a823fd943..a19b1489103 100644
--- a/chromium/media/learning/impl/learning_task_controller_helper.cc
+++ b/chromium/media/learning/impl/learning_task_controller_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_task_controller_helper.h b/chromium/media/learning/impl/learning_task_controller_helper.h
index 7ae36e58390..8fda2c272a2 100644
--- a/chromium/media/learning/impl/learning_task_controller_helper.h
+++ b/chromium/media/learning/impl/learning_task_controller_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_task_controller_helper_unittest.cc b/chromium/media/learning/impl/learning_task_controller_helper_unittest.cc
index 99b7c585768..65f28f77087 100644
--- a/chromium/media/learning/impl/learning_task_controller_helper_unittest.cc
+++ b/chromium/media/learning/impl/learning_task_controller_helper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_task_controller_impl.cc b/chromium/media/learning/impl/learning_task_controller_impl.cc
index 895f94f8681..21408aca382 100644
--- a/chromium/media/learning/impl/learning_task_controller_impl.cc
+++ b/chromium/media/learning/impl/learning_task_controller_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_task_controller_impl.h b/chromium/media/learning/impl/learning_task_controller_impl.h
index bc32ddf86eb..4a9c3bfae05 100644
--- a/chromium/media/learning/impl/learning_task_controller_impl.h
+++ b/chromium/media/learning/impl/learning_task_controller_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/learning_task_controller_impl_unittest.cc b/chromium/media/learning/impl/learning_task_controller_impl_unittest.cc
index aca71a51f1f..6fe5147e7e3 100644
--- a/chromium/media/learning/impl/learning_task_controller_impl_unittest.cc
+++ b/chromium/media/learning/impl/learning_task_controller_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/lookup_table_trainer.cc b/chromium/media/learning/impl/lookup_table_trainer.cc
index f858e68756e..d5eac0f5278 100644
--- a/chromium/media/learning/impl/lookup_table_trainer.cc
+++ b/chromium/media/learning/impl/lookup_table_trainer.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/lookup_table_trainer.h b/chromium/media/learning/impl/lookup_table_trainer.h
index 288209afab5..afc493e154c 100644
--- a/chromium/media/learning/impl/lookup_table_trainer.h
+++ b/chromium/media/learning/impl/lookup_table_trainer.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/lookup_table_trainer_unittest.cc b/chromium/media/learning/impl/lookup_table_trainer_unittest.cc
index fa0fc88f65c..b8c114f1e6d 100644
--- a/chromium/media/learning/impl/lookup_table_trainer_unittest.cc
+++ b/chromium/media/learning/impl/lookup_table_trainer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/model.h b/chromium/media/learning/impl/model.h
index 793455c8505..7dd67da2edd 100644
--- a/chromium/media/learning/impl/model.h
+++ b/chromium/media/learning/impl/model.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/one_hot.cc b/chromium/media/learning/impl/one_hot.cc
index c3e82855eda..2436385dcd1 100644
--- a/chromium/media/learning/impl/one_hot.cc
+++ b/chromium/media/learning/impl/one_hot.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/one_hot.h b/chromium/media/learning/impl/one_hot.h
index 994ac9d8e44..0a53e33ecc9 100644
--- a/chromium/media/learning/impl/one_hot.h
+++ b/chromium/media/learning/impl/one_hot.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/one_hot_unittest.cc b/chromium/media/learning/impl/one_hot_unittest.cc
index 53d884cfdea..3eb17b63113 100644
--- a/chromium/media/learning/impl/one_hot_unittest.cc
+++ b/chromium/media/learning/impl/one_hot_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/random_number_generator.cc b/chromium/media/learning/impl/random_number_generator.cc
index 6fcff2f5ebc..d6900c41336 100644
--- a/chromium/media/learning/impl/random_number_generator.cc
+++ b/chromium/media/learning/impl/random_number_generator.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/random_number_generator.h b/chromium/media/learning/impl/random_number_generator.h
index ad3ba3c0588..9e103b1f8b1 100644
--- a/chromium/media/learning/impl/random_number_generator.h
+++ b/chromium/media/learning/impl/random_number_generator.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/random_number_generator_unittest.cc b/chromium/media/learning/impl/random_number_generator_unittest.cc
index 880d7dad92c..4b69297da23 100644
--- a/chromium/media/learning/impl/random_number_generator_unittest.cc
+++ b/chromium/media/learning/impl/random_number_generator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/random_tree_trainer.cc b/chromium/media/learning/impl/random_tree_trainer.cc
index c2749d65ac2..c065f098533 100644
--- a/chromium/media/learning/impl/random_tree_trainer.cc
+++ b/chromium/media/learning/impl/random_tree_trainer.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/random_tree_trainer.h b/chromium/media/learning/impl/random_tree_trainer.h
index 2d4ecfcff3c..403dec9e499 100644
--- a/chromium/media/learning/impl/random_tree_trainer.h
+++ b/chromium/media/learning/impl/random_tree_trainer.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/random_tree_trainer_unittest.cc b/chromium/media/learning/impl/random_tree_trainer_unittest.cc
index e289f06e07c..bea7bed89ea 100644
--- a/chromium/media/learning/impl/random_tree_trainer_unittest.cc
+++ b/chromium/media/learning/impl/random_tree_trainer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/test_random_number_generator.cc b/chromium/media/learning/impl/test_random_number_generator.cc
index d4650af4a2a..cff61d4cc7d 100644
--- a/chromium/media/learning/impl/test_random_number_generator.cc
+++ b/chromium/media/learning/impl/test_random_number_generator.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/test_random_number_generator.h b/chromium/media/learning/impl/test_random_number_generator.h
index e4f931b48d4..7bca5858323 100644
--- a/chromium/media/learning/impl/test_random_number_generator.h
+++ b/chromium/media/learning/impl/test_random_number_generator.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/training_algorithm.h b/chromium/media/learning/impl/training_algorithm.h
index 90c71f9bedd..33a7b71bc3a 100644
--- a/chromium/media/learning/impl/training_algorithm.h
+++ b/chromium/media/learning/impl/training_algorithm.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/voting_ensemble.cc b/chromium/media/learning/impl/voting_ensemble.cc
index ef07b1cb731..ec29cf5d1da 100644
--- a/chromium/media/learning/impl/voting_ensemble.cc
+++ b/chromium/media/learning/impl/voting_ensemble.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/impl/voting_ensemble.h b/chromium/media/learning/impl/voting_ensemble.h
index 8f21bb12ce5..eede2ce5b3b 100644
--- a/chromium/media/learning/impl/voting_ensemble.h
+++ b/chromium/media/learning/impl/voting_ensemble.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/BUILD.gn b/chromium/media/learning/mojo/BUILD.gn
index 7d2a654093c..39457fd24a5 100644
--- a/chromium/media/learning/mojo/BUILD.gn
+++ b/chromium/media/learning/mojo/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/mojo_learning_task_controller_service.cc b/chromium/media/learning/mojo/mojo_learning_task_controller_service.cc
index af2b814525d..9926c11453b 100644
--- a/chromium/media/learning/mojo/mojo_learning_task_controller_service.cc
+++ b/chromium/media/learning/mojo/mojo_learning_task_controller_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/mojo_learning_task_controller_service.h b/chromium/media/learning/mojo/mojo_learning_task_controller_service.h
index 2ac2cdcfbe3..6fe33b9f169 100644
--- a/chromium/media/learning/mojo/mojo_learning_task_controller_service.h
+++ b/chromium/media/learning/mojo/mojo_learning_task_controller_service.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc b/chromium/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc
index aed1f1719dd..e020d0967c2 100644
--- a/chromium/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc
+++ b/chromium/media/learning/mojo/mojo_learning_task_controller_service_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/public/cpp/BUILD.gn b/chromium/media/learning/mojo/public/cpp/BUILD.gn
index 0b3a8f643c3..89baf740c4f 100644
--- a/chromium/media/learning/mojo/public/cpp/BUILD.gn
+++ b/chromium/media/learning/mojo/public/cpp/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/public/cpp/learning_mojom_traits.cc b/chromium/media/learning/mojo/public/cpp/learning_mojom_traits.cc
index 9756815ba6b..8fce735a6a9 100644
--- a/chromium/media/learning/mojo/public/cpp/learning_mojom_traits.cc
+++ b/chromium/media/learning/mojo/public/cpp/learning_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/public/cpp/learning_mojom_traits.h b/chromium/media/learning/mojo/public/cpp/learning_mojom_traits.h
index 262a6f16ec0..7e545f51744 100644
--- a/chromium/media/learning/mojo/public/cpp/learning_mojom_traits.h
+++ b/chromium/media/learning/mojo/public/cpp/learning_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.cc b/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.cc
index aaca1ad3896..86d89f3686c 100644
--- a/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.cc
+++ b/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.h b/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.h
index 57d1e97528a..6e56ef48f69 100644
--- a/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.h
+++ b/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc b/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc
index c00fe14e7c9..be3e5feacc2 100644
--- a/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc
+++ b/chromium/media/learning/mojo/public/cpp/mojo_learning_task_controller_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/public/mojom/BUILD.gn b/chromium/media/learning/mojo/public/mojom/BUILD.gn
index 22f20526e02..34e5d66bad9 100644
--- a/chromium/media/learning/mojo/public/mojom/BUILD.gn
+++ b/chromium/media/learning/mojo/public/mojom/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/public/mojom/learning_task_controller.mojom b/chromium/media/learning/mojo/public/mojom/learning_task_controller.mojom
index 4c4d9bf0e7e..85232e8b8b4 100644
--- a/chromium/media/learning/mojo/public/mojom/learning_task_controller.mojom
+++ b/chromium/media/learning/mojo/public/mojom/learning_task_controller.mojom
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/learning/mojo/public/mojom/learning_types.mojom b/chromium/media/learning/mojo/public/mojom/learning_types.mojom
index 22c73482e1f..a37b13a9a3a 100644
--- a/chromium/media/learning/mojo/public/mojom/learning_types.mojom
+++ b/chromium/media/learning/mojo/public/mojom/learning_types.mojom
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/media_options.gni b/chromium/media/media_options.gni
index de27a559582..b75ffafd25d 100644
--- a/chromium/media/media_options.gni
+++ b/chromium/media/media_options.gni
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -103,12 +103,14 @@ declare_args() {
enable_hevc_parser_and_hw_decoder =
proprietary_codecs &&
(use_fuzzing_engine || use_chromeos_protected_media || is_win || is_mac ||
- is_android)
+ is_android || is_linux)
}
# Use another declare_args() to allow dependence on
# |enable_hevc_parser_and_hw_decoder|.
declare_args() {
+ # If overriding this to false, possibly via its component values,
+ # `enable_libaom` should likely also be overriddent to false.
enable_av1_decoder = enable_dav1d_decoder || enable_libgav1_decoder
# Enable HEVC/H265 demuxing. Actual decoding must be provided by the
diff --git a/chromium/media/midi/BUILD.gn b/chromium/media/midi/BUILD.gn
index e64097cdeab..42530139641 100644
--- a/chromium/media/midi/BUILD.gn
+++ b/chromium/media/midi/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
+# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/midi/OWNERS b/chromium/media/midi/OWNERS
index 45e53d4129d..19e2d23991b 100644
--- a/chromium/media/midi/OWNERS
+++ b/chromium/media/midi/OWNERS
@@ -2,7 +2,6 @@
# But it would be a good idea to involve {yukawa,agoode}@chromium.org if
# they are the original author of files you are touching.
toyoshim@chromium.org
-yhirano@chromium.org
per-file *.mojom=set noparent
per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/chromium/media/midi/java/src/org/chromium/midi/MidiDeviceAndroid.java b/chromium/media/midi/java/src/org/chromium/midi/MidiDeviceAndroid.java
index f5f01a1dba1..5b911a7b236 100644
--- a/chromium/media/midi/java/src/org/chromium/midi/MidiDeviceAndroid.java
+++ b/chromium/media/midi/java/src/org/chromium/midi/MidiDeviceAndroid.java
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,9 +6,6 @@ package org.chromium.midi;
import android.media.midi.MidiDevice;
import android.media.midi.MidiDeviceInfo;
-import android.os.Build;
-
-import androidx.annotation.RequiresApi;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
@@ -17,7 +14,6 @@ import org.chromium.base.annotations.JNINamespace;
/**
* A class implementing midi::MidiDeviceAndroid functionality.
*/
-@RequiresApi(Build.VERSION_CODES.M)
class MidiDeviceAndroid {
/**
* The underlying device.
diff --git a/chromium/media/midi/java/src/org/chromium/midi/MidiInputPortAndroid.java b/chromium/media/midi/java/src/org/chromium/midi/MidiInputPortAndroid.java
index 722fa23a363..017250ee4b8 100644
--- a/chromium/media/midi/java/src/org/chromium/midi/MidiInputPortAndroid.java
+++ b/chromium/media/midi/java/src/org/chromium/midi/MidiInputPortAndroid.java
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,9 +7,6 @@ package org.chromium.midi;
import android.media.midi.MidiDevice;
import android.media.midi.MidiOutputPort;
import android.media.midi.MidiReceiver;
-import android.os.Build;
-
-import androidx.annotation.RequiresApi;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
@@ -23,7 +20,6 @@ import java.io.IOException;
* A MidiInputPortAndroid provides data to the associated midi::MidiInputPortAndroid object.
*/
@JNINamespace("midi")
-@RequiresApi(Build.VERSION_CODES.M)
class MidiInputPortAndroid {
/**
* The underlying port.
diff --git a/chromium/media/midi/java/src/org/chromium/midi/MidiManagerAndroid.java b/chromium/media/midi/java/src/org/chromium/midi/MidiManagerAndroid.java
index 3b632657359..c9341a2e8b7 100644
--- a/chromium/media/midi/java/src/org/chromium/midi/MidiManagerAndroid.java
+++ b/chromium/media/midi/java/src/org/chromium/midi/MidiManagerAndroid.java
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,11 +9,8 @@ import android.content.pm.PackageManager;
import android.media.midi.MidiDevice;
import android.media.midi.MidiDeviceInfo;
import android.media.midi.MidiManager;
-import android.os.Build;
import android.os.Handler;
-import androidx.annotation.RequiresApi;
-
import org.chromium.base.ContextUtils;
import org.chromium.base.ThreadUtils;
import org.chromium.base.annotations.CalledByNative;
@@ -29,7 +26,6 @@ import java.util.Set;
* A Java class implementing midi::MidiManagerAndroid functionality.
*/
@JNINamespace("midi")
-@RequiresApi(Build.VERSION_CODES.M)
class MidiManagerAndroid {
/**
* Set true when this instance is successfully initialized.
diff --git a/chromium/media/midi/java/src/org/chromium/midi/MidiOutputPortAndroid.java b/chromium/media/midi/java/src/org/chromium/midi/MidiOutputPortAndroid.java
index 29996be698f..205c94d871c 100644
--- a/chromium/media/midi/java/src/org/chromium/midi/MidiOutputPortAndroid.java
+++ b/chromium/media/midi/java/src/org/chromium/midi/MidiOutputPortAndroid.java
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,9 +6,6 @@ package org.chromium.midi;
import android.media.midi.MidiDevice;
import android.media.midi.MidiInputPort;
-import android.os.Build;
-
-import androidx.annotation.RequiresApi;
import org.chromium.base.Log;
import org.chromium.base.annotations.CalledByNative;
@@ -22,7 +19,6 @@ import java.io.IOException;
// Note "OutputPort" is named in the Web MIDI manner. It corresponds to MidiInputPort class in the
// Android API.
@JNINamespace("midi")
-@RequiresApi(Build.VERSION_CODES.M)
class MidiOutputPortAndroid {
/**
* The underlying port.
diff --git a/chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceAndroid.java b/chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceAndroid.java
index 6f19d11ff8f..e46a5bdc5fa 100644
--- a/chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceAndroid.java
+++ b/chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceAndroid.java
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceFactoryAndroid.java b/chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceFactoryAndroid.java
index 8c9b406a717..2bd69b57b20 100644
--- a/chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceFactoryAndroid.java
+++ b/chromium/media/midi/java/src/org/chromium/midi/UsbMidiDeviceFactoryAndroid.java
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/message_util.cc b/chromium/media/midi/message_util.cc
index 350932e9f23..c49e50b2d62 100644
--- a/chromium/media/midi/message_util.cc
+++ b/chromium/media/midi/message_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/message_util.h b/chromium/media/midi/message_util.h
index 7f7abc0b2f5..0cba2b66c1f 100644
--- a/chromium/media/midi/message_util.h
+++ b/chromium/media/midi/message_util.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/message_util_unittest.cc b/chromium/media/midi/message_util_unittest.cc
index 2580641b258..726fc9113e7 100644
--- a/chromium/media/midi/message_util_unittest.cc
+++ b/chromium/media/midi/message_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_device_android.cc b/chromium/media/midi/midi_device_android.cc
index 61c5a9ac40d..16fdb165b43 100644
--- a/chromium/media/midi/midi_device_android.cc
+++ b/chromium/media/midi/midi_device_android.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_device_android.h b/chromium/media/midi/midi_device_android.h
index 53556d3ce52..710fa02a9dc 100644
--- a/chromium/media/midi/midi_device_android.h
+++ b/chromium/media/midi/midi_device_android.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_export.h b/chromium/media/midi/midi_export.h
index 18dc239bbbb..705b238f404 100644
--- a/chromium/media/midi/midi_export.h
+++ b/chromium/media/midi/midi_export.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_input_port_android.cc b/chromium/media/midi/midi_input_port_android.cc
index ee0155aac41..6e18e0562ac 100644
--- a/chromium/media/midi/midi_input_port_android.cc
+++ b/chromium/media/midi/midi_input_port_android.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_input_port_android.h b/chromium/media/midi/midi_input_port_android.h
index 61703df38d2..2f55fe58e70 100644
--- a/chromium/media/midi/midi_input_port_android.h
+++ b/chromium/media/midi/midi_input_port_android.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager.cc b/chromium/media/midi/midi_manager.cc
index a53c1b2b73d..bab2d9f9f88 100644
--- a/chromium/media/midi/midi_manager.cc
+++ b/chromium/media/midi/midi_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager.h b/chromium/media/midi/midi_manager.h
index b5f06b88451..c550e1d0a8c 100644
--- a/chromium/media/midi/midi_manager.h
+++ b/chromium/media/midi/midi_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_alsa.cc b/chromium/media/midi/midi_manager_alsa.cc
index 7685e67dd49..725d5d62407 100644
--- a/chromium/media/midi/midi_manager_alsa.cc
+++ b/chromium/media/midi/midi_manager_alsa.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,6 @@
#include <stddef.h>
#include <stdlib.h>
-#include <algorithm>
#include <string>
#include <utility>
@@ -18,6 +17,7 @@
#include "base/logging.h"
#include "base/posix/eintr_wrapper.h"
#include "base/posix/safe_strerror.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
@@ -488,11 +488,9 @@ MidiManagerAlsa::MidiPortStateBase::iterator
MidiManagerAlsa::MidiPortStateBase::FindConnected(
const MidiManagerAlsa::MidiPort& port) {
// Exact match required for connected ports.
- auto it = std::find_if(ports_.begin(), ports_.end(),
- [&port](std::unique_ptr<MidiPort>& p) {
- return p->MatchConnected(port);
- });
- return it;
+ return base::ranges::find_if(ports_, [&port](std::unique_ptr<MidiPort>& p) {
+ return p->MatchConnected(port);
+ });
}
MidiManagerAlsa::MidiPortStateBase::iterator
@@ -515,10 +513,10 @@ MidiManagerAlsa::MidiPortStateBase::FindDisconnected(
// Pass 1. Match on path, id, midi_device, port_id.
// This is the best possible match for hardware card-based clients.
// This will also match the empty id correctly for devices without an id.
- auto it = std::find_if(ports_.begin(), ports_.end(),
- [&port](std::unique_ptr<MidiPort>& p) {
- return p->MatchCardPass1(port);
- });
+ auto it =
+ base::ranges::find_if(ports_, [&port](std::unique_ptr<MidiPort>& p) {
+ return p->MatchCardPass1(port);
+ });
if (it != ports_.end())
return it;
@@ -527,10 +525,9 @@ MidiManagerAlsa::MidiPortStateBase::FindDisconnected(
// This will give us a high-confidence match when a user moves a device to
// another USB/Firewire/Thunderbolt/etc port, but only works if the device
// has a hardware id.
- it = std::find_if(ports_.begin(), ports_.end(),
- [&port](std::unique_ptr<MidiPort>& p) {
- return p->MatchCardPass2(port);
- });
+ it = base::ranges::find_if(ports_, [&port](std::unique_ptr<MidiPort>& p) {
+ return p->MatchCardPass2(port);
+ });
if (it != ports_.end())
return it;
}
@@ -538,20 +535,19 @@ MidiManagerAlsa::MidiPortStateBase::FindDisconnected(
// Else, we have a non-card-based client.
// Pass 1. Match on client_id, port_id, client_name, port_name.
// This will give us a reasonably good match.
- auto it = std::find_if(ports_.begin(), ports_.end(),
- [&port](std::unique_ptr<MidiPort>& p) {
- return p->MatchNoCardPass1(port);
- });
+ auto it =
+ base::ranges::find_if(ports_, [&port](std::unique_ptr<MidiPort>& p) {
+ return p->MatchNoCardPass1(port);
+ });
if (it != ports_.end())
return it;
// Pass 2. Match on port_id, client_name, port_name.
// This is weaker but similar to pass 2 in the hardware card-based clients
// match.
- it = std::find_if(ports_.begin(), ports_.end(),
- [&port](std::unique_ptr<MidiPort>& p) {
- return p->MatchNoCardPass2(port);
- });
+ it = base::ranges::find_if(ports_, [&port](std::unique_ptr<MidiPort>& p) {
+ return p->MatchNoCardPass2(port);
+ });
if (it != ports_.end())
return it;
}
diff --git a/chromium/media/midi/midi_manager_alsa.h b/chromium/media/midi/midi_manager_alsa.h
index 2dbb43630c1..56063002b2f 100644
--- a/chromium/media/midi/midi_manager_alsa.h
+++ b/chromium/media/midi/midi_manager_alsa.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_alsa_unittest.cc b/chromium/media/midi/midi_manager_alsa_unittest.cc
index 995ccc350bd..3ade6fc66fe 100644
--- a/chromium/media/midi/midi_manager_alsa_unittest.cc
+++ b/chromium/media/midi/midi_manager_alsa_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_android.cc b/chromium/media/midi/midi_manager_android.cc
index c7604a63097..c1c3ed0c418 100644
--- a/chromium/media/midi/midi_manager_android.cc
+++ b/chromium/media/midi/midi_manager_android.cc
@@ -1,10 +1,9 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/midi/midi_manager_android.h"
-#include "base/android/build_info.h"
#include "base/bind.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
@@ -27,10 +26,6 @@ namespace midi {
namespace {
bool HasSystemFeatureMidi() {
- // MIDI API was added at Android M.
- DCHECK_GE(base::android::BuildInfo::GetInstance()->sdk_int(),
- base::android::SDK_VERSION_MARSHMALLOW);
-
// Check if the MIDI service actually runs on the system.
return Java_MidiManagerAndroid_hasSystemFeatureMidi(
base::android::AttachCurrentThread());
diff --git a/chromium/media/midi/midi_manager_android.h b/chromium/media/midi/midi_manager_android.h
index 3f2b42d986d..d7e78d0d839 100644
--- a/chromium/media/midi/midi_manager_android.h
+++ b/chromium/media/midi/midi_manager_android.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_mac.cc b/chromium/media/midi/midi_manager_mac.cc
index 50d08ae4eaa..45c7893dc33 100644
--- a/chromium/media/midi/midi_manager_mac.cc
+++ b/chromium/media/midi/midi_manager_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include <CoreAudio/HostTime.h>
#include "base/bind.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
@@ -234,7 +235,7 @@ void MidiManagerMac::ReceiveMidiNotify(const MIDINotification* message) {
static_cast<MIDIEndpointRef>(notification->child);
if (notification->childType == kMIDIObjectType_Source) {
// Attaching device is an input device.
- auto it = std::find(sources_.begin(), sources_.end(), endpoint);
+ auto it = base::ranges::find(sources_, endpoint);
if (it == sources_.end()) {
mojom::PortInfo info = GetPortInfoFromEndpoint(endpoint);
// If the device disappears before finishing queries, mojom::PortInfo
@@ -252,7 +253,7 @@ void MidiManagerMac::ReceiveMidiNotify(const MIDINotification* message) {
}
} else if (notification->childType == kMIDIObjectType_Destination) {
// Attaching device is an output device.
- auto it = std::find(destinations_.begin(), destinations_.end(), endpoint);
+ auto it = base::ranges::find(destinations_, endpoint);
if (it == destinations_.end()) {
mojom::PortInfo info = GetPortInfoFromEndpoint(endpoint);
// Skip cases that queries are not finished correctly.
@@ -272,12 +273,12 @@ void MidiManagerMac::ReceiveMidiNotify(const MIDINotification* message) {
static_cast<MIDIEndpointRef>(notification->child);
if (notification->childType == kMIDIObjectType_Source) {
// Detaching device is an input device.
- auto it = std::find(sources_.begin(), sources_.end(), endpoint);
+ auto it = base::ranges::find(sources_, endpoint);
if (it != sources_.end())
SetInputPortState(it - sources_.begin(), PortState::DISCONNECTED);
} else if (notification->childType == kMIDIObjectType_Destination) {
// Detaching device is an output device.
- auto it = std::find(destinations_.begin(), destinations_.end(), endpoint);
+ auto it = base::ranges::find(destinations_, endpoint);
if (it != destinations_.end())
SetOutputPortState(it - destinations_.begin(), PortState::DISCONNECTED);
}
diff --git a/chromium/media/midi/midi_manager_mac.h b/chromium/media/midi/midi_manager_mac.h
index 46cbd926702..e848b5fd3ea 100644
--- a/chromium/media/midi/midi_manager_mac.h
+++ b/chromium/media/midi/midi_manager_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_mac_unittest.cc b/chromium/media/midi/midi_manager_mac_unittest.cc
index acee1af90cb..abc1bdc74b2 100644
--- a/chromium/media/midi/midi_manager_mac_unittest.cc
+++ b/chromium/media/midi/midi_manager_mac_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_unittest.cc b/chromium/media/midi/midi_manager_unittest.cc
index 859f8e501c8..c89afef2f8e 100644
--- a/chromium/media/midi/midi_manager_unittest.cc
+++ b/chromium/media/midi/midi_manager_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_usb.cc b/chromium/media/midi/midi_manager_usb.cc
index c3be612afd3..40606315eec 100644
--- a/chromium/media/midi/midi_manager_usb.cc
+++ b/chromium/media/midi/midi_manager_usb.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_usb.h b/chromium/media/midi/midi_manager_usb.h
index 1100f68dd3f..3cc568e70a8 100644
--- a/chromium/media/midi/midi_manager_usb.h
+++ b/chromium/media/midi/midi_manager_usb.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_usb_unittest.cc b/chromium/media/midi/midi_manager_usb_unittest.cc
index 3bb5417a9ce..15a0a1502d6 100644
--- a/chromium/media/midi/midi_manager_usb_unittest.cc
+++ b/chromium/media/midi/midi_manager_usb_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_win.cc b/chromium/media/midi/midi_manager_win.cc
index bc5cd0daabc..b6d833eb5ac 100644
--- a/chromium/media/midi/midi_manager_win.cc
+++ b/chromium/media/midi/midi_manager_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,7 +11,6 @@
#include <mmreg.h>
#include <mmsystem.h>
-#include <algorithm>
#include <limits>
#include <map>
#include <memory>
@@ -22,8 +21,10 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/lock.h"
@@ -848,14 +849,15 @@ void MidiManagerWin::UpdateDeviceListOnTaskRunner() {
}
template <typename T>
-void MidiManagerWin::ReflectActiveDeviceList(MidiManagerWin* manager,
- std::vector<T>* known_ports,
- std::vector<T>* active_ports) {
+void MidiManagerWin::ReflectActiveDeviceList(
+ MidiManagerWin* manager,
+ std::vector<std::unique_ptr<T>>* known_ports,
+ std::vector<std::unique_ptr<T>>* active_ports) {
// Update existing port states.
for (const auto& port : *known_ports) {
- const auto& it = std::find_if(
- active_ports->begin(), active_ports->end(),
- [&port](const auto& candidate) { return *candidate == *port; });
+ const auto& it = base::ranges::find(
+ *active_ports, *port,
+ [](const auto& candidate) -> T& { return *candidate; });
if (it == active_ports->end()) {
if (port->Disconnect())
port->NotifyPortStateSet(this);
@@ -868,10 +870,9 @@ void MidiManagerWin::ReflectActiveDeviceList(MidiManagerWin* manager,
// Find new ports from active ports and append them to known ports.
for (auto& port : *active_ports) {
- if (std::find_if(known_ports->begin(), known_ports->end(),
- [&port](const auto& candidate) {
- return *candidate == *port;
- }) == known_ports->end()) {
+ if (!base::Contains(*known_ports, *port, [](const auto& candidate) -> T& {
+ return *candidate;
+ })) {
size_t index = known_ports->size();
port->set_index(index);
known_ports->push_back(std::move(port));
diff --git a/chromium/media/midi/midi_manager_win.h b/chromium/media/midi/midi_manager_win.h
index a47689a4bcb..d0c53966ef1 100644
--- a/chromium/media/midi/midi_manager_win.h
+++ b/chromium/media/midi/midi_manager_win.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -80,8 +80,8 @@ class MidiManagerWin final
// Reflect active port list to a device list.
template <typename T>
void ReflectActiveDeviceList(MidiManagerWin* manager,
- std::vector<T>* known_ports,
- std::vector<T>* active_ports);
+ std::vector<std::unique_ptr<T>>* known_ports,
+ std::vector<std::unique_ptr<T>>* active_ports);
// Sends MIDI data on TaskRunner.
void SendOnTaskRunner(MidiManagerClient* client,
diff --git a/chromium/media/midi/midi_manager_winrt.cc b/chromium/media/midi/midi_manager_winrt.cc
index 19d9ce857c6..a9c39587a74 100644
--- a/chromium/media/midi/midi_manager_winrt.cc
+++ b/chromium/media/midi/midi_manager_winrt.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_manager_winrt.h b/chromium/media/midi/midi_manager_winrt.h
index ff0599584bd..596bc662e60 100644
--- a/chromium/media/midi/midi_manager_winrt.h
+++ b/chromium/media/midi/midi_manager_winrt.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_message_queue.cc b/chromium/media/midi/midi_message_queue.cc
index 1beb682c1cb..d975585fe2a 100644
--- a/chromium/media/midi/midi_message_queue.cc
+++ b/chromium/media/midi/midi_message_queue.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_message_queue.h b/chromium/media/midi/midi_message_queue.h
index 27301b345f7..155177f9ef8 100644
--- a/chromium/media/midi/midi_message_queue.h
+++ b/chromium/media/midi/midi_message_queue.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_message_queue_fuzzer.cc b/chromium/media/midi/midi_message_queue_fuzzer.cc
index 07677743aef..a29c2d68ce9 100644
--- a/chromium/media/midi/midi_message_queue_fuzzer.cc
+++ b/chromium/media/midi/midi_message_queue_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_message_queue_unittest.cc b/chromium/media/midi/midi_message_queue_unittest.cc
index 11077e7ad91..b0acdd9510d 100644
--- a/chromium/media/midi/midi_message_queue_unittest.cc
+++ b/chromium/media/midi/midi_message_queue_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_output_port_android.cc b/chromium/media/midi/midi_output_port_android.cc
index fb796610192..046bf9cebe2 100644
--- a/chromium/media/midi/midi_output_port_android.cc
+++ b/chromium/media/midi/midi_output_port_android.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_output_port_android.h b/chromium/media/midi/midi_output_port_android.h
index f2da111b426..2ef2757dab9 100644
--- a/chromium/media/midi/midi_output_port_android.h
+++ b/chromium/media/midi/midi_output_port_android.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_service.cc b/chromium/media/midi/midi_service.cc
index 2dfb355ed34..dd0bc1d0e09 100644
--- a/chromium/media/midi/midi_service.cc
+++ b/chromium/media/midi/midi_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_service.h b/chromium/media/midi/midi_service.h
index 57a8b28dd57..1db19576897 100644
--- a/chromium/media/midi/midi_service.h
+++ b/chromium/media/midi/midi_service.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_service.mojom b/chromium/media/midi/midi_service.mojom
index bc32b820332..c89e9a74e86 100644
--- a/chromium/media/midi/midi_service.mojom
+++ b/chromium/media/midi/midi_service.mojom
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/midi_switches.cc b/chromium/media/midi/midi_switches.cc
index 72aa9486289..ec158cac7d5 100644
--- a/chromium/media/midi/midi_switches.cc
+++ b/chromium/media/midi/midi_switches.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,8 +9,9 @@ namespace midi {
namespace features {
#if BUILDFLAG(IS_WIN)
-const base::Feature kMidiManagerWinrt{"MidiManagerWinrt",
- base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kMidiManagerWinrt,
+ "MidiManagerWinrt",
+ base::FEATURE_DISABLED_BY_DEFAULT);
#endif
} // namespace features
diff --git a/chromium/media/midi/midi_switches.h b/chromium/media/midi/midi_switches.h
index f9abb13b976..32e7f3a5713 100644
--- a/chromium/media/midi/midi_switches.h
+++ b/chromium/media/midi/midi_switches.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,7 +15,7 @@ namespace midi {
namespace features {
#if BUILDFLAG(IS_WIN)
-MIDI_EXPORT extern const base::Feature kMidiManagerWinrt;
+MIDI_EXPORT BASE_DECLARE_FEATURE(kMidiManagerWinrt);
#endif
} // namespace features
diff --git a/chromium/media/midi/midi_webmidi_data_validator_fuzzer.cc b/chromium/media/midi/midi_webmidi_data_validator_fuzzer.cc
index ac17cd0a768..40920d49721 100644
--- a/chromium/media/midi/midi_webmidi_data_validator_fuzzer.cc
+++ b/chromium/media/midi/midi_webmidi_data_validator_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/task_service.cc b/chromium/media/midi/task_service.cc
index e2a7b573cb4..383d46741ad 100644
--- a/chromium/media/midi/task_service.cc
+++ b/chromium/media/midi/task_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/task_service.h b/chromium/media/midi/task_service.h
index bf59cdb2658..dc622c14aa6 100644
--- a/chromium/media/midi/task_service.h
+++ b/chromium/media/midi/task_service.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/task_service_unittest.cc b/chromium/media/midi/task_service_unittest.cc
index 60f852be8de..c0609a62ef6 100644
--- a/chromium/media/midi/task_service_unittest.cc
+++ b/chromium/media/midi/task_service_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_descriptor_parser.cc b/chromium/media/midi/usb_midi_descriptor_parser.cc
index b2a5a0d9368..3dcc1679298 100644
--- a/chromium/media/midi/usb_midi_descriptor_parser.cc
+++ b/chromium/media/midi/usb_midi_descriptor_parser.cc
@@ -1,12 +1,11 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/midi/usb_midi_descriptor_parser.h"
-#include <algorithm>
-
#include "base/logging.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
namespace midi {
@@ -47,18 +46,6 @@ enum JackType {
const uint8_t kAudioInterfaceClass = 1;
const uint8_t kAudioMidiInterfaceSubclass = 3;
-class JackMatcher {
- public:
- explicit JackMatcher(uint8_t id) : id_(id) {}
-
- bool operator() (const UsbMidiJack& jack) const {
- return jack.jack_id == id_;
- }
-
- private:
- uint8_t id_;
-};
-
bool DecodeBcd(uint8_t byte, int* decoded) {
// Write decoded decimal value from |byte| into |decoded|. If either nibble in
// |byte| exceeds decimal 10, returns false.
@@ -269,8 +256,8 @@ bool UsbMidiDescriptorParser::ParseCSEndpoint(const uint8_t* data,
for (size_t i = 0; i < num_jacks; ++i) {
uint8_t jack = data[kSizeForEmptyJacks + i];
- auto it = std::find_if(incomplete_jacks_.begin(), incomplete_jacks_.end(),
- JackMatcher(jack));
+ auto it =
+ base::ranges::find(incomplete_jacks_, jack, &UsbMidiJack::jack_id);
if (it == incomplete_jacks_.end()) {
DVLOG(1) << "A non-existing MIDI jack is associated.";
return false;
diff --git a/chromium/media/midi/usb_midi_descriptor_parser.h b/chromium/media/midi/usb_midi_descriptor_parser.h
index 1509c7b43fe..0604b40acd7 100644
--- a/chromium/media/midi/usb_midi_descriptor_parser.h
+++ b/chromium/media/midi/usb_midi_descriptor_parser.h
@@ -1,5 +1,4 @@
-
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_descriptor_parser_fuzzer.cc b/chromium/media/midi/usb_midi_descriptor_parser_fuzzer.cc
index 004f865eb29..47cc894b3eb 100644
--- a/chromium/media/midi/usb_midi_descriptor_parser_fuzzer.cc
+++ b/chromium/media/midi/usb_midi_descriptor_parser_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_descriptor_parser_unittest.cc b/chromium/media/midi/usb_midi_descriptor_parser_unittest.cc
index 2e2f4db10b4..403f4d6487b 100644
--- a/chromium/media/midi/usb_midi_descriptor_parser_unittest.cc
+++ b/chromium/media/midi/usb_midi_descriptor_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_device.h b/chromium/media/midi/usb_midi_device.h
index c113d5d0bb9..6fcc8e906f9 100644
--- a/chromium/media/midi/usb_midi_device.h
+++ b/chromium/media/midi/usb_midi_device.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_device_android.cc b/chromium/media/midi/usb_midi_device_android.cc
index f089abf6252..992d7df6c60 100644
--- a/chromium/media/midi/usb_midi_device_android.cc
+++ b/chromium/media/midi/usb_midi_device_android.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_device_android.h b/chromium/media/midi/usb_midi_device_android.h
index f5c7bbbfcbf..e7d3a47bcf2 100644
--- a/chromium/media/midi/usb_midi_device_android.h
+++ b/chromium/media/midi/usb_midi_device_android.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_device_factory_android.cc b/chromium/media/midi/usb_midi_device_factory_android.cc
index dbb7c5abf5e..8718c91dd7d 100644
--- a/chromium/media/midi/usb_midi_device_factory_android.cc
+++ b/chromium/media/midi/usb_midi_device_factory_android.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_device_factory_android.h b/chromium/media/midi/usb_midi_device_factory_android.h
index 1a547e55d47..9a484799fd0 100644
--- a/chromium/media/midi/usb_midi_device_factory_android.h
+++ b/chromium/media/midi/usb_midi_device_factory_android.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_export.h b/chromium/media/midi/usb_midi_export.h
index 0335d63cddd..14dae2174ea 100644
--- a/chromium/media/midi/usb_midi_export.h
+++ b/chromium/media/midi/usb_midi_export.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_input_stream.cc b/chromium/media/midi/usb_midi_input_stream.cc
index 90420977700..810fff19cbf 100644
--- a/chromium/media/midi/usb_midi_input_stream.cc
+++ b/chromium/media/midi/usb_midi_input_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_input_stream.h b/chromium/media/midi/usb_midi_input_stream.h
index d302476b706..092c4748f24 100644
--- a/chromium/media/midi/usb_midi_input_stream.h
+++ b/chromium/media/midi/usb_midi_input_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_input_stream_unittest.cc b/chromium/media/midi/usb_midi_input_stream_unittest.cc
index b43c4091912..ff9a6ca6db2 100644
--- a/chromium/media/midi/usb_midi_input_stream_unittest.cc
+++ b/chromium/media/midi/usb_midi_input_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_jack.h b/chromium/media/midi/usb_midi_jack.h
index 48f3fa0eb8c..c1eb4a5a18b 100644
--- a/chromium/media/midi/usb_midi_jack.h
+++ b/chromium/media/midi/usb_midi_jack.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_output_stream.cc b/chromium/media/midi/usb_midi_output_stream.cc
index 21657d11a00..d867bda044a 100644
--- a/chromium/media/midi/usb_midi_output_stream.cc
+++ b/chromium/media/midi/usb_midi_output_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_output_stream.h b/chromium/media/midi/usb_midi_output_stream.h
index 8b1a08f8c0a..e25a31d1bdc 100644
--- a/chromium/media/midi/usb_midi_output_stream.h
+++ b/chromium/media/midi/usb_midi_output_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/midi/usb_midi_output_stream_unittest.cc b/chromium/media/midi/usb_midi_output_stream_unittest.cc
index 34fa86a1f07..cc6a56b469a 100644
--- a/chromium/media/midi/usb_midi_output_stream_unittest.cc
+++ b/chromium/media/midi/usb_midi_output_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/BUILD.gn b/chromium/media/mojo/BUILD.gn
index 636a7349f5d..96098118641 100644
--- a/chromium/media/mojo/BUILD.gn
+++ b/chromium/media/mojo/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -22,7 +22,11 @@ buildflag_header("buildflags") {
if (service == "renderer") {
enable_mojo_renderer = true
} else if (service == "cdm") {
- enable_mojo_cdm = true
+ # Fuchsia communicates directly with the platform CDM via FIDL instead of
+ # the mojo service.
+ if (!is_fuchsia) {
+ enable_mojo_cdm = true
+ }
} else if (service == "audio_decoder") {
enable_mojo_audio_decoder = true
} else if (service == "audio_encoder") {
@@ -59,7 +63,6 @@ source_set("test_support") {
public_deps = [
"//media/mojo/clients",
"//media/mojo/common",
- "//media/mojo/common:mojo_shared_buffer_video_frame",
"//media/mojo/mojom",
"//media/mojo/mojom:test_interfaces",
"//media/mojo/services",
diff --git a/chromium/media/mojo/README.md b/chromium/media/mojo/README.md
index 955d9a589da..2c2edc29893 100644
--- a/chromium/media/mojo/README.md
+++ b/chromium/media/mojo/README.md
@@ -97,6 +97,18 @@ Note that `media::mojom::InterfaceFactory` interface is reused in the
communication between `MediaInterfaceProxy` and `MediaService` (see
[below](#Site-Isolation)).
+### Frameless Media Interface Factory
+
+In addition to the main `MediaInterfaceProxy`, which handles requests from
+ordinary media playback, `FramelessMediaInterfaceProxy` handles requests for
+media cases that do not need or have a frame.
+
+A frame is required for protected media playback because media decoding and
+the CDM are associated within a frame.
+
+The `FramelessMediaInterfaceProxy` is used by WebCodecs (which may be operating
+in a worker context), by WebRTC, and for early querying of supported codecs.
+
### MediaService
The MediaService is a mojo `service_manager::Service` that provides media player
diff --git a/chromium/media/mojo/clients/BUILD.gn b/chromium/media/mojo/clients/BUILD.gn
index ea2e58edae7..0c7eab9d130 100644
--- a/chromium/media/mojo/clients/BUILD.gn
+++ b/chromium/media/mojo/clients/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -9,26 +9,20 @@ source_set("clients") {
# Mirroring Service needs the video accelerated encoder mojom interfaces.
"//components/mirroring/service:mirroring_service",
-
"//content/renderer:*",
# TODO(xhwang): Only allow //media/mojo/services:unit_tests
- "//media/mojo/services:*",
-
- "//media/mojo:test_support",
-
- "//media/test/*",
-
- "//content/browser:*",
"//chrome/browser:*",
-
"//chrome/browser/thumbnail/generator",
-
+ "//content/browser:*",
"//content/gpu:*",
+ "//media/mojo:test_support",
+ "//media/mojo/services:*",
+ "//media/test/*",
# TODO(liberato): can we avoid this?
"//content/test/*",
-
+ "//third_party/blink/renderer/modules/mediarecorder",
"//third_party/blink/renderer/modules/webcodecs",
]
@@ -82,7 +76,6 @@ source_set("clients") {
"//build:chromeos_buildflags",
"//media/gpu",
"//media/mojo/common",
- "//media/mojo/common:mojo_shared_buffer_video_frame",
"//services/service_manager/public/cpp",
]
diff --git a/chromium/media/mojo/clients/mojo_android_overlay.cc b/chromium/media/mojo/clients/mojo_android_overlay.cc
index 5652af5f442..fec7dd933ba 100644
--- a/chromium/media/mojo/clients/mojo_android_overlay.cc
+++ b/chromium/media/mojo/clients/mojo_android_overlay.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_android_overlay.h b/chromium/media/mojo/clients/mojo_android_overlay.h
index 3001f871f5e..5c79bad80bb 100644
--- a/chromium/media/mojo/clients/mojo_android_overlay.h
+++ b/chromium/media/mojo/clients/mojo_android_overlay.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_android_overlay_unittest.cc b/chromium/media/mojo/clients/mojo_android_overlay_unittest.cc
index 643ce38fdd6..7e1447a85c2 100644
--- a/chromium/media/mojo/clients/mojo_android_overlay_unittest.cc
+++ b/chromium/media/mojo/clients/mojo_android_overlay_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_audio_decoder.cc b/chromium/media/mojo/clients/mojo_audio_decoder.cc
index 8855de0cde7..7cd077df6b5 100644
--- a/chromium/media/mojo/clients/mojo_audio_decoder.cc
+++ b/chromium/media/mojo/clients/mojo_audio_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_audio_decoder.h b/chromium/media/mojo/clients/mojo_audio_decoder.h
index 3097a9e148f..6e5f682166a 100644
--- a/chromium/media/mojo/clients/mojo_audio_decoder.h
+++ b/chromium/media/mojo/clients/mojo_audio_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_audio_decoder_unittest.cc b/chromium/media/mojo/clients/mojo_audio_decoder_unittest.cc
index 01b0fd424f4..d91724c9626 100644
--- a/chromium/media/mojo/clients/mojo_audio_decoder_unittest.cc
+++ b/chromium/media/mojo/clients/mojo_audio_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_audio_encoder.cc b/chromium/media/mojo/clients/mojo_audio_encoder.cc
index 66fd091474f..d6f71a1b0d5 100644
--- a/chromium/media/mojo/clients/mojo_audio_encoder.cc
+++ b/chromium/media/mojo/clients/mojo_audio_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_audio_encoder.h b/chromium/media/mojo/clients/mojo_audio_encoder.h
index 3929dbdf2ec..d727cd8655d 100644
--- a/chromium/media/mojo/clients/mojo_audio_encoder.h
+++ b/chromium/media/mojo/clients/mojo_audio_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_audio_encoder_unittest.cc b/chromium/media/mojo/clients/mojo_audio_encoder_unittest.cc
index 5324730c823..e83f0bca7a2 100644
--- a/chromium/media/mojo/clients/mojo_audio_encoder_unittest.cc
+++ b/chromium/media/mojo/clients/mojo_audio_encoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -253,9 +253,8 @@ TEST_F(MojoAudioEncoderTest, Encode) {
EXPECT_LE(input_number, input_count);
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_DISCRETE, options.sample_rate,
- audio_bus->frames());
- params.set_channels_for_discrete(audio_bus->channels());
+ {CHANNEL_LAYOUT_DISCRETE, audio_bus->channels()},
+ options.sample_rate, audio_bus->frames());
size_t size = audio_bus->frames();
std::unique_ptr<uint8_t[]> data(new uint8_t[size]);
@@ -329,8 +328,7 @@ TEST_F(MojoAudioEncoderTest, EncodeWithEmptyResult) {
std::move(done_cb).Run(EncoderStatus::Codes::kOk);
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_DISCRETE, 8000, 1);
- params.set_channels_for_discrete(1);
+ {CHANNEL_LAYOUT_DISCRETE, 1}, 8000, 1);
EncodedAudioBuffer output(params, nullptr, 0, capture_time);
@@ -376,9 +374,8 @@ TEST_F(MojoAudioEncoderTest, Flush) {
std::move(done_cb).Run(EncoderStatus::Codes::kOk);
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_DISCRETE, options.sample_rate,
- audio_bus->frames());
- params.set_channels_for_discrete(audio_bus->channels());
+ {CHANNEL_LAYOUT_DISCRETE, audio_bus->channels()},
+ options.sample_rate, audio_bus->frames());
EncodedAudioBuffer output(params, nullptr, 0, capture_time);
service_output_cb.Run(std::move(output), {});
}));
diff --git a/chromium/media/mojo/clients/mojo_cdm.cc b/chromium/media/mojo/clients/mojo_cdm.cc
index 065f76e3b15..1fb4244df64 100644
--- a/chromium/media/mojo/clients/mojo_cdm.cc
+++ b/chromium/media/mojo/clients/mojo_cdm.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,9 +12,9 @@
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h"
-#include "base/stl_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "base/types/optional_util.h"
#include "build/build_config.h"
#include "media/base/cdm_context.h"
#include "media/base/cdm_key_information.h"
@@ -57,7 +57,7 @@ MojoCdm::MojoCdm(mojo::Remote<mojom::ContentDecryptionModule> remote_cdm,
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DCHECK(cdm_id_);
DVLOG(2) << __func__ << " cdm_id: "
- << CdmContext::CdmIdToString(base::OptionalOrNullptr(cdm_id_));
+ << CdmContext::CdmIdToString(base::OptionalToPtr(cdm_id_));
DCHECK(session_message_cb_);
DCHECK(session_closed_cb_);
DCHECK(session_keys_change_cb_);
@@ -275,7 +275,7 @@ absl::optional<base::UnguessableToken> MojoCdm::GetCdmId() const {
// Can be called on a different thread.
base::AutoLock auto_lock(lock_);
DVLOG(2) << __func__ << ": cdm_id="
- << CdmContext::CdmIdToString(base::OptionalOrNullptr(cdm_id_));
+ << CdmContext::CdmIdToString(base::OptionalToPtr(cdm_id_));
return cdm_id_;
}
diff --git a/chromium/media/mojo/clients/mojo_cdm.h b/chromium/media/mojo/clients/mojo_cdm.h
index d5e13355c1c..a5af49666b6 100644
--- a/chromium/media/mojo/clients/mojo_cdm.h
+++ b/chromium/media/mojo/clients/mojo_cdm.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_cdm_factory.cc b/chromium/media/mojo/clients/mojo_cdm_factory.cc
index 32bd6e5aaa7..c2b6a6fb832 100644
--- a/chromium/media/mojo/clients/mojo_cdm_factory.cc
+++ b/chromium/media/mojo/clients/mojo_cdm_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_cdm_factory.h b/chromium/media/mojo/clients/mojo_cdm_factory.h
index 6e075b48f86..37bfaea1373 100644
--- a/chromium/media/mojo/clients/mojo_cdm_factory.h
+++ b/chromium/media/mojo/clients/mojo_cdm_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_cdm_unittest.cc b/chromium/media/mojo/clients/mojo_cdm_unittest.cc
index 7a83e21539e..9f6dbd4d778 100644
--- a/chromium/media/mojo/clients/mojo_cdm_unittest.cc
+++ b/chromium/media/mojo/clients/mojo_cdm_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_decoder_factory.cc b/chromium/media/mojo/clients/mojo_decoder_factory.cc
index f3dcf525e1e..9f65451b962 100644
--- a/chromium/media/mojo/clients/mojo_decoder_factory.cc
+++ b/chromium/media/mojo/clients/mojo_decoder_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_decoder_factory.h b/chromium/media/mojo/clients/mojo_decoder_factory.h
index 3757b78b3c1..af40ae294ec 100644
--- a/chromium/media/mojo/clients/mojo_decoder_factory.h
+++ b/chromium/media/mojo/clients/mojo_decoder_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_decryptor.cc b/chromium/media/mojo/clients/mojo_decryptor.cc
index 33f472fb0c0..73447f7f573 100644
--- a/chromium/media/mojo/clients/mojo_decryptor.cc
+++ b/chromium/media/mojo/clients/mojo_decryptor.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,7 +16,6 @@
#include "media/base/video_frame.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/mojom/decryptor.mojom.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
diff --git a/chromium/media/mojo/clients/mojo_decryptor.h b/chromium/media/mojo/clients/mojo_decryptor.h
index d6877a24d1f..5ca3ee48689 100644
--- a/chromium/media/mojo/clients/mojo_decryptor.h
+++ b/chromium/media/mojo/clients/mojo_decryptor.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_decryptor_unittest.cc b/chromium/media/mojo/clients/mojo_decryptor_unittest.cc
index 04383ed8694..a223a40c00e 100644
--- a/chromium/media/mojo/clients/mojo_decryptor_unittest.cc
+++ b/chromium/media/mojo/clients/mojo_decryptor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,7 +16,6 @@
#include "media/base/timestamp_constants.h"
#include "media/base/video_frame.h"
#include "media/mojo/clients/mojo_decryptor.h"
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/mojom/decryptor.mojom.h"
#include "media/mojo/services/mojo_decryptor_service.h"
#include "mojo/public/cpp/bindings/receiver.h"
@@ -72,16 +71,22 @@ class MojoDecryptorTest : public ::testing::Test {
void ReturnSharedBufferVideoFrame(scoped_refptr<DecoderBuffer> encrypted,
Decryptor::VideoDecodeCB video_decode_cb) {
- // We don't care about the encrypted data, just create a simple VideoFrame.
- scoped_refptr<VideoFrame> frame(
- MojoSharedBufferVideoFrame::CreateDefaultForTesting(
- PIXEL_FORMAT_I420, gfx::Size(100, 100), base::Seconds(100)));
+ // We don't care about the encrypted data, just create a simple SHMEM
+ // VideoFrame.
+ auto region = base::ReadOnlySharedMemoryRegion::Create(15000);
+ CHECK(region.IsValid());
+ uint8_t* data = const_cast<uint8_t*>(region.mapping.GetMemoryAs<uint8_t>());
+ scoped_refptr<VideoFrame> frame = VideoFrame::WrapExternalYuvData(
+ PIXEL_FORMAT_I420, gfx::Size(100, 100), gfx::Rect(100, 100),
+ gfx::Size(100, 100), 100, 50, 50, data, data + 100 * 100,
+ data + (100 * 100 * 5 / 4), base::Seconds(100));
+ auto read_only_mapping = region.region.Map();
+ CHECK(read_only_mapping.IsValid());
+ frame->BackWithOwnedSharedMemory(std::move(region.region),
+ std::move(read_only_mapping));
frame->AddDestructionObserver(base::BindOnce(
&MojoDecryptorTest::OnFrameDestroyed, base::Unretained(this)));
- // Currently freeing buffers only works for MojoSharedMemory, so make
- // sure |frame| is of that type.
- EXPECT_EQ(VideoFrame::STORAGE_MOJO_SHARED_BUFFER, frame->storage_type());
std::move(video_decode_cb).Run(Decryptor::kSuccess, std::move(frame));
}
diff --git a/chromium/media/mojo/clients/mojo_demuxer_stream_impl.cc b/chromium/media/mojo/clients/mojo_demuxer_stream_impl.cc
index 2149c8aaef3..0bafd4f5aa9 100644
--- a/chromium/media/mojo/clients/mojo_demuxer_stream_impl.cc
+++ b/chromium/media/mojo/clients/mojo_demuxer_stream_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_demuxer_stream_impl.h b/chromium/media/mojo/clients/mojo_demuxer_stream_impl.h
index 23708583e6b..7492bb4f2a7 100644
--- a/chromium/media/mojo/clients/mojo_demuxer_stream_impl.h
+++ b/chromium/media/mojo/clients/mojo_demuxer_stream_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_media_log_service.cc b/chromium/media/mojo/clients/mojo_media_log_service.cc
index ab91a410402..cba85ebaee8 100644
--- a/chromium/media/mojo/clients/mojo_media_log_service.cc
+++ b/chromium/media/mojo/clients/mojo_media_log_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -27,11 +27,6 @@ void MojoMediaLogService::AddLogRecord(const MediaLogRecord& event) {
std::unique_ptr<media::MediaLogRecord> modified_event =
std::make_unique<media::MediaLogRecord>(event);
- // |id| is player-unique per-process, but the remote side does not know the
- // correct value (nor would we necessarily trust it). Overwrite with the
- // correct value.
- modified_event->id = media_log_->id();
-
media_log_->AddLogRecord(std::move(modified_event));
}
diff --git a/chromium/media/mojo/clients/mojo_media_log_service.h b/chromium/media/mojo/clients/mojo_media_log_service.h
index 5a39ab67527..80825db10e9 100644
--- a/chromium/media/mojo/clients/mojo_media_log_service.h
+++ b/chromium/media/mojo/clients/mojo_media_log_service.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_renderer.cc b/chromium/media/mojo/clients/mojo_renderer.cc
index c3eae53b053..c529abc382b 100644
--- a/chromium/media/mojo/clients/mojo_renderer.cc
+++ b/chromium/media/mojo/clients/mojo_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_renderer.h b/chromium/media/mojo/clients/mojo_renderer.h
index a522def4b9a..3e98c1963a1 100644
--- a/chromium/media/mojo/clients/mojo_renderer.h
+++ b/chromium/media/mojo/clients/mojo_renderer.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_renderer_factory.cc b/chromium/media/mojo/clients/mojo_renderer_factory.cc
index 753f469c43f..443b78716eb 100644
--- a/chromium/media/mojo/clients/mojo_renderer_factory.cc
+++ b/chromium/media/mojo/clients/mojo_renderer_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_renderer_factory.h b/chromium/media/mojo/clients/mojo_renderer_factory.h
index 8a6ad30427f..e36799eb8d0 100644
--- a/chromium/media/mojo/clients/mojo_renderer_factory.h
+++ b/chromium/media/mojo/clients/mojo_renderer_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_renderer_unittest.cc b/chromium/media/mojo/clients/mojo_renderer_unittest.cc
index 6f693a2fb90..36cb66f2f2c 100644
--- a/chromium/media/mojo/clients/mojo_renderer_unittest.cc
+++ b/chromium/media/mojo/clients/mojo_renderer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_renderer_wrapper.cc b/chromium/media/mojo/clients/mojo_renderer_wrapper.cc
index 0bf3197a414..3fd355d6678 100644
--- a/chromium/media/mojo/clients/mojo_renderer_wrapper.cc
+++ b/chromium/media/mojo/clients/mojo_renderer_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_renderer_wrapper.h b/chromium/media/mojo/clients/mojo_renderer_wrapper.h
index f8ee0dcb0d9..743cd3fd2c2 100644
--- a/chromium/media/mojo/clients/mojo_renderer_wrapper.h
+++ b/chromium/media/mojo/clients/mojo_renderer_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_video_decoder.cc b/chromium/media/mojo/clients/mojo_video_decoder.cc
index bc6b09ea172..146814fbf45 100644
--- a/chromium/media/mojo/clients/mojo_video_decoder.cc
+++ b/chromium/media/mojo/clients/mojo_video_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_video_decoder.h b/chromium/media/mojo/clients/mojo_video_decoder.h
index 46277b98dd1..fd195f7ffe1 100644
--- a/chromium/media/mojo/clients/mojo_video_decoder.h
+++ b/chromium/media/mojo/clients/mojo_video_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_video_encode_accelerator.cc b/chromium/media/mojo/clients/mojo_video_encode_accelerator.cc
index 5f03572c937..4390b3d6ba5 100644
--- a/chromium/media/mojo/clients/mojo_video_encode_accelerator.cc
+++ b/chromium/media/mojo/clients/mojo_video_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
+#include "base/metrics/histogram_macros.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "gpu/ipc/client/gpu_channel_host.h"
@@ -16,7 +17,6 @@
#include "media/base/video_frame.h"
#include "media/gpu/gpu_video_accelerator_util.h"
#include "media/mojo/clients/mojo_media_log_service.h"
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/mojom/video_encoder_info.mojom.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
@@ -159,40 +159,22 @@ void MojoVideoEncodeAccelerator::Encode(scoped_refptr<VideoFrame> frame,
frame->timestamp());
DVLOG(2) << __func__ << " tstamp=" << frame->timestamp();
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- size_t num_planes = VideoFrame::NumPlanes(frame->format());
- DCHECK_EQ(num_planes, frame->layout().num_planes());
+ DCHECK_EQ(VideoFrame::NumPlanes(frame->format()),
+ frame->layout().num_planes());
DCHECK(vea_.is_bound());
- // GPU memory path: Pass-through.
- if (frame->storage_type() == VideoFrame::STORAGE_GPU_MEMORY_BUFFER) {
- vea_->Encode(frame, force_keyframe,
- base::BindOnce([](scoped_refptr<VideoFrame>) {}, frame));
- return;
- }
-
- // Mappable memory path: Copy buffer to shared memory.
+ UMA_HISTOGRAM_ENUMERATION("Media.MojoVideoEncodeAccelerator.InputStorageType",
+ frame->storage_type(),
+ static_cast<int>(VideoFrame::STORAGE_MAX) + 1);
if (frame->format() != PIXEL_FORMAT_I420 &&
frame->format() != PIXEL_FORMAT_NV12) {
DLOG(ERROR) << "Unexpected pixel format: "
<< VideoPixelFormatToString(frame->format());
return;
}
- if (frame->storage_type() != VideoFrame::STORAGE_SHMEM &&
- frame->storage_type() != VideoFrame::STORAGE_UNOWNED_MEMORY) {
- DLOG(ERROR) << "Unexpected storage type: "
- << VideoFrame::StorageTypeToString(frame->storage_type());
- return;
- }
- scoped_refptr<MojoSharedBufferVideoFrame> mojo_frame =
- MojoSharedBufferVideoFrame::CreateFromYUVFrame(*frame);
- if (!mojo_frame) {
- DLOG(ERROR) << "Failed creating MojoSharedBufferVideoFrame from YUV";
- return;
- }
- vea_->Encode(
- std::move(mojo_frame), force_keyframe,
- base::BindOnce([](scoped_refptr<VideoFrame>) {}, std::move(frame)));
+ vea_->Encode(frame, force_keyframe,
+ base::BindOnce([](scoped_refptr<VideoFrame>) {}, frame));
}
void MojoVideoEncodeAccelerator::UseOutputBitstreamBuffer(
diff --git a/chromium/media/mojo/clients/mojo_video_encode_accelerator.h b/chromium/media/mojo/clients/mojo_video_encode_accelerator.h
index a88260ba4e4..f362cb96669 100644
--- a/chromium/media/mojo/clients/mojo_video_encode_accelerator.h
+++ b/chromium/media/mojo/clients/mojo_video_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc b/chromium/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc
index 2dd1b5be9c3..674884e7f29 100644
--- a/chromium/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc
+++ b/chromium/media/mojo/clients/mojo_video_encode_accelerator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,8 @@
#include <memory>
#include "base/memory/ptr_util.h"
+#include "base/memory/read_only_shared_memory_region.h"
+#include "base/memory/unsafe_shared_memory_region.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "gpu/config/gpu_info.h"
@@ -251,18 +253,14 @@ TEST_F(MojoVideoEncodeAcceleratorTest, EncodeOneFrame) {
}
{
- base::UnsafeSharedMemoryRegion shmem =
- base::UnsafeSharedMemoryRegion::Create(
- VideoFrame::AllocationSize(PIXEL_FORMAT_I420, kInputVisibleSize) *
- 2);
+ base::MappedReadOnlyRegion shmem = base::ReadOnlySharedMemoryRegion::Create(
+ VideoFrame::AllocationSize(PIXEL_FORMAT_I420, kInputVisibleSize) * 2);
ASSERT_TRUE(shmem.IsValid());
- base::WritableSharedMemoryMapping mapping = shmem.Map();
- ASSERT_TRUE(mapping.IsValid());
const scoped_refptr<VideoFrame> video_frame = VideoFrame::WrapExternalData(
PIXEL_FORMAT_I420, kInputVisibleSize, gfx::Rect(kInputVisibleSize),
- kInputVisibleSize, mapping.GetMemoryAsSpan<uint8_t>().data(),
- mapping.size(), base::TimeDelta());
- video_frame->BackWithSharedMemory(&shmem);
+ kInputVisibleSize, static_cast<uint8_t*>(shmem.mapping.memory()),
+ shmem.mapping.size(), base::TimeDelta());
+ video_frame->BackWithSharedMemory(&shmem.region);
const bool is_keyframe = true;
// The remote end of the mojo Pipe doesn't receive |video_frame| itself.
diff --git a/chromium/media/mojo/clients/win/media_foundation_renderer_client.cc b/chromium/media/mojo/clients/win/media_foundation_renderer_client.cc
index 15fdbd8c45d..b3d6f43a8ff 100644
--- a/chromium/media/mojo/clients/win/media_foundation_renderer_client.cc
+++ b/chromium/media/mojo/clients/win/media_foundation_renderer_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -225,14 +225,6 @@ void MediaFoundationRendererClient::StartPlayingFrom(base::TimeDelta time) {
SignalMediaPlayingStateChange(true);
next_video_frame_.reset();
mojo_renderer_->StartPlayingFrom(time);
- // Request the first frame (if we are not in frame server mode this just
- // gets dropped).
- base::TimeTicks request_min = base::TimeTicks::Now();
- base::TimeTicks request_max =
- base::TimeTicks::Now() + GetPreferredRenderInterval();
-
- renderer_extension_->RequestNextFrameBetweenTimestamps(request_min,
- request_max);
}
void MediaFoundationRendererClient::SetPlaybackRate(double playback_rate) {
@@ -356,22 +348,15 @@ scoped_refptr<VideoFrame> MediaFoundationRendererClient::Render(
return nullptr;
}
- base::TimeTicks next_request_min = deadline_max;
- base::TimeTicks next_request_max =
- deadline_max + GetPreferredRenderInterval();
-
auto callback =
- [](base::TimeTicks deadline_min, base::TimeTicks deadline_max,
- base::WeakPtr<MediaFoundationRendererClient> renderer_client) {
- if (renderer_client.MaybeValid()) {
- renderer_client->renderer_extension_
- ->RequestNextFrameBetweenTimestamps(deadline_min, deadline_max);
+ [](base::WeakPtr<MediaFoundationRendererClient> renderer_client) {
+ if (renderer_client) {
+ renderer_client->renderer_extension_->RequestNextFrame();
}
};
media_task_runner_->PostTask(
- FROM_HERE, base::BindOnce(callback, next_request_min, next_request_max,
- weak_factory_.GetWeakPtr()));
+ FROM_HERE, base::BindOnce(callback, weak_factory_.GetWeakPtr()));
// TODO(crbug.com/1298093): Need to report underflow when we don't have a
// frame ready for presentation by calling OnBufferingStateChange
@@ -413,7 +398,8 @@ void MediaFoundationRendererClient::OnRemoteRendererInitialized(
base::BindRepeating(&MediaFoundationRendererClient::OnOutputRectChange,
weak_factory_.GetWeakPtr()));
if (!success) {
- std::move(init_cb_).Run(PIPELINE_ERROR_INITIALIZATION_FAILED);
+ std::move(init_cb_).Run(PipelineStatus(PIPELINE_ERROR_INITIALIZATION_FAILED,
+ "DComTextureWrapper init failed"));
return;
}
@@ -544,7 +530,9 @@ void MediaFoundationRendererClient::OnVideoFrameCreated(
}
dcomp_video_frame_ = video_frame;
- sink_->PaintSingleFrame(dcomp_video_frame_, true);
+ if (!IsFrameServerMode()) {
+ sink_->PaintSingleFrame(dcomp_video_frame_, true);
+ }
}
void MediaFoundationRendererClient::OnCdmAttached(bool success) {
diff --git a/chromium/media/mojo/clients/win/media_foundation_renderer_client.h b/chromium/media/mojo/clients/win/media_foundation_renderer_client.h
index 0b8f337caf3..b2d0aea5ca8 100644
--- a/chromium/media/mojo/clients/win/media_foundation_renderer_client.h
+++ b/chromium/media/mojo/clients/win/media_foundation_renderer_client.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -140,9 +140,9 @@ class MediaFoundationRendererClient
void OnOverlayStateChanged(const gpu::Mailbox& mailbox, bool promoted);
void UpdateRenderMode();
- // This class is constructed on the main thread and used exclusively on the
- // media thread. Hence we store PendingRemotes so we can bind the Remotes
- // on the media task runner during/after Initialize().
+ // This class is constructed on the main thread. Hence we store
+ // PendingRemotes so we can bind the Remotes on the media task
+ // runner during/after Initialize().
scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
std::unique_ptr<MediaLog> media_log_;
std::unique_ptr<MojoRenderer> mojo_renderer_;
diff --git a/chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.cc b/chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.cc
index 0f3e560ef67..6d0862e53f0 100644
--- a/chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.cc
+++ b/chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.h b/chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.h
index f37be85c59c..d57f64a7284 100644
--- a/chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.h
+++ b/chromium/media/mojo/clients/win/media_foundation_renderer_client_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/BUILD.gn b/chromium/media/mojo/common/BUILD.gn
index a570c550931..ae5303dc1d3 100644
--- a/chromium/media/mojo/common/BUILD.gn
+++ b/chromium/media/mojo/common/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -19,7 +19,6 @@ source_set("common") {
]
deps = [
- ":mojo_shared_buffer_video_frame",
"//base",
"//gpu/ipc/common",
"//media",
@@ -31,22 +30,6 @@ source_set("common") {
]
}
-# This is a separate target so that //media/mojo/mojom can depend on it
-# without creating a cycle.
-source_set("mojo_shared_buffer_video_frame") {
- sources = [
- "mojo_shared_buffer_video_frame.cc",
- "mojo_shared_buffer_video_frame.h",
- ]
-
- deps = [
- "//base",
- "//media",
- "//mojo/public/cpp/system",
- "//ui/gfx/geometry",
- ]
-}
-
source_set("unit_tests") {
testonly = true
@@ -54,7 +37,6 @@ source_set("unit_tests") {
"media_type_converters_unittest.cc",
"mojo_data_pipe_read_write_unittest.cc",
"mojo_decoder_buffer_converter_unittest.cc",
- "mojo_shared_buffer_video_frame_unittest.cc",
]
deps = [
diff --git a/chromium/media/mojo/common/audio_data_s16_converter.cc b/chromium/media/mojo/common/audio_data_s16_converter.cc
index 7d1a07b284f..a9f2b5d4b13 100644
--- a/chromium/media/mojo/common/audio_data_s16_converter.cc
+++ b/chromium/media/mojo/common/audio_data_s16_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/audio_data_s16_converter.h b/chromium/media/mojo/common/audio_data_s16_converter.h
index ba18c40605b..d5efb597832 100644
--- a/chromium/media/mojo/common/audio_data_s16_converter.h
+++ b/chromium/media/mojo/common/audio_data_s16_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/input_error_code_converter.cc b/chromium/media/mojo/common/input_error_code_converter.cc
index c740d65df63..63a956421fa 100644
--- a/chromium/media/mojo/common/input_error_code_converter.cc
+++ b/chromium/media/mojo/common/input_error_code_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/input_error_code_converter.h b/chromium/media/mojo/common/input_error_code_converter.h
index cd6406f4c5e..99436e75934 100644
--- a/chromium/media/mojo/common/input_error_code_converter.h
+++ b/chromium/media/mojo/common/input_error_code_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/media_type_converters.cc b/chromium/media/mojo/common/media_type_converters.cc
index 93377483602..a5ac18beec0 100644
--- a/chromium/media/mojo/common/media_type_converters.cc
+++ b/chromium/media/mojo/common/media_type_converters.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/media_type_converters.h b/chromium/media/mojo/common/media_type_converters.h
index db71a2622c3..d94c1051970 100644
--- a/chromium/media/mojo/common/media_type_converters.h
+++ b/chromium/media/mojo/common/media_type_converters.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/media_type_converters_unittest.cc b/chromium/media/mojo/common/media_type_converters_unittest.cc
index 89cfb3591d4..e1ab9298063 100644
--- a/chromium/media/mojo/common/media_type_converters_unittest.cc
+++ b/chromium/media/mojo/common/media_type_converters_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/mojo_data_pipe_read_write.cc b/chromium/media/mojo/common/mojo_data_pipe_read_write.cc
index 10cdb3694a3..9db02bc7745 100644
--- a/chromium/media/mojo/common/mojo_data_pipe_read_write.cc
+++ b/chromium/media/mojo/common/mojo_data_pipe_read_write.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/mojo_data_pipe_read_write.h b/chromium/media/mojo/common/mojo_data_pipe_read_write.h
index 7c6f9d58d00..2cc975cd5a9 100644
--- a/chromium/media/mojo/common/mojo_data_pipe_read_write.h
+++ b/chromium/media/mojo/common/mojo_data_pipe_read_write.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/mojo_data_pipe_read_write_unittest.cc b/chromium/media/mojo/common/mojo_data_pipe_read_write_unittest.cc
index f99cc6da2cf..e7dc4417e59 100644
--- a/chromium/media/mojo/common/mojo_data_pipe_read_write_unittest.cc
+++ b/chromium/media/mojo/common/mojo_data_pipe_read_write_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/mojo_decoder_buffer_converter.cc b/chromium/media/mojo/common/mojo_decoder_buffer_converter.cc
index b15b859fb7a..c2541e3b0b5 100644
--- a/chromium/media/mojo/common/mojo_decoder_buffer_converter.cc
+++ b/chromium/media/mojo/common/mojo_decoder_buffer_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/mojo_decoder_buffer_converter.h b/chromium/media/mojo/common/mojo_decoder_buffer_converter.h
index 46d3931a089..d09e78cf355 100644
--- a/chromium/media/mojo/common/mojo_decoder_buffer_converter.h
+++ b/chromium/media/mojo/common/mojo_decoder_buffer_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/mojo_decoder_buffer_converter_unittest.cc b/chromium/media/mojo/common/mojo_decoder_buffer_converter_unittest.cc
index 7259821aaac..938fc8fdc0f 100644
--- a/chromium/media/mojo/common/mojo_decoder_buffer_converter_unittest.cc
+++ b/chromium/media/mojo/common/mojo_decoder_buffer_converter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/mojo_pipe_read_write_util.cc b/chromium/media/mojo/common/mojo_pipe_read_write_util.cc
index 85b6fe9440d..2da6d7c9dcb 100644
--- a/chromium/media/mojo/common/mojo_pipe_read_write_util.cc
+++ b/chromium/media/mojo/common/mojo_pipe_read_write_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/mojo_pipe_read_write_util.h b/chromium/media/mojo/common/mojo_pipe_read_write_util.h
index 4d4f8726d0b..991a61f37e4 100644
--- a/chromium/media/mojo/common/mojo_pipe_read_write_util.h
+++ b/chromium/media/mojo/common/mojo_pipe_read_write_util.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/common/mojo_shared_buffer_video_frame.cc b/chromium/media/mojo/common/mojo_shared_buffer_video_frame.cc
deleted file mode 100644
index c19582533b1..00000000000
--- a/chromium/media/mojo/common/mojo_shared_buffer_video_frame.cc
+++ /dev/null
@@ -1,288 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
-
-#include <utility>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/callback.h"
-#include "base/compiler_specific.h"
-#include "base/logging.h"
-#include "base/memory/shared_memory_mapping.h"
-#include "base/memory/unsafe_shared_memory_region.h"
-#include "base/numerics/safe_conversions.h"
-#include "base/numerics/safe_math.h"
-
-namespace media {
-
-// static
-scoped_refptr<MojoSharedBufferVideoFrame>
-MojoSharedBufferVideoFrame::CreateDefaultForTesting(
- const VideoPixelFormat format,
- const gfx::Size& dimensions,
- base::TimeDelta timestamp) {
- DCHECK(format == PIXEL_FORMAT_I420 || format == PIXEL_FORMAT_NV12);
- const gfx::Rect visible_rect(dimensions);
-
- // Since we're allocating memory for the new frame, pad the requested
- // size if necessary so that the requested size does line up on sample
- // boundaries. See related discussion in VideoFrame::CreateFrameInternal().
- const gfx::Size coded_size = DetermineAlignedSize(format, dimensions);
- if (!IsValidConfig(format, STORAGE_MOJO_SHARED_BUFFER, coded_size,
- visible_rect, dimensions)) {
- LOG(DFATAL) << __func__ << " Invalid config. "
- << ConfigToString(format, STORAGE_MOJO_SHARED_BUFFER,
- dimensions, visible_rect, dimensions);
- return nullptr;
- }
-
- // Allocate a shared memory buffer big enough to hold the desired frame.
- const size_t allocation_size = VideoFrame::AllocationSize(format, coded_size);
- auto region = base::UnsafeSharedMemoryRegion::Create(allocation_size);
- if (!region.IsValid()) {
- DLOG(ERROR) << __func__ << " Unable to allocate memory.";
- return nullptr;
- }
-
- // As both formats are 4:2:0, the U and V (or UV plane) have samples for each
- // 2x2 block.
- DCHECK((coded_size.width() % 2 == 0) && (coded_size.height() % 2 == 0));
-
- if (format == PIXEL_FORMAT_I420) {
- // Create and initialize the frame. As this is I420 format, the U and V
- // planes have samples for each 2x2 block. The memory is laid out as
- // follows:
- // - Yplane, full size (each element represents a 1x1 block)
- // - Uplane, quarter size (each element represents a 2x2 block)
- // - Vplane, quarter size (each element represents a 2x2 block)
- const uint32_t offsets[] = {
- 0 /* y_offset */, static_cast<uint32_t>(coded_size.GetArea()),
- static_cast<uint32_t>(coded_size.GetArea() * 5 / 4)};
- const int32_t strides[] = {coded_size.width(), coded_size.width() / 2,
- coded_size.width() / 2};
- return Create(format, coded_size, visible_rect, dimensions,
- std::move(region), offsets, strides, timestamp);
- } else {
- // |format| is PIXEL_FORMAT_NV12.
- // Create and initialize the frame. As this is NV12 format, the UV plane
- // has interleaved U & V samples for each 2x2 block. The memory is laid out
- // as follows:
- // - Yplane, full size (each element represents a 1x1 block)
- // - UVplane, full width, half height (each pair represents a 2x2 block)
- const uint32_t offsets[] = {0 /* y_offset */,
- static_cast<uint32_t>(coded_size.GetArea())};
- const int32_t strides[] = {coded_size.width(), coded_size.width()};
- return Create(format, coded_size, visible_rect, dimensions,
- std::move(region), offsets, strides, timestamp);
- }
-}
-
-scoped_refptr<MojoSharedBufferVideoFrame>
-MojoSharedBufferVideoFrame::CreateFromYUVFrame(VideoFrame& frame) {
- size_t num_planes = VideoFrame::NumPlanes(frame.format());
- DCHECK_LE(num_planes, 3u);
- DCHECK_GE(num_planes, 2u);
-
- std::vector<uint32_t> offsets(num_planes);
- std::vector<int32_t> strides(num_planes);
- std::vector<size_t> sizes(num_planes);
- size_t aggregate_size = 0;
- for (size_t i = 0; i < num_planes; ++i) {
- strides[i] = frame.stride(i);
- offsets[i] = aggregate_size;
- sizes[i] =
- VideoFrame::Rows(i, frame.format(), frame.coded_size().height()) *
- strides[i];
- aggregate_size += sizes[i];
- }
-
- auto region = base::UnsafeSharedMemoryRegion::Create(aggregate_size);
- if (!region.IsValid()) {
- DLOG(ERROR) << "Can't create new frame backing memory";
- return nullptr;
- }
- base::WritableSharedMemoryMapping dst_mapping = region.Map();
- if (!dst_mapping.IsValid()) {
- DLOG(ERROR) << "Can't create map frame backing memory";
- return nullptr;
- }
-
- // The data from |frame| may not be consecutive between planes. Copy data into
- // a shared memory buffer which is tightly packed. Padding inside each planes
- // are preserved.
- scoped_refptr<MojoSharedBufferVideoFrame> mojo_frame =
- MojoSharedBufferVideoFrame::Create(
- frame.format(), frame.coded_size(), frame.visible_rect(),
- frame.natural_size(), std::move(region), offsets, strides,
- frame.timestamp());
- CHECK(!!mojo_frame);
-
- // If the source memory region is a shared memory region we must map it too.
- base::WritableSharedMemoryMapping src_mapping;
- if (frame.storage_type() == VideoFrame::STORAGE_SHMEM) {
- if (!frame.shm_region()->IsValid()) {
- DLOG(ERROR) << "Invalid source shared memory region";
- return nullptr;
- }
- src_mapping = frame.shm_region()->Map();
- if (!src_mapping.IsValid()) {
- DLOG(ERROR) << "Can't map source shared memory region";
- return nullptr;
- }
- }
-
- // Copy plane data while mappings are in scope.
- for (size_t i = 0; i < num_planes; ++i) {
- memcpy(mojo_frame->shared_buffer_data() + offsets[i],
- static_cast<const void*>(frame.data(i)), sizes[i]);
- }
-
- // TODO(xingliu): Maybe also copy the alpha plane in
- // |MojoSharedBufferVideoFrame|. The alpha plane is ignored here, but
- // the |shared_memory| should contain the space for alpha plane.
-
- return mojo_frame;
-}
-
-// static
-scoped_refptr<MojoSharedBufferVideoFrame> MojoSharedBufferVideoFrame::Create(
- VideoPixelFormat format,
- const gfx::Size& coded_size,
- const gfx::Rect& visible_rect,
- const gfx::Size& natural_size,
- base::UnsafeSharedMemoryRegion region,
- base::span<const uint32_t> offsets,
- base::span<const int32_t> strides,
- base::TimeDelta timestamp) {
- if (!IsValidConfig(format, STORAGE_MOJO_SHARED_BUFFER, coded_size,
- visible_rect, natural_size)) {
- LOG(DFATAL) << __func__ << " Invalid config. "
- << ConfigToString(format, STORAGE_MOJO_SHARED_BUFFER,
- coded_size, visible_rect, natural_size);
- return nullptr;
- }
-
- // Validate that the format has the proper plane count and that it matches the
- // offsets/strides array sizes passed in.
- size_t num_planes = NumPlanes(format);
- if (num_planes != 3 && num_planes != 2) {
- DLOG(ERROR) << __func__ << " " << VideoPixelFormatToString(format)
- << " is not supported; only bi/tri-planar formats are allowed";
- return nullptr;
- }
- if (num_planes != offsets.size() || num_planes != strides.size()) {
- DLOG(ERROR) << __func__ << " offsets and strides length must match number "
- << "of planes";
- return nullptr;
- }
-
- // Validate that the offsets and strides fit in the buffer.
- //
- // We can rely on coded_size.GetArea() being relatively small (compared to the
- // range of an int) due to the IsValidConfig() check above.
- //
- // TODO(sandersd): Allow non-sequential formats.
- const size_t data_size = region.GetSize();
- std::vector<ColorPlaneLayout> planes(num_planes);
- for (size_t i = 0; i < num_planes; ++i) {
- if (strides[i] < 0) {
- DLOG(ERROR) << __func__ << " Invalid stride";
- return nullptr;
- }
-
- // Compute the number of bytes needed on each row.
- const size_t row_bytes = RowBytes(i, format, coded_size.width());
-
- // Safe given sizeof(size_t) >= sizeof(int32_t).
- size_t stride_size_t = strides[i];
- if (stride_size_t < row_bytes) {
- DLOG(ERROR) << __func__ << " Invalid stride";
- return nullptr;
- }
- const size_t rows = Rows(i, format, coded_size.height());
-
- // The last row only needs RowBytes() and not a full stride. This is to
- // avoid problems if the U and V data is interleaved (where |stride| is
- // double the number of bytes actually needed).
- base::CheckedNumeric<size_t> bound = base::CheckAdd(
- offsets[i], base::CheckMul(base::CheckSub(rows, 1), stride_size_t),
- row_bytes);
- if (!bound.IsValid() || bound.ValueOrDie() > data_size) {
- DLOG(ERROR) << __func__ << " Invalid offset";
- return nullptr;
- }
-
- planes[i].stride = strides[i];
- planes[i].offset = offsets[i];
- planes[i].size = i + 1 < num_planes ? offsets[i + 1] - offsets[i]
- : data_size - offsets.back();
- }
-
- auto layout =
- VideoFrameLayout::CreateWithPlanes(format, coded_size, std::move(planes));
- if (!layout) {
- return nullptr;
- }
- // Now allocate the frame and initialize it.
- scoped_refptr<MojoSharedBufferVideoFrame> frame(
- new MojoSharedBufferVideoFrame(*layout, visible_rect, natural_size,
- std::move(region), timestamp));
- if (!frame->Init(offsets)) {
- DLOG(ERROR) << __func__ << " MojoSharedBufferVideoFrame::Init failed.";
- return nullptr;
- }
-
- return frame;
-}
-
-MojoSharedBufferVideoFrame::MojoSharedBufferVideoFrame(
- const VideoFrameLayout& layout,
- const gfx::Rect& visible_rect,
- const gfx::Size& natural_size,
- base::UnsafeSharedMemoryRegion region,
- base::TimeDelta timestamp)
- : VideoFrame(layout,
- STORAGE_MOJO_SHARED_BUFFER,
- visible_rect,
- natural_size,
- timestamp),
- region_(std::move(region)) {
- DCHECK(region_.IsValid());
-}
-
-bool MojoSharedBufferVideoFrame::Init(base::span<const uint32_t> offsets) {
- DCHECK(!mapping_.IsValid());
- mapping_ = region_.Map();
- if (!mapping_.IsValid())
- return false;
- const size_t num_planes = NumPlanes(format());
- DCHECK_EQ(offsets.size(), num_planes);
- for (size_t i = 0; i < num_planes; ++i) {
- offsets_[i] = offsets[i];
- set_data(i, shared_buffer_data() + offsets[i]);
- }
- return true;
-}
-
-MojoSharedBufferVideoFrame::~MojoSharedBufferVideoFrame() {
- // Call |mojo_shared_buffer_done_cb_| to take ownership of
- // |shared_buffer_handle_|.
- if (mojo_shared_buffer_done_cb_) {
- std::move(mojo_shared_buffer_done_cb_).Run(std::move(region_));
- }
-}
-
-size_t MojoSharedBufferVideoFrame::PlaneOffset(size_t plane) const {
- DCHECK(IsValidPlane(format(), plane));
- return offsets_[plane];
-}
-
-void MojoSharedBufferVideoFrame::SetMojoSharedBufferDoneCB(
- MojoSharedBufferDoneCB mojo_shared_buffer_done_cb) {
- mojo_shared_buffer_done_cb_ = std::move(mojo_shared_buffer_done_cb);
-}
-
-} // namespace media
diff --git a/chromium/media/mojo/common/mojo_shared_buffer_video_frame.h b/chromium/media/mojo/common/mojo_shared_buffer_video_frame.h
deleted file mode 100644
index aa1a92f16ed..00000000000
--- a/chromium/media/mojo/common/mojo_shared_buffer_video_frame.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_
-#define MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include "base/callback_forward.h"
-#include "base/containers/span.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/shared_memory_mapping.h"
-#include "base/memory/unsafe_shared_memory_region.h"
-#include "media/base/video_frame.h"
-#include "media/base/video_frame_layout.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace media {
-
-// A derived class of media::VideoFrame holding a mojo::SharedBufferHandle
-// which is mapped on constructor and remains so for the lifetime of the
-// object. These frames are ref-counted.
-class MojoSharedBufferVideoFrame : public VideoFrame {
- public:
- // Callback called when this object is destructed. Ownership of the shared
- // memory is transferred to the callee.
- using MojoSharedBufferDoneCB =
- base::OnceCallback<void(base::UnsafeSharedMemoryRegion region)>;
-
- // Creates a new I420 or NV12 frame in shared memory with provided parameters
- // (coded_size() == natural_size() == visible_rect()), or returns nullptr.
- // Buffers for the frame are allocated but not initialized. The caller must
- // not make assumptions about the actual underlying sizes, but check the
- // returned VideoFrame instead. |format| must be either PIXEL_FORMAT_I420 or
- // PIXEL_FORMAT_NV12.
- static scoped_refptr<MojoSharedBufferVideoFrame> CreateDefaultForTesting(
- const VideoPixelFormat format,
- const gfx::Size& dimensions,
- base::TimeDelta timestamp);
-
- // Creates a YUV frame backed by shared memory from in-memory YUV frame.
- // Internally the data from in-memory YUV frame will be copied to a
- // consecutive block in shared memory. Will return null on failure.
- static scoped_refptr<MojoSharedBufferVideoFrame> CreateFromYUVFrame(
- VideoFrame& frame);
-
- // Creates a MojoSharedBufferVideoFrame that uses the memory in |handle|.
- // This will take ownership of |handle|, so the caller can no longer use it.
- // |mojo_shared_buffer_done_cb|, if not null, is called on destruction,
- // and is passed ownership of |handle|. |handle| must be writable. |offsets|
- // and |strides| should be in plane order.
- static scoped_refptr<MojoSharedBufferVideoFrame> Create(
- VideoPixelFormat format,
- const gfx::Size& coded_size,
- const gfx::Rect& visible_rect,
- const gfx::Size& natural_size,
- base::UnsafeSharedMemoryRegion region,
- base::span<const uint32_t> offsets,
- base::span<const int32_t> strides,
- base::TimeDelta timestamp);
-
- MojoSharedBufferVideoFrame(const MojoSharedBufferVideoFrame&) = delete;
- MojoSharedBufferVideoFrame& operator=(const MojoSharedBufferVideoFrame&) =
- delete;
-
- // Returns the offsets relative to the start of the shmem mapping for the
- // |plane| specified.
- size_t PlaneOffset(size_t plane) const;
-
- // Callers can `Duplicate()` the mapping to extend the lifetime of the region.
- const base::UnsafeSharedMemoryRegion& shmem_region() const { return region_; }
-
- // Sets the callback to be called to free the shmem region. If not null,
- // the callback is called when `this` is destroyed, and ownership of
- // `region_` is transferred to it.
- void SetMojoSharedBufferDoneCB(
- MojoSharedBufferDoneCB mojo_shared_buffer_done_cb);
-
- private:
- friend class MojoDecryptorService;
-
- MojoSharedBufferVideoFrame(const VideoFrameLayout& layout,
- const gfx::Rect& visible_rect,
- const gfx::Size& natural_size,
- base::UnsafeSharedMemoryRegion region,
- base::TimeDelta timestamp);
- ~MojoSharedBufferVideoFrame() override;
-
- // Initializes the MojoSharedBufferVideoFrame by creating a mapping onto
- // the shared memory, and then setting offsets as specified.
- bool Init(base::span<const uint32_t> offsets);
-
- uint8_t* shared_buffer_data() { return mapping_.GetMemoryAs<uint8_t>(); }
-
- // WritableSharedMemoryRegion has strict ownership and cannot be cloned. Since
- // the shared memory region may be reused and handed out to a producer
- // multiple times, this must use an UnsafeSharedMemoryRegion instead.
- base::UnsafeSharedMemoryRegion region_;
- base::WritableSharedMemoryMapping mapping_;
- size_t offsets_[kMaxPlanes];
- MojoSharedBufferDoneCB mojo_shared_buffer_done_cb_;
-};
-
-} // namespace media
-
-#endif // MEDIA_MOJO_COMMON_MOJO_SHARED_BUFFER_VIDEO_FRAME_H_
diff --git a/chromium/media/mojo/common/mojo_shared_buffer_video_frame_unittest.cc b/chromium/media/mojo/common/mojo_shared_buffer_video_frame_unittest.cc
deleted file mode 100644
index 18a70f3967b..00000000000
--- a/chromium/media/mojo/common/mojo_shared_buffer_video_frame_unittest.cc
+++ /dev/null
@@ -1,356 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <string>
-
-#include "base/bind.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/unsafe_shared_memory_region.h"
-#include "base/test/bind.h"
-#include "base/time/time.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace media {
-
-TEST(MojoSharedBufferVideoFrameTest, CreateFrameWithSharedMemoryI420) {
- const int kWidth = 16;
- const int kHeight = 9;
- const base::TimeDelta kTimestamp = base::Microseconds(1337);
-
- // Create a MojoSharedBufferVideoFrame which will allocate enough space
- // to hold a 16x9 video frame.
- gfx::Size size(kWidth, kHeight);
- scoped_refptr<MojoSharedBufferVideoFrame> frame =
- MojoSharedBufferVideoFrame::CreateDefaultForTesting(PIXEL_FORMAT_I420,
- size, kTimestamp);
- ASSERT_TRUE(frame.get());
-
- // Verify that the correct frame was allocated.
- EXPECT_EQ(media::PIXEL_FORMAT_I420, frame->format());
-
- // The offsets should be set appropriately.
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kYPlane), 0u);
- EXPECT_GT(frame->PlaneOffset(VideoFrame::kUPlane), 0u);
- EXPECT_GT(frame->PlaneOffset(VideoFrame::kVPlane), 0u);
-
- // The strides should be set appropriately.
- EXPECT_EQ(frame->stride(VideoFrame::kYPlane), kWidth);
- EXPECT_EQ(frame->stride(VideoFrame::kUPlane), kWidth / 2);
- EXPECT_EQ(frame->stride(VideoFrame::kVPlane), kWidth / 2);
-
- // The data pointers for each plane should be set.
- EXPECT_TRUE(frame->data(VideoFrame::kYPlane));
- EXPECT_TRUE(frame->data(VideoFrame::kUPlane));
- EXPECT_TRUE(frame->data(VideoFrame::kVPlane));
-}
-
-TEST(MojoSharedBufferVideoFrameTest, CreateFrameWithSharedMemoryNV12) {
- const int kWidth = 16;
- const int kHeight = 9;
- const base::TimeDelta kTimestamp = base::Microseconds(1337);
-
- // Create a MojoSharedBufferVideoFrame which will allocate enough space
- // to hold a 16x9 video frame.
- gfx::Size size(kWidth, kHeight);
- scoped_refptr<MojoSharedBufferVideoFrame> frame =
- MojoSharedBufferVideoFrame::CreateDefaultForTesting(PIXEL_FORMAT_NV12,
- size, kTimestamp);
- ASSERT_TRUE(frame.get());
-
- // Verify that the correct frame was allocated.
- EXPECT_EQ(media::PIXEL_FORMAT_NV12, frame->format());
-
- // The offsets should be set appropriately.
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kYPlane), 0u);
- EXPECT_GT(frame->PlaneOffset(VideoFrame::kUVPlane), 0u);
-
- // The strides should be set appropriately.
- EXPECT_EQ(frame->stride(VideoFrame::kYPlane), kWidth);
- EXPECT_EQ(frame->stride(VideoFrame::kUVPlane), kWidth);
-
- // The data pointers for each plane should be set.
- EXPECT_TRUE(frame->data(VideoFrame::kYPlane));
- EXPECT_TRUE(frame->data(VideoFrame::kUVPlane));
-}
-
-TEST(MojoSharedBufferVideoFrameTest, CreateFrameAndPassSharedMemoryI420) {
- const int kWidth = 32;
- const int kHeight = 18;
- const base::TimeDelta kTimestamp = base::Microseconds(1338);
-
- // Some random values to use. Since we actually don't use the data inside the
- // frame, random values are fine (as long as the offsets are within the
- // memory size allocated).
- const VideoPixelFormat format = PIXEL_FORMAT_I420;
- const size_t y_offset = kWidth * 2;
- const size_t u_offset = kWidth * 3;
- const size_t v_offset = kWidth * 5;
- const int32_t y_stride = kWidth;
- const int32_t u_stride = kWidth - 1;
- const int32_t v_stride = kWidth - 2;
-
- // Allocate some shared memory.
- gfx::Size size(kWidth, kHeight);
- gfx::Rect visible_rect(size);
- size_t requested_size = VideoFrame::AllocationSize(format, size);
- ASSERT_LT(y_offset, requested_size);
- auto region = base::UnsafeSharedMemoryRegion::Create(requested_size);
- ASSERT_TRUE(region.IsValid());
-
- // Allocate frame.
- const uint32_t offsets[] = {y_offset, u_offset, v_offset};
- const int32_t strides[] = {y_stride, u_stride, v_stride};
- scoped_refptr<MojoSharedBufferVideoFrame> frame =
- MojoSharedBufferVideoFrame::Create(format, size, visible_rect, size,
- std::move(region), offsets, strides,
- kTimestamp);
- ASSERT_TRUE(frame.get());
- EXPECT_EQ(frame->format(), format);
-
- // The offsets should be set appropriately.
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kYPlane), y_offset);
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kUPlane), u_offset);
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kVPlane), v_offset);
-
- // The strides should be set appropriately.
- EXPECT_EQ(frame->stride(VideoFrame::kYPlane), y_stride);
- EXPECT_EQ(frame->stride(VideoFrame::kUPlane), u_stride);
- EXPECT_EQ(frame->stride(VideoFrame::kVPlane), v_stride);
-
- // The data pointers for each plane should be set.
- EXPECT_TRUE(frame->data(VideoFrame::kYPlane));
- EXPECT_TRUE(frame->data(VideoFrame::kUPlane));
- EXPECT_TRUE(frame->data(VideoFrame::kVPlane));
-}
-
-TEST(MojoSharedBufferVideoFrameTest, CreateFrameAndPassSharedMemoryNV12) {
- const int kWidth = 32;
- const int kHeight = 18;
- const base::TimeDelta kTimestamp = base::Microseconds(1338);
-
- // Some random values to use. Since we actually don't use the data inside the
- // frame, random values are fine (as long as the offsets are within the
- // memory size allocated).
- const VideoPixelFormat format = PIXEL_FORMAT_NV12;
- const size_t y_offset = kWidth * 2;
- const size_t uv_offset = kWidth * 3;
- const int32_t y_stride = kWidth;
- const int32_t uv_stride = kWidth + 1;
-
- // Allocate some shared memory.
- gfx::Size size(kWidth, kHeight);
- gfx::Rect visible_rect(size);
- size_t requested_size = VideoFrame::AllocationSize(format, size);
- ASSERT_LT(y_offset, requested_size);
- auto region = base::UnsafeSharedMemoryRegion::Create(requested_size);
- ASSERT_TRUE(region.IsValid());
-
- // Allocate frame.
- const uint32_t offsets[] = {y_offset, uv_offset};
- const int32_t strides[] = {y_stride, uv_stride};
- scoped_refptr<MojoSharedBufferVideoFrame> frame =
- MojoSharedBufferVideoFrame::Create(format, size, visible_rect, size,
- std::move(region), offsets, strides,
- kTimestamp);
- ASSERT_TRUE(frame.get());
- EXPECT_EQ(frame->format(), format);
-
- // The offsets should be set appropriately.
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kYPlane), y_offset);
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kUVPlane), uv_offset);
-
- // The strides should be set appropriately.
- EXPECT_EQ(frame->stride(VideoFrame::kYPlane), y_stride);
- EXPECT_EQ(frame->stride(VideoFrame::kUVPlane), uv_stride);
-
- // The data pointers for each plane should be set.
- EXPECT_TRUE(frame->data(VideoFrame::kYPlane));
- EXPECT_TRUE(frame->data(VideoFrame::kUVPlane));
-}
-
-TEST(MojoSharedBufferVideoFrameTest, CreateFrameOddWidth) {
- const int kWidth = 15;
- const int kHeight = 9;
- const base::TimeDelta kTimestamp = base::Microseconds(1337);
-
- VideoPixelFormat formats[] = {PIXEL_FORMAT_I420, PIXEL_FORMAT_NV12};
- for (auto format : formats) {
- // Create a MojoSharedBufferVideoFrame which will allocate enough space
- // to hold the video frame. Size should be adjusted.
- gfx::Size size(kWidth, kHeight);
- scoped_refptr<MojoSharedBufferVideoFrame> frame =
- MojoSharedBufferVideoFrame::CreateDefaultForTesting(format, size,
- kTimestamp);
- ASSERT_TRUE(frame.get());
-
- // Verify that the correct frame was allocated.
- EXPECT_EQ(format, frame->format());
-
- // The size should be >= 15x9.
- EXPECT_GE(frame->coded_size().width(), kWidth);
- EXPECT_GE(frame->coded_size().height(), kHeight);
- }
-}
-
-TEST(MojoSharedBufferVideoFrameTest, TestDestructionCallback) {
- const VideoPixelFormat format = PIXEL_FORMAT_I420;
- const int kWidth = 32;
- const int kHeight = 18;
- const base::TimeDelta kTimestamp = base::Microseconds(1338);
-
- // Allocate some shared memory.
- gfx::Size size(kWidth, kHeight);
- gfx::Rect visible_rect(size);
- size_t requested_size = VideoFrame::AllocationSize(format, size);
- auto region = base::UnsafeSharedMemoryRegion::Create(requested_size);
- ASSERT_TRUE(region.IsValid());
-
- const char kTestData[] = "reduce reuse recycle";
- {
- base::WritableSharedMemoryMapping mapping = region.Map();
- ASSERT_GT(mapping.size(), strlen(kTestData));
- // Note: deliberately using sizeof() to include the null terminator.
- memcpy(mapping.memory(), kTestData, sizeof(kTestData));
- }
-
- // Allocate frame.
- const uint32_t kOffsets[] = {0, 0, 0};
- const int32_t kStrides[] = {kWidth, kWidth, kWidth};
- scoped_refptr<MojoSharedBufferVideoFrame> frame =
- MojoSharedBufferVideoFrame::Create(format, size, visible_rect, size,
- std::move(region), kOffsets, kStrides,
- kTimestamp);
- ASSERT_TRUE(frame.get());
- EXPECT_EQ(frame->format(), format);
-
- // Set the destruction callback.
- bool callback_called = false;
- auto destruction_cb =
- base::BindLambdaForTesting([&](base::UnsafeSharedMemoryRegion region) {
- callback_called = true;
- ASSERT_EQ(requested_size, region.GetSize());
- // Unsafe regions are always mapped as writable.
- base::WritableSharedMemoryMapping mapping = region.Map();
- // Check that the test data that was written there is still there as a
- // proxy signal for checking that ownership of the shmem region has been
- // transferred.
- EXPECT_STREQ(kTestData, mapping.GetMemoryAs<char>());
- });
- frame->SetMojoSharedBufferDoneCB(std::move(destruction_cb));
- EXPECT_FALSE(callback_called);
-
- // Force destruction of |frame|.
- frame = nullptr;
- EXPECT_TRUE(callback_called);
-}
-
-TEST(MojoSharedBufferVideoFrameTest, InterleavedData) {
- const VideoPixelFormat format = PIXEL_FORMAT_I420;
- const int kWidth = 32;
- const int kHeight = 18;
- const base::TimeDelta kTimestamp = base::Microseconds(1338);
- gfx::Size size(kWidth, kHeight);
- gfx::Rect visible_rect(size);
-
- // Create interlaced UV data, which are each 1/4 the size of the Y data.
- const uint32_t y_offset = 0;
- const uint32_t u_offset =
- VideoFrame::PlaneSize(format, VideoFrame::kYPlane, size).GetArea();
- const uint32_t v_offset =
- u_offset + VideoFrame::RowBytes(VideoFrame::kUPlane, format, kWidth);
- const int32_t y_stride =
- VideoFrame::RowBytes(VideoFrame::kYPlane, format, kWidth);
- const int32_t u_stride = y_stride;
- const int32_t v_stride = y_stride;
-
- // Allocate some shared memory.
- size_t requested_size = VideoFrame::AllocationSize(format, size);
- auto region = base::UnsafeSharedMemoryRegion::Create(requested_size);
- ASSERT_TRUE(region.IsValid());
-
- // Allocate frame.
- const uint32_t kOffsets[] = {y_offset, u_offset, v_offset};
- const int32_t kStrides[] = {y_stride, u_stride, v_stride};
- scoped_refptr<MojoSharedBufferVideoFrame> frame =
- MojoSharedBufferVideoFrame::Create(format, size, visible_rect, size,
- std::move(region), kOffsets, kStrides,
- kTimestamp);
- ASSERT_TRUE(frame.get());
- EXPECT_EQ(frame->format(), format);
-
- // The offsets should be set appropriately.
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kYPlane), y_offset);
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kUPlane), u_offset);
- EXPECT_EQ(frame->PlaneOffset(VideoFrame::kVPlane), v_offset);
-
- // The strides should be set appropriately.
- EXPECT_EQ(frame->stride(VideoFrame::kYPlane), y_stride);
- EXPECT_EQ(frame->stride(VideoFrame::kUPlane), u_stride);
- EXPECT_EQ(frame->stride(VideoFrame::kVPlane), v_stride);
-
- // The data pointers for each plane should be set.
- EXPECT_TRUE(frame->data(VideoFrame::kYPlane));
- EXPECT_TRUE(frame->data(VideoFrame::kUPlane));
- EXPECT_TRUE(frame->data(VideoFrame::kVPlane));
-}
-
-TEST(MojoSharedBufferVideoFrameTest, I420FrameToMojoFrame) {
- std::vector<uint8_t> data = std::vector<uint8_t>(12, 1u);
- const auto pixel_format = VideoPixelFormat::PIXEL_FORMAT_I420;
- const auto size = gfx::Size(1, 1);
- const int32_t stride = 3;
-
- // The YUV frame only has 1 pixel. But each plane are not in consecutive
- // memory block, also stride is 3 bytes that contains 1 byte image data and 2
- // bytes padding.
- scoped_refptr<VideoFrame> frame = VideoFrame::WrapExternalYuvData(
- pixel_format, size, gfx::Rect(1, 1), size, stride, stride, stride,
- &data[0], &data[4], &data[8], base::TimeDelta());
- auto mojo_frame = MojoSharedBufferVideoFrame::CreateFromYUVFrame(*frame);
- EXPECT_TRUE(mojo_frame);
-
- const size_t y_stride = frame->stride(VideoFrame::kYPlane);
- const size_t u_stride = frame->stride(VideoFrame::kUPlane);
-
- // Verifies mapped size and offset.
- EXPECT_EQ(mojo_frame->shmem_region().GetSize(),
- static_cast<size_t>(3 * stride));
- EXPECT_EQ(mojo_frame->PlaneOffset(VideoFrame::kYPlane), 0u);
- EXPECT_EQ(mojo_frame->PlaneOffset(VideoFrame::kUPlane), y_stride);
- EXPECT_EQ(mojo_frame->PlaneOffset(VideoFrame::kVPlane), y_stride + u_stride);
-}
-
-TEST(MojoSharedBufferVideoFrameTest, NV12FrameToMojoFrame) {
- std::vector<uint8_t> data = std::vector<uint8_t>(12, 1u);
- const auto pixel_format = VideoPixelFormat::PIXEL_FORMAT_NV12;
- const auto size = gfx::Size(1, 1);
- const int32_t stride = 3;
-
- // The YUV frame only has 1 pixel. But each plane are not in consecutive
- // memory block, also stride is 3 bytes that contains 1 byte image data and 2
- // bytes padding in Y plane and 2 bytes image data and 1 byte padding in UV
- // plane.
- scoped_refptr<VideoFrame> frame = VideoFrame::WrapExternalYuvData(
- pixel_format, size, gfx::Rect(1, 1), size, stride, stride, stride,
- &data[0], &data[4], &data[4], base::TimeDelta());
- auto mojo_frame = MojoSharedBufferVideoFrame::CreateFromYUVFrame(*frame);
- EXPECT_TRUE(mojo_frame);
-
- const size_t y_stride = frame->stride(VideoFrame::kYPlane);
-
- // Verifies mapped size and offset.
- EXPECT_EQ(mojo_frame->shmem_region().GetSize(),
- static_cast<size_t>(2 * stride));
- EXPECT_EQ(mojo_frame->PlaneOffset(VideoFrame::kYPlane), 0u);
- EXPECT_EQ(mojo_frame->PlaneOffset(VideoFrame::kUVPlane), y_stride);
-}
-
-} // namespace media
diff --git a/chromium/media/mojo/mojom/BUILD.gn b/chromium/media/mojo/mojom/BUILD.gn
index f65c4b2039a..988ee25fcb0 100644
--- a/chromium/media/mojo/mojom/BUILD.gn
+++ b/chromium/media/mojo/mojom/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -627,10 +627,7 @@ mojom("mojom") {
]
traits_headers = [ "video_frame_mojom_traits.h" ]
traits_sources = [ "video_frame_mojom_traits.cc" ]
- traits_public_deps = [
- "//media/mojo/common:mojo_shared_buffer_video_frame",
- "//ui/gfx/geometry/mojom",
- ]
+ traits_public_deps = [ "//ui/gfx/geometry/mojom" ]
},
{
types = [
diff --git a/chromium/media/mojo/mojom/android_overlay.mojom b/chromium/media/mojo/mojom/android_overlay.mojom
index f0e50f61cc5..f04e4c4c1f0 100644
--- a/chromium/media/mojo/mojom/android_overlay.mojom
+++ b/chromium/media/mojo/mojom/android_overlay.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_data.mojom b/chromium/media/mojo/mojom/audio_data.mojom
index 8d48cfc27ed..500a620b5bc 100644
--- a/chromium/media/mojo/mojom/audio_data.mojom
+++ b/chromium/media/mojo/mojom/audio_data.mojom
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_data_pipe.mojom b/chromium/media/mojo/mojom/audio_data_pipe.mojom
index 4db8d827bc9..4dce4ee6063 100644
--- a/chromium/media/mojo/mojom/audio_data_pipe.mojom
+++ b/chromium/media/mojo/mojom/audio_data_pipe.mojom
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_decoder.mojom b/chromium/media/mojo/mojom/audio_decoder.mojom
index 7c9fb8aacd2..82487f4974f 100644
--- a/chromium/media/mojo/mojom/audio_decoder.mojom
+++ b/chromium/media/mojo/mojom/audio_decoder.mojom
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.cc b/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.cc
index 6692386f539..472409f4b51 100644
--- a/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.h b/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.h
index bc50cbf4c7f..e2d8144369f 100644
--- a/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.h
+++ b/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits_unittest.cc b/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits_unittest.cc
index a72207eb118..1ff7ed6c33e 100644
--- a/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits_unittest.cc
+++ b/chromium/media/mojo/mojom/audio_decoder_config_mojom_traits_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_encoder.mojom b/chromium/media/mojo/mojom/audio_encoder.mojom
index 1d131ea16c8..92837968734 100644
--- a/chromium/media/mojo/mojom/audio_encoder.mojom
+++ b/chromium/media/mojo/mojom/audio_encoder.mojom
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.cc b/chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.cc
index 9f0c76c7bf8..263929e658b 100644
--- a/chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.h b/chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.h
index 941ee681f48..d99908a1510 100644
--- a/chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.h
+++ b/chromium/media/mojo/mojom/audio_encoder_config_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_input_stream.mojom b/chromium/media/mojo/mojom/audio_input_stream.mojom
index 2ca29b14dd0..ddc547a2632 100644
--- a/chromium/media/mojo/mojom/audio_input_stream.mojom
+++ b/chromium/media/mojo/mojom/audio_input_stream.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_logging.mojom b/chromium/media/mojo/mojom/audio_logging.mojom
index 3878361f735..b59522f3778 100644
--- a/chromium/media/mojo/mojom/audio_logging.mojom
+++ b/chromium/media/mojo/mojom/audio_logging.mojom
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_output_stream.mojom b/chromium/media/mojo/mojom/audio_output_stream.mojom
index 68ed6e7db47..384d4cda518 100644
--- a/chromium/media/mojo/mojom/audio_output_stream.mojom
+++ b/chromium/media/mojo/mojom/audio_output_stream.mojom
@@ -1,10 +1,9 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
-import "mojo/public/mojom/base/unguessable_token.mojom";
import "media/mojo/mojom/audio_data_pipe.mojom";
import "media/mojo/mojom/audio_parameters.mojom";
import "media/mojo/mojom/media_types.mojom";
diff --git a/chromium/media/mojo/mojom/audio_parameters.mojom b/chromium/media/mojo/mojom/audio_parameters.mojom
index 077bf3e9dbf..8e14338c6ff 100644
--- a/chromium/media/mojo/mojom/audio_parameters.mojom
+++ b/chromium/media/mojo/mojom/audio_parameters.mojom
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_processing.mojom b/chromium/media/mojo/mojom/audio_processing.mojom
index b5ede7e89b6..8472eb26302 100644
--- a/chromium/media/mojo/mojom/audio_processing.mojom
+++ b/chromium/media/mojo/mojom/audio_processing.mojom
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_processing_mojom_traits.cc b/chromium/media/mojo/mojom/audio_processing_mojom_traits.cc
index 62d57ac1543..65b777aafe6 100644
--- a/chromium/media/mojo/mojom/audio_processing_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/audio_processing_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_processing_mojom_traits.h b/chromium/media/mojo/mojom/audio_processing_mojom_traits.h
index 71e136aa760..bec18ed4fa9 100644
--- a/chromium/media/mojo/mojom/audio_processing_mojom_traits.h
+++ b/chromium/media/mojo/mojom/audio_processing_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_MOJO_MOJOM_AUDIO_PROCESSING_MOJOM_TRAITS_H_
diff --git a/chromium/media/mojo/mojom/audio_processing_mojom_traits_unittest.cc b/chromium/media/mojo/mojom/audio_processing_mojom_traits_unittest.cc
index 4aa9fb01d5f..6278a811530 100644
--- a/chromium/media/mojo/mojom/audio_processing_mojom_traits_unittest.cc
+++ b/chromium/media/mojo/mojom/audio_processing_mojom_traits_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/audio_stream_factory.mojom b/chromium/media/mojo/mojom/audio_stream_factory.mojom
index e954892751d..981a5110b59 100644
--- a/chromium/media/mojo/mojom/audio_stream_factory.mojom
+++ b/chromium/media/mojo/mojom/audio_stream_factory.mojom
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/capture_handle.mojom b/chromium/media/mojo/mojom/capture_handle.mojom
index 7dc157bd82d..e7bf3ca034a 100644
--- a/chromium/media/mojo/mojom/capture_handle.mojom
+++ b/chromium/media/mojo/mojom/capture_handle.mojom
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/cast_application_media_info_manager.mojom b/chromium/media/mojo/mojom/cast_application_media_info_manager.mojom
index 77295ddc069..4d6baea1f2d 100644
--- a/chromium/media/mojo/mojom/cast_application_media_info_manager.mojom
+++ b/chromium/media/mojo/mojom/cast_application_media_info_manager.mojom
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/cdm_capability_mojom_traits.cc b/chromium/media/mojo/mojom/cdm_capability_mojom_traits.cc
index 5da528a3163..edac3b95091 100644
--- a/chromium/media/mojo/mojom/cdm_capability_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/cdm_capability_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/cdm_capability_mojom_traits.h b/chromium/media/mojo/mojom/cdm_capability_mojom_traits.h
index 43afb38a1e2..cf10af9d323 100644
--- a/chromium/media/mojo/mojom/cdm_capability_mojom_traits.h
+++ b/chromium/media/mojo/mojom/cdm_capability_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/cdm_document_service.mojom b/chromium/media/mojo/mojom/cdm_document_service.mojom
index 4114f0dd823..4775950b6f6 100644
--- a/chromium/media/mojo/mojom/cdm_document_service.mojom
+++ b/chromium/media/mojo/mojom/cdm_document_service.mojom
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/cdm_key_information_mojom_traits.cc b/chromium/media/mojo/mojom/cdm_key_information_mojom_traits.cc
index e3b2182b4e9..587bdf15987 100644
--- a/chromium/media/mojo/mojom/cdm_key_information_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/cdm_key_information_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/cdm_key_information_mojom_traits.h b/chromium/media/mojo/mojom/cdm_key_information_mojom_traits.h
index f4a48fa7c18..9d1ff24a7e9 100644
--- a/chromium/media/mojo/mojom/cdm_key_information_mojom_traits.h
+++ b/chromium/media/mojo/mojom/cdm_key_information_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/cdm_key_information_mojom_traits_unittest.cc b/chromium/media/mojo/mojom/cdm_key_information_mojom_traits_unittest.cc
index 51036815cd2..32567081554 100644
--- a/chromium/media/mojo/mojom/cdm_key_information_mojom_traits_unittest.cc
+++ b/chromium/media/mojo/mojom/cdm_key_information_mojom_traits_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/cdm_service.mojom b/chromium/media/mojo/mojom/cdm_service.mojom
index cb10ff26f23..ee4981a2ffa 100644
--- a/chromium/media/mojo/mojom/cdm_service.mojom
+++ b/chromium/media/mojo/mojom/cdm_service.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/cdm_storage.mojom b/chromium/media/mojo/mojom/cdm_storage.mojom
index 53b39df2f1c..8cd744f8b64 100644
--- a/chromium/media/mojo/mojom/cdm_storage.mojom
+++ b/chromium/media/mojo/mojom/cdm_storage.mojom
@@ -1,18 +1,18 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
-import "mojo/public/mojom/base/file.mojom";
-
// Provides a way to organize persistent per-origin/per-cdm-type data
// in the browser's file system.
interface CdmStorage {
+ // These values are persisted to logs. Entries should not be renumbered and
+ // numeric values should never be reused.
enum Status {
- kSuccess, // File was successfully opened.
- kInUse, // File is already open by another client.
- kFailure // Unable to open file.
+ kSuccess = 0, // File was successfully opened.
+ kInUse = 1, // File is already open by another client.
+ kFailure = 2 // Unable to open file.
};
// Opens the file specified by |file_name|. Can be called multiple times for
diff --git a/chromium/media/mojo/mojom/content_decryption_module.mojom b/chromium/media/mojo/mojom/content_decryption_module.mojom
index b181f37764b..1563eaf39d7 100644
--- a/chromium/media/mojo/mojom/content_decryption_module.mojom
+++ b/chromium/media/mojo/mojom/content_decryption_module.mojom
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,6 @@ module media.mojom;
import "media/mojo/mojom/decryptor.mojom";
import "media/mojo/mojom/media_types.mojom";
-import "url/mojom/url.mojom";
import "mojo/public/mojom/base/unguessable_token.mojom";
// See media::EmeInitDataType.
diff --git a/chromium/media/mojo/mojom/dcomp_surface_registry.mojom b/chromium/media/mojo/mojom/dcomp_surface_registry.mojom
index 6ddb20e5bc4..6f651959983 100644
--- a/chromium/media/mojo/mojom/dcomp_surface_registry.mojom
+++ b/chromium/media/mojo/mojom/dcomp_surface_registry.mojom
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/decryptor.mojom b/chromium/media/mojo/mojom/decryptor.mojom
index 8733ab74d77..5630ce8c962 100644
--- a/chromium/media/mojo/mojom/decryptor.mojom
+++ b/chromium/media/mojo/mojom/decryptor.mojom
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/demuxer_stream.mojom b/chromium/media/mojo/mojom/demuxer_stream.mojom
index 59db5ea85b5..5cc1de514c7 100644
--- a/chromium/media/mojo/mojom/demuxer_stream.mojom
+++ b/chromium/media/mojo/mojom/demuxer_stream.mojom
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/display_media_information.mojom b/chromium/media/mojo/mojom/display_media_information.mojom
index 387d8cb8a96..7b909cf5842 100644
--- a/chromium/media/mojo/mojom/display_media_information.mojom
+++ b/chromium/media/mojo/mojom/display_media_information.mojom
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,16 +6,14 @@ module media.mojom;
import "media/mojo/mojom/capture_handle.mojom";
-// Mojo equivalent to media::DisplayMediaInformation. See also
-// media/base/display_media_information.h
-
+// Describes the different types of display surface.
enum DisplayCaptureSurfaceType {
MONITOR,
WINDOW,
- APPLICATION,
BROWSER,
};
+// Describes the conditions under which the cursor is captured.
enum CursorCaptureType {
NEVER,
ALWAYS,
diff --git a/chromium/media/mojo/mojom/encoded_audio_buffer_traits.cc b/chromium/media/mojo/mojom/encoded_audio_buffer_traits.cc
index bcf6819e94b..eff8380e11e 100644
--- a/chromium/media/mojo/mojom/encoded_audio_buffer_traits.cc
+++ b/chromium/media/mojo/mojom/encoded_audio_buffer_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/encoded_audio_buffer_traits.h b/chromium/media/mojo/mojom/encoded_audio_buffer_traits.h
index 30160a907f6..f307ce6bad9 100644
--- a/chromium/media/mojo/mojom/encoded_audio_buffer_traits.h
+++ b/chromium/media/mojo/mojom/encoded_audio_buffer_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/encryption_pattern.mojom b/chromium/media/mojo/mojom/encryption_pattern.mojom
index 09cbb821c8a..ba889cb94f9 100644
--- a/chromium/media/mojo/mojom/encryption_pattern.mojom
+++ b/chromium/media/mojo/mojom/encryption_pattern.mojom
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/encryption_pattern_mojom_traits.cc b/chromium/media/mojo/mojom/encryption_pattern_mojom_traits.cc
index d463132c383..10a827c00e5 100644
--- a/chromium/media/mojo/mojom/encryption_pattern_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/encryption_pattern_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/encryption_pattern_mojom_traits.h b/chromium/media/mojo/mojom/encryption_pattern_mojom_traits.h
index 7de349de186..cd7aad12572 100644
--- a/chromium/media/mojo/mojom/encryption_pattern_mojom_traits.h
+++ b/chromium/media/mojo/mojom/encryption_pattern_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/frame_interface_factory.mojom b/chromium/media/mojo/mojom/frame_interface_factory.mojom
index afad43900c6..54810e1ca01 100644
--- a/chromium/media/mojo/mojom/frame_interface_factory.mojom
+++ b/chromium/media/mojo/mojom/frame_interface_factory.mojom
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,8 +9,6 @@ import "media/mojo/mojom/provision_fetcher.mojom";
import "mojo/public/mojom/base/generic_pending_receiver.mojom";
import "url/mojom/origin.mojom";
[EnableIf=is_win]
-import "gpu/ipc/common/luid.mojom";
-[EnableIf=is_win]
import "media/mojo/mojom/dcomp_surface_registry.mojom";
// Implemented by things like audio playback in the utility process to respond
@@ -22,14 +20,6 @@ interface MuteStateObserver {
OnMuteStateChange(bool muted);
};
-// Implemented by utility processes which would like change notifications
-// when GpuInfo changes (currently subsetted to the LUID).
-[EnableIf=is_win]
-interface GpuInfoObserver {
- // Notifies client of GPU Adapter LUID on GPU Info state change.
- OnGpuLuidChange(gpu.mojom.Luid adapter_luid);
-};
-
// A factory providing extra services for media mojo services running remotely.
// The implementation of this interface lives in the browser process and
// is bound to a RenderFrameHost (see MediaInterfaceProxy). Interfaces created
@@ -59,10 +49,4 @@ interface FrameInterfaceFactory {
// Binds a generic media frame-bound interface. This is to allow //content
// embedders to provide additional interfaces.
BindEmbedderReceiver(mojo_base.mojom.GenericPendingReceiver receiver);
-
- // Registers `observer` to get notified of the active GPU adapter LUID when
- // GpuInfo changes, synchronously returns the current adapter LUID.
- [EnableIf=is_win, Sync]
- RegisterGpuInfoObserver(pending_remote<GpuInfoObserver> observer)
- => (gpu.mojom.Luid adapter_luid);
};
diff --git a/chromium/media/mojo/mojom/gpu_accelerated_video_decoder.mojom b/chromium/media/mojo/mojom/gpu_accelerated_video_decoder.mojom
index fc3410ce460..434d41ee8fc 100644
--- a/chromium/media/mojo/mojom/gpu_accelerated_video_decoder.mojom
+++ b/chromium/media/mojo/mojom/gpu_accelerated_video_decoder.mojom
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/interface_factory.mojom b/chromium/media/mojo/mojom/interface_factory.mojom
index b430f0b331e..bc72da0faa9 100644
--- a/chromium/media/mojo/mojom/interface_factory.mojom
+++ b/chromium/media/mojo/mojom/interface_factory.mojom
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/key_system_support.mojom b/chromium/media/mojo/mojom/key_system_support.mojom
index 1bc2b8c897e..945d143af76 100644
--- a/chromium/media/mojo/mojom/key_system_support.mojom
+++ b/chromium/media/mojo/mojom/key_system_support.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/media_drm_storage.mojom b/chromium/media/mojo/mojom/media_drm_storage.mojom
index ed9c7ca2b2a..3b2df8efc33 100644
--- a/chromium/media/mojo/mojom/media_drm_storage.mojom
+++ b/chromium/media/mojo/mojom/media_drm_storage.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.cc b/chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.cc
index 984d1efe433..fa834c244bf 100644
--- a/chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h b/chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h
index 5055a8f09f3..c7d30248a22 100644
--- a/chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h
+++ b/chromium/media/mojo/mojom/media_foundation_cdm_data_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/media_foundation_rendering_mode_mojom_traits.h b/chromium/media/mojo/mojom/media_foundation_rendering_mode_mojom_traits.h
index c6d0ce26588..3d3cc06eab5 100644
--- a/chromium/media/mojo/mojom/media_foundation_rendering_mode_mojom_traits.h
+++ b/chromium/media/mojo/mojom/media_foundation_rendering_mode_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/media_foundation_service.mojom b/chromium/media/mojo/mojom/media_foundation_service.mojom
index fd7eba5b171..9579d316ca0 100644
--- a/chromium/media/mojo/mojom/media_foundation_service.mojom
+++ b/chromium/media/mojo/mojom/media_foundation_service.mojom
@@ -1,15 +1,22 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
+import "gpu/ipc/common/gpu_info.mojom";
import "media/mojo/mojom/frame_interface_factory.mojom";
import "media/mojo/mojom/interface_factory.mojom";
import "media/mojo/mojom/key_system_support.mojom";
import "mojo/public/mojom/base/file_path.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
+// An observer on GpuInfo updates.
+interface GpuInfoObserver {
+ // Notifies that a new GpuInfo update is available.
+ OnGpuInfoUpdate(gpu.mojom.GpuInfo gpu_info);
+};
+
// A service to provide Windows MediaFoundation-based InterfaceFactory and
// KeySystemCapability. See comments on MediaFoundationServiceBroker for the
// process/sandbox model.
@@ -40,6 +47,13 @@ interface MediaFoundationService {
// allow CDM preloading. After `GetService()` the process is fully sandboxed.
[ServiceSandbox=sandbox.mojom.Sandbox.kMediaFoundationCdm]
interface MediaFoundationServiceBroker {
+ // Updates `GpuInfo` stored in the `MediaFoundationService` process. The
+ // service will also provide a `gpu_info_observer` to get notified of any
+ // future `GpuInfo` updates. This info will be used for crash reporting and
+ // other purposes.
+ UpdateGpuInfo(gpu.mojom.GpuInfo gpu_info)
+ => (pending_remote<GpuInfoObserver> gpu_info_observer);
+
// Loads the CDM at `cdm_path` into the process and returns the
// `MediaFoundationService`.
GetService(
diff --git a/chromium/media/mojo/mojom/media_log.mojom b/chromium/media/mojo/mojom/media_log.mojom
index 0096ebc6c3f..0486522b458 100644
--- a/chromium/media/mojo/mojom/media_log.mojom
+++ b/chromium/media/mojo/mojom/media_log.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/media_metrics_provider.mojom b/chromium/media/mojo/mojom/media_metrics_provider.mojom
index d388e4a9c82..b1109cdb6fe 100644
--- a/chromium/media/mojo/mojom/media_metrics_provider.mojom
+++ b/chromium/media/mojo/mojom/media_metrics_provider.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,7 +10,6 @@ import "media/mojo/mojom/video_decode_stats_recorder.mojom";
import "media/mojo/mojom/playback_events_recorder.mojom";
import "media/mojo/mojom/watch_time_recorder.mojom";
import "mojo/public/mojom/base/time.mojom";
-import "ui/gfx/geometry/mojom/geometry.mojom";
// Used for reporting to UMA and UKM. Represents the URL scheme of the src URL
// given to an <audio> or <video> tag. Always add new entries to the end.
diff --git a/chromium/media/mojo/mojom/media_player.mojom b/chromium/media/mojo/mojom/media_player.mojom
index 1079db53943..d5805150c5e 100644
--- a/chromium/media/mojo/mojom/media_player.mojom
+++ b/chromium/media/mojo/mojom/media_player.mojom
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -106,6 +106,10 @@ interface MediaPlayerObserver {
// Notifies the browser process that the ability to switch audio output
// devices for the associated media player has been disabled.
OnAudioOutputSinkChangingDisabled();
+
+ // Notifies that the RemotePlayback metadata of the media player has changed.
+ OnRemotePlaybackMetadataChange(media_session.mojom.RemotePlaybackMetadata
+ remote_playback_metadata);
};
// Implemented by MediaWebContentsObserver::MediaPlayerHostImpl in the browser
diff --git a/chromium/media/mojo/mojom/media_service.mojom b/chromium/media/mojo/mojom/media_service.mojom
index 8c641b89d50..60aaa8c9d36 100644
--- a/chromium/media/mojo/mojom/media_service.mojom
+++ b/chromium/media/mojo/mojom/media_service.mojom
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/media_types.mojom b/chromium/media/mojo/mojom/media_types.mojom
index 77dab2c75c8..630f852e0a1 100644
--- a/chromium/media/mojo/mojom/media_types.mojom
+++ b/chromium/media/mojo/mojom/media_types.mojom
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -383,7 +383,7 @@ struct VideoFrame {
// Possible choices for storing VideoFrame data.
union VideoFrameData {
EosVideoFrameData eos_data;
- SharedBufferVideoFrameData shared_buffer_data;
+ SharedMemoryVideoFrameData shared_memory_data;
GpuMemoryBufferVideoFrameData gpu_memory_buffer_data;
MailboxVideoFrameData mailbox_data;
};
@@ -392,10 +392,10 @@ union VideoFrameData {
struct EosVideoFrameData {
};
-// This defines video frame data stored in a Mojo shared buffer.
-struct SharedBufferVideoFrameData {
+// This defines video frame data for STORAGE_SHMEM VideoFrame.
+struct SharedMemoryVideoFrameData {
// Shared memory region for the frame data.
- mojo_base.mojom.UnsafeSharedMemoryRegion frame_data;
+ mojo_base.mojom.ReadOnlySharedMemoryRegion frame_data;
// Stride and offsets for each plane. Offsets are relative to the start
// of |frame_data|.
diff --git a/chromium/media/mojo/mojom/media_types_enum_mojom_traits.h b/chromium/media/mojo/mojom/media_types_enum_mojom_traits.h
index 21053131c3d..d7447964d49 100644
--- a/chromium/media/mojo/mojom/media_types_enum_mojom_traits.h
+++ b/chromium/media/mojo/mojom/media_types_enum_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/output_protection.mojom b/chromium/media/mojo/mojom/output_protection.mojom
index 0d09055e9c7..4dbb64bb5bb 100644
--- a/chromium/media/mojo/mojom/output_protection.mojom
+++ b/chromium/media/mojo/mojom/output_protection.mojom
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/pipeline_status_mojom_traits.h b/chromium/media/mojo/mojom/pipeline_status_mojom_traits.h
index 7981fbbac33..3a52f3c3647 100644
--- a/chromium/media/mojo/mojom/pipeline_status_mojom_traits.h
+++ b/chromium/media/mojo/mojom/pipeline_status_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/playback_events_recorder.mojom b/chromium/media/mojo/mojom/playback_events_recorder.mojom
index 4971c776c16..f074a59cdc9 100644
--- a/chromium/media/mojo/mojom/playback_events_recorder.mojom
+++ b/chromium/media/mojo/mojom/playback_events_recorder.mojom
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/provision_fetcher.mojom b/chromium/media/mojo/mojom/provision_fetcher.mojom
index ec0c04fa6de..9f5e07fc333 100644
--- a/chromium/media/mojo/mojom/provision_fetcher.mojom
+++ b/chromium/media/mojo/mojom/provision_fetcher.mojom
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/remoting.mojom b/chromium/media/mojo/mojom/remoting.mojom
index 860eb94e022..6d83f55d370 100644
--- a/chromium/media/mojo/mojom/remoting.mojom
+++ b/chromium/media/mojo/mojom/remoting.mojom
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/remoting_common.mojom b/chromium/media/mojo/mojom/remoting_common.mojom
index 8be37e8d078..1fb7c40550d 100644
--- a/chromium/media/mojo/mojom/remoting_common.mojom
+++ b/chromium/media/mojo/mojom/remoting_common.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/renderer.mojom b/chromium/media/mojo/mojom/renderer.mojom
index 83d3887b295..9077053c69d 100644
--- a/chromium/media/mojo/mojom/renderer.mojom
+++ b/chromium/media/mojo/mojom/renderer.mojom
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/renderer_extensions.mojom b/chromium/media/mojo/mojom/renderer_extensions.mojom
index 293ed504679..c326d52bd30 100644
--- a/chromium/media/mojo/mojom/renderer_extensions.mojom
+++ b/chromium/media/mojo/mojom/renderer_extensions.mojom
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -125,12 +125,10 @@ interface MediaFoundationRendererExtension {
// Notify that the frame has been displayed and can be reused.
NotifyFrameReleased(mojo_base.mojom.UnguessableToken frame_token);
- // Request a frame from the media engine if it is available for a specific
- // time.
+ // Request a frame from the media engine if it is available
// The frame will be returned async via the
// MediaFoundationRendererClientExtension::OnFrameAvailable callback.
- RequestNextFrameBetweenTimestamps(mojo_base.mojom.TimeTicks deadline_min,
- mojo_base.mojom.TimeTicks deadline_max);
+ RequestNextFrame();
// Notify which rendering mode to be using for future video frames.
SetMediaFoundationRenderingMode(MediaFoundationRenderingMode mode);
diff --git a/chromium/media/mojo/mojom/speech_recognition.mojom b/chromium/media/mojo/mojom/speech_recognition.mojom
index 39a14db269e..b7e7a2b1836 100644
--- a/chromium/media/mojo/mojom/speech_recognition.mojom
+++ b/chromium/media/mojo/mojom/speech_recognition.mojom
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -176,8 +176,23 @@ enum SpeechRecognitionMode {
kCaption,
};
+// Which Chrome/ChromeOS application that is triggering the
+// speech recognition session to start.
+[Stable, Extensible]
+enum RecognizerClientType {
+ [Default] kUnknown,
+ // Dictation on ChromeOS.
+ kDictation,
+ // LiveCaption on Chrome/ChromeOS.
+ kLiveCaption,
+ // Projector on ChromeOS.
+ kProjector,
+ // CastModerator on ChromeOS.
+ kCastModerator,
+};
+
// Options for speech recognition.
-// TODO(crbug.com/1165437): Add option to include timing metrics in the result.
+// Next version: 2
[Stable]
struct SpeechRecognitionOptions {
// What kind of recognition to use.
@@ -194,4 +209,10 @@ struct SpeechRecognitionOptions {
// can use its own language. Right now Language is only used by Projector
// and Dictation via OnDeviceSpeechRecognizer in Chrome OS.
string? language;
+
+ // Whether the recognition is happening on-device or remotely on a server.
+ [MinVersion=1] bool is_server_based;
+
+ // Which client is requesting the speech recognition session.
+ [MinVersion=1] RecognizerClientType recognizer_client_type;
};
diff --git a/chromium/media/mojo/mojom/speech_recognition_result.cc b/chromium/media/mojo/mojom/speech_recognition_result.cc
index eb99456e8dd..09e68bf8b9f 100644
--- a/chromium/media/mojo/mojom/speech_recognition_result.cc
+++ b/chromium/media/mojo/mojom/speech_recognition_result.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/speech_recognition_result.h b/chromium/media/mojo/mojom/speech_recognition_result.h
index 269388b5f40..0c0718c59c1 100644
--- a/chromium/media/mojo/mojom/speech_recognition_result.h
+++ b/chromium/media/mojo/mojom/speech_recognition_result.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.cc b/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.cc
index 77c516188be..f40bba47454 100644
--- a/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.h b/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.h
index addceb988da..81888301ed3 100644
--- a/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.h
+++ b/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits_unittest.cc b/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits_unittest.cc
index 517e3817e4b..54e9b45e563 100644
--- a/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits_unittest.cc
+++ b/chromium/media/mojo/mojom/speech_recognition_result_mojom_traits_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/speech_recognition_service.mojom b/chromium/media/mojo/mojom/speech_recognition_service.mojom
index 60daf9b600b..5f8bb511aa7 100644
--- a/chromium/media/mojo/mojom/speech_recognition_service.mojom
+++ b/chromium/media/mojo/mojom/speech_recognition_service.mojom
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,7 +10,6 @@ import "media/mojo/mojom/audio_stream_factory.mojom";
import "media/mojo/mojom/media_types.mojom";
import "media/mojo/mojom/speech_recognition.mojom";
import "mojo/public/mojom/base/file_path.mojom";
-import "mojo/public/mojom/base/time.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
// Like a SpeechRecognitionContext, except it binds AudioSourceFetcher speech
diff --git a/chromium/media/mojo/mojom/stable/BUILD.gn b/chromium/media/mojo/mojom/stable/BUILD.gn
index 6f1b0d3b140..dd961a6853f 100644
--- a/chromium/media/mojo/mojom/stable/BUILD.gn
+++ b/chromium/media/mojo/mojom/stable/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2021 The Chromium Authors. All rights reserved.
+# Copyright 2021 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/stable/native_pixmap_handle.mojom b/chromium/media/mojo/mojom/stable/native_pixmap_handle.mojom
index 765e6773130..d3fc32c971d 100644
--- a/chromium/media/mojo/mojom/stable/native_pixmap_handle.mojom
+++ b/chromium/media/mojo/mojom/stable/native_pixmap_handle.mojom
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.cc b/chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.cc
index 8e695ffddc7..4fac7a099c4 100644
--- a/chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.h b/chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.h
index 5b611da8753..2cf0c86456a 100644
--- a/chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.h
+++ b/chromium/media/mojo/mojom/stable/native_pixmap_handle_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/stable/stable_video_decoder.mojom b/chromium/media/mojo/mojom/stable/stable_video_decoder.mojom
index 83b6bd9484a..dcfb1a79aa1 100644
--- a/chromium/media/mojo/mojom/stable/stable_video_decoder.mojom
+++ b/chromium/media/mojo/mojom/stable/stable_video_decoder.mojom
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/stable/stable_video_decoder_types.mojom b/chromium/media/mojo/mojom/stable/stable_video_decoder_types.mojom
index 1f9b0058769..02acd4ede67 100644
--- a/chromium/media/mojo/mojom/stable/stable_video_decoder_types.mojom
+++ b/chromium/media/mojo/mojom/stable/stable_video_decoder_types.mojom
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -525,7 +525,7 @@ struct MediaLogRecord {
int32 id@0;
Type type@1;
- mojo_base.mojom.DeprecatedDictionaryValue params@2;
+ mojo_base.mojom.DictionaryValue params@2;
mojo_base.mojom.TimeTicks time@3;
};
diff --git a/chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc b/chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
index 844405a1035..d712808d32c 100644
--- a/chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -686,11 +686,11 @@ StructTraits<media::stable::mojom::MediaLogRecordDataView,
}
// static
-const base::Value& StructTraits<
+const base::Value::Dict& StructTraits<
media::stable::mojom::MediaLogRecordDataView,
media::MediaLogRecord>::params(const media::MediaLogRecord& input) {
static_assert(std::is_same<decltype(::media::MediaLogRecord::params),
- base::DictionaryValue>::value,
+ base::Value::Dict>::value,
"Unexpected type for media::MediaLogRecord::params. If you "
"need to change this assertion, please contact "
"chromeos-gfx-video@google.com.");
@@ -722,9 +722,7 @@ bool StructTraits<media::stable::mojom::MediaLogRecordDataView,
if (!data.ReadType(&output->type))
return false;
- if (!data.ReadParams(static_cast<base::Value*>(&output->params)))
- return false;
- if (!output->params.is_dict())
+ if (!data.ReadParams(&output->params))
return false;
if (!data.ReadTime(&output->time))
diff --git a/chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h b/chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
index 63c9a4d992c..358f5c2a338 100644
--- a/chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
+++ b/chromium/media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -681,7 +681,7 @@ struct StructTraits<media::stable::mojom::MediaLogRecordDataView,
static media::MediaLogRecord::Type type(const media::MediaLogRecord& input);
- static const base::Value& params(const media::MediaLogRecord& input);
+ static const base::Value::Dict& params(const media::MediaLogRecord& input);
static base::TimeTicks time(const media::MediaLogRecord& input);
diff --git a/chromium/media/mojo/mojom/status_mojom_traits.cc b/chromium/media/mojo/mojom/status_mojom_traits.cc
index 3f9433476aa..2556d4a2b7a 100644
--- a/chromium/media/mojo/mojom/status_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/status_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/status_mojom_traits.h b/chromium/media/mojo/mojom/status_mojom_traits.h
index 4e21f872de7..366bb75d510 100644
--- a/chromium/media/mojo/mojom/status_mojom_traits.h
+++ b/chromium/media/mojo/mojom/status_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.cc b/chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.cc
index 95651813ee4..09e3c04510f 100644
--- a/chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.h b/chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.h
index ac43d30ecbf..276468773f7 100644
--- a/chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.h
+++ b/chromium/media/mojo/mojom/supported_video_decoder_config_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/traits_test_service.mojom b/chromium/media/mojo/mojom/traits_test_service.mojom
index 8e02156cb1f..34823ca0e05 100644
--- a/chromium/media/mojo/mojom/traits_test_service.mojom
+++ b/chromium/media/mojo/mojom/traits_test_service.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_color_space_mojom_traits.h b/chromium/media/mojo/mojom/video_color_space_mojom_traits.h
index dde2e551ea6..ca16dbd81ad 100644
--- a/chromium/media/mojo/mojom/video_color_space_mojom_traits.h
+++ b/chromium/media/mojo/mojom/video_color_space_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_decode_perf_history.mojom b/chromium/media/mojo/mojom/video_decode_perf_history.mojom
index cd66b26bdb5..32526979146 100644
--- a/chromium/media/mojo/mojom/video_decode_perf_history.mojom
+++ b/chromium/media/mojo/mojom/video_decode_perf_history.mojom
@@ -1,11 +1,10 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
import "media/mojo/mojom/media_types.mojom";
-import "ui/gfx/geometry/mojom/geometry.mojom";
// This service will query the history of playback stats to evaluate how
// a video stream with the given configuration will perform.
diff --git a/chromium/media/mojo/mojom/video_decode_stats_recorder.mojom b/chromium/media/mojo/mojom/video_decode_stats_recorder.mojom
index 478590758f3..ea3d0402a65 100644
--- a/chromium/media/mojo/mojom/video_decode_stats_recorder.mojom
+++ b/chromium/media/mojo/mojom/video_decode_stats_recorder.mojom
@@ -1,11 +1,10 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
import "media/mojo/mojom/media_types.mojom";
-import "ui/gfx/geometry/mojom/geometry.mojom";
// Interface for media players in the renderer to send decode stats to the
// browser process. Each player will have its own recorder instance.
diff --git a/chromium/media/mojo/mojom/video_decoder.mojom b/chromium/media/mojo/mojom/video_decoder.mojom
index c19e33e5baf..86054af88f0 100644
--- a/chromium/media/mojo/mojom/video_decoder.mojom
+++ b/chromium/media/mojo/mojom/video_decoder.mojom
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_decoder_config_mojom_traits.cc b/chromium/media/mojo/mojom/video_decoder_config_mojom_traits.cc
index f968638da35..fbb3712eba8 100644
--- a/chromium/media/mojo/mojom/video_decoder_config_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/video_decoder_config_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_decoder_config_mojom_traits.h b/chromium/media/mojo/mojom/video_decoder_config_mojom_traits.h
index 089395f9a0f..f79c60f0037 100644
--- a/chromium/media/mojo/mojom/video_decoder_config_mojom_traits.h
+++ b/chromium/media/mojo/mojom/video_decoder_config_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_decoder_config_mojom_traits_unittest.cc b/chromium/media/mojo/mojom/video_decoder_config_mojom_traits_unittest.cc
index 878b4880368..b2ac632977a 100644
--- a/chromium/media/mojo/mojom/video_decoder_config_mojom_traits_unittest.cc
+++ b/chromium/media/mojo/mojom/video_decoder_config_mojom_traits_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_encode_accelerator.mojom b/chromium/media/mojo/mojom/video_encode_accelerator.mojom
index 9e720fdf94a..41c67a81085 100644
--- a/chromium/media/mojo/mojom/video_encode_accelerator.mojom
+++ b/chromium/media/mojo/mojom/video_encode_accelerator.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc b/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc
index 0a098ea4eda..16f1c0cc360 100644
--- a/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.h b/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.h
index 2a8d33c81ef..b7ca8c48ac0 100644
--- a/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.h
+++ b/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits_unittest.cc b/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits_unittest.cc
index ec2add2e610..23433a61495 100644
--- a/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits_unittest.cc
+++ b/chromium/media/mojo/mojom/video_encode_accelerator_mojom_traits_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_encoder_info.mojom b/chromium/media/mojo/mojom/video_encoder_info.mojom
index fbd84d6c92b..d6b3236fa81 100644
--- a/chromium/media/mojo/mojom/video_encoder_info.mojom
+++ b/chromium/media/mojo/mojom/video_encoder_info.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_encoder_info_mojom_traits.cc b/chromium/media/mojo/mojom/video_encoder_info_mojom_traits.cc
index b3907ecefbc..fd321d64d37 100644
--- a/chromium/media/mojo/mojom/video_encoder_info_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/video_encoder_info_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_encoder_info_mojom_traits.h b/chromium/media/mojo/mojom/video_encoder_info_mojom_traits.h
index f67c4f2b54f..fbe27ac9390 100644
--- a/chromium/media/mojo/mojom/video_encoder_info_mojom_traits.h
+++ b/chromium/media/mojo/mojom/video_encoder_info_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.cc b/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.cc
index c325ce720b8..31891a421e9 100644
--- a/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.h b/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.h
index 3f8ac3866b5..67b74d3debc 100644
--- a/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.h
+++ b/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits_unittest.cc b/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits_unittest.cc
index cf7090d8f33..a19524e5434 100644
--- a/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits_unittest.cc
+++ b/chromium/media/mojo/mojom/video_frame_metadata_mojom_traits_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_frame_mojom_traits.cc b/chromium/media/mojo/mojom/video_frame_mojom_traits.cc
index a4ee74cdee7..cdc4498f528 100644
--- a/chromium/media/mojo/mojom/video_frame_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/video_frame_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,7 +15,6 @@
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "media/base/color_plane_layout.h"
#include "media/base/format_utils.h"
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/mojom/video_frame_metadata_mojom_traits.h"
#include "mojo/public/cpp/base/time_mojom_traits.h"
#include "mojo/public/cpp/system/handle.h"
@@ -31,6 +30,73 @@ namespace mojo {
namespace {
+base::ReadOnlySharedMemoryRegion CreateRegion(const media::VideoFrame& frame,
+ std::vector<uint32_t>& offsets,
+ std::vector<int32_t>& strides) {
+ if (!media::IsYuvPlanar(frame.format()) || !media::IsOpaque(frame.format())) {
+ DLOG(ERROR) << "format is not opaque YUV: "
+ << VideoPixelFormatToString(frame.format());
+ return base::ReadOnlySharedMemoryRegion();
+ }
+
+ size_t num_planes = media::VideoFrame::NumPlanes(frame.format());
+ DCHECK_LE(num_planes, 3u);
+ offsets.resize(num_planes);
+ strides.resize(num_planes);
+ if (frame.storage_type() == media::VideoFrame::STORAGE_SHMEM) {
+ for (size_t i = 0; i < num_planes; ++i) {
+ // This offset computation is safe because the planes are in the single
+ // buffer, a single SharedMemoryBuffer. The first plane data must lie
+ // in the beginning of the buffer.
+ base::CheckedNumeric<intptr_t> offset =
+ reinterpret_cast<intptr_t>(frame.data(i));
+ offset -= reinterpret_cast<intptr_t>(frame.data(0));
+ if (!offset.AssignIfValid(&offsets[i])) {
+ DLOG(ERROR) << "Invalid offset: "
+ << static_cast<intptr_t>(frame.data(i) - frame.data(0));
+ return base::ReadOnlySharedMemoryRegion();
+ }
+
+ strides[i] = frame.stride(i);
+ }
+ return frame.shm_region()->Duplicate();
+ }
+
+ // |frame| is on-memory based VideoFrame. Creates a ReadOnlySharedMemoryRegion
+ // and copy the frame data to the region. This DCHECK is safe because of the
+ // the conditional in a calling function.
+ DCHECK(frame.storage_type() == media::VideoFrame::STORAGE_UNOWNED_MEMORY ||
+ frame.storage_type() == media::VideoFrame::STORAGE_OWNED_MEMORY);
+ std::vector<size_t> sizes(num_planes);
+ size_t aggregate_size = 0;
+ for (size_t i = 0; i < num_planes; ++i) {
+ strides[i] = frame.stride(i);
+ offsets[i] = aggregate_size;
+ sizes[i] = media::VideoFrame::Rows(i, frame.format(),
+ frame.coded_size().height()) *
+ strides[i];
+ aggregate_size += sizes[i];
+ }
+
+ auto mapped_region = base::ReadOnlySharedMemoryRegion::Create(aggregate_size);
+ if (!mapped_region.IsValid()) {
+ DLOG(ERROR) << "Can't create new frame backing memory";
+ return base::ReadOnlySharedMemoryRegion();
+ }
+
+ base::WritableSharedMemoryMapping& dst_mapping = mapped_region.mapping;
+ uint8_t* dst_data = dst_mapping.GetMemoryAs<uint8_t>();
+ // The data from |frame| may not be consecutive between planes. Copy data into
+ // a shared memory buffer which is tightly packed. Padding inside each planes
+ // are preserved.
+ for (size_t i = 0; i < num_planes; ++i) {
+ memcpy(dst_data + offsets[i], static_cast<const void*>(frame.data(i)),
+ sizes[i]);
+ }
+
+ return std::move(mapped_region.region);
+}
+
media::mojom::VideoFrameDataPtr MakeVideoFrameData(
const media::VideoFrame* input) {
if (input->metadata().end_of_stream) {
@@ -38,23 +104,19 @@ media::mojom::VideoFrameDataPtr MakeVideoFrameData(
media::mojom::EosVideoFrameData::New());
}
- if (input->storage_type() == media::VideoFrame::STORAGE_MOJO_SHARED_BUFFER) {
- const media::MojoSharedBufferVideoFrame* mojo_frame =
- static_cast<const media::MojoSharedBufferVideoFrame*>(input);
-
- base::UnsafeSharedMemoryRegion region =
- mojo_frame->shmem_region().Duplicate();
- DCHECK(region.IsValid());
- size_t num_planes = media::VideoFrame::NumPlanes(mojo_frame->format());
- std::vector<uint32_t> offsets(num_planes);
- std::vector<int32_t> strides(num_planes);
- for (size_t i = 0; i < num_planes; ++i) {
- offsets[i] = mojo_frame->PlaneOffset(i);
- strides[i] = mojo_frame->stride(i);
+ if (input->storage_type() == media::VideoFrame::STORAGE_SHMEM ||
+ input->storage_type() == media::VideoFrame::STORAGE_UNOWNED_MEMORY ||
+ input->storage_type() == media::VideoFrame::STORAGE_OWNED_MEMORY) {
+ std::vector<uint32_t> offsets;
+ std::vector<int32_t> strides;
+ auto region = CreateRegion(*input, offsets, strides);
+ if (!region.IsValid()) {
+ DLOG(ERROR) << "Failed to create region from VideoFrame";
+ return nullptr;
}
- return media::mojom::VideoFrameData::NewSharedBufferData(
- media::mojom::SharedBufferVideoFrameData::New(
+ return media::mojom::VideoFrameData::NewSharedMemoryData(
+ media::mojom::SharedMemoryVideoFrameData::New(
std::move(region), std::move(strides), std::move(offsets)));
}
@@ -129,23 +191,54 @@ bool StructTraits<media::mojom::VideoFrameDataView,
return false;
scoped_refptr<media::VideoFrame> frame;
- if (data.is_shared_buffer_data()) {
- media::mojom::SharedBufferVideoFrameDataDataView shared_buffer_data;
- data.GetSharedBufferDataDataView(&shared_buffer_data);
+ if (data.is_shared_memory_data()) {
+ media::mojom::SharedMemoryVideoFrameDataDataView shared_memory_data;
+ data.GetSharedMemoryDataDataView(&shared_memory_data);
- base::UnsafeSharedMemoryRegion region;
- if (!shared_buffer_data.ReadFrameData(&region))
+ base::ReadOnlySharedMemoryRegion region;
+ if (!shared_memory_data.ReadFrameData(&region))
return false;
mojo::ArrayDataView<uint32_t> offsets;
- shared_buffer_data.GetOffsetsDataView(&offsets);
+ shared_memory_data.GetOffsetsDataView(&offsets);
mojo::ArrayDataView<int32_t> strides;
- shared_buffer_data.GetStridesDataView(&strides);
+ shared_memory_data.GetStridesDataView(&strides);
- frame = media::MojoSharedBufferVideoFrame::Create(
- format, coded_size, visible_rect, natural_size, std::move(region),
- offsets, strides, timestamp);
+ base::ReadOnlySharedMemoryMapping mapping = region.Map();
+ if (!mapping.IsValid()) {
+ DLOG(ERROR) << "Failed to map ReadOnlySharedMemoryRegion";
+ return false;
+ }
+
+ const size_t num_planes = offsets.size();
+ if (num_planes == 0 || num_planes > 3) {
+ DLOG(ERROR) << "Invalid number of planes: " << num_planes;
+ return false;
+ }
+
+ uint8_t* addr[3] = {};
+ std::vector<media::ColorPlaneLayout> planes(num_planes);
+ for (size_t i = 0; i < num_planes; i++) {
+ addr[i] =
+ const_cast<uint8_t*>(mapping.GetMemoryAs<uint8_t>()) + offsets[i];
+ planes[i].stride = strides[i];
+ planes[i].offset = base::strict_cast<size_t>(offsets[i]);
+ planes[i].size = i + 1 < num_planes
+ ? offsets[i + 1] - offsets[i]
+ : mapping.size() - offsets[num_planes - 1];
+ }
+
+ auto layout = media::VideoFrameLayout::CreateWithPlanes(format, coded_size,
+ std::move(planes));
+ if (!layout) {
+ DLOG(ERROR) << "Invalid layout";
+ return false;
+ }
+ frame = media::VideoFrame::WrapExternalYuvDataWithLayout(
+ *layout, visible_rect, natural_size, addr[0], addr[1], addr[2],
+ timestamp);
+ frame->BackWithOwnedSharedMemory(std::move(region), std::move(mapping));
} else if (data.is_gpu_memory_buffer_data()) {
media::mojom::GpuMemoryBufferVideoFrameDataDataView gpu_memory_buffer_data;
data.GetGpuMemoryBufferDataDataView(&gpu_memory_buffer_data);
@@ -153,6 +246,7 @@ bool StructTraits<media::mojom::VideoFrameDataView,
gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle;
if (!gpu_memory_buffer_data.ReadGpuMemoryBufferHandle(
&gpu_memory_buffer_handle)) {
+ DLOG(ERROR) << "Failed to read GpuMemoryBufferHandle";
return false;
}
diff --git a/chromium/media/mojo/mojom/video_frame_mojom_traits.h b/chromium/media/mojo/mojom/video_frame_mojom_traits.h
index 93c515276e5..e55ea123757 100644
--- a/chromium/media/mojo/mojom/video_frame_mojom_traits.h
+++ b/chromium/media/mojo/mojom/video_frame_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_frame_mojom_traits_unittest.cc b/chromium/media/mojo/mojom/video_frame_mojom_traits_unittest.cc
index 13864dfe29b..1b6c6244eb8 100644
--- a/chromium/media/mojo/mojom/video_frame_mojom_traits_unittest.cc
+++ b/chromium/media/mojo/mojom/video_frame_mojom_traits_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,7 +13,6 @@
#include "gpu/command_buffer/common/sync_token.h"
#include "media/base/color_plane_layout.h"
#include "media/base/video_frame.h"
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/mojom/traits_test_service.mojom.h"
#include "media/video/fake_gpu_memory_buffer.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
@@ -76,25 +75,66 @@ TEST_F(VideoFrameStructTraitsTest, EOS) {
EXPECT_TRUE(frame->metadata().end_of_stream);
}
-TEST_F(VideoFrameStructTraitsTest, MojoSharedBufferVideoFrame) {
- VideoPixelFormat formats[] = {PIXEL_FORMAT_I420, PIXEL_FORMAT_NV12};
+TEST_F(VideoFrameStructTraitsTest, MappableVideoFrame) {
+ constexpr VideoFrame::StorageType storage_types[] = {
+ VideoFrame::STORAGE_SHMEM,
+ VideoFrame::STORAGE_OWNED_MEMORY,
+ VideoFrame::STORAGE_UNOWNED_MEMORY,
+ };
+ constexpr VideoPixelFormat formats[] = {PIXEL_FORMAT_I420, PIXEL_FORMAT_NV12};
+ constexpr gfx::Size kCodedSize(100, 100);
+ constexpr gfx::Rect kVisibleRect(kCodedSize);
+ constexpr gfx::Size kNaturalSize = kCodedSize;
+ constexpr double kFrameRate = 42.0;
+ constexpr base::TimeDelta kTimestamp = base::Seconds(100);
for (auto format : formats) {
- scoped_refptr<VideoFrame> frame =
- MojoSharedBufferVideoFrame::CreateDefaultForTesting(
- format, gfx::Size(100, 100), base::Seconds(100));
- frame->metadata().frame_rate = 42.0;
-
- ASSERT_TRUE(RoundTrip(&frame));
- ASSERT_TRUE(frame);
- EXPECT_FALSE(frame->metadata().end_of_stream);
- EXPECT_EQ(*frame->metadata().frame_rate, 42.0);
- EXPECT_EQ(frame->coded_size(), gfx::Size(100, 100));
- EXPECT_EQ(frame->timestamp(), base::Seconds(100));
-
- ASSERT_EQ(frame->storage_type(), VideoFrame::STORAGE_MOJO_SHARED_BUFFER);
- MojoSharedBufferVideoFrame* mojo_shared_buffer_frame =
- static_cast<MojoSharedBufferVideoFrame*>(frame.get());
- EXPECT_TRUE(mojo_shared_buffer_frame->shmem_region().IsValid());
+ for (auto storage_type : storage_types) {
+ scoped_refptr<media::VideoFrame> frame;
+ base::MappedReadOnlyRegion region;
+ if (storage_type == VideoFrame::STORAGE_OWNED_MEMORY) {
+ frame = media::VideoFrame::CreateFrame(format, kCodedSize, kVisibleRect,
+ kNaturalSize, kTimestamp);
+ } else {
+ std::vector<int32_t> strides =
+ VideoFrame::ComputeStrides(format, kCodedSize);
+ size_t aggregate_size = 0;
+ size_t sizes[3] = {};
+ for (size_t i = 0; i < strides.size(); ++i) {
+ sizes[i] = media::VideoFrame::Rows(i, format, kCodedSize.height()) *
+ strides[i];
+ aggregate_size += sizes[i];
+ }
+ region = base::ReadOnlySharedMemoryRegion::Create(aggregate_size);
+ ASSERT_TRUE(region.IsValid());
+
+ uint8_t* data[3] = {};
+ data[0] = const_cast<uint8_t*>(region.mapping.GetMemoryAs<uint8_t>());
+ for (size_t i = 1; i < strides.size(); ++i)
+ data[i] = data[i - 1] + sizes[i];
+
+ strides.resize(3, 0);
+ frame = media::VideoFrame::WrapExternalYuvData(
+ format, kCodedSize, kVisibleRect, kNaturalSize, strides[0],
+ strides[1], strides[2], data[0], data[1], data[2], kTimestamp);
+ if (storage_type == VideoFrame::STORAGE_SHMEM)
+ frame->BackWithSharedMemory(&region.region);
+ }
+
+ ASSERT_TRUE(frame);
+ frame->metadata().frame_rate = kFrameRate;
+ ASSERT_EQ(frame->storage_type(), storage_type);
+ ASSERT_TRUE(RoundTrip(&frame));
+ ASSERT_TRUE(frame);
+ EXPECT_FALSE(frame->metadata().end_of_stream);
+ EXPECT_EQ(frame->format(), format);
+ EXPECT_EQ(*frame->metadata().frame_rate, kFrameRate);
+ EXPECT_EQ(frame->coded_size(), kCodedSize);
+ EXPECT_EQ(frame->visible_rect(), kVisibleRect);
+ EXPECT_EQ(frame->natural_size(), kNaturalSize);
+ EXPECT_EQ(frame->timestamp(), kTimestamp);
+ ASSERT_EQ(frame->storage_type(), VideoFrame::STORAGE_SHMEM);
+ EXPECT_TRUE(frame->shm_region()->IsValid());
+ }
}
}
diff --git a/chromium/media/mojo/mojom/video_transformation_mojom_traits.cc b/chromium/media/mojo/mojom/video_transformation_mojom_traits.cc
index 14ff07017fc..58c2860cbd6 100644
--- a/chromium/media/mojo/mojom/video_transformation_mojom_traits.cc
+++ b/chromium/media/mojo/mojom/video_transformation_mojom_traits.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/video_transformation_mojom_traits.h b/chromium/media/mojo/mojom/video_transformation_mojom_traits.h
index bd53385d302..391708603de 100644
--- a/chromium/media/mojo/mojom/video_transformation_mojom_traits.h
+++ b/chromium/media/mojo/mojom/video_transformation_mojom_traits.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/watch_time_recorder.mojom b/chromium/media/mojo/mojom/watch_time_recorder.mojom
index 0bec65de8c0..2e92a1520f4 100644
--- a/chromium/media/mojo/mojom/watch_time_recorder.mojom
+++ b/chromium/media/mojo/mojom/watch_time_recorder.mojom
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/mojom/webrtc_video_perf.mojom b/chromium/media/mojo/mojom/webrtc_video_perf.mojom
index de410fd726c..32db0ce6a2d 100644
--- a/chromium/media/mojo/mojom/webrtc_video_perf.mojom
+++ b/chromium/media/mojo/mojom/webrtc_video_perf.mojom
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/BUILD.gn b/chromium/media/mojo/services/BUILD.gn
index 5bfd1e97021..b248b4cf27d 100644
--- a/chromium/media/mojo/services/BUILD.gn
+++ b/chromium/media/mojo/services/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -102,7 +102,6 @@ component("services") {
"//media/learning/impl",
"//media/learning/mojo:impl",
"//media/mojo/common",
- "//media/mojo/common:mojo_shared_buffer_video_frame",
"//services/metrics/public/cpp:metrics_cpp",
"//services/metrics/public/cpp:ukm_builders",
"//services/service_manager/public/mojom",
@@ -170,6 +169,8 @@ component("services") {
if (is_win) {
sources += [
+ "media_foundation_gpu_info_monitor.cc",
+ "media_foundation_gpu_info_monitor.h",
"media_foundation_mojo_media_client.cc",
"media_foundation_mojo_media_client.h",
"media_foundation_renderer_wrapper.cc",
@@ -195,7 +196,10 @@ component("services") {
public_deps += [ "//media/mojo/mojom/stable:stable_video_decoder" ]
- deps += [ "//media/gpu/chromeos" ]
+ deps += [
+ "//media/gpu/chromeos",
+ "//ui/ozone:ozone_switches",
+ ]
}
}
diff --git a/chromium/media/mojo/services/android_mojo_media_client.cc b/chromium/media/mojo/services/android_mojo_media_client.cc
index fee056b790f..82f5ca73aec 100644
--- a/chromium/media/mojo/services/android_mojo_media_client.cc
+++ b/chromium/media/mojo/services/android_mojo_media_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/android_mojo_media_client.h b/chromium/media/mojo/services/android_mojo_media_client.h
index 403ba4b0e50..7c27d008529 100644
--- a/chromium/media/mojo/services/android_mojo_media_client.h
+++ b/chromium/media/mojo/services/android_mojo_media_client.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/android_mojo_util.cc b/chromium/media/mojo/services/android_mojo_util.cc
index f91415e62a8..a5e580e27d8 100644
--- a/chromium/media/mojo/services/android_mojo_util.cc
+++ b/chromium/media/mojo/services/android_mojo_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/android_mojo_util.h b/chromium/media/mojo/services/android_mojo_util.h
index 3a41f51e251..31c989fe97e 100644
--- a/chromium/media/mojo/services/android_mojo_util.h
+++ b/chromium/media/mojo/services/android_mojo_util.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/cdm_service.cc b/chromium/media/mojo/services/cdm_service.cc
index 4ececfadf18..4cc301b7760 100644
--- a/chromium/media/mojo/services/cdm_service.cc
+++ b/chromium/media/mojo/services/cdm_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/cdm_service.h b/chromium/media/mojo/services/cdm_service.h
index 821804cdb82..c9c139850b6 100644
--- a/chromium/media/mojo/services/cdm_service.h
+++ b/chromium/media/mojo/services/cdm_service.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/cdm_service_broker.cc b/chromium/media/mojo/services/cdm_service_broker.cc
index cb48d8b2e50..64b2656be3e 100644
--- a/chromium/media/mojo/services/cdm_service_broker.cc
+++ b/chromium/media/mojo/services/cdm_service_broker.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/cdm_service_broker.h b/chromium/media/mojo/services/cdm_service_broker.h
index b056042f2be..a0d2c395ff4 100644
--- a/chromium/media/mojo/services/cdm_service_broker.h
+++ b/chromium/media/mojo/services/cdm_service_broker.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/cdm_service_broker_unittest.cc b/chromium/media/mojo/services/cdm_service_broker_unittest.cc
index 9daf307d80d..32e8f138897 100644
--- a/chromium/media/mojo/services/cdm_service_broker_unittest.cc
+++ b/chromium/media/mojo/services/cdm_service_broker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/cdm_service_unittest.cc b/chromium/media/mojo/services/cdm_service_unittest.cc
index d173a01f673..c3da53a19fe 100644
--- a/chromium/media/mojo/services/cdm_service_unittest.cc
+++ b/chromium/media/mojo/services/cdm_service_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/deferred_destroy_unique_receiver_set.h b/chromium/media/mojo/services/deferred_destroy_unique_receiver_set.h
index 41f941eaed7..932eed5f8b7 100644
--- a/chromium/media/mojo/services/deferred_destroy_unique_receiver_set.h
+++ b/chromium/media/mojo/services/deferred_destroy_unique_receiver_set.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/deferred_destroy_unique_receiver_set_unittest.cc b/chromium/media/mojo/services/deferred_destroy_unique_receiver_set_unittest.cc
index 1f1dd77a99d..2b0299f7eff 100644
--- a/chromium/media/mojo/services/deferred_destroy_unique_receiver_set_unittest.cc
+++ b/chromium/media/mojo/services/deferred_destroy_unique_receiver_set_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/gpu_mojo_media_client.cc b/chromium/media/mojo/services/gpu_mojo_media_client.cc
index cf047731cb7..8969b9c67fc 100644
--- a/chromium/media/mojo/services/gpu_mojo_media_client.cc
+++ b/chromium/media/mojo/services/gpu_mojo_media_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/gpu_mojo_media_client.h b/chromium/media/mojo/services/gpu_mojo_media_client.h
index 4fcad1f5ae4..be28b871074 100644
--- a/chromium/media/mojo/services/gpu_mojo_media_client.h
+++ b/chromium/media/mojo/services/gpu_mojo_media_client.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/gpu_mojo_media_client_android.cc b/chromium/media/mojo/services/gpu_mojo_media_client_android.cc
index 3760358e136..781adfb4935 100644
--- a/chromium/media/mojo/services/gpu_mojo_media_client_android.cc
+++ b/chromium/media/mojo/services/gpu_mojo_media_client_android.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/gpu_mojo_media_client_cros.cc b/chromium/media/mojo/services/gpu_mojo_media_client_cros.cc
index 2b6a4ff277d..acb247d4e78 100644
--- a/chromium/media/mojo/services/gpu_mojo_media_client_cros.cc
+++ b/chromium/media/mojo/services/gpu_mojo_media_client_cros.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -26,6 +26,10 @@ namespace {
VideoDecoderType GetPreferredCrosDecoderImplementation(
gpu::GpuPreferences gpu_preferences) {
+ // TODO(b/195769334): eventually, we may turn off USE_VAAPI and USE_V4L2_CODEC
+ // on LaCrOS if we delegate all video acceleration to ash-chrome. In those
+ // cases, GetPreferredCrosDecoderImplementation() won't be able to determine
+ // the video API in LaCrOS.
if (gpu_preferences.disable_accelerated_video_decode)
return VideoDecoderType::kUnknown;
@@ -48,8 +52,8 @@ VideoDecoderType GetPreferredLinuxDecoderImplementation(
if (!base::FeatureList::IsEnabled(kVaapiVideoDecodeLinux))
return VideoDecoderType::kUnknown;
- // Regardless of vulkan support, if direct video decoder is disabled, revert
- // to using the VDA implementation.
+ // If direct video decoder is disabled, revert to using the VDA
+ // implementation.
if (!base::FeatureList::IsEnabled(kUseChromeOSDirectVideoDecoder))
return VideoDecoderType::kVda;
return VideoDecoderType::kVaapi;
@@ -73,8 +77,12 @@ VideoDecoderType GetActualPlatformDecoderImplementation(
: VideoDecoderType::kUnknown;
}
case VideoDecoderType::kVaapi: {
+ // Allow VaapiVideoDecoder on GL.
+ if (gpu_preferences.gr_context_type == gpu::GrContextType::kGL)
+ return VideoDecoderType::kVaapi;
if (gpu_preferences.gr_context_type != gpu::GrContextType::kVulkan)
return VideoDecoderType::kUnknown;
+ // If Vulkan is active, check Vulkan info if VaapiVideoDecoder is allowed.
if (!gpu_info.vulkan_info.has_value())
return VideoDecoderType::kUnknown;
if (gpu_info.vulkan_info->physical_devices.empty())
@@ -107,49 +115,46 @@ VideoDecoderType GetActualPlatformDecoderImplementation(
std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder(
VideoDecoderTraits& traits) {
- // TODO(b/195769334): we'll need to structure this function a bit differently
- // to account for the following:
- //
- // 1) Eventually, we may turn off USE_VAAPI and USE_V4L2_CODEC on LaCrOS if we
- // delegate all video acceleration to ash-chrome. In those cases,
- // GetPreferredCrosDecoderImplementation() won't be able to determine the
- // video API in LaCrOS.
- //
- // 2) For out-of-process video decoding, we don't need a |frame_pool| because
- // the buffers will be allocated and managed out-of-process.
- //
- // 3) It's very possible that not all platforms will be able to migrate to the
- // direct VD soon enough. In those cases, the GPU process will still need
- // to use a VideoDecoderPipeline backed by an OOPVideoDecoder, and the
- // video decoder process will need to run the legacy VDA code and return
- // GpuMemoryBuffers.
+ if (traits.oop_video_decoder) {
+ // TODO(b/195769334): for out-of-process video decoding, we don't need a
+ // |frame_pool| because the buffers will be allocated and managed
+ // out-of-process.
+ auto frame_pool = std::make_unique<PlatformVideoFramePool>();
+
+ // With out-of-process video decoding, we don't feed wrapped frames to the
+ // MailboxVideoFrameConverter, so we need to pass base::NullCallback() as
+ // the callback for unwrapping.
+ auto frame_converter = MailboxVideoFrameConverter::Create(
+ /*unwrap_frame_cb=*/base::NullCallback(), traits.gpu_task_runner,
+ traits.get_command_buffer_stub_cb,
+ traits.gpu_preferences.enable_unsafe_webgpu);
+ return VideoDecoderPipeline::Create(
+ *traits.gpu_workarounds, traits.task_runner, std::move(frame_pool),
+ std::move(frame_converter), traits.media_log->Clone(),
+ std::move(traits.oop_video_decoder));
+ }
switch (GetActualPlatformDecoderImplementation(traits.gpu_preferences,
traits.gpu_info)) {
case VideoDecoderType::kVaapi:
case VideoDecoderType::kV4L2: {
auto frame_pool = std::make_unique<PlatformVideoFramePool>();
-
- // With out-of-process video decoding, we don't feed wrapped frames to the
- // MailboxVideoFrameConverter.
- MailboxVideoFrameConverter::UnwrapFrameCB unwrap_frame_cb =
- traits.oop_video_decoder
- ? base::NullCallback()
- : base::BindRepeating(&PlatformVideoFramePool::UnwrapFrame,
- base::Unretained(frame_pool.get()));
auto frame_converter = MailboxVideoFrameConverter::Create(
- std::move(unwrap_frame_cb), traits.gpu_task_runner,
- traits.get_command_buffer_stub_cb,
+ base::BindRepeating(&PlatformVideoFramePool::UnwrapFrame,
+ base::Unretained(frame_pool.get())),
+ traits.gpu_task_runner, traits.get_command_buffer_stub_cb,
traits.gpu_preferences.enable_unsafe_webgpu);
return VideoDecoderPipeline::Create(
- traits.task_runner, std::move(frame_pool), std::move(frame_converter),
- traits.media_log->Clone(), std::move(traits.oop_video_decoder));
+ *traits.gpu_workarounds, traits.task_runner, std::move(frame_pool),
+ std::move(frame_converter), traits.media_log->Clone(),
+ /*oop_video_decoder=*/{});
}
case VideoDecoderType::kVda: {
return VdaVideoDecoder::Create(
traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(),
*traits.target_color_space, traits.gpu_preferences,
- *traits.gpu_workarounds, traits.get_command_buffer_stub_cb);
+ *traits.gpu_workarounds, traits.get_command_buffer_stub_cb,
+ VideoDecodeAccelerator::Config::OutputMode::ALLOCATE);
}
default: {
return nullptr;
diff --git a/chromium/media/mojo/services/gpu_mojo_media_client_mac.cc b/chromium/media/mojo/services/gpu_mojo_media_client_mac.cc
index 4bf6fd884b8..ea9341c4410 100644
--- a/chromium/media/mojo/services/gpu_mojo_media_client_mac.cc
+++ b/chromium/media/mojo/services/gpu_mojo_media_client_mac.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,7 +17,8 @@ std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder(
return VdaVideoDecoder::Create(
traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(),
*traits.target_color_space, traits.gpu_preferences,
- *traits.gpu_workarounds, traits.get_command_buffer_stub_cb);
+ *traits.gpu_workarounds, traits.get_command_buffer_stub_cb,
+ VideoDecodeAccelerator::Config::OutputMode::ALLOCATE);
}
absl::optional<SupportedVideoDecoderConfigs>
diff --git a/chromium/media/mojo/services/gpu_mojo_media_client_stubs.cc b/chromium/media/mojo/services/gpu_mojo_media_client_stubs.cc
index b96de020c83..df0dde6d920 100644
--- a/chromium/media/mojo/services/gpu_mojo_media_client_stubs.cc
+++ b/chromium/media/mojo/services/gpu_mojo_media_client_stubs.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/gpu_mojo_media_client_win.cc b/chromium/media/mojo/services/gpu_mojo_media_client_win.cc
index df7123c374e..d8bb56ba504 100644
--- a/chromium/media/mojo/services/gpu_mojo_media_client_win.cc
+++ b/chromium/media/mojo/services/gpu_mojo_media_client_win.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,10 +9,9 @@
#include "media/base/audio_decoder.h"
#include "media/base/media_switches.h"
#include "media/base/offloading_audio_encoder.h"
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
#include "media/filters/win/media_foundation_audio_decoder.h"
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
#include "media/gpu/ipc/service/vda_video_decoder.h"
#include "media/gpu/windows/d3d11_video_decoder.h"
#include "media/gpu/windows/mf_audio_encoder.h"
@@ -44,7 +43,8 @@ std::unique_ptr<VideoDecoder> CreatePlatformVideoDecoder(
return VdaVideoDecoder::Create(
traits.task_runner, traits.gpu_task_runner, traits.media_log->Clone(),
*traits.target_color_space, traits.gpu_preferences,
- *traits.gpu_workarounds, traits.get_command_buffer_stub_cb);
+ *traits.gpu_workarounds, traits.get_command_buffer_stub_cb,
+ VideoDecodeAccelerator::Config::OutputMode::ALLOCATE);
}
// Report that HDR is enabled if any display has HDR enabled.
bool hdr_enabled = false;
@@ -74,6 +74,8 @@ GetPlatformSupportedVideoDecoderConfigs(
const gpu::GPUInfo& gpu_info,
base::OnceCallback<SupportedVideoDecoderConfigs()> get_vda_configs) {
SupportedVideoDecoderConfigs supported_configs;
+ if (gpu_preferences.disable_accelerated_video_decode)
+ return supported_configs;
if (ShouldUseD3D11VideoDecoder(gpu_workarounds)) {
supported_configs = D3D11VideoDecoder::GetSupportedVideoDecoderConfigs(
gpu_preferences, gpu_workarounds, GetD3D11DeviceCallback());
@@ -85,12 +87,11 @@ GetPlatformSupportedVideoDecoderConfigs(
std::unique_ptr<AudioDecoder> CreatePlatformAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
return MediaFoundationAudioDecoder::Create(std::move(task_runner));
-#else
+#else // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
return nullptr;
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
}
VideoDecoderType GetPlatformDecoderImplementationType(
diff --git a/chromium/media/mojo/services/interface_factory_impl.cc b/chromium/media/mojo/services/interface_factory_impl.cc
index 30bcba60448..fbecdd2103d 100644
--- a/chromium/media/mojo/services/interface_factory_impl.cc
+++ b/chromium/media/mojo/services/interface_factory_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -237,10 +237,11 @@ bool InterfaceFactoryImpl::IsEmpty() {
return false;
#endif // BUILDFLAG(ENABLE_MOJO_AUDIO_ENCODER)
-#if BUILDFLAG(ENABLE_MOJO_RENDERER)
+#if BUILDFLAG(ENABLE_MOJO_RENDERER) || BUILDFLAG(ENABLE_CAST_RENDERER) || \
+ BUILDFLAG(IS_WIN)
if (!renderer_receivers_.empty())
return false;
-#endif // BUILDFLAG(ENABLE_MOJO_RENDERER)
+#endif
#if BUILDFLAG(ENABLE_MOJO_CDM)
if (!cdm_receivers_.empty())
@@ -272,9 +273,10 @@ void InterfaceFactoryImpl::SetReceiverDisconnectHandler() {
audio_encoder_receivers_.set_disconnect_handler(disconnect_cb);
#endif // BUILDFLAG(ENABLE_MOJO_AUDIO_ENCODER)
-#if BUILDFLAG(ENABLE_MOJO_RENDERER)
+#if BUILDFLAG(ENABLE_MOJO_RENDERER) || BUILDFLAG(ENABLE_CAST_RENDERER) || \
+ BUILDFLAG(IS_WIN)
renderer_receivers_.set_disconnect_handler(disconnect_cb);
-#endif // BUILDFLAG(ENABLE_MOJO_RENDERER)
+#endif
#if BUILDFLAG(ENABLE_MOJO_CDM)
cdm_receivers_.set_disconnect_handler(disconnect_cb);
diff --git a/chromium/media/mojo/services/interface_factory_impl.h b/chromium/media/mojo/services/interface_factory_impl.h
index 29176b994ae..dec82db3bd2 100644
--- a/chromium/media/mojo/services/interface_factory_impl.h
+++ b/chromium/media/mojo/services/interface_factory_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_foundation_gpu_info_monitor.cc b/chromium/media/mojo/services/media_foundation_gpu_info_monitor.cc
new file mode 100644
index 00000000000..078901b45cd
--- /dev/null
+++ b/chromium/media/mojo/services/media_foundation_gpu_info_monitor.cc
@@ -0,0 +1,32 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/mojo/services/media_foundation_gpu_info_monitor.h"
+
+namespace media {
+
+// static
+MediaFoundationGpuInfoMonitor* MediaFoundationGpuInfoMonitor::GetInstance() {
+ static auto* instance = new MediaFoundationGpuInfoMonitor();
+ return instance;
+}
+
+MediaFoundationGpuInfoMonitor::MediaFoundationGpuInfoMonitor() = default;
+MediaFoundationGpuInfoMonitor::~MediaFoundationGpuInfoMonitor() = default;
+
+void MediaFoundationGpuInfoMonitor::UpdateGpuInfo(
+ const gpu::GPUInfo& gpu_info) {
+ auto new_gpu_luid = gpu_info.active_gpu().luid;
+ if (new_gpu_luid != gpu_luid_) {
+ gpu_luid_ = new_gpu_luid;
+ luid_observers_.Notify(new_gpu_luid);
+ }
+}
+
+base::CallbackListSubscription MediaFoundationGpuInfoMonitor::AddLuidObserver(
+ MediaFoundationGpuInfoMonitor::LuidObservers::CallbackType cb) {
+ return luid_observers_.Add(std::move(cb));
+}
+
+} // namespace media \ No newline at end of file
diff --git a/chromium/media/mojo/services/media_foundation_gpu_info_monitor.h b/chromium/media/mojo/services/media_foundation_gpu_info_monitor.h
new file mode 100644
index 00000000000..4f1d01714f7
--- /dev/null
+++ b/chromium/media/mojo/services/media_foundation_gpu_info_monitor.h
@@ -0,0 +1,44 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_GPU_INFO_MONITOR_H_
+#define MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_GPU_INFO_MONITOR_H_
+
+#include "base/callback.h"
+#include "base/callback_list.h"
+#include "base/win/windows_types.h"
+#include "gpu/config/gpu_info.h"
+#include "media/mojo/services/media_mojo_export.h"
+
+namespace media {
+
+// A singleton class keeps track of GPUInfo and manages notifications.
+class MEDIA_MOJO_EXPORT MediaFoundationGpuInfoMonitor {
+ public:
+ static MediaFoundationGpuInfoMonitor* GetInstance();
+
+ MediaFoundationGpuInfoMonitor();
+ MediaFoundationGpuInfoMonitor(const MediaFoundationGpuInfoMonitor&) = delete;
+ MediaFoundationGpuInfoMonitor operator=(
+ const MediaFoundationGpuInfoMonitor&) = delete;
+ ~MediaFoundationGpuInfoMonitor();
+
+ // Updates GpuInfo in `this` and notify observers if needed.
+ void UpdateGpuInfo(const gpu::GPUInfo& gpu_info);
+
+ CHROME_LUID gpu_luid() const { return gpu_luid_; }
+
+ // Adds an observer to get notified on GPU LUID changes.
+ using LuidObservers = base::RepeatingCallbackList<void(const CHROME_LUID&)>;
+ base::CallbackListSubscription AddLuidObserver(
+ LuidObservers::CallbackType cb);
+
+ private:
+ CHROME_LUID gpu_luid_;
+ LuidObservers luid_observers_;
+};
+
+} // namespace media
+
+#endif // MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_GPU_INFO_MONITOR_H_
diff --git a/chromium/media/mojo/services/media_foundation_mojo_media_client.cc b/chromium/media/mojo/services/media_foundation_mojo_media_client.cc
index 37197d1fcf2..2279639b845 100644
--- a/chromium/media/mojo/services/media_foundation_mojo_media_client.cc
+++ b/chromium/media/mojo/services/media_foundation_mojo_media_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,10 +8,9 @@
#include "media/cdm/win/media_foundation_cdm_factory.h"
#include "media/mojo/services/media_foundation_renderer_wrapper.h"
#include "media/mojo/services/mojo_cdm_helper.h"
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
#include "media/filters/win/media_foundation_audio_decoder.h"
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
namespace media {
@@ -26,12 +25,11 @@ MediaFoundationMojoMediaClient::~MediaFoundationMojoMediaClient() {
std::unique_ptr<AudioDecoder>
MediaFoundationMojoMediaClient::CreateAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
-#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
return std::make_unique<MediaFoundationAudioDecoder>(task_runner);
-#else
+#else // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
return nullptr;
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) &&
- // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
}
std::unique_ptr<Renderer>
diff --git a/chromium/media/mojo/services/media_foundation_mojo_media_client.h b/chromium/media/mojo/services/media_foundation_mojo_media_client.h
index 294a8e3cae7..27545e5c66e 100644
--- a/chromium/media/mojo/services/media_foundation_mojo_media_client.h
+++ b/chromium/media/mojo/services/media_foundation_mojo_media_client.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_foundation_renderer_wrapper.cc b/chromium/media/mojo/services/media_foundation_renderer_wrapper.cc
index c4ecb8ace60..3a16cabf69b 100644
--- a/chromium/media/mojo/services/media_foundation_renderer_wrapper.cc
+++ b/chromium/media/mojo/services/media_foundation_renderer_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "base/callback_helpers.h"
#include "media/base/win/mf_helpers.h"
#include "media/mojo/mojom/renderer_extensions.mojom.h"
+#include "media/mojo/services/media_foundation_gpu_info_monitor.h"
#include "media/mojo/services/mojo_media_log.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
#include "mojo/public/cpp/system/platform_handle.h"
@@ -46,19 +47,20 @@ MediaFoundationRendererWrapper::MediaFoundationRendererWrapper(
renderer_extension_receiver_(this,
std::move(renderer_extension_receiver)),
client_extension_remote_(std::move(client_extension_remote), task_runner),
- site_mute_observer_(this),
- gpu_info_observer_(this) {
+ site_mute_observer_(this) {
DVLOG_FUNC(1);
DCHECK(frame_interfaces_);
- CHROME_LUID adapter_luid;
- frame_interfaces_->RegisterGpuInfoObserver(
- gpu_info_observer_.BindNewPipeAndPassRemote(), &adapter_luid);
- LUID gpu_process_adapter_luid = ChromeLuidToLuid(adapter_luid);
renderer_ = std::make_unique<MediaFoundationRenderer>(
std::move(task_runner),
std::make_unique<MojoMediaLog>(std::move(media_log_remote), task_runner),
- gpu_process_adapter_luid);
+ ChromeLuidToLuid(
+ MediaFoundationGpuInfoMonitor::GetInstance()->gpu_luid()));
+
+ luid_update_subscription_ =
+ MediaFoundationGpuInfoMonitor::GetInstance()->AddLuidObserver(
+ base::BindRepeating(&MediaFoundationRendererWrapper::OnGpuLuidChange,
+ weak_factory_.GetWeakPtr()));
}
MediaFoundationRendererWrapper::~MediaFoundationRendererWrapper() {
@@ -154,8 +156,7 @@ void MediaFoundationRendererWrapper::OnMuteStateChange(bool muted) {
void MediaFoundationRendererWrapper::OnGpuLuidChange(
const CHROME_LUID& adapter_luid) {
- LUID gpu_process_adapter_luid = ChromeLuidToLuid(adapter_luid);
- renderer_->SetGpuProcessAdapterLuid(gpu_process_adapter_luid);
+ renderer_->SetGpuProcessAdapterLuid(ChromeLuidToLuid(adapter_luid));
}
void MediaFoundationRendererWrapper::OnReceiveDCOMPSurface(
@@ -230,10 +231,8 @@ void MediaFoundationRendererWrapper::NotifyFrameReleased(
renderer_->NotifyFrameReleased(frame_token);
}
-void MediaFoundationRendererWrapper::RequestNextFrameBetweenTimestamps(
- base::TimeTicks deadline_min,
- base::TimeTicks deadline_max) {
- renderer_->RequestNextFrameBetweenTimestamps(deadline_min, deadline_max);
+void MediaFoundationRendererWrapper::RequestNextFrame() {
+ renderer_->RequestNextFrame();
}
void MediaFoundationRendererWrapper::SetMediaFoundationRenderingMode(
diff --git a/chromium/media/mojo/services/media_foundation_renderer_wrapper.h b/chromium/media/mojo/services/media_foundation_renderer_wrapper.h
index 9a7ded2a2fc..f59061dc8f2 100644
--- a/chromium/media/mojo/services/media_foundation_renderer_wrapper.h
+++ b/chromium/media/mojo/services/media_foundation_renderer_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#define MEDIA_MOJO_SERVICES_MEDIA_FOUNDATION_RENDERER_WRAPPER_H_
#include "base/callback.h"
+#include "base/callback_list.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "media/base/media_resource.h"
@@ -27,8 +28,7 @@ namespace media {
class MediaFoundationRendererWrapper final
: public Renderer,
public mojom::MediaFoundationRendererExtension,
- public mojom::MuteStateObserver,
- public mojom::GpuInfoObserver {
+ public mojom::MuteStateObserver {
public:
using RendererExtension = mojom::MediaFoundationRendererExtension;
using ClientExtension = mojom::MediaFoundationRendererClientExtension;
@@ -63,18 +63,15 @@ class MediaFoundationRendererWrapper final
void SetOutputRect(const gfx::Rect& output_rect,
SetOutputRectCallback callback) override;
void NotifyFrameReleased(const base::UnguessableToken& frame_token) override;
- void RequestNextFrameBetweenTimestamps(base::TimeTicks deadline_min,
- base::TimeTicks deadline_max) override;
+ void RequestNextFrame() override;
void SetMediaFoundationRenderingMode(
MediaFoundationRenderingMode mode) override;
// mojom::MuteStateObserver implementation.
void OnMuteStateChange(bool muted) override;
- // mojom::GpuInfoObserver
- void OnGpuLuidChange(const CHROME_LUID& adapter_luid) override;
-
private:
+ void OnGpuLuidChange(const CHROME_LUID& adapter_luid);
void OnReceiveDCOMPSurface(GetDCOMPSurfaceCallback callback,
base::win::ScopedHandle handle,
const std::string& error);
@@ -95,7 +92,8 @@ class MediaFoundationRendererWrapper final
mojo::Remote<media::mojom::MediaFoundationRendererClientExtension>
client_extension_remote_;
mojo::Receiver<mojom::MuteStateObserver> site_mute_observer_;
- mojo::Receiver<mojom::GpuInfoObserver> gpu_info_observer_;
+
+ base::CallbackListSubscription luid_update_subscription_;
float volume_ = 1.0;
bool muted_ = false; // Whether the site (WebContents) is muted.
diff --git a/chromium/media/mojo/services/media_foundation_service.cc b/chromium/media/mojo/services/media_foundation_service.cc
index 151fb0fe70b..4064f93e23b 100644
--- a/chromium/media/mojo/services/media_foundation_service.cc
+++ b/chromium/media/mojo/services/media_foundation_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -319,6 +319,10 @@ absl::optional<CdmCapability> GetCdmCapability(
// assume all relevant profiles are supported.
VideoCodecInfo video_codec_info;
+ // `supports_clear_lead` should be set to false until detection for clear
+ // lead support is fixed and the query works as expected.
+ video_codec_info.supports_clear_lead = false;
+
#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) && BUILDFLAG(ENABLE_PLATFORM_HEVC)
// Dolby Vision on Windows only support profile 4/5/8 now.
if (video_codec == VideoCodec::kDolbyVision) {
diff --git a/chromium/media/mojo/services/media_foundation_service.h b/chromium/media/mojo/services/media_foundation_service.h
index 1b316597d54..d57562971e0 100644
--- a/chromium/media/mojo/services/media_foundation_service.h
+++ b/chromium/media/mojo/services/media_foundation_service.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "base/callback.h"
#include "base/files/file_path.h"
+#include "gpu/config/gpu_info.h"
#include "media/mojo/mojom/frame_interface_factory.mojom.h"
#include "media/mojo/mojom/interface_factory.mojom.h"
#include "media/mojo/mojom/media_foundation_service.mojom.h"
diff --git a/chromium/media/mojo/services/media_foundation_service_broker.cc b/chromium/media/mojo/services/media_foundation_service_broker.cc
index 314b2a43953..9ed36cf6717 100644
--- a/chromium/media/mojo/services/media_foundation_service_broker.cc
+++ b/chromium/media/mojo/services/media_foundation_service_broker.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "media/cdm/win/media_foundation_cdm_module.h"
+#include "media/mojo/services/media_foundation_gpu_info_monitor.h"
namespace media {
@@ -13,10 +14,18 @@ MediaFoundationServiceBroker::MediaFoundationServiceBroker(
mojo::PendingReceiver<mojom::MediaFoundationServiceBroker> receiver,
base::OnceClosure ensure_sandboxed_cb)
: receiver_(this, std::move(receiver)),
+ gpu_info_observer_(this),
ensure_sandboxed_cb_(std::move(ensure_sandboxed_cb)) {}
MediaFoundationServiceBroker::~MediaFoundationServiceBroker() = default;
+void MediaFoundationServiceBroker::UpdateGpuInfo(
+ const gpu::GPUInfo& gpu_info,
+ UpdateGpuInfoCallback callback) {
+ OnGpuInfoUpdate(gpu_info);
+ std::move(callback).Run(gpu_info_observer_.BindNewPipeAndPassRemote());
+}
+
void MediaFoundationServiceBroker::GetService(
const base::FilePath& cdm_path,
mojo::PendingReceiver<mojom::MediaFoundationService> service_receiver) {
@@ -34,4 +43,13 @@ void MediaFoundationServiceBroker::GetService(
std::make_unique<MediaFoundationService>(std::move(service_receiver));
}
+void MediaFoundationServiceBroker::OnGpuInfoUpdate(
+ const gpu::GPUInfo& gpu_info) {
+ // When the MediaFoundationService crashes, the GPUInfo will be available in
+ // the crash report.
+ DVLOG(1) << __func__;
+ gpu::SetKeysForCrashLogging(gpu_info);
+ MediaFoundationGpuInfoMonitor::GetInstance()->UpdateGpuInfo(gpu_info);
+}
+
} // namespace media
diff --git a/chromium/media/mojo/services/media_foundation_service_broker.h b/chromium/media/mojo/services/media_foundation_service_broker.h
index 92f31e7c55b..4d6c3d53da0 100644
--- a/chromium/media/mojo/services/media_foundation_service_broker.h
+++ b/chromium/media/mojo/services/media_foundation_service_broker.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,8 @@
#include "base/callback.h"
#include "base/files/file_path.h"
+#include "gpu/config/gpu_info.h"
+#include "gpu/config/gpu_util.h"
#include "media/mojo/mojom/media_foundation_service.mojom.h"
#include "media/mojo/services/media_foundation_service.h"
#include "media/mojo/services/media_mojo_export.h"
@@ -18,7 +20,8 @@
namespace media {
class MEDIA_MOJO_EXPORT MediaFoundationServiceBroker final
- : public mojom::MediaFoundationServiceBroker {
+ : public mojom::MediaFoundationServiceBroker,
+ public mojom::GpuInfoObserver {
public:
// The MediaFoundationServiceBroker process is NOT sandboxed after
// startup. The `ensure_sandboxed_cb` must be called after necessary
@@ -31,13 +34,19 @@ class MEDIA_MOJO_EXPORT MediaFoundationServiceBroker final
delete;
~MediaFoundationServiceBroker() final;
- // mojom::MediaFoundationServiceBroker implementation:
+ // mojom::MediaFoundationServiceBroker:
+ void UpdateGpuInfo(const gpu::GPUInfo& gpu_info,
+ UpdateGpuInfoCallback callback) final;
void GetService(const base::FilePath& cdm_path,
mojo::PendingReceiver<mojom::MediaFoundationService>
service_receiver) final;
+ // mojom::GpuInfoObserver:
+ void OnGpuInfoUpdate(const gpu::GPUInfo& gpu_info) final;
+
private:
mojo::Receiver<mojom::MediaFoundationServiceBroker> receiver_;
+ mojo::Receiver<mojom::GpuInfoObserver> gpu_info_observer_;
base::OnceClosure ensure_sandboxed_cb_;
std::unique_ptr<MediaFoundationService> media_foundation_service_;
};
diff --git a/chromium/media/mojo/services/media_metrics_provider.cc b/chromium/media/mojo/services/media_metrics_provider.cc
index e98ae88b413..88f2c7b6861 100644
--- a/chromium/media/mojo/services/media_metrics_provider.cc
+++ b/chromium/media/mojo/services/media_metrics_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "media/base/key_systems.h"
+#include "media/base/video_codecs.h"
#include "media/learning/mojo/mojo_learning_task_controller_service.h"
#include "media/mojo/services/video_decode_stats_recorder.h"
#include "media/mojo/services/watch_time_recorder.h"
@@ -103,22 +104,8 @@ MediaMetricsProvider::~MediaMetricsProvider() {
std::string MediaMetricsProvider::GetUMANameForAVStream(
const PipelineInfo& player_info) {
constexpr char kPipelineUmaPrefix[] = "Media.PipelineStatus.AudioVideo.";
- std::string uma_name = kPipelineUmaPrefix;
- // TODO(xhwang): Use a helper function to simply the codec name mapping.
- if (player_info.video_codec == VideoCodec::kVP8)
- uma_name += "VP8.";
- else if (player_info.video_codec == VideoCodec::kVP9)
- uma_name += "VP9.";
- else if (player_info.video_codec == VideoCodec::kH264)
- uma_name += "H264.";
- else if (player_info.video_codec == VideoCodec::kAV1)
- uma_name += "AV1.";
- else if (player_info.video_codec == VideoCodec::kHEVC)
- uma_name += "HEVC.";
- else if (player_info.video_codec == VideoCodec::kDolbyVision)
- uma_name += "DolbyVision.";
- else
- return uma_name + "Other";
+ std::string uma_name =
+ kPipelineUmaPrefix + GetCodecNameForUMA(player_info.video_codec) + ".";
// Add Renderer name when not using the default RendererImpl.
if (renderer_type_ == RendererType::kMediaFoundation) {
diff --git a/chromium/media/mojo/services/media_metrics_provider.h b/chromium/media/mojo/services/media_metrics_provider.h
index 5e8595f4884..55426438e76 100644
--- a/chromium/media/mojo/services/media_metrics_provider.h
+++ b/chromium/media/mojo/services/media_metrics_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_metrics_provider_unittest.cc b/chromium/media/mojo/services/media_metrics_provider_unittest.cc
index 94a53573c5b..2c29fa03e9d 100644
--- a/chromium/media/mojo/services/media_metrics_provider_unittest.cc
+++ b/chromium/media/mojo/services/media_metrics_provider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_mojo_export.h b/chromium/media/mojo/services/media_mojo_export.h
index b8d0dde6ab7..b4b341883c5 100644
--- a/chromium/media/mojo/services/media_mojo_export.h
+++ b/chromium/media/mojo/services/media_mojo_export.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_resource_shim.cc b/chromium/media/mojo/services/media_resource_shim.cc
index fbb331497b1..9230e3f080a 100644
--- a/chromium/media/mojo/services/media_resource_shim.cc
+++ b/chromium/media/mojo/services/media_resource_shim.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_resource_shim.h b/chromium/media/mojo/services/media_resource_shim.h
index 86b6c6cbc2d..98276112cae 100644
--- a/chromium/media/mojo/services/media_resource_shim.h
+++ b/chromium/media/mojo/services/media_resource_shim.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_service.cc b/chromium/media/mojo/services/media_service.cc
index 2ff11ac5139..cc3a2d27482 100644
--- a/chromium/media/mojo/services/media_service.cc
+++ b/chromium/media/mojo/services/media_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_service.h b/chromium/media/mojo/services/media_service.h
index cca6f2f7786..176206d6cef 100644
--- a/chromium/media/mojo/services/media_service.h
+++ b/chromium/media/mojo/services/media_service.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_service_factory.cc b/chromium/media/mojo/services/media_service_factory.cc
index 1c533946eb0..f6341e8cfe5 100644
--- a/chromium/media/mojo/services/media_service_factory.cc
+++ b/chromium/media/mojo/services/media_service_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_service_factory.h b/chromium/media/mojo/services/media_service_factory.h
index 37b0bfaffda..1d7e70fa7d9 100644
--- a/chromium/media/mojo/services/media_service_factory.h
+++ b/chromium/media/mojo/services/media_service_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/media_service_unittest.cc b/chromium/media/mojo/services/media_service_unittest.cc
index aab1ad8ada5..670b764572f 100644
--- a/chromium/media/mojo/services/media_service_unittest.cc
+++ b/chromium/media/mojo/services/media_service_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_decoder_service.cc b/chromium/media/mojo/services/mojo_audio_decoder_service.cc
index 654c3c3d0aa..2e2335c10f5 100644
--- a/chromium/media/mojo/services/mojo_audio_decoder_service.cc
+++ b/chromium/media/mojo/services/mojo_audio_decoder_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,7 +10,7 @@
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/logging.h"
-#include "base/stl_util.h"
+#include "base/types/optional_util.h"
#include "media/base/content_decryption_module.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
@@ -65,7 +65,7 @@ void MojoAudioDecoderService::Initialize(
if (config.is_encrypted() && !cdm_context) {
DVLOG(1) << "CdmContext for "
- << CdmContext::CdmIdToString(base::OptionalOrNullptr(cdm_id))
+ << CdmContext::CdmIdToString(base::OptionalToPtr(cdm_id))
<< " not found for encrypted audio";
OnInitialized(std::move(callback),
DecoderStatus::Codes::kUnsupportedEncryptionMode);
diff --git a/chromium/media/mojo/services/mojo_audio_decoder_service.h b/chromium/media/mojo/services/mojo_audio_decoder_service.h
index ab0c9af425f..889b25f8ab7 100644
--- a/chromium/media/mojo/services/mojo_audio_decoder_service.h
+++ b/chromium/media/mojo/services/mojo_audio_decoder_service.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_encoder_service.cc b/chromium/media/mojo/services/mojo_audio_encoder_service.cc
index f110c86840b..57f8e79d6e6 100644
--- a/chromium/media/mojo/services/mojo_audio_encoder_service.cc
+++ b/chromium/media/mojo/services/mojo_audio_encoder_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_encoder_service.h b/chromium/media/mojo/services/mojo_audio_encoder_service.h
index b1d31b471b9..1e1bbe9b9fa 100644
--- a/chromium/media/mojo/services/mojo_audio_encoder_service.h
+++ b/chromium/media/mojo/services/mojo_audio_encoder_service.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_input_stream.cc b/chromium/media/mojo/services/mojo_audio_input_stream.cc
index df9550d8b80..3ece3411edc 100644
--- a/chromium/media/mojo/services/mojo_audio_input_stream.cc
+++ b/chromium/media/mojo/services/mojo_audio_input_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_input_stream.h b/chromium/media/mojo/services/mojo_audio_input_stream.h
index b4449d5c238..c3b23a8a816 100644
--- a/chromium/media/mojo/services/mojo_audio_input_stream.h
+++ b/chromium/media/mojo/services/mojo_audio_input_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_input_stream_unittest.cc b/chromium/media/mojo/services/mojo_audio_input_stream_unittest.cc
index cf449f65ea7..61ccd1f3bad 100644
--- a/chromium/media/mojo/services/mojo_audio_input_stream_unittest.cc
+++ b/chromium/media/mojo/services/mojo_audio_input_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_output_stream.cc b/chromium/media/mojo/services/mojo_audio_output_stream.cc
index 865dedecf9a..8343003f6c9 100644
--- a/chromium/media/mojo/services/mojo_audio_output_stream.cc
+++ b/chromium/media/mojo/services/mojo_audio_output_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_output_stream.h b/chromium/media/mojo/services/mojo_audio_output_stream.h
index 5a7f95e5b22..ceb764a2ef1 100644
--- a/chromium/media/mojo/services/mojo_audio_output_stream.h
+++ b/chromium/media/mojo/services/mojo_audio_output_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_output_stream_provider.cc b/chromium/media/mojo/services/mojo_audio_output_stream_provider.cc
index 9a68e35ae38..19dbdf962be 100644
--- a/chromium/media/mojo/services/mojo_audio_output_stream_provider.cc
+++ b/chromium/media/mojo/services/mojo_audio_output_stream_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_output_stream_provider.h b/chromium/media/mojo/services/mojo_audio_output_stream_provider.h
index ee24d37574f..5bee6c088fc 100644
--- a/chromium/media/mojo/services/mojo_audio_output_stream_provider.h
+++ b/chromium/media/mojo/services/mojo_audio_output_stream_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_output_stream_provider_unittest.cc b/chromium/media/mojo/services/mojo_audio_output_stream_provider_unittest.cc
index 26b0e79f22f..0d6be03a15f 100644
--- a/chromium/media/mojo/services/mojo_audio_output_stream_provider_unittest.cc
+++ b/chromium/media/mojo/services/mojo_audio_output_stream_provider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_audio_output_stream_unittest.cc b/chromium/media/mojo/services/mojo_audio_output_stream_unittest.cc
index a7b97339996..d26efdf3de4 100644
--- a/chromium/media/mojo/services/mojo_audio_output_stream_unittest.cc
+++ b/chromium/media/mojo/services/mojo_audio_output_stream_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_cdm_allocator.cc b/chromium/media/mojo/services/mojo_cdm_allocator.cc
index 8ab6c272638..1025f856da0 100644
--- a/chromium/media/mojo/services/mojo_cdm_allocator.cc
+++ b/chromium/media/mojo/services/mojo_cdm_allocator.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,14 +10,14 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
+#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/shared_memory_mapping.h"
-#include "base/memory/unsafe_shared_memory_region.h"
#include "base/numerics/safe_conversions.h"
#include "base/numerics/safe_math.h"
+#include "media/base/video_frame.h"
#include "media/cdm/api/content_decryption_module.h"
#include "media/cdm/cdm_helpers.h"
#include "media/cdm/cdm_type_conversion.h"
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -25,26 +25,23 @@ namespace media {
namespace {
+using RecycleRegionCB =
+ base::OnceCallback<void(std::unique_ptr<base::MappedReadOnlyRegion>)>;
+
// cdm::Buffer implementation that provides access to mojo shared memory.
// It owns the memory until Destroy() is called.
class MojoCdmBuffer final : public cdm::Buffer {
public:
- static MojoCdmBuffer* Create(
- base::UnsafeSharedMemoryRegion region,
- MojoSharedBufferVideoFrame::MojoSharedBufferDoneCB
- mojo_shared_buffer_done_cb) {
- DCHECK(region.IsValid());
- DCHECK(mojo_shared_buffer_done_cb);
-
+ MojoCdmBuffer(std::unique_ptr<base::MappedReadOnlyRegion> mapped_region,
+ RecycleRegionCB recycle_region_cb)
+ : mapped_region_(std::move(mapped_region)),
+ recycle_region_cb_(std::move(recycle_region_cb)) {
+ DCHECK(mapped_region_);
+ DCHECK(mapped_region_->IsValid());
+ DCHECK(recycle_region_cb_);
// cdm::Buffer interface limits capacity to uint32.
- CHECK_LE(region.GetSize(), std::numeric_limits<uint32_t>::max());
-
- base::WritableSharedMemoryMapping mapping = region.Map();
- if (!mapping.IsValid())
- return nullptr;
-
- return new MojoCdmBuffer(std::move(region), std::move(mapping),
- std::move(mojo_shared_buffer_done_cb));
+ CHECK_LE(mapped_region_->region.GetSize(),
+ std::numeric_limits<uint32_t>::max());
}
MojoCdmBuffer(const MojoCdmBuffer&) = delete;
@@ -53,17 +50,19 @@ class MojoCdmBuffer final : public cdm::Buffer {
// cdm::Buffer implementation.
void Destroy() final {
// If nobody has claimed the handle, then return it.
- if (region_.IsValid()) {
- std::move(mojo_shared_buffer_done_cb_).Run(std::move(region_));
+ if (mapped_region_ && mapped_region_->IsValid()) {
+ std::move(recycle_region_cb_).Run(std::move(mapped_region_));
}
// No need to exist anymore.
delete this;
}
- uint32_t Capacity() const final { return mapping_.size(); }
+ uint32_t Capacity() const final { return mapped_region_->mapping.size(); }
- uint8_t* Data() final { return mapping_.GetMemoryAs<uint8_t>(); }
+ uint8_t* Data() final {
+ return mapped_region_->mapping.GetMemoryAs<uint8_t>();
+ }
void SetSize(uint32_t size) final {
DCHECK_LE(size, Capacity());
@@ -72,43 +71,28 @@ class MojoCdmBuffer final : public cdm::Buffer {
uint32_t Size() const final { return size_; }
- const base::UnsafeSharedMemoryRegion& Region() const { return region_; }
-
- base::UnsafeSharedMemoryRegion TakeRegion() { return std::move(region_); }
-
- private:
- MojoCdmBuffer(base::UnsafeSharedMemoryRegion region,
- base::WritableSharedMemoryMapping mapping,
- MojoSharedBufferVideoFrame::MojoSharedBufferDoneCB
- mojo_shared_buffer_done_cb)
- : region_(std::move(region)),
- mojo_shared_buffer_done_cb_(std::move(mojo_shared_buffer_done_cb)),
- mapping_(std::move(mapping)) {
- DCHECK(mapping_.IsValid());
+ const base::MappedReadOnlyRegion& Region() const { return *mapped_region_; }
+ std::unique_ptr<base::MappedReadOnlyRegion> TakeRegion() {
+ return std::move(mapped_region_);
}
+ private:
~MojoCdmBuffer() final {
// Verify that the buffer has been returned so it can be reused.
- DCHECK(!region_.IsValid());
+ DCHECK(!mapped_region_);
}
- // Unsafe because of the requirements of VideoFrame; see
- // MojoSharedBufferVideoFrame for more details.
- base::UnsafeSharedMemoryRegion region_;
- MojoSharedBufferVideoFrame::MojoSharedBufferDoneCB
- mojo_shared_buffer_done_cb_;
-
- base::WritableSharedMemoryMapping mapping_;
+ std::unique_ptr<base::MappedReadOnlyRegion> mapped_region_;
+ RecycleRegionCB recycle_region_cb_;
uint32_t size_ = 0;
};
-// VideoFrameImpl that is able to create a MojoSharedBufferVideoFrame
+// VideoFrameImpl that is able to create a STORAGE_SHMEM VideoFrame
// out of the data.
class MojoCdmVideoFrame final : public VideoFrameImpl {
public:
- explicit MojoCdmVideoFrame(MojoSharedBufferVideoFrame::MojoSharedBufferDoneCB
- mojo_shared_buffer_done_cb)
- : mojo_shared_buffer_done_cb_(std::move(mojo_shared_buffer_done_cb)) {}
+ explicit MojoCdmVideoFrame(RecycleRegionCB recycle_region_cb)
+ : recycle_region_cb_(std::move(recycle_region_cb)) {}
MojoCdmVideoFrame(const MojoCdmVideoFrame&) = delete;
MojoCdmVideoFrame& operator=(const MojoCdmVideoFrame&) = delete;
@@ -123,40 +107,45 @@ class MojoCdmVideoFrame final : public VideoFrameImpl {
MojoCdmBuffer* buffer = static_cast<MojoCdmBuffer*>(FrameBuffer());
const gfx::Size frame_size(Size().width, Size().height);
- base::UnsafeSharedMemoryRegion region = buffer->TakeRegion();
- DCHECK(region.IsValid());
+ std::unique_ptr<base::MappedReadOnlyRegion> mapped_region =
+ buffer->TakeRegion();
+ DCHECK(mapped_region);
+ DCHECK(mapped_region->region.IsValid());
// Clear FrameBuffer so that MojoCdmVideoFrame no longer has a reference
- // to it (memory will be transferred to MojoSharedBufferVideoFrame).
+ // to it (memory will be transferred to media::VideoFrame).
SetFrameBuffer(nullptr);
// Destroy the MojoCdmBuffer as it is no longer needed.
buffer->Destroy();
- const uint32_t offsets[] = {PlaneOffset(cdm::kYPlane),
- PlaneOffset(cdm::kUPlane),
- PlaneOffset(cdm::kVPlane)};
- const int32_t strides[] = {static_cast<int32_t>(Stride(cdm::kYPlane)),
- static_cast<int32_t>(Stride(cdm::kUPlane)),
- static_cast<int32_t>(Stride(cdm::kVPlane))};
- scoped_refptr<MojoSharedBufferVideoFrame> frame =
- media::MojoSharedBufferVideoFrame::Create(
- ToMediaVideoFormat(Format()), frame_size, gfx::Rect(frame_size),
- natural_size, std::move(region), offsets, strides,
- base::Microseconds(Timestamp()));
+ uint8_t* data =
+ const_cast<uint8_t*>(mapped_region->mapping.GetMemoryAs<uint8_t>());
+ if (PlaneOffset(cdm::kYPlane) != 0u) {
+ LOG(ERROR) << "The first buffer offset is not 0";
+ return nullptr;
+ }
+ auto frame = media::VideoFrame::WrapExternalYuvData(
+ ToMediaVideoFormat(Format()), frame_size, gfx::Rect(frame_size),
+ natural_size, static_cast<int32_t>(Stride(cdm::kYPlane)),
+ static_cast<int32_t>(Stride(cdm::kUPlane)),
+ static_cast<int32_t>(Stride(cdm::kVPlane)),
+ data + PlaneOffset(cdm::kYPlane), data + PlaneOffset(cdm::kUPlane),
+ data + PlaneOffset(cdm::kVPlane), base::Microseconds(Timestamp()));
// |frame| could fail to be created if the memory can't be mapped into
// this address space.
if (frame) {
frame->set_color_space(MediaColorSpace().ToGfxColorSpace());
- frame->SetMojoSharedBufferDoneCB(std::move(mojo_shared_buffer_done_cb_));
+ frame->BackWithSharedMemory(&mapped_region->region);
+ frame->AddDestructionObserver(base::BindOnce(
+ std::move(recycle_region_cb_), std::move(mapped_region)));
}
return frame;
}
private:
- MojoSharedBufferVideoFrame::MojoSharedBufferDoneCB
- mojo_shared_buffer_done_cb_;
+ RecycleRegionCB recycle_region_cb_;
};
} // namespace
@@ -176,23 +165,23 @@ cdm::Buffer* MojoCdmAllocator::CreateCdmBuffer(size_t capacity) {
// Reuse a shmem region in the free map if there is one that fits |capacity|.
// Otherwise, create a new one.
- base::UnsafeSharedMemoryRegion region;
+ std::unique_ptr<base::MappedReadOnlyRegion> mapped_region;
auto found = available_regions_.lower_bound(capacity);
if (found == available_regions_.end()) {
- region = AllocateNewRegion(capacity);
- if (!region.IsValid()) {
+ mapped_region = AllocateNewRegion(capacity);
+ if (!mapped_region->IsValid()) {
return nullptr;
}
} else {
- region = std::move(found->second);
+ mapped_region = std::move(found->second);
available_regions_.erase(found);
}
// Ownership of `region` is passed to MojoCdmBuffer. When it is done with the
// memory, it must call `AddRegionrToAvailableMap()` to make the memory
// available for another MojoCdmBuffer.
- return MojoCdmBuffer::Create(
- std::move(region),
+ return new MojoCdmBuffer(
+ std::move(mapped_region),
base::BindOnce(&MojoCdmAllocator::AddRegionToAvailableMap,
weak_ptr_factory_.GetWeakPtr()));
}
@@ -205,7 +194,7 @@ std::unique_ptr<VideoFrameImpl> MojoCdmAllocator::CreateCdmVideoFrame() {
weak_ptr_factory_.GetWeakPtr()));
}
-base::UnsafeSharedMemoryRegion MojoCdmAllocator::AllocateNewRegion(
+std::unique_ptr<base::MappedReadOnlyRegion> MojoCdmAllocator::AllocateNewRegion(
size_t capacity) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -227,19 +216,20 @@ base::UnsafeSharedMemoryRegion MojoCdmAllocator::AllocateNewRegion(
// calls. That's why we try to avoid AllocateNewRegion() as much as we can.
base::CheckedNumeric<size_t> requested_capacity(capacity);
requested_capacity += kBufferPadding;
- auto region =
- base::UnsafeSharedMemoryRegion::Create(requested_capacity.ValueOrDie());
- return region;
+ return std::make_unique<base::MappedReadOnlyRegion>(
+ base::ReadOnlySharedMemoryRegion::Create(
+ requested_capacity.ValueOrDie()));
}
void MojoCdmAllocator::AddRegionToAvailableMap(
- base::UnsafeSharedMemoryRegion region) {
+ std::unique_ptr<base::MappedReadOnlyRegion> mapped_region) {
DCHECK(thread_checker_.CalledOnValidThread());
- size_t capacity = region.GetSize();
- available_regions_.insert({capacity, std::move(region)});
+ DCHECK(mapped_region);
+ size_t capacity = mapped_region->region.GetSize();
+ available_regions_.insert({capacity, std::move(mapped_region)});
}
-const base::UnsafeSharedMemoryRegion& MojoCdmAllocator::GetRegionForTesting(
+const base::MappedReadOnlyRegion& MojoCdmAllocator::GetRegionForTesting(
cdm::Buffer* buffer) const {
MojoCdmBuffer* mojo_buffer = static_cast<MojoCdmBuffer*>(buffer);
return mojo_buffer->Region();
diff --git a/chromium/media/mojo/services/mojo_cdm_allocator.h b/chromium/media/mojo/services/mojo_cdm_allocator.h
index 5f538ce3980..c24d6eda29e 100644
--- a/chromium/media/mojo/services/mojo_cdm_allocator.h
+++ b/chromium/media/mojo/services/mojo_cdm_allocator.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,7 +11,7 @@
#include <map>
#include <memory>
-#include "base/memory/unsafe_shared_memory_region.h"
+#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread_checker.h"
#include "media/cdm/cdm_allocator.h"
@@ -41,18 +41,20 @@ class MEDIA_MOJO_EXPORT MojoCdmAllocator final : public CdmAllocator {
// make it efficient to find an available buffer of a particular size.
// Regions in the map are unmapped.
using AvailableRegionMap =
- std::multimap<size_t, base::UnsafeSharedMemoryRegion>;
+ std::multimap<size_t, std::unique_ptr<base::MappedReadOnlyRegion>>;
// Allocates a shmem region of at least |capacity| bytes.
- base::UnsafeSharedMemoryRegion AllocateNewRegion(size_t capacity);
+ std::unique_ptr<base::MappedReadOnlyRegion> AllocateNewRegion(
+ size_t capacity);
// Returns |region| to the map of available buffers, ready to be used the
// next time CreateCdmBuffer() is called.
- void AddRegionToAvailableMap(base::UnsafeSharedMemoryRegion region);
+ void AddRegionToAvailableMap(
+ std::unique_ptr<base::MappedReadOnlyRegion> region);
- // Returns the base::UnsafeSharedMemoryRegion for a cdm::Buffer allocated by
- // this class.
- const base::UnsafeSharedMemoryRegion& GetRegionForTesting(
+ // Returns the base::MappedReadOnlyRegion for a cdm::Buffer allocated by this
+ // class.
+ const base::MappedReadOnlyRegion& GetRegionForTesting(
cdm::Buffer* buffer) const;
// Returns the number of buffers in |available_regions_|.
diff --git a/chromium/media/mojo/services/mojo_cdm_allocator_unittest.cc b/chromium/media/mojo/services/mojo_cdm_allocator_unittest.cc
index 6a918fd994f..6223dca9a6c 100644
--- a/chromium/media/mojo/services/mojo_cdm_allocator_unittest.cc
+++ b/chromium/media/mojo/services/mojo_cdm_allocator_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -36,7 +36,7 @@ class MojoCdmAllocatorTest : public testing::Test {
return allocator_.CreateCdmVideoFrame();
}
- const base::UnsafeSharedMemoryRegion& GetRegion(cdm::Buffer* buffer) {
+ const base::MappedReadOnlyRegion& GetRegion(cdm::Buffer* buffer) {
return allocator_.GetRegionForTesting(buffer);
}
@@ -65,8 +65,7 @@ TEST_F(MojoCdmAllocatorTest, ReuseCdmBuffer) {
cdm::Buffer* buffer = CreateCdmBuffer(kRandomDataSize);
{
// Create a mapping and write some test data.
- const auto& region = GetRegion(buffer);
- base::WritableSharedMemoryMapping mapping = region.Map();
+ auto& mapping = GetRegion(buffer).mapping;
// Note: deliberately using sizeof() to include the null terminator.
memcpy(mapping.memory(), kTestData, sizeof(kTestData));
}
@@ -76,9 +75,7 @@ TEST_F(MojoCdmAllocatorTest, ReuseCdmBuffer) {
// just freed.
cdm::Buffer* new_buffer = CreateCdmBuffer(kRandomDataSize);
{
- const auto& region = GetRegion(new_buffer);
- // Unsafe regions are always mapped as writable.
- base::WritableSharedMemoryMapping mapping = region.Map();
+ auto& mapping = GetRegion(new_buffer).mapping;
// Check that the test data that was written there is still there as a proxy
// signal for checking that the shmem region is reused.
EXPECT_STREQ(kTestData, mapping.GetMemoryAs<char>());
diff --git a/chromium/media/mojo/services/mojo_cdm_file_io.cc b/chromium/media/mojo/services/mojo_cdm_file_io.cc
index 89c195045e9..5e13d33940c 100644
--- a/chromium/media/mojo/services/mojo_cdm_file_io.cc
+++ b/chromium/media/mojo/services/mojo_cdm_file_io.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/metrics/histogram_macros.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
@@ -91,6 +92,8 @@ void MojoCdmFileIO::OnFileOpened(
mojo::PendingAssociatedRemote<mojom::CdmFile> cdm_file) {
DVLOG(3) << __func__ << " file: " << file_name_ << ", status: " << status;
+ UMA_HISTOGRAM_ENUMERATION("Media.EME.CdmFileIO::OpenFile", status);
+
// This logs the end of the async Open() request, and separately logs
// how long the client takes in OnOpenComplete().
TRACE_EVENT_ASYNC_END1("media", "MojoCdmFileIO::Open", this, "status",
diff --git a/chromium/media/mojo/services/mojo_cdm_file_io.h b/chromium/media/mojo/services/mojo_cdm_file_io.h
index c6e9dae7528..176e4409fcd 100644
--- a/chromium/media/mojo/services/mojo_cdm_file_io.h
+++ b/chromium/media/mojo/services/mojo_cdm_file_io.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_cdm_file_io_unittest.cc b/chromium/media/mojo/services/mojo_cdm_file_io_unittest.cc
index 553c1eff163..660caf07bcd 100644
--- a/chromium/media/mojo/services/mojo_cdm_file_io_unittest.cc
+++ b/chromium/media/mojo/services/mojo_cdm_file_io_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_cdm_helper.cc b/chromium/media/mojo/services/mojo_cdm_helper.cc
index a1e15018ef3..ed6528232f5 100644
--- a/chromium/media/mojo/services/mojo_cdm_helper.cc
+++ b/chromium/media/mojo/services/mojo_cdm_helper.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_cdm_helper.h b/chromium/media/mojo/services/mojo_cdm_helper.h
index f9c9a3ab494..5904f5e77be 100644
--- a/chromium/media/mojo/services/mojo_cdm_helper.h
+++ b/chromium/media/mojo/services/mojo_cdm_helper.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_cdm_helper_unittest.cc b/chromium/media/mojo/services/mojo_cdm_helper_unittest.cc
index ab893b365cb..b6985c45e59 100644
--- a/chromium/media/mojo/services/mojo_cdm_helper_unittest.cc
+++ b/chromium/media/mojo/services/mojo_cdm_helper_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -79,9 +79,6 @@ class TestFrameInterfaceFactory : public mojom::FrameInterfaceFactory {
mojo::PendingRemote<mojom::MuteStateObserver> observer) override {}
void CreateDCOMPSurfaceRegistry(
mojo::PendingReceiver<mojom::DCOMPSurfaceRegistry> receiver) override {}
- void RegisterGpuInfoObserver(
- mojo::PendingRemote<media::mojom::GpuInfoObserver> observer,
- RegisterGpuInfoObserverCallback callback) override {}
#endif // BUILDFLAG(IS_WIN)
void GetCdmOrigin(GetCdmOriginCallback callback) override {}
void BindEmbedderReceiver(mojo::GenericPendingReceiver) override {}
diff --git a/chromium/media/mojo/services/mojo_cdm_promise.cc b/chromium/media/mojo/services/mojo_cdm_promise.cc
index 3641388b5ce..05702fb3d9b 100644
--- a/chromium/media/mojo/services/mojo_cdm_promise.cc
+++ b/chromium/media/mojo/services/mojo_cdm_promise.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_cdm_promise.h b/chromium/media/mojo/services/mojo_cdm_promise.h
index 479ee932567..19027a04c3e 100644
--- a/chromium/media/mojo/services/mojo_cdm_promise.h
+++ b/chromium/media/mojo/services/mojo_cdm_promise.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_cdm_service.cc b/chromium/media/mojo/services/mojo_cdm_service.cc
index a6ae0850e87..d6d1ecb8a84 100644
--- a/chromium/media/mojo/services/mojo_cdm_service.cc
+++ b/chromium/media/mojo/services/mojo_cdm_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,8 +9,8 @@
#include <utility>
#include "base/bind.h"
-#include "base/stl_util.h"
#include "base/synchronization/lock.h"
+#include "base/types/optional_util.h"
#include "build/build_config.h"
#include "media/base/cdm_config.h"
#include "media/base/cdm_context.h"
@@ -153,7 +153,7 @@ void MojoCdmService::OnCdmCreated(
cdm_ = cdm;
cdm_id_ = context_->RegisterCdm(this);
DVLOG(1) << __func__ << ": CDM successfully registered with ID "
- << CdmContext::CdmIdToString(base::OptionalOrNullptr(cdm_id_));
+ << CdmContext::CdmIdToString(base::OptionalToPtr(cdm_id_));
auto mojo_cdm_context = mojom::CdmContext::New();
mojo_cdm_context->cdm_id = cdm_id();
diff --git a/chromium/media/mojo/services/mojo_cdm_service.h b/chromium/media/mojo/services/mojo_cdm_service.h
index fb6dd461f47..b4199941c7c 100644
--- a/chromium/media/mojo/services/mojo_cdm_service.h
+++ b/chromium/media/mojo/services/mojo_cdm_service.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_cdm_service_context.cc b/chromium/media/mojo/services/mojo_cdm_service_context.cc
index e5a4a91daf0..fb0e4b2ab8c 100644
--- a/chromium/media/mojo/services/mojo_cdm_service_context.cc
+++ b/chromium/media/mojo/services/mojo_cdm_service_context.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_cdm_service_context.h b/chromium/media/mojo/services/mojo_cdm_service_context.h
index 41114d93142..4b5f06d9217 100644
--- a/chromium/media/mojo/services/mojo_cdm_service_context.h
+++ b/chromium/media/mojo/services/mojo_cdm_service_context.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_decryptor_service.cc b/chromium/media/mojo/services/mojo_decryptor_service.cc
index b95abe3fbe7..9d12386cd23 100644
--- a/chromium/media/mojo/services/mojo_decryptor_service.cc
+++ b/chromium/media/mojo/services/mojo_decryptor_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,7 +17,6 @@
#include "media/base/video_frame.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/common/mojo_decoder_buffer_converter.h"
-#include "media/mojo/common/mojo_shared_buffer_video_frame.h"
#include "media/mojo/mojom/demuxer_stream.mojom.h"
#include "media/mojo/services/mojo_cdm_service_context.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
@@ -37,7 +36,7 @@ class FrameResourceReleaserImpl final : public mojom::FrameResourceReleaser {
explicit FrameResourceReleaserImpl(scoped_refptr<VideoFrame> frame)
: frame_(std::move(frame)) {
DVLOG(3) << __func__;
- DCHECK_EQ(VideoFrame::STORAGE_MOJO_SHARED_BUFFER, frame_->storage_type());
+ DCHECK_EQ(VideoFrame::STORAGE_SHMEM, frame_->storage_type());
}
FrameResourceReleaserImpl(const FrameResourceReleaserImpl&) = delete;
@@ -292,7 +291,7 @@ void MojoDecryptorService::OnVideoDecoded(
// If |frame| has shared memory that will be passed back, keep the reference
// to it until the other side is done with the memory.
mojo::PendingRemote<mojom::FrameResourceReleaser> releaser;
- if (frame->storage_type() == VideoFrame::STORAGE_MOJO_SHARED_BUFFER) {
+ if (frame->storage_type() == VideoFrame::STORAGE_SHMEM) {
mojo::MakeSelfOwnedReceiver(
std::make_unique<FrameResourceReleaserImpl>(frame),
releaser.InitWithNewPipeAndPassReceiver());
diff --git a/chromium/media/mojo/services/mojo_decryptor_service.h b/chromium/media/mojo/services/mojo_decryptor_service.h
index ce92e26bb10..291a16e9eb7 100644
--- a/chromium/media/mojo/services/mojo_decryptor_service.h
+++ b/chromium/media/mojo/services/mojo_decryptor_service.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_demuxer_stream_adapter.cc b/chromium/media/mojo/services/mojo_demuxer_stream_adapter.cc
index c248002d029..c5de6823ec6 100644
--- a/chromium/media/mojo/services/mojo_demuxer_stream_adapter.cc
+++ b/chromium/media/mojo/services/mojo_demuxer_stream_adapter.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_demuxer_stream_adapter.h b/chromium/media/mojo/services/mojo_demuxer_stream_adapter.h
index 12ab8c5d09a..a9f4349c464 100644
--- a/chromium/media/mojo/services/mojo_demuxer_stream_adapter.h
+++ b/chromium/media/mojo/services/mojo_demuxer_stream_adapter.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_media_client.cc b/chromium/media/mojo/services/mojo_media_client.cc
index 348549f62a9..895157859a6 100644
--- a/chromium/media/mojo/services/mojo_media_client.cc
+++ b/chromium/media/mojo/services/mojo_media_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_media_client.h b/chromium/media/mojo/services/mojo_media_client.h
index 03fe64fb3b4..2c242965e0e 100644
--- a/chromium/media/mojo/services/mojo_media_client.h
+++ b/chromium/media/mojo/services/mojo_media_client.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_media_drm_storage.cc b/chromium/media/mojo/services/mojo_media_drm_storage.cc
index 49f0405e08a..3dcf5c525be 100644
--- a/chromium/media/mojo/services/mojo_media_drm_storage.cc
+++ b/chromium/media/mojo/services/mojo_media_drm_storage.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_media_drm_storage.h b/chromium/media/mojo/services/mojo_media_drm_storage.h
index a3b3b620c49..cadf3ad7dbd 100644
--- a/chromium/media/mojo/services/mojo_media_drm_storage.h
+++ b/chromium/media/mojo/services/mojo_media_drm_storage.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_media_log.cc b/chromium/media/mojo/services/mojo_media_log.cc
index 5dfe8f2dfc4..f7c7339bb61 100644
--- a/chromium/media/mojo/services/mojo_media_log.cc
+++ b/chromium/media/mojo/services/mojo_media_log.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_media_log.h b/chromium/media/mojo/services/mojo_media_log.h
index 81f7ff1c036..cb8ae2f7fe5 100644
--- a/chromium/media/mojo/services/mojo_media_log.h
+++ b/chromium/media/mojo/services/mojo_media_log.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_provision_fetcher.cc b/chromium/media/mojo/services/mojo_provision_fetcher.cc
index e4560640223..e9f6de15930 100644
--- a/chromium/media/mojo/services/mojo_provision_fetcher.cc
+++ b/chromium/media/mojo/services/mojo_provision_fetcher.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_provision_fetcher.h b/chromium/media/mojo/services/mojo_provision_fetcher.h
index b5296c864f5..7217021fca1 100644
--- a/chromium/media/mojo/services/mojo_provision_fetcher.h
+++ b/chromium/media/mojo/services/mojo_provision_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_renderer_service.cc b/chromium/media/mojo/services/mojo_renderer_service.cc
index ce26bf64cd6..1697c7b6bff 100644
--- a/chromium/media/mojo/services/mojo_renderer_service.cc
+++ b/chromium/media/mojo/services/mojo_renderer_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_renderer_service.h b/chromium/media/mojo/services/mojo_renderer_service.h
index e2701757b89..295eebdefcf 100644
--- a/chromium/media/mojo/services/mojo_renderer_service.h
+++ b/chromium/media/mojo/services/mojo_renderer_service.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_video_decoder_service.cc b/chromium/media/mojo/services/mojo_video_decoder_service.cc
index 3c649853ea7..d23f4673ef4 100644
--- a/chromium/media/mojo/services/mojo_video_decoder_service.cc
+++ b/chromium/media/mojo/services/mojo_video_decoder_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,9 +11,9 @@
#include "base/callback_helpers.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
-#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "base/types/optional_util.h"
#include "media/base/decoder_buffer.h"
#include "media/base/simple_sync_token_client.h"
#include "media/base/video_decoder.h"
@@ -203,14 +203,14 @@ void MojoVideoDecoderService::Initialize(
InitializeCallback callback) {
DVLOG(1) << __func__ << " config = " << config.AsHumanReadableString()
<< ", cdm_id = "
- << CdmContext::CdmIdToString(base::OptionalOrNullptr(cdm_id));
+ << CdmContext::CdmIdToString(base::OptionalToPtr(cdm_id));
DCHECK(!init_cb_);
DCHECK(callback);
TRACE_EVENT_ASYNC_BEGIN2(
"media", kInitializeTraceName, this, "config",
config.AsHumanReadableString(), "cdm_id",
- CdmContext::CdmIdToString(base::OptionalOrNullptr(cdm_id)));
+ CdmContext::CdmIdToString(base::OptionalToPtr(cdm_id)));
init_cb_ = std::move(callback);
@@ -251,7 +251,7 @@ void MojoVideoDecoderService::Initialize(
if (config.is_encrypted() && !cdm_context) {
DVLOG(1) << "CdmContext for "
- << CdmContext::CdmIdToString(base::OptionalOrNullptr(cdm_id))
+ << CdmContext::CdmIdToString(base::OptionalToPtr(cdm_id))
<< " not found for encrypted video";
OnDecoderInitialized(DecoderStatus::Codes::kUnsupportedEncryptionMode);
return;
diff --git a/chromium/media/mojo/services/mojo_video_decoder_service.h b/chromium/media/mojo/services/mojo_video_decoder_service.h
index 26d76d9c0a1..9db66c615de 100644
--- a/chromium/media/mojo/services/mojo_video_decoder_service.h
+++ b/chromium/media/mojo/services/mojo_video_decoder_service.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_video_encode_accelerator_provider.cc b/chromium/media/mojo/services/mojo_video_encode_accelerator_provider.cc
index 9f76134bb18..5015f5d0750 100644
--- a/chromium/media/mojo/services/mojo_video_encode_accelerator_provider.cc
+++ b/chromium/media/mojo/services/mojo_video_encode_accelerator_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_video_encode_accelerator_provider.h b/chromium/media/mojo/services/mojo_video_encode_accelerator_provider.h
index b759db21c59..7d8342b2231 100644
--- a/chromium/media/mojo/services/mojo_video_encode_accelerator_provider.h
+++ b/chromium/media/mojo/services/mojo_video_encode_accelerator_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_video_encode_accelerator_service.cc b/chromium/media/mojo/services/mojo_video_encode_accelerator_service.cc
index 1449746a582..d3da022a98c 100644
--- a/chromium/media/mojo/services/mojo_video_encode_accelerator_service.cc
+++ b/chromium/media/mojo/services/mojo_video_encode_accelerator_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_video_encode_accelerator_service.h b/chromium/media/mojo/services/mojo_video_encode_accelerator_service.h
index 7a5dc4139c9..91da4753d6c 100644
--- a/chromium/media/mojo/services/mojo_video_encode_accelerator_service.h
+++ b/chromium/media/mojo/services/mojo_video_encode_accelerator_service.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc b/chromium/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc
index cc96b49d919..783d846d3e1 100644
--- a/chromium/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc
+++ b/chromium/media/mojo/services/mojo_video_encode_accelerator_service_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/playback_events_recorder.cc b/chromium/media/mojo/services/playback_events_recorder.cc
index ec1d2650ac0..9363bc82879 100644
--- a/chromium/media/mojo/services/playback_events_recorder.cc
+++ b/chromium/media/mojo/services/playback_events_recorder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/playback_events_recorder.h b/chromium/media/mojo/services/playback_events_recorder.h
index 39c5a70e294..c95a4a849b9 100644
--- a/chromium/media/mojo/services/playback_events_recorder.h
+++ b/chromium/media/mojo/services/playback_events_recorder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/playback_events_recorder_test.cc b/chromium/media/mojo/services/playback_events_recorder_test.cc
index d4528bd67a7..dd1f1b24288 100644
--- a/chromium/media/mojo/services/playback_events_recorder_test.cc
+++ b/chromium/media/mojo/services/playback_events_recorder_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/stable_video_decoder_factory_service.cc b/chromium/media/mojo/services/stable_video_decoder_factory_service.cc
index f77e39e9876..80dba079bac 100644
--- a/chromium/media/mojo/services/stable_video_decoder_factory_service.cc
+++ b/chromium/media/mojo/services/stable_video_decoder_factory_service.cc
@@ -1,20 +1,29 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/mojo/services/stable_video_decoder_factory_service.h"
+#include "base/command_line.h"
+#include "base/task/thread_pool.h"
#include "gpu/config/gpu_driver_bug_workarounds.h"
+#include "gpu/config/gpu_preferences.h"
#include "media/base/media_log.h"
#include "media/base/media_util.h"
#include "media/gpu/buildflags.h"
#include "media/gpu/chromeos/platform_video_frame_pool.h"
#include "media/gpu/chromeos/video_decoder_pipeline.h"
#include "media/gpu/chromeos/video_frame_converter.h"
+#include "media/gpu/gpu_video_accelerator_util.h"
+#include "media/gpu/gpu_video_decode_accelerator_factory.h"
+#include "media/gpu/gpu_video_decode_accelerator_helpers.h"
+#include "media/gpu/ipc/service/vda_video_decoder.h"
#include "media/mojo/services/mojo_media_client.h"
#include "media/mojo/services/mojo_video_decoder_service.h"
#include "media/mojo/services/stable_video_decoder_service.h"
+#include "media/video/video_decode_accelerator.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
+#include "ui/ozone/public/ozone_switches.h"
namespace media {
@@ -34,15 +43,38 @@ class MojoMediaClientImpl : public MojoMediaClient {
// MojoMediaClient implementation.
std::vector<SupportedVideoDecoderConfig> GetSupportedVideoDecoderConfigs()
final {
- // TODO(b/195769334): we should pass a meaningful
+ // TODO(b/195769334): we should pass meaningful gpu::GpuPreferences and
// gpu::GpuDriverBugWorkarounds so that we can restrict the supported
// configurations using that facility.
- absl::optional<std::vector<SupportedVideoDecoderConfig>> configs =
- VideoDecoderPipeline::GetSupportedConfigs(
+ absl::optional<std::vector<SupportedVideoDecoderConfig>> configs;
+ switch (GetDecoderImplementationType()) {
+ case VideoDecoderType::kVaapi:
+ case VideoDecoderType::kV4L2:
+ configs = VideoDecoderPipeline::GetSupportedConfigs(
gpu::GpuDriverBugWorkarounds());
+ break;
+ case VideoDecoderType::kVda: {
+ VideoDecodeAccelerator::Capabilities capabilities =
+ GpuVideoAcceleratorUtil::ConvertGpuToMediaDecodeCapabilities(
+ GpuVideoDecodeAcceleratorFactory::GetDecoderCapabilities(
+ gpu::GpuPreferences(), gpu::GpuDriverBugWorkarounds()));
+ configs = ConvertFromSupportedProfiles(
+ capabilities.supported_profiles,
+ capabilities.flags & VideoDecodeAccelerator::Capabilities::
+ SUPPORTS_ENCRYPTED_STREAMS);
+ break;
+ }
+ default:
+ NOTREACHED();
+ }
return configs.value_or(std::vector<SupportedVideoDecoderConfig>{});
}
VideoDecoderType GetDecoderImplementationType() final {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kPlatformDisallowsChromeOSDirectVideoDecoder)) {
+ return VideoDecoderType::kVda;
+ }
+
// TODO(b/195769334): how can we keep this in sync with
// VideoDecoderPipeline::GetDecoderType()?
#if BUILDFLAG(USE_VAAPI)
@@ -62,10 +94,6 @@ class MojoMediaClientImpl : public MojoMediaClient {
const gfx::ColorSpace& target_color_space,
mojo::PendingRemote<stable::mojom::StableVideoDecoder> oop_video_decoder)
final {
- // TODO(b/195769334): some platforms do not support the
- // VideoDecoderPipeline so we need to handle those (and the rest of the
- // methods of MojoMediaClientImpl are affected as well).
-
// For out-of-process video decoding, |command_buffer_id| is not used and
// should not be supplied.
DCHECK(!command_buffer_id);
@@ -75,12 +103,48 @@ class MojoMediaClientImpl : public MojoMediaClient {
std::unique_ptr<MediaLog> log =
media_log ? media_log->Clone()
: std::make_unique<media::NullMediaLog>();
- return VideoDecoderPipeline::Create(
- /*client_task_runner=*/std::move(task_runner),
- std::make_unique<PlatformVideoFramePool>(),
- std::make_unique<media::VideoFrameConverter>(), std::move(log),
- /*oop_video_decoder=*/{});
+
+ if (GetDecoderImplementationType() == VideoDecoderType::kVda) {
+ if (!gpu_task_runner_) {
+ gpu_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
+ {base::WithBaseSyncPrimitives(), base::MayBlock()},
+ base::SingleThreadTaskRunnerThreadMode::DEDICATED);
+ }
+ // TODO(b/195769334): we should pass meaningful gpu::Preferences and
+ // gpu::GpuDriverBugWorkarounds so that we can restrict the supported
+ // configurations using that facility.
+ return VdaVideoDecoder::Create(
+ /*parent_task_runner=*/std::move(task_runner), gpu_task_runner_,
+ std::move(log), target_color_space, gpu::GpuPreferences(),
+ gpu::GpuDriverBugWorkarounds(),
+ /*get_stub_cb=*/base::NullCallback(),
+ VideoDecodeAccelerator::Config::OutputMode::IMPORT);
+ } else {
+ return VideoDecoderPipeline::Create(
+ // TODO(b/195769334): we should pass a meaningful
+ // gpu::GpuDriverBugWorkarounds so that we can restrict the supported
+ // configurations using that facility.
+ gpu::GpuDriverBugWorkarounds(),
+ /*client_task_runner=*/std::move(task_runner),
+ std::make_unique<PlatformVideoFramePool>(),
+ std::make_unique<media::VideoFrameConverter>(), std::move(log),
+ /*oop_video_decoder=*/{});
+ }
}
+
+ private:
+ // A "GPU" thread. With traditional hardware video decoding that runs in the
+ // GPU process, this would be the thread needed to access specific GPU
+ // functionality. For out-of-process video decoding, this isn't really the
+ // "GPU" thread, but we use the terminology of the VdaVideoDecoder::Create()
+ // (as such this member is only used when using the VdaVideoDecoder).
+ //
+ // TODO(b/195769334): could we get rid of this and just use the same task
+ // runner for the |parent_task_runner| and |gpu_task_runner| parameters of
+ // VdaVideoDecoder::Create(). For now, we've made it a dedicated thread in
+ // case the VdaVideoDecoder or any of the underlying components rely on a
+ // separate GPU thread.
+ scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_;
};
} // namespace
diff --git a/chromium/media/mojo/services/stable_video_decoder_factory_service.h b/chromium/media/mojo/services/stable_video_decoder_factory_service.h
index 427fb41c148..c46f2c223cc 100644
--- a/chromium/media/mojo/services/stable_video_decoder_factory_service.h
+++ b/chromium/media/mojo/services/stable_video_decoder_factory_service.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/stable_video_decoder_service.cc b/chromium/media/mojo/services/stable_video_decoder_service.cc
index 0a5ea217a35..799ab774f82 100644
--- a/chromium/media/mojo/services/stable_video_decoder_service.cc
+++ b/chromium/media/mojo/services/stable_video_decoder_service.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/stable_video_decoder_service.h b/chromium/media/mojo/services/stable_video_decoder_service.h
index 0e708221f17..7bf601a004c 100644
--- a/chromium/media/mojo/services/stable_video_decoder_service.h
+++ b/chromium/media/mojo/services/stable_video_decoder_service.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/stable_video_decoder_service_unittest.cc b/chromium/media/mojo/services/stable_video_decoder_service_unittest.cc
index 3b8fb9964a5..0ad29839db4 100644
--- a/chromium/media/mojo/services/stable_video_decoder_service_unittest.cc
+++ b/chromium/media/mojo/services/stable_video_decoder_service_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -82,7 +82,7 @@ class MockVideoDecoder : public mojom::VideoDecoder {
}
std::unique_ptr<MojoDecoderBufferReader> TakeMojoDecoderBufferReader() {
return std::move(mojo_decoder_buffer_reader_);
- };
+ }
// mojom::VideoDecoder implementation.
MOCK_METHOD1(GetSupportedConfigs, void(GetSupportedConfigsCallback callback));
@@ -767,7 +767,7 @@ TEST_F(StableVideoDecoderServiceTest,
MediaLogRecord media_log_record_to_send;
media_log_record_to_send.id = 2;
media_log_record_to_send.type = MediaLogRecord::Type::kMediaStatus;
- media_log_record_to_send.params.SetStringKey("Test", "Value");
+ media_log_record_to_send.params.Set("Test", "Value");
media_log_record_to_send.time = base::TimeTicks::Now();
EXPECT_CALL(*auxiliary_endpoints->mock_stable_media_log,
diff --git a/chromium/media/mojo/services/test_helpers.cc b/chromium/media/mojo/services/test_helpers.cc
index 585d90ccff7..bddb0b4b80a 100644
--- a/chromium/media/mojo/services/test_helpers.cc
+++ b/chromium/media/mojo/services/test_helpers.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/test_helpers.h b/chromium/media/mojo/services/test_helpers.h
index cad003df18f..72ea71f6916 100644
--- a/chromium/media/mojo/services/test_helpers.h
+++ b/chromium/media/mojo/services/test_helpers.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/test_mojo_media_client.cc b/chromium/media/mojo/services/test_mojo_media_client.cc
index 28194c6b9c9..3a487d8f34f 100644
--- a/chromium/media/mojo/services/test_mojo_media_client.cc
+++ b/chromium/media/mojo/services/test_mojo_media_client.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -60,15 +60,17 @@ std::unique_ptr<Renderer> TestMojoMediaClient::CreateRenderer(
decoder_factory_ = std::make_unique<media::DefaultDecoderFactory>(nullptr);
}
+ media::MediaPlayerLoggingID player_id = media::GetNextMediaPlayerLoggingID();
+
if (!renderer_factory_) {
#if BUILDFLAG(IS_ANDROID)
renderer_factory_ = std::make_unique<DefaultRendererFactory>(
media_log, decoder_factory_.get(),
- DefaultRendererFactory::GetGpuFactoriesCB());
+ DefaultRendererFactory::GetGpuFactoriesCB(), player_id);
#else
renderer_factory_ = std::make_unique<DefaultRendererFactory>(
media_log, decoder_factory_.get(),
- DefaultRendererFactory::GetGpuFactoriesCB(), nullptr);
+ DefaultRendererFactory::GetGpuFactoriesCB(), player_id, nullptr);
#endif
}
diff --git a/chromium/media/mojo/services/test_mojo_media_client.h b/chromium/media/mojo/services/test_mojo_media_client.h
index 2f4a0378b13..76645390fdf 100644
--- a/chromium/media/mojo/services/test_mojo_media_client.h
+++ b/chromium/media/mojo/services/test_mojo_media_client.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/video_decode_perf_history.cc b/chromium/media/mojo/services/video_decode_perf_history.cc
index b0902f9f34e..8f4e77c42d1 100644
--- a/chromium/media/mojo/services/video_decode_perf_history.cc
+++ b/chromium/media/mojo/services/video_decode_perf_history.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/video_decode_perf_history.h b/chromium/media/mojo/services/video_decode_perf_history.h
index 4de22e6bf45..5dea1527637 100644
--- a/chromium/media/mojo/services/video_decode_perf_history.h
+++ b/chromium/media/mojo/services/video_decode_perf_history.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/video_decode_perf_history_unittest.cc b/chromium/media/mojo/services/video_decode_perf_history_unittest.cc
index 7f290f51cdb..eebcef7b8d8 100644
--- a/chromium/media/mojo/services/video_decode_perf_history_unittest.cc
+++ b/chromium/media/mojo/services/video_decode_perf_history_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/video_decode_stats_recorder.cc b/chromium/media/mojo/services/video_decode_stats_recorder.cc
index 3dc6ffb690c..084305ffb07 100644
--- a/chromium/media/mojo/services/video_decode_stats_recorder.cc
+++ b/chromium/media/mojo/services/video_decode_stats_recorder.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/video_decode_stats_recorder.h b/chromium/media/mojo/services/video_decode_stats_recorder.h
index 595068f4aa9..0ee1a592277 100644
--- a/chromium/media/mojo/services/video_decode_stats_recorder.h
+++ b/chromium/media/mojo/services/video_decode_stats_recorder.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/video_decode_stats_recorder_unittest.cc b/chromium/media/mojo/services/video_decode_stats_recorder_unittest.cc
index 8e3831b5d12..dc164be840f 100644
--- a/chromium/media/mojo/services/video_decode_stats_recorder_unittest.cc
+++ b/chromium/media/mojo/services/video_decode_stats_recorder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/watch_time_recorder.cc b/chromium/media/mojo/services/watch_time_recorder.cc
index 084c930e651..98f36ba082f 100644
--- a/chromium/media/mojo/services/watch_time_recorder.cc
+++ b/chromium/media/mojo/services/watch_time_recorder.cc
@@ -1,16 +1,17 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/mojo/services/watch_time_recorder.h"
-#include <algorithm>
#include <cmath>
#include "base/callback.h"
+#include "base/containers/contains.h"
#include "base/containers/flat_set.h"
#include "base/hash/hash.h"
#include "base/metrics/histogram_functions.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/string_piece.h"
#include "media/base/limits.h"
#include "media/base/video_codecs.h"
@@ -113,8 +114,7 @@ void WatchTimeRecorder::FinalizeWatchTime(
// needed by for UKM and MTBR recording below.
for (auto& kv : watch_time_info_) {
if (!should_finalize_everything &&
- std::find(keys_to_finalize.begin(), keys_to_finalize.end(), kv.first) ==
- keys_to_finalize.end()) {
+ !base::Contains(keys_to_finalize, kv.first)) {
continue;
}
@@ -126,11 +126,8 @@ void WatchTimeRecorder::FinalizeWatchTime(
if (kv.second >= kMinimumElapsedWatchTime) {
RecordWatchTimeInternal(key_str, kv.second);
} else if (kv.second.is_positive()) {
- auto it = std::find_if(extended_metrics_keys_.begin(),
- extended_metrics_keys_.end(),
- [kv](const ExtendedMetricsKeyMap& map) {
- return map.watch_time_key == kv.first;
- });
+ auto it = base::ranges::find(extended_metrics_keys_, kv.first,
+ &ExtendedMetricsKeyMap::watch_time_key);
if (it != extended_metrics_keys_.end())
RecordDiscardedWatchTime(it->discard_key, kv.second);
}
diff --git a/chromium/media/mojo/services/watch_time_recorder.h b/chromium/media/mojo/services/watch_time_recorder.h
index e5efd71393a..ebb687abe7f 100644
--- a/chromium/media/mojo/services/watch_time_recorder.h
+++ b/chromium/media/mojo/services/watch_time_recorder.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/watch_time_recorder_unittest.cc b/chromium/media/mojo/services/watch_time_recorder_unittest.cc
index beca492fbbd..d0388c6e3d2 100644
--- a/chromium/media/mojo/services/watch_time_recorder_unittest.cc
+++ b/chromium/media/mojo/services/watch_time_recorder_unittest.cc
@@ -1,16 +1,18 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/mojo/services/watch_time_recorder.h"
#include <stddef.h>
+
#include <memory>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/callback_helpers.h"
+#include "base/containers/contains.h"
#include "base/hash/hash.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
@@ -110,12 +112,11 @@ class WatchTimeRecorderTest : public testing::Test {
ConvertWatchTimeKeyToStringForUma(static_cast<WatchTimeKey>(i));
if (test_key.empty())
continue;
- auto it = std::find(keys.begin(), keys.end(), test_key);
- if (it == keys.end()) {
- histogram_tester_->ExpectTotalCount(test_key, 0);
- } else {
+ if (base::Contains(keys, test_key)) {
histogram_tester_->ExpectUniqueSample(test_key, value.InMilliseconds(),
1);
+ } else {
+ histogram_tester_->ExpectTotalCount(test_key, 0);
}
}
}
@@ -124,11 +125,10 @@ class WatchTimeRecorderTest : public testing::Test {
const std::vector<base::StringPiece>& keys,
int64_t value) {
for (auto key : full_key_list) {
- auto it = std::find(keys.begin(), keys.end(), key);
- if (it == keys.end())
- histogram_tester_->ExpectTotalCount(key, 0);
- else
+ if (base::Contains(keys, key))
histogram_tester_->ExpectUniqueSample(key, value, 1);
+ else
+ histogram_tester_->ExpectTotalCount(key, 0);
}
}
diff --git a/chromium/media/mojo/services/webrtc_video_perf_history.cc b/chromium/media/mojo/services/webrtc_video_perf_history.cc
index ab5f84db291..01947489214 100644
--- a/chromium/media/mojo/services/webrtc_video_perf_history.cc
+++ b/chromium/media/mojo/services/webrtc_video_perf_history.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/webrtc_video_perf_history.h b/chromium/media/mojo/services/webrtc_video_perf_history.h
index 75327f67a25..ce724ce77f6 100644
--- a/chromium/media/mojo/services/webrtc_video_perf_history.h
+++ b/chromium/media/mojo/services/webrtc_video_perf_history.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/webrtc_video_perf_history_unittest.cc b/chromium/media/mojo/services/webrtc_video_perf_history_unittest.cc
index 5fc59d60f26..1a9ea56debf 100644
--- a/chromium/media/mojo/services/webrtc_video_perf_history_unittest.cc
+++ b/chromium/media/mojo/services/webrtc_video_perf_history_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.cc b/chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.cc
index 88839462f9a..4ed160b2d6a 100644
--- a/chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.cc
+++ b/chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.proto b/chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.proto
index 1f5b264a70e..69ee551c3a0 100644
--- a/chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.proto
+++ b/chromium/media/mojo/services/webrtc_video_perf_mojolpm_fuzzer.proto
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/webrtc_video_perf_recorder.cc b/chromium/media/mojo/services/webrtc_video_perf_recorder.cc
index 44987f15ffc..a0cfacab436 100644
--- a/chromium/media/mojo/services/webrtc_video_perf_recorder.cc
+++ b/chromium/media/mojo/services/webrtc_video_perf_recorder.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/webrtc_video_perf_recorder.h b/chromium/media/mojo/services/webrtc_video_perf_recorder.h
index 0efa2b51614..030f2c8e20c 100644
--- a/chromium/media/mojo/services/webrtc_video_perf_recorder.h
+++ b/chromium/media/mojo/services/webrtc_video_perf_recorder.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/services/webrtc_video_perf_recorder_unittest.cc b/chromium/media/mojo/services/webrtc_video_perf_recorder_unittest.cc
index c50e5408029..8d9a9aba682 100644
--- a/chromium/media/mojo/services/webrtc_video_perf_recorder_unittest.cc
+++ b/chromium/media/mojo/services/webrtc_video_perf_recorder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/mojo/test/BUILD.gn b/chromium/media/mojo/test/BUILD.gn
index 91172e62f38..5dada94ecf3 100644
--- a/chromium/media/mojo/test/BUILD.gn
+++ b/chromium/media/mojo/test/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/muxers/BUILD.gn b/chromium/media/muxers/BUILD.gn
index cf46665cc8a..271a33767a5 100644
--- a/chromium/media/muxers/BUILD.gn
+++ b/chromium/media/muxers/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/muxers/file_webm_muxer_delegate.cc b/chromium/media/muxers/file_webm_muxer_delegate.cc
index 2d0959013df..7847067388d 100644
--- a/chromium/media/muxers/file_webm_muxer_delegate.cc
+++ b/chromium/media/muxers/file_webm_muxer_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/muxers/file_webm_muxer_delegate.h b/chromium/media/muxers/file_webm_muxer_delegate.h
index 8e6a53d3b84..58b12b8f1c4 100644
--- a/chromium/media/muxers/file_webm_muxer_delegate.h
+++ b/chromium/media/muxers/file_webm_muxer_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/muxers/live_webm_muxer_delegate.cc b/chromium/media/muxers/live_webm_muxer_delegate.cc
index f2d9cffb998..0f2797163c2 100644
--- a/chromium/media/muxers/live_webm_muxer_delegate.cc
+++ b/chromium/media/muxers/live_webm_muxer_delegate.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/muxers/live_webm_muxer_delegate.h b/chromium/media/muxers/live_webm_muxer_delegate.h
index 9357165bf5e..02e3f606d6b 100644
--- a/chromium/media/muxers/live_webm_muxer_delegate.h
+++ b/chromium/media/muxers/live_webm_muxer_delegate.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/muxers/webm_muxer.cc b/chromium/media/muxers/webm_muxer.cc
index bc4eba170b0..bd04d895cf1 100644
--- a/chromium/media/muxers/webm_muxer.cc
+++ b/chromium/media/muxers/webm_muxer.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/muxers/webm_muxer.h b/chromium/media/muxers/webm_muxer.h
index b70e7365132..37b38536d31 100644
--- a/chromium/media/muxers/webm_muxer.h
+++ b/chromium/media/muxers/webm_muxer.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/muxers/webm_muxer_fuzzertest.cc b/chromium/media/muxers/webm_muxer_fuzzertest.cc
index bc202056d48..61085715fce 100644
--- a/chromium/media/muxers/webm_muxer_fuzzertest.cc
+++ b/chromium/media/muxers/webm_muxer_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -82,9 +82,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
if (input_type.has_audio) {
- const media::ChannelLayout layout = rng() % 2
- ? media::CHANNEL_LAYOUT_STEREO
- : media::CHANNEL_LAYOUT_MONO;
+ const media::ChannelLayoutConfig layout =
+ rng() % 2 ? media::ChannelLayoutConfig::Stereo()
+ : media::ChannelLayoutConfig::Mono();
const int sample_rate =
kSampleRatesInKHz[rng() % std::size(kSampleRatesInKHz)];
diff --git a/chromium/media/muxers/webm_muxer_unittest.cc b/chromium/media/muxers/webm_muxer_unittest.cc
index e23a386f95e..dca5be414d5 100644
--- a/chromium/media/muxers/webm_muxer_unittest.cc
+++ b/chromium/media/muxers/webm_muxer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -134,7 +134,8 @@ TEST_P(WebmMuxerTest,
const std::string encoded_data("abcdefghijklmnopqrstuvwxyz");
media::AudioParameters audio_params(
media::AudioParameters::Format::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_MONO, /*sample_rate=*/48000,
+ ChannelLayoutConfig::Mono(),
+ /*sample_rate=*/48000,
/*frames_per_buffer=*/480);
// Force an error in libwebm and expect OnEncodedVideo to fail.
webm_muxer_->ForceOneLibWebmErrorForTesting();
@@ -157,7 +158,8 @@ TEST_P(WebmMuxerTest,
const std::string encoded_data("abcdefghijklmnopqrstuvwxyz");
media::AudioParameters audio_params(
media::AudioParameters::Format::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_MONO, /*sample_rate=*/48000,
+ ChannelLayoutConfig::Mono(),
+ /*sample_rate=*/48000,
/*frames_per_buffer=*/480);
// Force an error in libwebm and expect OnEncodedVideo to fail.
webm_muxer_->ForceOneLibWebmErrorForTesting();
@@ -272,7 +274,7 @@ TEST_P(WebmMuxerTest, OnEncodedAudioTwoFrames) {
const int frames_per_buffer = 480;
media::AudioParameters audio_params(
media::AudioParameters::Format::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_MONO, sample_rate, frames_per_buffer);
+ ChannelLayoutConfig::Mono(), sample_rate, frames_per_buffer);
const std::string encoded_data("abcdefghijklmnopqrstuvwxyz");
@@ -397,7 +399,7 @@ TEST_P(WebmMuxerTest, VideoIsStoredWhileWaitingForAudio) {
const int frames_per_buffer = 480;
media::AudioParameters audio_params(
media::AudioParameters::Format::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_MONO, sample_rate, frames_per_buffer);
+ ChannelLayoutConfig::Mono(), sample_rate, frames_per_buffer);
const std::string encoded_audio("thisisanencodedaudiopacket");
// Timestamped frames should come as:
@@ -495,7 +497,7 @@ class WebmMuxerTestUnparametrized : public testing::Test {
int frames_per_buffer = frame_rate_hz * duration_ms / 1000;
media::AudioParameters audio_params(
media::AudioParameters::Format::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_MONO, frame_rate_hz, frames_per_buffer);
+ ChannelLayoutConfig::Mono(), frame_rate_hz, frames_per_buffer);
webm_muxer_->OnEncodedAudio(
audio_params, "audio_at_offset",
base::TimeTicks() + base::Milliseconds(system_timestamp_offset_ms));
diff --git a/chromium/media/parsers/BUILD.gn b/chromium/media/parsers/BUILD.gn
index 48f9bbb035e..0bb8e16d27c 100644
--- a/chromium/media/parsers/BUILD.gn
+++ b/chromium/media/parsers/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium Authors. All rights reserved.
+# Copyright 2019 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/parsers/jpeg_parser.cc b/chromium/media/parsers/jpeg_parser.cc
index a01ce87cf4e..4270a699d60 100644
--- a/chromium/media/parsers/jpeg_parser.cc
+++ b/chromium/media/parsers/jpeg_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/jpeg_parser.h b/chromium/media/parsers/jpeg_parser.h
index c7998d12966..9d177a08fe6 100644
--- a/chromium/media/parsers/jpeg_parser.h
+++ b/chromium/media/parsers/jpeg_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/jpeg_parser_picture_fuzzertest.cc b/chromium/media/parsers/jpeg_parser_picture_fuzzertest.cc
index 31d9cae7e0f..38f607e4359 100644
--- a/chromium/media/parsers/jpeg_parser_picture_fuzzertest.cc
+++ b/chromium/media/parsers/jpeg_parser_picture_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/jpeg_parser_unittest.cc b/chromium/media/parsers/jpeg_parser_unittest.cc
index 72b9ae957aa..fc6e7893433 100644
--- a/chromium/media/parsers/jpeg_parser_unittest.cc
+++ b/chromium/media/parsers/jpeg_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/media_parsers_export.h b/chromium/media/parsers/media_parsers_export.h
index 72277ea7a92..6b86904ae4b 100644
--- a/chromium/media/parsers/media_parsers_export.h
+++ b/chromium/media/parsers/media_parsers_export.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/vp8_bool_decoder.cc b/chromium/media/parsers/vp8_bool_decoder.cc
index fb715e5ea29..5b4710469f9 100644
--- a/chromium/media/parsers/vp8_bool_decoder.cc
+++ b/chromium/media/parsers/vp8_bool_decoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/parsers/vp8_bool_decoder.h b/chromium/media/parsers/vp8_bool_decoder.h
index 7b41925d149..96e6b98deac 100644
--- a/chromium/media/parsers/vp8_bool_decoder.h
+++ b/chromium/media/parsers/vp8_bool_decoder.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/parsers/vp8_bool_decoder_unittest.cc b/chromium/media/parsers/vp8_bool_decoder_unittest.cc
index 70071361fdc..da7e11adce7 100644
--- a/chromium/media/parsers/vp8_bool_decoder_unittest.cc
+++ b/chromium/media/parsers/vp8_bool_decoder_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/vp8_parser.cc b/chromium/media/parsers/vp8_parser.cc
index 88730134ae8..71ba6a73dce 100644
--- a/chromium/media/parsers/vp8_parser.cc
+++ b/chromium/media/parsers/vp8_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/parsers/vp8_parser.h b/chromium/media/parsers/vp8_parser.h
index 165b9f9a490..783ba46e4ef 100644
--- a/chromium/media/parsers/vp8_parser.h
+++ b/chromium/media/parsers/vp8_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/parsers/vp8_parser_fuzzertest.cc b/chromium/media/parsers/vp8_parser_fuzzertest.cc
index 75cc6bb317b..4d845c8bccb 100644
--- a/chromium/media/parsers/vp8_parser_fuzzertest.cc
+++ b/chromium/media/parsers/vp8_parser_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/vp8_parser_unittest.cc b/chromium/media/parsers/vp8_parser_unittest.cc
index cbe4ff07b5f..81e15aecc37 100644
--- a/chromium/media/parsers/vp8_parser_unittest.cc
+++ b/chromium/media/parsers/vp8_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/webp_parser.cc b/chromium/media/parsers/webp_parser.cc
index dda7ea16385..2a3d37f3b1c 100644
--- a/chromium/media/parsers/webp_parser.cc
+++ b/chromium/media/parsers/webp_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/webp_parser.h b/chromium/media/parsers/webp_parser.h
index 436d6c74210..39187dc62f6 100644
--- a/chromium/media/parsers/webp_parser.h
+++ b/chromium/media/parsers/webp_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/webp_parser_fuzzertest.cc b/chromium/media/parsers/webp_parser_fuzzertest.cc
index d10c830c0af..8ae42f48e75 100644
--- a/chromium/media/parsers/webp_parser_fuzzertest.cc
+++ b/chromium/media/parsers/webp_parser_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/parsers/webp_parser_unittest.cc b/chromium/media/parsers/webp_parser_unittest.cc
index 4c9d99765b1..a0f0e022bb7 100644
--- a/chromium/media/parsers/webp_parser_unittest.cc
+++ b/chromium/media/parsers/webp_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/BUILD.gn b/chromium/media/remoting/BUILD.gn
index 504a880aed9..c20dcc25145 100644
--- a/chromium/media/remoting/BUILD.gn
+++ b/chromium/media/remoting/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -39,10 +39,7 @@ source_set("remoting_sender") {
# Consumers of the CourierRenderer implicitly take a dependency on the
# generated remoting.pb.h file.
- public_deps += [
- "//components/cast_streaming/public:remoting_utils",
- "//components/openscreen_platform:openscreen_platform_network_service",
- ]
+ public_deps += [ "//components/cast_streaming/public:remoting_utils" ]
}
}
@@ -50,6 +47,18 @@ source_set("remoting_constants") {
sources = [ "remoting_constants.h" ]
}
+source_set("remoting_device_capability") {
+ sources = [
+ "device_capability_checker.cc",
+ "device_capability_checker.h",
+ ]
+
+ deps = [
+ "//base",
+ "//media",
+ ]
+}
+
source_set("remoting_renderer") {
sources = [
"receiver.cc",
@@ -64,7 +73,6 @@ source_set("remoting_renderer") {
deps = [
":remoting_constants",
- "//components/openscreen_platform:openscreen_platform_network_service",
"//media/mojo/common:common",
"//media/mojo/mojom:remoting",
]
@@ -77,6 +85,7 @@ source_set("remoting_renderer") {
source_set("media_remoting_tests") {
testonly = true
sources = [
+ "device_capability_checker_unittest.cc",
"fake_remoter.cc",
"fake_remoter.h",
"mock_receiver_controller.cc",
@@ -89,12 +98,12 @@ source_set("media_remoting_tests") {
]
deps = [
+ ":remoting_device_capability",
":remoting_renderer",
":remoting_sender",
"//base",
"//base/test:test_support",
"//components/cast_streaming/public:remoting_utils",
- "//components/openscreen_platform:openscreen_platform_network_service",
"//media:test_support",
"//media/mojo/common",
"//media/mojo/mojom:remoting",
diff --git a/chromium/media/remoting/OWNERS b/chromium/media/remoting/OWNERS
index 7d3110de24e..866a0313dc6 100644
--- a/chromium/media/remoting/OWNERS
+++ b/chromium/media/remoting/OWNERS
@@ -1,3 +1,2 @@
-erickung@chromium.org
jophba@chromium.org
mfoltz@chromium.org
diff --git a/chromium/media/remoting/courier_renderer.cc b/chromium/media/remoting/courier_renderer.cc
index ab3293a118b..16f662ef012 100644
--- a/chromium/media/remoting/courier_renderer.cc
+++ b/chromium/media/remoting/courier_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -57,6 +57,25 @@ constexpr base::TimeDelta kStabilizationPeriod = base::Seconds(2);
// data flow rates for metrics.
constexpr base::TimeDelta kDataFlowPollPeriod = base::Seconds(10);
+// base::Bind* doesn't understand openscreen::WeakPtr, so we must manually
+// check the RpcMessenger pointer before calling into it.
+void RegisterForRpcTask(
+ openscreen::WeakPtr<openscreen::cast::RpcMessenger> rpc_messenger,
+ int rpc_handle,
+ openscreen::cast::RpcMessenger::ReceiveMessageCallback message_cb) {
+ if (rpc_messenger) {
+ rpc_messenger->RegisterMessageReceiverCallback(rpc_handle,
+ std::move(message_cb));
+ }
+}
+void DeregisterFromRpcTask(
+ openscreen::WeakPtr<openscreen::cast::RpcMessenger> rpc_messenger,
+ int rpc_handle) {
+ if (rpc_messenger) {
+ rpc_messenger->UnregisterMessageReceiverCallback(rpc_handle);
+ }
+}
+
} // namespace
CourierRenderer::CourierRenderer(
@@ -77,27 +96,15 @@ CourierRenderer::CourierRenderer(
// Note: The constructor is running on the main thread, but will be destroyed
// on the media thread. Therefore, all weak pointers must be dereferenced on
// the media thread.
- rpc_messenger_->RegisterMessageReceiverCallback(
- rpc_handle_,
- [runner = media_task_runner_, ptr = weak_factory_.GetWeakPtr()](
- std::unique_ptr<openscreen::cast::RpcMessage> message) {
- if (ptr) {
- CourierRenderer::OnMessageReceivedOnMainThread(runner, ptr,
- std::move(message));
- } else {
- LOG(WARNING) << "Invalid weak factory pointer.";
- }
- });
+ media_task_runner_->PostTask(
+ FROM_HERE, base::BindOnce(&CourierRenderer::RegisterForRpcMessaging,
+ weak_factory_.GetWeakPtr()));
}
CourierRenderer::~CourierRenderer() {
DCHECK(media_task_runner_->BelongsToCurrentThread());
- // Post task on main thread to unregister message receiver.
- main_task_runner_->PostTask(
- FROM_HERE, base::BindOnce(&CourierRenderer::DeregisterFromRpcMessaging,
- weak_factory_.GetWeakPtr()));
-
+ DeregisterFromRpcMessaging();
if (video_renderer_sink_) {
video_renderer_sink_->PaintSingleFrame(
VideoFrame::CreateBlackFrame(gfx::Size(1280, 720)));
@@ -812,10 +819,28 @@ bool CourierRenderer::IsWaitingForDataFromDemuxers() const {
!audio_demuxer_stream_adapter_->is_data_pending()));
}
+void CourierRenderer::RegisterForRpcMessaging() {
+ DCHECK(media_task_runner_->BelongsToCurrentThread());
+ auto receive_callback = BindToCurrentLoop(base::BindRepeating(
+ &CourierRenderer::OnReceivedRpc, weak_factory_.GetWeakPtr()));
+
+ main_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(
+ &RegisterForRpcTask, rpc_messenger_, rpc_handle_,
+ [cb = std::move(receive_callback)](
+
+ std::unique_ptr<openscreen::cast::RpcMessage> message) {
+ cb.Run(std::move(message));
+ }));
+}
+
void CourierRenderer::DeregisterFromRpcMessaging() {
DCHECK(media_task_runner_->BelongsToCurrentThread());
if (rpc_messenger_) {
- rpc_messenger_->UnregisterMessageReceiverCallback(rpc_handle_);
+ main_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(&DeregisterFromRpcTask, rpc_messenger_, rpc_handle_));
}
}
diff --git a/chromium/media/remoting/courier_renderer.h b/chromium/media/remoting/courier_renderer.h
index 9fdf9c9c743..82ead887fca 100644
--- a/chromium/media/remoting/courier_renderer.h
+++ b/chromium/media/remoting/courier_renderer.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -161,7 +161,11 @@ class CourierRenderer final : public Renderer {
// though the playback might be delayed or paused.
bool IsWaitingForDataFromDemuxers() const;
- // Helper to deregister the renderer from the RPC messenger.
+ // Helpers to register/deregister the renderer with the RPC messenger. These
+ // must be called on the media thread to dereference the weak pointer to
+ // this, which if contains a valid RPC messenger pointer will result in a
+ // jump to the main thread.
+ void RegisterForRpcMessaging();
void DeregisterFromRpcMessaging();
State state_;
diff --git a/chromium/media/remoting/courier_renderer_factory.cc b/chromium/media/remoting/courier_renderer_factory.cc
index 6340cb19cbb..86d594132bc 100644
--- a/chromium/media/remoting/courier_renderer_factory.cc
+++ b/chromium/media/remoting/courier_renderer_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/courier_renderer_factory.h b/chromium/media/remoting/courier_renderer_factory.h
index 5b822a9d572..0b8843685e9 100644
--- a/chromium/media/remoting/courier_renderer_factory.h
+++ b/chromium/media/remoting/courier_renderer_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/courier_renderer_unittest.cc b/chromium/media/remoting/courier_renderer_unittest.cc
index 1ea0be41393..b3fb5f00f09 100644
--- a/chromium/media/remoting/courier_renderer_unittest.cc
+++ b/chromium/media/remoting/courier_renderer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/demuxer_stream_adapter.cc b/chromium/media/remoting/demuxer_stream_adapter.cc
index b1b3026a8b0..385b40c7fb6 100644
--- a/chromium/media/remoting/demuxer_stream_adapter.cc
+++ b/chromium/media/remoting/demuxer_stream_adapter.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -24,6 +24,27 @@ using openscreen::cast::RpcMessenger;
namespace media {
namespace remoting {
+namespace {
+// base::Bind* doesn't understand openscreen::WeakPtr, so we must manually
+// check the RpcMessenger pointer before calling into it.
+void RegisterForRpcTask(
+ openscreen::WeakPtr<openscreen::cast::RpcMessenger> rpc_messenger,
+ int rpc_handle,
+ openscreen::cast::RpcMessenger::ReceiveMessageCallback message_cb) {
+ if (rpc_messenger) {
+ rpc_messenger->RegisterMessageReceiverCallback(rpc_handle,
+ std::move(message_cb));
+ }
+}
+void DeregisterFromRpcTask(
+ openscreen::WeakPtr<openscreen::cast::RpcMessenger> rpc_messenger,
+ int rpc_handle) {
+ if (rpc_messenger) {
+ rpc_messenger->UnregisterMessageReceiverCallback(rpc_handle);
+ }
+}
+} // namespace
+
DemuxerStreamAdapter::DemuxerStreamAdapter(
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> media_task_runner,
@@ -56,17 +77,8 @@ DemuxerStreamAdapter::DemuxerStreamAdapter(
DCHECK(media_task_runner_->BelongsToCurrentThread());
DCHECK(demuxer_stream);
DCHECK(!error_callback_.is_null());
- auto receive_callback = BindToCurrentLoop(base::BindRepeating(
- &DemuxerStreamAdapter::OnReceivedRpc, weak_factory_.GetWeakPtr()));
- main_task_runner_->PostTask(
- FROM_HERE,
- base::BindOnce(
- &RpcMessenger::RegisterMessageReceiverCallback, rpc_messenger_,
- rpc_handle_,
- [cb = std::move(receive_callback)](
- std::unique_ptr<openscreen::cast::RpcMessage> message) {
- cb.Run(std::move(message));
- }));
+
+ RegisterForRpcMessaging();
stream_sender_.Bind(std::move(stream_sender_remote));
stream_sender_.set_disconnect_handler(
@@ -76,10 +88,7 @@ DemuxerStreamAdapter::DemuxerStreamAdapter(
DemuxerStreamAdapter::~DemuxerStreamAdapter() {
DCHECK(media_task_runner_->BelongsToCurrentThread());
- main_task_runner_->PostTask(
- FROM_HERE,
- base::BindOnce(&DemuxerStreamAdapter::DeregisterFromRpcMessaging,
- weak_factory_.GetWeakPtr()));
+ DeregisterFromRpcMessaging();
}
int64_t DemuxerStreamAdapter::GetBytesWrittenAndReset() {
@@ -429,10 +438,26 @@ void DemuxerStreamAdapter::OnFatalError(StopTrigger stop_trigger) {
std::move(error_callback_).Run(stop_trigger);
}
+void DemuxerStreamAdapter::RegisterForRpcMessaging() {
+ DCHECK(media_task_runner_->BelongsToCurrentThread());
+ auto receive_callback = BindToCurrentLoop(base::BindRepeating(
+ &DemuxerStreamAdapter::OnReceivedRpc, weak_factory_.GetWeakPtr()));
+ main_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(
+ &RegisterForRpcTask, rpc_messenger_, rpc_handle_,
+ [cb = std::move(receive_callback)](
+ std::unique_ptr<openscreen::cast::RpcMessage> message) {
+ cb.Run(std::move(message));
+ }));
+}
+
void DemuxerStreamAdapter::DeregisterFromRpcMessaging() {
DCHECK(media_task_runner_->BelongsToCurrentThread());
if (rpc_messenger_) {
- rpc_messenger_->UnregisterMessageReceiverCallback(rpc_handle_);
+ main_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(&DeregisterFromRpcTask, rpc_messenger_, rpc_handle_));
}
}
diff --git a/chromium/media/remoting/demuxer_stream_adapter.h b/chromium/media/remoting/demuxer_stream_adapter.h
index 7574a92a352..5f24a48dd13 100644
--- a/chromium/media/remoting/demuxer_stream_adapter.h
+++ b/chromium/media/remoting/demuxer_stream_adapter.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -131,7 +131,11 @@ class DemuxerStreamAdapter {
// Callback function when a fatal runtime error occurs.
void OnFatalError(StopTrigger stop_trigger);
- // Helper to deregister the renderer from the RPC messenger.
+ // Helpers to register/deregister the adapter with the RPC messenger. These
+ // must be called on the media thread to dereference the weak pointer to
+ // this, which if contains a valid RPC messenger pointer will result in a
+ // jump to the main thread.
+ void RegisterForRpcMessaging();
void DeregisterFromRpcMessaging();
const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
diff --git a/chromium/media/remoting/demuxer_stream_adapter_unittest.cc b/chromium/media/remoting/demuxer_stream_adapter_unittest.cc
index 72bf24ed162..d1c47a44b67 100644
--- a/chromium/media/remoting/demuxer_stream_adapter_unittest.cc
+++ b/chromium/media/remoting/demuxer_stream_adapter_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/device_capability_checker.cc b/chromium/media/remoting/device_capability_checker.cc
new file mode 100644
index 00000000000..4b48cb6e235
--- /dev/null
+++ b/chromium/media/remoting/device_capability_checker.cc
@@ -0,0 +1,47 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/remoting/device_capability_checker.h"
+
+#include "base/strings/string_util.h"
+#include "media/base/audio_codecs.h"
+#include "media/base/video_codecs.h"
+
+namespace media::remoting {
+
+bool IsChromecast(const std::string& model_name) {
+ // This is a workaround for Nest Hub devices, which do not support remoting.
+ // TODO(crbug.com/1198616): filtering hack should be removed. See b/135725157
+ // for more information.
+ return base::StartsWith(model_name, "Chromecast",
+ base::CompareCase::SENSITIVE) ||
+ base::StartsWith(model_name, "Eureka Dongle",
+ base::CompareCase::SENSITIVE);
+}
+
+bool IsVideoCodecCompatible(const std::string& model_name,
+ VideoCodec video_codec) {
+ if (!IsChromecast(model_name)) {
+ return false;
+ }
+
+ if (video_codec == VideoCodec::kH264 || video_codec == VideoCodec::kVP8) {
+ return true;
+ }
+ if (model_name == "Chromecast Ultra" &&
+ (video_codec == VideoCodec::kHEVC || video_codec == VideoCodec::kVP9)) {
+ return true;
+ }
+ return false;
+}
+
+bool IsAudioCodecCompatible(const std::string& model_name,
+ AudioCodec audio_codec) {
+ if (!IsChromecast(model_name)) {
+ return false;
+ }
+ return (audio_codec == AudioCodec::kAAC) ||
+ (audio_codec == AudioCodec::kOpus);
+}
+} // namespace media::remoting
diff --git a/chromium/media/remoting/device_capability_checker.h b/chromium/media/remoting/device_capability_checker.h
new file mode 100644
index 00000000000..132fa55e862
--- /dev/null
+++ b/chromium/media/remoting/device_capability_checker.h
@@ -0,0 +1,29 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_REMOTING_DEVICE_CAPABILITY_CHECKER_H_
+#define MEDIA_REMOTING_DEVICE_CAPABILITY_CHECKER_H_
+
+#include <string>
+
+namespace media {
+enum class AudioCodec;
+enum class VideoCodec;
+
+namespace remoting {
+// Return true if the device is a Chromecast device according to its
+// `model_name`.
+bool IsChromecast(const std::string& model_name);
+
+// Return true if the device is compatible to render `video_codec`.
+bool IsVideoCodecCompatible(const std::string& model_name,
+ media::VideoCodec video_codec);
+
+// Return true if the device is compatible to render `audio_codec`.
+bool IsAudioCodecCompatible(const std::string& model_name,
+ media::AudioCodec audio_codec);
+} // namespace remoting
+} // namespace media
+
+#endif // MEDIA_REMOTING_DEVICE_CAPABILITY_CHECKER_H_
diff --git a/chromium/media/remoting/device_capability_checker_unittest.cc b/chromium/media/remoting/device_capability_checker_unittest.cc
new file mode 100644
index 00000000000..da9b1e3ae8a
--- /dev/null
+++ b/chromium/media/remoting/device_capability_checker_unittest.cc
@@ -0,0 +1,38 @@
+// Copyright 2022 The Chromium Authors
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/remoting/device_capability_checker.h"
+
+#include "media/base/audio_codecs.h"
+#include "media/base/video_codecs.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media::remoting {
+
+namespace {
+constexpr char cc_model_name[] = "Chromecast";
+constexpr char cc_ultra_model_name[] = "Chromecast Ultra";
+constexpr char cc_dongle_model_name[] = "Eureka Dongle";
+} // namespace
+
+TEST(DeviceCapabilityCheckerTest, CheckDeviceCapability) {
+ EXPECT_TRUE(IsChromecast(cc_model_name));
+ EXPECT_TRUE(IsChromecast(cc_ultra_model_name));
+ EXPECT_TRUE(IsChromecast(cc_dongle_model_name));
+ EXPECT_FALSE(IsChromecast("Nest"));
+}
+
+TEST(DeviceCapabilityCheckerTest, CheckVideoCapability) {
+ EXPECT_FALSE(IsVideoCodecCompatible(cc_model_name, VideoCodec::kHEVC));
+ EXPECT_TRUE(IsVideoCodecCompatible(cc_ultra_model_name, VideoCodec::kHEVC));
+ EXPECT_TRUE(IsVideoCodecCompatible(cc_ultra_model_name, VideoCodec::kVP9));
+ EXPECT_TRUE(IsVideoCodecCompatible(cc_dongle_model_name, VideoCodec::kVP8));
+}
+
+TEST(DeviceCapabilityCheckerTest, CheckAudioCapability) {
+ EXPECT_FALSE(IsAudioCodecCompatible(cc_ultra_model_name, AudioCodec::kMP3));
+ EXPECT_TRUE(IsAudioCodecCompatible(cc_model_name, AudioCodec::kAAC));
+ EXPECT_TRUE(IsAudioCodecCompatible(cc_dongle_model_name, AudioCodec::kOpus));
+}
+} // namespace media::remoting \ No newline at end of file
diff --git a/chromium/media/remoting/end2end_test_renderer.cc b/chromium/media/remoting/end2end_test_renderer.cc
index 933e75a0286..9a05a715dbb 100644
--- a/chromium/media/remoting/end2end_test_renderer.cc
+++ b/chromium/media/remoting/end2end_test_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/end2end_test_renderer.h b/chromium/media/remoting/end2end_test_renderer.h
index d5f034419ad..f2f02b65bd4 100644
--- a/chromium/media/remoting/end2end_test_renderer.h
+++ b/chromium/media/remoting/end2end_test_renderer.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/fake_media_resource.cc b/chromium/media/remoting/fake_media_resource.cc
index db4f9310716..6afa806fee8 100644
--- a/chromium/media/remoting/fake_media_resource.cc
+++ b/chromium/media/remoting/fake_media_resource.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/fake_media_resource.h b/chromium/media/remoting/fake_media_resource.h
index d39064a4168..55e0d2edbb1 100644
--- a/chromium/media/remoting/fake_media_resource.h
+++ b/chromium/media/remoting/fake_media_resource.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/fake_remoter.cc b/chromium/media/remoting/fake_remoter.cc
index fa91911568d..ad1fa52d94b 100644
--- a/chromium/media/remoting/fake_remoter.cc
+++ b/chromium/media/remoting/fake_remoter.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/fake_remoter.h b/chromium/media/remoting/fake_remoter.h
index 666035a1861..9299c9a44bd 100644
--- a/chromium/media/remoting/fake_remoter.h
+++ b/chromium/media/remoting/fake_remoter.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/integration_test.cc b/chromium/media/remoting/integration_test.cc
index 15648ab0a9c..c42e0cb2c50 100644
--- a/chromium/media/remoting/integration_test.cc
+++ b/chromium/media/remoting/integration_test.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/metrics.cc b/chromium/media/remoting/metrics.cc
index 0fd8d885980..1b9da593702 100644
--- a/chromium/media/remoting/metrics.cc
+++ b/chromium/media/remoting/metrics.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/metrics.h b/chromium/media/remoting/metrics.h
index 343904a2094..f11def74fb3 100644
--- a/chromium/media/remoting/metrics.h
+++ b/chromium/media/remoting/metrics.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/metrics_unittest.cc b/chromium/media/remoting/metrics_unittest.cc
index cd6f8b6f020..728e8548d4a 100644
--- a/chromium/media/remoting/metrics_unittest.cc
+++ b/chromium/media/remoting/metrics_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/mock_receiver_controller.cc b/chromium/media/remoting/mock_receiver_controller.cc
index ac34302a2f3..6afc3bbbba1 100644
--- a/chromium/media/remoting/mock_receiver_controller.cc
+++ b/chromium/media/remoting/mock_receiver_controller.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/mock_receiver_controller.h b/chromium/media/remoting/mock_receiver_controller.h
index 69df2fec16b..1ce4d2432cc 100644
--- a/chromium/media/remoting/mock_receiver_controller.h
+++ b/chromium/media/remoting/mock_receiver_controller.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,6 +13,7 @@
#include "media/mojo/mojom/media_types.mojom.h"
#include "media/mojo/mojom/remoting.mojom.h"
#include "media/remoting/receiver_controller.h"
+#include "mojo/public/cpp/bindings/receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
diff --git a/chromium/media/remoting/receiver.cc b/chromium/media/remoting/receiver.cc
index 2cba44ee20b..1fd9e8a2022 100644
--- a/chromium/media/remoting/receiver.cc
+++ b/chromium/media/remoting/receiver.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/receiver.h b/chromium/media/remoting/receiver.h
index d1f0881b1bf..bbc9751a925 100644
--- a/chromium/media/remoting/receiver.h
+++ b/chromium/media/remoting/receiver.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/receiver_controller.cc b/chromium/media/remoting/receiver_controller.cc
index da8a909c9da..3e09aae9ab1 100644
--- a/chromium/media/remoting/receiver_controller.cc
+++ b/chromium/media/remoting/receiver_controller.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/receiver_controller.h b/chromium/media/remoting/receiver_controller.h
index 28108f1addc..105727dd76b 100644
--- a/chromium/media/remoting/receiver_controller.h
+++ b/chromium/media/remoting/receiver_controller.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/receiver_unittest.cc b/chromium/media/remoting/receiver_unittest.cc
index d15a086ce51..ed52b98fe86 100644
--- a/chromium/media/remoting/receiver_unittest.cc
+++ b/chromium/media/remoting/receiver_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/remoting_constants.h b/chromium/media/remoting/remoting_constants.h
index 4dd35dd21f5..42e92bf1d64 100644
--- a/chromium/media/remoting/remoting_constants.h
+++ b/chromium/media/remoting/remoting_constants.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/remoting_renderer_factory.cc b/chromium/media/remoting/remoting_renderer_factory.cc
index 4ee8c99e7f8..90eaf3a0293 100644
--- a/chromium/media/remoting/remoting_renderer_factory.cc
+++ b/chromium/media/remoting/remoting_renderer_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/remoting_renderer_factory.h b/chromium/media/remoting/remoting_renderer_factory.h
index 3400962f62b..9ddd45bd869 100644
--- a/chromium/media/remoting/remoting_renderer_factory.h
+++ b/chromium/media/remoting/remoting_renderer_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/renderer_controller.cc b/chromium/media/remoting/renderer_controller.cc
index 2f72a512534..8b15ff383f5 100644
--- a/chromium/media/remoting/renderer_controller.cc
+++ b/chromium/media/remoting/renderer_controller.cc
@@ -1,10 +1,11 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/remoting/renderer_controller.h"
#include "base/bind.h"
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/time/default_tick_clock.h"
#include "base/time/tick_clock.h"
@@ -95,6 +96,7 @@ MediaObserverClient::ReasonToSwitchToLocal GetSwitchReason(
return MediaObserverClient::ReasonToSwitchToLocal::PIPELINE_ERROR;
case ROUTE_TERMINATED:
case MEDIA_ELEMENT_DESTROYED:
+ case MEDIA_ELEMENT_FROZEN:
case START_RACE:
case SERVICE_GONE:
return MediaObserverClient::ReasonToSwitchToLocal::ROUTE_TERMINATED;
@@ -370,6 +372,14 @@ void RendererController::OnPaused() {
CancelDelayedStart();
}
+void RendererController::OnFrozen() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ DCHECK(is_paused_);
+
+ // If the element is frozen we want to stop remoting.
+ UpdateAndMaybeSwitch(UNKNOWN_START_TRIGGER, MEDIA_ELEMENT_FROZEN);
+}
+
RemotingCompatibility RendererController::GetVideoCompatibility() const {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(has_video());
@@ -616,23 +626,17 @@ void RendererController::SetClient(MediaObserverClient* client) {
bool RendererController::HasVideoCapability(
mojom::RemotingSinkVideoCapability capability) const {
- return std::find(std::begin(sink_metadata_.video_capabilities),
- std::end(sink_metadata_.video_capabilities),
- capability) != std::end(sink_metadata_.video_capabilities);
+ return base::Contains(sink_metadata_.video_capabilities, capability);
}
bool RendererController::HasAudioCapability(
mojom::RemotingSinkAudioCapability capability) const {
- return std::find(std::begin(sink_metadata_.audio_capabilities),
- std::end(sink_metadata_.audio_capabilities),
- capability) != std::end(sink_metadata_.audio_capabilities);
+ return base::Contains(sink_metadata_.audio_capabilities, capability);
}
bool RendererController::HasFeatureCapability(
RemotingSinkFeature capability) const {
- return std::find(std::begin(sink_metadata_.features),
- std::end(sink_metadata_.features),
- capability) != std::end(sink_metadata_.features);
+ return base::Contains(sink_metadata_.features, capability);
}
bool RendererController::SinkSupportsRemoting() const {
diff --git a/chromium/media/remoting/renderer_controller.h b/chromium/media/remoting/renderer_controller.h
index cfa759a017d..5dc74cbbea3 100644
--- a/chromium/media/remoting/renderer_controller.h
+++ b/chromium/media/remoting/renderer_controller.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -65,6 +65,7 @@ class RendererController final : public mojom::RemotingSource,
void OnRemotePlaybackDisabled(bool disabled) override;
void OnPlaying() override;
void OnPaused() override;
+ void OnFrozen() override;
void OnDataSourceInitialized(const GURL& url_after_redirects) override;
void OnHlsManifestDetected() override;
void SetClient(MediaObserverClient* client) override;
diff --git a/chromium/media/remoting/renderer_controller_unittest.cc b/chromium/media/remoting/renderer_controller_unittest.cc
index e22b406edaa..96c82c5172e 100644
--- a/chromium/media/remoting/renderer_controller_unittest.cc
+++ b/chromium/media/remoting/renderer_controller_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -394,6 +394,24 @@ TEST_F(RendererControllerTest, SetClientNullptr) {
ExpectInLocalRendering();
}
+TEST_F(RendererControllerTest, OnFrozen) {
+ InitializeControllerAndBecomeDominant(DefaultMetadata(VideoCodec::kVP8),
+ GetDefaultSinkMetadata(true));
+ ExpectInDelayedStart();
+ DelayedStartEnds();
+ RunUntilIdle();
+ ExpectInRemoting();
+
+ // Pausing needs to occur before freezing can be enabled.
+ controller_->OnPaused();
+ ExpectInRemoting();
+
+ // Freezing should kick rendering back to local.
+ controller_->OnFrozen();
+ RunUntilIdle();
+ ExpectInLocalRendering();
+}
+
#if BUILDFLAG(IS_ANDROID)
TEST_F(RendererControllerTest, RemotePlaybackHlsCompatibility) {
controller_ = FakeRemoterFactory::CreateController(true);
diff --git a/chromium/media/remoting/stream_provider.cc b/chromium/media/remoting/stream_provider.cc
index 68886bbdf84..f5b15218dec 100644
--- a/chromium/media/remoting/stream_provider.cc
+++ b/chromium/media/remoting/stream_provider.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/stream_provider.h b/chromium/media/remoting/stream_provider.h
index 7e227bdeb4e..910e6ae64b1 100644
--- a/chromium/media/remoting/stream_provider.h
+++ b/chromium/media/remoting/stream_provider.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/stream_provider_unittest.cc b/chromium/media/remoting/stream_provider_unittest.cc
index d6cd705ef68..adb58750844 100644
--- a/chromium/media/remoting/stream_provider_unittest.cc
+++ b/chromium/media/remoting/stream_provider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/test_utils.cc b/chromium/media/remoting/test_utils.cc
index d3ec82254d4..ab361511a5b 100644
--- a/chromium/media/remoting/test_utils.cc
+++ b/chromium/media/remoting/test_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/test_utils.h b/chromium/media/remoting/test_utils.h
index 2b5a3e77de3..c69f6d389bf 100644
--- a/chromium/media/remoting/test_utils.h
+++ b/chromium/media/remoting/test_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/remoting/triggers.h b/chromium/media/remoting/triggers.h
index 8d4a07ebd09..40e9389bbca 100644
--- a/chromium/media/remoting/triggers.h
+++ b/chromium/media/remoting/triggers.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -85,8 +85,11 @@ enum StopTrigger {
// User changing setting forcing shutdown.
USER_DISABLED = 23, // Media Remoting was disabled by user.
+ // Media element was frozen (e.g. page was navigated away).
+ MEDIA_ELEMENT_FROZEN = 25,
+
// Change this to the highest value.
- STOP_TRIGGER_MAX = 24,
+ STOP_TRIGGER_MAX = MEDIA_ELEMENT_FROZEN,
};
} // namespace remoting
diff --git a/chromium/media/renderers/BUILD.gn b/chromium/media/renderers/BUILD.gn
index 2e49d654d76..52a3bab1887 100644
--- a/chromium/media/renderers/BUILD.gn
+++ b/chromium/media/renderers/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/renderers/audio_renderer_impl.cc b/chromium/media/renderers/audio_renderer_impl.cc
index 7c47c375ab5..65bab13c999 100644
--- a/chromium/media/renderers/audio_renderer_impl.cc
+++ b/chromium/media/renderers/audio_renderer_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,7 +6,7 @@
#include <math.h>
#include <stddef.h>
-#include <algorithm>
+
#include <memory>
#include <utility>
@@ -17,6 +17,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/power_monitor/power_monitor.h"
+#include "base/ranges/algorithm.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/default_tick_clock.h"
#include "base/time/time.h"
@@ -46,11 +47,13 @@ AudioRendererImpl::AudioRendererImpl(
AudioRendererSink* sink,
const CreateAudioDecodersCB& create_audio_decoders_cb,
MediaLog* media_log,
+ MediaPlayerLoggingID media_player_id,
SpeechRecognitionClient* speech_recognition_client)
: task_runner_(task_runner),
expecting_config_changes_(false),
sink_(sink),
media_log_(media_log),
+ player_id_(media_player_id),
client_(nullptr),
tick_clock_(base::DefaultTickClock::GetInstance()),
last_audio_memory_usage_(0),
@@ -470,6 +473,10 @@ void AudioRendererImpl::OnDeviceInfoReceived(
SampleFormat target_output_sample_format = kUnknownSampleFormat;
if (is_passthrough_) {
+ ChannelLayout channel_layout =
+ stream->audio_decoder_config().channel_layout();
+ int channels = stream->audio_decoder_config().channels();
+ int bytes_per_frame = stream->audio_decoder_config().bytes_per_frame();
AudioParameters::Format format = AudioParameters::AUDIO_FAKE;
// For DTS and Dolby formats, set target_output_sample_format to the
// respective bit-stream format so that passthrough decoder will be selected
@@ -483,9 +490,11 @@ void AudioRendererImpl::OnDeviceInfoReceived(
} else if (codec == AudioCodec::kDTS) {
format = AudioParameters::AUDIO_BITSTREAM_DTS;
target_output_sample_format = kSampleFormatDts;
- } else if (codec == AudioCodec::kDTSXP2) {
- format = AudioParameters::AUDIO_BITSTREAM_DTSX_P2;
- target_output_sample_format = kSampleFormatDtsxP2;
+ if (hw_params.RequireEncapsulation()) {
+ bytes_per_frame = 1;
+ channel_layout = CHANNEL_LAYOUT_MONO;
+ channels = 1;
+ }
} else {
NOTREACHED();
}
@@ -497,20 +506,18 @@ void AudioRendererImpl::OnDeviceInfoReceived(
// count for bitstream formats will be carried in additional fields of
// AudioBus.
const int buffer_size =
- AudioParameters::kMaxFramesPerCompressedAudioBuffer *
- stream->audio_decoder_config().bytes_per_frame();
+ AudioParameters::kMaxFramesPerCompressedAudioBuffer * bytes_per_frame;
- audio_parameters_.Reset(
- format, stream->audio_decoder_config().channel_layout(),
- stream->audio_decoder_config().samples_per_second(), buffer_size);
+ audio_parameters_.Reset(format, {channel_layout, channels},
+ stream->audio_decoder_config().samples_per_second(),
+ buffer_size);
buffer_converter_.reset();
} else if (use_stream_params) {
audio_parameters_.Reset(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- stream->audio_decoder_config().channel_layout(),
+ {stream->audio_decoder_config().channel_layout(),
+ stream->audio_decoder_config().channels()},
stream->audio_decoder_config().samples_per_second(),
preferred_buffer_size);
- audio_parameters_.set_channels_for_discrete(
- stream->audio_decoder_config().channels());
buffer_converter_.reset();
} else {
// To allow for seamless sample rate adaptations (i.e. changes from say
@@ -564,12 +571,17 @@ void AudioRendererImpl::OnDeviceInfoReceived(
// renderer. Browser-side will down-mix to the hardware config. If the
// hardware later changes to equal stream channels, browser-side will stop
// down-mixing and use the data from all stream channels.
- ChannelLayout renderer_channel_layout =
- hw_channel_count > stream_channel_count
- ? hw_channel_layout
- : stream->audio_decoder_config().channel_layout();
- audio_parameters_.Reset(hw_params.format(), renderer_channel_layout,
+ ChannelLayout stream_channel_layout =
+ stream->audio_decoder_config().channel_layout();
+ bool use_stream_channel_layout = hw_channel_count <= stream_channel_count;
+
+ ChannelLayoutConfig renderer_channel_layout_config =
+ use_stream_channel_layout
+ ? ChannelLayoutConfig(stream_channel_layout, stream_channel_count)
+ : ChannelLayoutConfig(hw_channel_layout, hw_channel_count);
+
+ audio_parameters_.Reset(hw_params.format(), renderer_channel_layout_config,
sample_rate,
AudioLatency::GetHighLatencyBufferSize(
sample_rate, preferred_buffer_size));
@@ -1158,7 +1170,7 @@ int AudioRendererImpl::Render(base::TimeDelta delay,
base::TimeTicks delay_timestamp,
int prior_frames_skipped,
AudioBus* audio_bus) {
- TRACE_EVENT1("media", "AudioRendererImpl::Render", "id", media_log_->id());
+ TRACE_EVENT1("media", "AudioRendererImpl::Render", "id", player_id_);
int frames_requested = audio_bus->frames();
DVLOG(4) << __func__ << " delay:" << delay
<< " prior_frames_skipped:" << prior_frames_skipped
@@ -1433,8 +1445,8 @@ void AudioRendererImpl::ConfigureChannelMask() {
// All channels with a zero mix are muted and can be ignored.
std::vector<bool> channel_mask(audio_parameters_.channels(), false);
for (size_t ch = 0; ch < matrix.size(); ++ch) {
- channel_mask[ch] = std::any_of(matrix[ch].begin(), matrix[ch].end(),
- [](float mix) { return !!mix; });
+ channel_mask[ch] =
+ base::ranges::any_of(matrix[ch], [](float mix) { return !!mix; });
}
algorithm_->SetChannelMask(std::move(channel_mask));
}
diff --git a/chromium/media/renderers/audio_renderer_impl.h b/chromium/media/renderers/audio_renderer_impl.h
index 03750eb7f1f..20ba1a28aef 100644
--- a/chromium/media/renderers/audio_renderer_impl.h
+++ b/chromium/media/renderers/audio_renderer_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -79,6 +79,7 @@ class MEDIA_EXPORT AudioRendererImpl
AudioRendererSink* sink,
const CreateAudioDecodersCB& create_audio_decoders_cb,
MediaLog* media_log,
+ MediaPlayerLoggingID media_player_id,
SpeechRecognitionClient* speech_recognition_client = nullptr);
AudioRendererImpl(const AudioRendererImpl&) = delete;
@@ -270,6 +271,8 @@ class MEDIA_EXPORT AudioRendererImpl
raw_ptr<MediaLog> media_log_;
+ MediaPlayerLoggingID player_id_;
+
// Cached copy of audio params that the renderer is initialized with.
AudioParameters audio_parameters_;
diff --git a/chromium/media/renderers/audio_renderer_impl_unittest.cc b/chromium/media/renderers/audio_renderer_impl_unittest.cc
index d79fbfd0250..6331c2d7dd7 100644
--- a/chromium/media/renderers/audio_renderer_impl_unittest.cc
+++ b/chromium/media/renderers/audio_renderer_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -118,7 +118,7 @@ class AudioRendererImplTest : public ::testing::Test,
// Give the decoder some non-garbage media properties.
AudioRendererImplTest()
: hardware_params_(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- kChannelLayout,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
kOutputSamplesPerSecond,
512),
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
@@ -134,13 +134,15 @@ class AudioRendererImplTest : public ::testing::Test,
ConfigureDemuxerStream(true);
- AudioParameters out_params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- kChannelLayout, kOutputSamplesPerSecond, 512);
+ AudioParameters out_params(
+ AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
+ kOutputSamplesPerSecond, 512);
renderer_ = std::make_unique<AudioRendererImpl>(
main_thread_task_runner_, sink_.get(),
base::BindRepeating(&AudioRendererImplTest::CreateAudioDecoderForTest,
base::Unretained(this)),
- &media_log_, this);
+ &media_log_, 0, this);
renderer_->tick_clock_ = &tick_clock_;
tick_clock_.Advance(base::Seconds(1));
}
@@ -185,7 +187,7 @@ class AudioRendererImplTest : public ::testing::Test,
main_thread_task_runner_, sink_.get(),
base::BindRepeating(&AudioRendererImplTest::CreateAudioDecoderForTest,
base::Unretained(this)),
- &media_log_, nullptr);
+ &media_log_, 0, nullptr);
testing::Mock::VerifyAndClearExpectations(&demuxer_stream_);
ConfigureDemuxerStream(false);
}
@@ -199,7 +201,7 @@ class AudioRendererImplTest : public ::testing::Test,
main_thread_task_runner_, sink_.get(),
base::BindRepeating(&AudioRendererImplTest::CreateAudioDecoderForTest,
base::Unretained(this)),
- &media_log_, nullptr);
+ &media_log_, 0, nullptr);
testing::Mock::VerifyAndClearExpectations(&demuxer_stream_);
ConfigureDemuxerStream(true);
}
@@ -210,7 +212,7 @@ class AudioRendererImplTest : public ::testing::Test,
main_thread_task_runner_, mock_sink_.get(),
base::BindRepeating(&AudioRendererImplTest::CreateAudioDecoderForTest,
base::Unretained(this)),
- &media_log_, nullptr);
+ &media_log_, 0, nullptr);
testing::Mock::VerifyAndClearExpectations(&demuxer_stream_);
ConfigureDemuxerStream(true);
}
@@ -267,7 +269,8 @@ class AudioRendererImplTest : public ::testing::Test,
SetMediaClient(&media_client_);
hardware_params_.Reset(AudioParameters::AUDIO_BITSTREAM_EAC3,
- kChannelLayout, kOutputSamplesPerSecond, 512);
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
+ kOutputSamplesPerSecond, 512);
sink_ = base::MakeRefCounted<FakeAudioRendererSink>(hardware_params_);
AudioDecoderConfig audio_config(AudioCodec::kAC3, kSampleFormatEac3,
kChannelLayout, kInputSamplesPerSecond,
@@ -281,7 +284,7 @@ class AudioRendererImplTest : public ::testing::Test,
main_thread_task_runner_, sink_.get(),
base::BindRepeating(&AudioRendererImplTest::CreateAudioDecoderForTest,
base::Unretained(this)),
- &media_log_, this);
+ &media_log_, 0, this);
Initialize();
}
@@ -894,11 +897,14 @@ TEST_F(AudioRendererImplTest, Underflow_OneCapacityIncreasePerUnderflow) {
// Verify that the proper reduced search space is configured for playback rate
// changes when upmixing is applied to the input.
TEST_F(AudioRendererImplTest, ChannelMask) {
- AudioParameters hw_params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_7_1, kOutputSamplesPerSecond, 1024);
+ AudioParameters hw_params(
+ AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_7_1>(),
+ kOutputSamplesPerSecond, 1024);
ConfigureConfigChangeRenderer(
AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- CHANNEL_LAYOUT_STEREO, kOutputSamplesPerSecond, 1024),
+ ChannelLayoutConfig::Stereo(), kOutputSamplesPerSecond,
+ 1024),
hw_params);
Initialize();
std::vector<bool> mask = channel_mask();
@@ -1424,7 +1430,7 @@ TEST_F(AudioRendererImplTest, MutedPlaybackBadDeviceInfo) {
main_thread_task_runner_, mock_sink_.get(),
base::BindRepeating(&AudioRendererImplTest::CreateAudioDecoderForTest,
base::Unretained(this)),
- &media_log_, nullptr);
+ &media_log_, 0, nullptr);
testing::Mock::VerifyAndClearExpectations(&demuxer_stream_);
ConfigureDemuxerStream(true);
@@ -1506,9 +1512,10 @@ TEST_F(AudioRendererImplTest, BasicMutedPlayback) {
}
TEST_F(AudioRendererImplTest, SinkIsFlushed) {
- ConfigureWithMockSink(AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- kChannelLayout, kOutputSamplesPerSecond,
- 1024 * 15));
+ ConfigureWithMockSink(
+ AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
+ kOutputSamplesPerSecond, 1024 * 15));
Initialize();
Preroll();
StartTicking();
@@ -1529,9 +1536,10 @@ TEST_F(AudioRendererImplTest, LowLatencyHint) {
// Use a basic setup that avoids buffer conversion and sample rate mismatch.
// This simplifies passing frames to the algorithm and verification of
// frames-to-time logic.
- ConfigureBasicRenderer(AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- kChannelLayout, kInputSamplesPerSecond,
- kFramesPerBuffer));
+ ConfigureBasicRenderer(
+ AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
+ kInputSamplesPerSecond, kFramesPerBuffer));
Initialize();
// Setup renderer for playback.
@@ -1617,9 +1625,10 @@ TEST_F(AudioRendererImplTest, HighLatencyHint) {
// Use a basic setup that avoids buffer conversion and sample rate mismatch.
// This simplifies passing frames to the algorithm and verification of
// frames-to-time logic.
- ConfigureBasicRenderer(AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- kChannelLayout, kInputSamplesPerSecond,
- kFramesPerBuffer));
+ ConfigureBasicRenderer(
+ AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ ChannelLayoutConfig::FromLayout<kChannelLayout>(),
+ kInputSamplesPerSecond, kFramesPerBuffer));
Initialize();
// Setup renderer for playback.
diff --git a/chromium/media/renderers/decrypting_renderer.cc b/chromium/media/renderers/decrypting_renderer.cc
index 4af39f4035f..f79ad19ec53 100644
--- a/chromium/media/renderers/decrypting_renderer.cc
+++ b/chromium/media/renderers/decrypting_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/decrypting_renderer.h b/chromium/media/renderers/decrypting_renderer.h
index fece2a5d893..ac1fee571a4 100644
--- a/chromium/media/renderers/decrypting_renderer.h
+++ b/chromium/media/renderers/decrypting_renderer.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/decrypting_renderer_factory.cc b/chromium/media/renderers/decrypting_renderer_factory.cc
index 948f7e0da17..8b38603ce56 100644
--- a/chromium/media/renderers/decrypting_renderer_factory.cc
+++ b/chromium/media/renderers/decrypting_renderer_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/decrypting_renderer_factory.h b/chromium/media/renderers/decrypting_renderer_factory.h
index 180a20b13fe..c7a2eb08145 100644
--- a/chromium/media/renderers/decrypting_renderer_factory.h
+++ b/chromium/media/renderers/decrypting_renderer_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/decrypting_renderer_unittest.cc b/chromium/media/renderers/decrypting_renderer_unittest.cc
index 39362f510d2..eb6b83e479b 100644
--- a/chromium/media/renderers/decrypting_renderer_unittest.cc
+++ b/chromium/media/renderers/decrypting_renderer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/default_decoder_factory.cc b/chromium/media/renderers/default_decoder_factory.cc
index f052f86cd39..3ed218def6b 100644
--- a/chromium/media/renderers/default_decoder_factory.cc
+++ b/chromium/media/renderers/default_decoder_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,6 +30,10 @@
#include "media/filters/ffmpeg_audio_decoder.h"
#endif
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+#include "media/filters/passthrough_dts_audio_decoder.h"
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO)
+
#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
#include "media/filters/ffmpeg_video_decoder.h"
#endif
@@ -67,6 +71,11 @@ void DefaultDecoderFactory::CreateAudioDecoders(
}
#endif
+#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN)
+ audio_decoders->push_back(
+ std::make_unique<PassthroughDTSAudioDecoder>(task_runner, media_log));
+#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN)
+
#if BUILDFLAG(ENABLE_FFMPEG)
audio_decoders->push_back(
std::make_unique<FFmpegAudioDecoder>(task_runner, media_log));
@@ -78,54 +87,6 @@ void DefaultDecoderFactory::CreateAudioDecoders(
}
}
-SupportedVideoDecoderConfigs
-DefaultDecoderFactory::GetSupportedVideoDecoderConfigsForWebRTC() {
- SupportedVideoDecoderConfigs supported_configs;
-
- {
- base::AutoLock auto_lock(shutdown_lock_);
- if (external_decoder_factory_) {
- SupportedVideoDecoderConfigs external_supported_configs =
- external_decoder_factory_->GetSupportedVideoDecoderConfigsForWebRTC();
- supported_configs.insert(supported_configs.end(),
- external_supported_configs.begin(),
- external_supported_configs.end());
- }
- }
-
- if (!base::FeatureList::IsEnabled(media::kExposeSwDecodersToWebRTC))
- return supported_configs;
-
-#if BUILDFLAG(ENABLE_LIBVPX)
- // When the VpxVideoDecoder has been updated for RTC add
- // `VpxVideoDecoder::SupportedConfigs()` to `supported_configs`.
-#endif
-
-#if BUILDFLAG(ENABLE_LIBGAV1_DECODER)
- if (base::FeatureList::IsEnabled(kGav1VideoDecoder)) {
- SupportedVideoDecoderConfigs gav1_configs =
- Gav1VideoDecoder::SupportedConfigs();
- supported_configs.insert(supported_configs.end(), gav1_configs.begin(),
- gav1_configs.end());
- } else
-#endif
- {
-#if BUILDFLAG(ENABLE_DAV1D_DECODER)
- SupportedVideoDecoderConfigs dav1d_configs =
- Dav1dVideoDecoder::SupportedConfigs();
- supported_configs.insert(supported_configs.end(), dav1d_configs.begin(),
- dav1d_configs.end());
-#endif
- }
-
-#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
- // When the FFmpegVideoDecoder has been updated for RTC add
- // `FFmpegVideoDecoder::SupportedConfigsForWebRTC()` to `supported_configs`.
-#endif
-
- return supported_configs;
-}
-
void DefaultDecoderFactory::CreateVideoDecoders(
scoped_refptr<base::SequencedTaskRunner> task_runner,
GpuVideoAcceleratorFactories* gpu_factories,
diff --git a/chromium/media/renderers/default_decoder_factory.h b/chromium/media/renderers/default_decoder_factory.h
index d738f482a60..ad55a609b07 100644
--- a/chromium/media/renderers/default_decoder_factory.h
+++ b/chromium/media/renderers/default_decoder_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -31,7 +31,6 @@ class MEDIA_EXPORT DefaultDecoderFactory final : public DecoderFactory {
scoped_refptr<base::SequencedTaskRunner> task_runner,
MediaLog* media_log,
std::vector<std::unique_ptr<AudioDecoder>>* audio_decoders) final;
- SupportedVideoDecoderConfigs GetSupportedVideoDecoderConfigsForWebRTC() final;
void CreateVideoDecoders(
scoped_refptr<base::SequencedTaskRunner> task_runner,
GpuVideoAcceleratorFactories* gpu_factories,
diff --git a/chromium/media/renderers/default_renderer_factory.cc b/chromium/media/renderers/default_renderer_factory.cc
index 9b9deb35dff..62ff51b5560 100644
--- a/chromium/media/renderers/default_renderer_factory.cc
+++ b/chromium/media/renderers/default_renderer_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,10 +23,12 @@ namespace media {
DefaultRendererFactory::DefaultRendererFactory(
MediaLog* media_log,
DecoderFactory* decoder_factory,
- const GetGpuFactoriesCB& get_gpu_factories_cb)
+ const GetGpuFactoriesCB& get_gpu_factories_cb,
+ MediaPlayerLoggingID media_player_id)
: media_log_(media_log),
decoder_factory_(decoder_factory),
- get_gpu_factories_cb_(get_gpu_factories_cb) {
+ get_gpu_factories_cb_(get_gpu_factories_cb),
+ media_player_id_(media_player_id) {
DCHECK(decoder_factory_);
}
#else
@@ -34,10 +36,12 @@ DefaultRendererFactory::DefaultRendererFactory(
MediaLog* media_log,
DecoderFactory* decoder_factory,
const GetGpuFactoriesCB& get_gpu_factories_cb,
+ MediaPlayerLoggingID media_player_id,
std::unique_ptr<SpeechRecognitionClient> speech_recognition_client)
: media_log_(media_log),
decoder_factory_(decoder_factory),
get_gpu_factories_cb_(get_gpu_factories_cb),
+ media_player_id_(media_player_id),
speech_recognition_client_(std::move(speech_recognition_client)) {
DCHECK(decoder_factory_);
}
@@ -91,10 +95,12 @@ std::unique_ptr<Renderer> DefaultRendererFactory::CreateRenderer(
// finishes.
base::BindRepeating(&DefaultRendererFactory::CreateAudioDecoders,
base::Unretained(this), media_task_runner),
+ media_log_, media_player_id_
#if BUILDFLAG(IS_ANDROID)
- media_log_));
+ ));
#else
- media_log_, speech_recognition_client_.get()));
+ ,
+ speech_recognition_client_.get()));
#endif
GpuVideoAcceleratorFactories* gpu_factories = nullptr;
@@ -120,7 +126,7 @@ std::unique_ptr<Renderer> DefaultRendererFactory::CreateRenderer(
base::Unretained(this), media_task_runner,
std::move(request_overlay_info_cb),
target_color_space, gpu_factories),
- true, media_log_, std::move(gmb_pool)));
+ true, media_log_, std::move(gmb_pool), media_player_id_));
return std::make_unique<RendererImpl>(
media_task_runner, std::move(audio_renderer), std::move(video_renderer));
diff --git a/chromium/media/renderers/default_renderer_factory.h b/chromium/media/renderers/default_renderer_factory.h
index 47defaa026b..552fef31c66 100644
--- a/chromium/media/renderers/default_renderer_factory.h
+++ b/chromium/media/renderers/default_renderer_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,7 @@
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "media/base/media_export.h"
+#include "media/base/media_player_logging_id.h"
#include "media/base/renderer_factory.h"
#if !BUILDFLAG(IS_ANDROID)
@@ -43,12 +44,14 @@ class MEDIA_EXPORT DefaultRendererFactory final : public RendererFactory {
#if BUILDFLAG(IS_ANDROID)
DefaultRendererFactory(MediaLog* media_log,
DecoderFactory* decoder_factory,
- const GetGpuFactoriesCB& get_gpu_factories_cb);
+ const GetGpuFactoriesCB& get_gpu_factories_cb,
+ MediaPlayerLoggingID media_player_id);
#else
DefaultRendererFactory(
MediaLog* media_log,
DecoderFactory* decoder_factory,
const GetGpuFactoriesCB& get_gpu_factories_cb,
+ MediaPlayerLoggingID media_player_id,
std::unique_ptr<SpeechRecognitionClient> speech_recognition_client);
#endif
@@ -83,6 +86,9 @@ class MEDIA_EXPORT DefaultRendererFactory final : public RendererFactory {
// Creates factories for supporting video accelerators. May be null.
GetGpuFactoriesCB get_gpu_factories_cb_;
+ // WebMediaPlayerImpl id.
+ MediaPlayerLoggingID media_player_id_;
+
#if !BUILDFLAG(IS_ANDROID)
std::unique_ptr<SpeechRecognitionClient> speech_recognition_client_;
#endif
diff --git a/chromium/media/renderers/paint_canvas_video_renderer.cc b/chromium/media/renderers/paint_canvas_video_renderer.cc
index 577550d1eff..6c74cca5050 100644
--- a/chromium/media/renderers/paint_canvas_video_renderer.cc
+++ b/chromium/media/renderers/paint_canvas_video_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -77,6 +77,39 @@ namespace media {
namespace {
+// Return the full-range RGB component of the color space of this frame's
+// content. This will replace several color spaces (Rec601, Rec709, and
+// Apple's Rec709) with sRGB, for compatibility with existing behavior.
+gfx::ColorSpace GetVideoFrameRGBColorSpacePreferringSRGB(
+ const VideoFrame* frame) {
+ const auto rgb_color_space = frame->ColorSpace().GetAsFullRangeRGB();
+ auto primary_id = rgb_color_space.GetPrimaryID();
+ switch (primary_id) {
+ case gfx::ColorSpace::PrimaryID::CUSTOM:
+ return rgb_color_space;
+ case gfx::ColorSpace::PrimaryID::SMPTE170M:
+ case gfx::ColorSpace::PrimaryID::SMPTE240M:
+ primary_id = gfx::ColorSpace::PrimaryID::BT709;
+ break;
+ default:
+ break;
+ }
+ auto transfer_id = rgb_color_space.GetTransferID();
+ switch (transfer_id) {
+ case gfx::ColorSpace::TransferID::CUSTOM:
+ case gfx::ColorSpace::TransferID::CUSTOM_HDR:
+ return rgb_color_space;
+ case gfx::ColorSpace::TransferID::BT709_APPLE:
+ case gfx::ColorSpace::TransferID::SMPTE170M:
+ case gfx::ColorSpace::TransferID::SMPTE240M:
+ transfer_id = gfx::ColorSpace::TransferID::SRGB;
+ break;
+ default:
+ break;
+ }
+ return gfx::ColorSpace(primary_id, transfer_id);
+}
+
// This class keeps the last image drawn.
// We delete the temporary resource if it is not used for 3 seconds.
const int kTemporaryResourceDeletionDelay = 3; // Seconds;
@@ -146,10 +179,6 @@ const gpu::MailboxHolder& GetVideoFrameMailboxHolder(VideoFrame* video_frame) {
<< "Format: " << VideoPixelFormatToString(video_frame->format());
const gpu::MailboxHolder& mailbox_holder = video_frame->mailbox_holder(0);
- DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D ||
- mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB ||
- mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES)
- << mailbox_holder.texture_target;
return mailbox_holder;
}
@@ -588,6 +617,17 @@ void ConvertVideoFrameToRGBPixelsTask(const VideoFrame* video_frame,
plane_meta[VideoFrame::kUVPlane].stride,
pixels, row_bytes, matrix, width, rows);
break;
+ case PIXEL_FORMAT_P016LE:
+ libyuv::P016ToARGBMatrix(reinterpret_cast<const uint16_t*>(
+ plane_meta[VideoFrame::kYPlane].data),
+ plane_meta[VideoFrame::kYPlane].stride,
+ reinterpret_cast<const uint16_t*>(
+ plane_meta[VideoFrame::kUVPlane].data),
+ plane_meta[VideoFrame::kUVPlane].stride, pixels,
+ row_bytes, matrix, width, rows);
+ if (!OUTPUT_ARGB)
+ libyuv::ARGBToABGR(pixels, row_bytes, pixels, row_bytes, width, rows);
+ break;
case PIXEL_FORMAT_YUV420P9:
case PIXEL_FORMAT_YUV422P9:
@@ -609,7 +649,6 @@ void ConvertVideoFrameToRGBPixelsTask(const VideoFrame* video_frame,
case PIXEL_FORMAT_MJPEG:
case PIXEL_FORMAT_ABGR:
case PIXEL_FORMAT_XBGR:
- case PIXEL_FORMAT_P016LE:
case PIXEL_FORMAT_XR30:
case PIXEL_FORMAT_XB30:
case PIXEL_FORMAT_RGBAF16:
@@ -1144,7 +1183,7 @@ scoped_refptr<VideoFrame> DownShiftHighbitVideoFrame(
video_frame->visible_rect().height());
const uint16_t* src =
reinterpret_cast<const uint16_t*>(video_frame->visible_data(plane));
- uint8_t* dst = ret->visible_data(plane);
+ uint8_t* dst = ret->GetWritableVisibleData(plane);
if (!src) {
// An AV1 monochrome (grayscale) frame has no U and V planes. Set all U
// and V samples to the neutral value (128).
@@ -1443,6 +1482,10 @@ bool PaintCanvasVideoRenderer::CopyVideoFrameTexturesToGLTexture(
const gpu::MailboxHolder& mailbox_holder =
GetVideoFrameMailboxHolder(video_frame.get());
+ DCHECK(mailbox_holder.texture_target == GL_TEXTURE_2D ||
+ mailbox_holder.texture_target == GL_TEXTURE_RECTANGLE_ARB ||
+ mailbox_holder.texture_target == GL_TEXTURE_EXTERNAL_OES)
+ << mailbox_holder.texture_target;
CopyMailboxToTexture(
destination_gl, video_frame->coded_size(), video_frame->visible_rect(),
mailbox_holder.mailbox, mailbox_holder.sync_token, target, texture,
@@ -1681,7 +1724,8 @@ bool PaintCanvasVideoRenderer::CopyVideoFrameYUVDataToGLTexture(
}
yuv_cache_.mailbox = sii->CreateSharedImage(
- RESOURCE_FORMAT, video_frame->coded_size(), gfx::ColorSpace(),
+ RESOURCE_FORMAT, video_frame->coded_size(),
+ GetVideoFrameRGBColorSpacePreferringSRGB(video_frame.get()),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, usage,
gpu::kNullSurfaceHandle);
token = sii->GenUnverifiedSyncToken();
@@ -1849,7 +1893,12 @@ bool PaintCanvasVideoRenderer::UpdateLastImage(
bool wraps_video_frame_texture = false;
gpu::Mailbox mailbox;
- if (allow_wrap_texture && video_frame->NumTextures() == 1) {
+ // `texture_target` is set only when the image backing the frame is
+ // compatible with GL.
+ bool can_wrap_texture = video_frame->NumTextures() == 1 &&
+ video_frame->mailbox_holder(0).texture_target != 0;
+
+ if (allow_wrap_texture && can_wrap_texture) {
cache_.emplace(video_frame->unique_id());
const gpu::MailboxHolder& holder =
GetVideoFrameMailboxHolder(video_frame.get());
@@ -1885,7 +1934,8 @@ bool PaintCanvasVideoRenderer::UpdateLastImage(
flags |= gpu::SHARED_IMAGE_USAGE_OOP_RASTERIZATION;
}
mailbox = sii->CreateSharedImage(
- RESOURCE_FORMAT, video_frame->coded_size(), gfx::ColorSpace(),
+ RESOURCE_FORMAT, video_frame->coded_size(),
+ GetVideoFrameRGBColorSpacePreferringSRGB(video_frame.get()),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, flags,
gpu::kNullSurfaceHandle);
ri->WaitSyncTokenCHROMIUM(sii->GenUnverifiedSyncToken().GetConstData());
diff --git a/chromium/media/renderers/paint_canvas_video_renderer.h b/chromium/media/renderers/paint_canvas_video_renderer.h
index 58369a6c9e0..4dcf3cdbed2 100644
--- a/chromium/media/renderers/paint_canvas_video_renderer.h
+++ b/chromium/media/renderers/paint_canvas_video_renderer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/paint_canvas_video_renderer_unittest.cc b/chromium/media/renderers/paint_canvas_video_renderer_unittest.cc
index 7fda50379fb..1014e087b90 100644
--- a/chromium/media/renderers/paint_canvas_video_renderer_unittest.cc
+++ b/chromium/media/renderers/paint_canvas_video_renderer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -241,11 +241,11 @@ static scoped_refptr<VideoFrame> CreateCroppedFrame() {
};
libyuv::I420Copy(cropped_y_plane, 16, cropped_u_plane, 8, cropped_v_plane, 8,
- cropped_frame->data(VideoFrame::kYPlane),
+ cropped_frame->writable_data(VideoFrame::kYPlane),
cropped_frame->stride(VideoFrame::kYPlane),
- cropped_frame->data(VideoFrame::kUPlane),
+ cropped_frame->writable_data(VideoFrame::kUPlane),
cropped_frame->stride(VideoFrame::kUPlane),
- cropped_frame->data(VideoFrame::kVPlane),
+ cropped_frame->writable_data(VideoFrame::kVPlane),
cropped_frame->stride(VideoFrame::kVPlane), 16, 16);
return cropped_frame;
@@ -428,10 +428,11 @@ TEST_F(PaintCanvasVideoRendererTest, CroppedFrameToRGBParallel) {
cropped_frame()->data(1), cropped_frame()->stride(1),
cropped_frame()->data(2), cropped_frame()->stride(2),
cropped_frame()->coded_size().width(),
- cropped_frame()->coded_size().height(), test_frame->data(0),
- test_frame->stride(0), test_frame->data(1),
- test_frame->stride(1), test_frame->data(2),
- test_frame->stride(2), test_frame->coded_size().width(),
+ cropped_frame()->coded_size().height(),
+ test_frame->writable_data(0), test_frame->stride(0),
+ test_frame->writable_data(1), test_frame->stride(1),
+ test_frame->writable_data(2), test_frame->stride(2),
+ test_frame->coded_size().width(),
test_frame->coded_size().height(), libyuv::kFilterNone);
const gfx::Size visible_size = test_frame->visible_rect().size();
@@ -621,8 +622,8 @@ TEST_F(PaintCanvasVideoRendererTest, HighBitDepth) {
for (int plane = VideoFrame::kYPlane; plane <= VideoFrame::kVPlane;
++plane) {
int width = cropped_frame()->row_bytes(plane);
- uint16_t* dst = reinterpret_cast<uint16_t*>(frame->data(plane));
- uint8_t* src = cropped_frame()->data(plane);
+ uint16_t* dst = reinterpret_cast<uint16_t*>(frame->writable_data(plane));
+ const uint8_t* src = cropped_frame()->data(plane);
for (int row = 0; row < cropped_frame()->rows(plane); row++) {
for (int col = 0; col < width; col++) {
dst[col] = src[col] << (param.bit_depth - 8);
diff --git a/chromium/media/renderers/remote_playback_client_wrapper.h b/chromium/media/renderers/remote_playback_client_wrapper.h
index 878c93516bd..6f53a7e3b64 100644
--- a/chromium/media/renderers/remote_playback_client_wrapper.h
+++ b/chromium/media/renderers/remote_playback_client_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/renderer_impl.cc b/chromium/media/renderers/renderer_impl.cc
index cb62e2d7785..52fa66e6633 100644
--- a/chromium/media/renderers/renderer_impl.cc
+++ b/chromium/media/renderers/renderer_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/renderer_impl.h b/chromium/media/renderers/renderer_impl.h
index 5ede0182d54..2f23bd88cc1 100644
--- a/chromium/media/renderers/renderer_impl.h
+++ b/chromium/media/renderers/renderer_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/renderer_impl_unittest.cc b/chromium/media/renderers/renderer_impl_unittest.cc
index 8e374ec9797..80dbbdd9f2a 100644
--- a/chromium/media/renderers/renderer_impl_unittest.cc
+++ b/chromium/media/renderers/renderer_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/shared_image_video_frame_test_utils.cc b/chromium/media/renderers/shared_image_video_frame_test_utils.cc
index 9431cae4e27..3439f1b9a4f 100644
--- a/chromium/media/renderers/shared_image_video_frame_test_utils.cc
+++ b/chromium/media/renderers/shared_image_video_frame_test_utils.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -39,23 +39,6 @@ void DestroySharedImages(scoped_refptr<viz::ContextProvider> context_provider,
std::move(callback).Run();
}
-// Upload pixels to a shared image using GL.
-void UploadPixels(gpu::gles2::GLES2Interface* gl,
- const gpu::Mailbox& mailbox,
- const gfx::Size& size,
- GLenum format,
- GLenum type,
- const uint8_t* data) {
- GLuint texture = gl->CreateAndTexStorage2DSharedImageCHROMIUM(mailbox.name);
- gl->BeginSharedImageAccessDirectCHROMIUM(
- texture, GL_SHARED_IMAGE_ACCESS_MODE_READWRITE_CHROMIUM);
- gl->BindTexture(GL_TEXTURE_2D, texture);
- gl->TexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, size.width(), size.height(), format,
- type, data);
- gl->EndSharedImageAccessDirectCHROMIUM(texture);
- gl->DeleteTextures(1, &texture);
-}
-
} // namespace
scoped_refptr<VideoFrame> CreateSharedImageFrame(
@@ -91,7 +74,7 @@ scoped_refptr<VideoFrame> CreateSharedImageRGBAFrame(
DCHECK_EQ(coded_size.width() % 4, 0);
DCHECK_EQ(coded_size.height() % 2, 0);
size_t pixels_size = coded_size.GetArea() * 4;
- auto pixels = std::make_unique<uint8_t[]>(pixels_size);
+ std::vector<uint8_t> pixels(pixels_size);
size_t i = 0;
for (size_t block_y = 0; block_y < 2u; ++block_y) {
for (int y = 0; y < coded_size.height() / 2; ++y) {
@@ -111,17 +94,11 @@ scoped_refptr<VideoFrame> CreateSharedImageRGBAFrame(
gpu::Mailbox mailbox = sii->CreateSharedImage(
viz::ResourceFormat::RGBA_8888, coded_size, gfx::ColorSpace(),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
- gpu::SHARED_IMAGE_USAGE_GLES2, gpu::kNullSurfaceHandle);
- auto* gl = context_provider->ContextGL();
- gl->WaitSyncTokenCHROMIUM(sii->GenUnverifiedSyncToken().GetConstData());
- UploadPixels(gl, mailbox, coded_size, GL_RGBA, GL_UNSIGNED_BYTE,
- pixels.get());
- gpu::SyncToken sync_token;
- gl->GenUnverifiedSyncTokenCHROMIUM(sync_token.GetData());
+ gpu::SHARED_IMAGE_USAGE_GLES2, pixels);
return CreateSharedImageFrame(
std::move(context_provider), VideoPixelFormat::PIXEL_FORMAT_ABGR,
- {mailbox}, sync_token, GL_TEXTURE_2D, coded_size, visible_rect,
+ {mailbox}, {}, GL_TEXTURE_2D, coded_size, visible_rect,
visible_rect.size(), base::Seconds(1), std::move(destroyed_callback));
}
@@ -135,9 +112,9 @@ scoped_refptr<VideoFrame> CreateSharedImageI420Frame(
gfx::Size uv_size(coded_size.width() / 2, coded_size.height() / 2);
size_t y_pixels_size = coded_size.GetArea();
size_t uv_pixels_size = uv_size.GetArea();
- auto y_pixels = std::make_unique<uint8_t[]>(y_pixels_size);
- auto u_pixels = std::make_unique<uint8_t[]>(uv_pixels_size);
- auto v_pixels = std::make_unique<uint8_t[]>(uv_pixels_size);
+ std::vector<uint8_t> y_pixels(y_pixels_size);
+ std::vector<uint8_t> u_pixels(uv_pixels_size);
+ std::vector<uint8_t> v_pixels(uv_pixels_size);
size_t y_i = 0;
size_t uv_i = 0;
for (size_t block_y = 0; block_y < 2u; ++block_y) {
@@ -162,29 +139,19 @@ scoped_refptr<VideoFrame> CreateSharedImageI420Frame(
gpu::Mailbox y_mailbox = sii->CreateSharedImage(
viz::ResourceFormat::LUMINANCE_8, coded_size, gfx::ColorSpace(),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
- gpu::SHARED_IMAGE_USAGE_GLES2, gpu::kNullSurfaceHandle);
+ gpu::SHARED_IMAGE_USAGE_GLES2, y_pixels);
gpu::Mailbox u_mailbox = sii->CreateSharedImage(
viz::ResourceFormat::LUMINANCE_8, uv_size, gfx::ColorSpace(),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
- gpu::SHARED_IMAGE_USAGE_GLES2, gpu::kNullSurfaceHandle);
+ gpu::SHARED_IMAGE_USAGE_GLES2, u_pixels);
gpu::Mailbox v_mailbox = sii->CreateSharedImage(
viz::ResourceFormat::LUMINANCE_8, uv_size, gfx::ColorSpace(),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
- gpu::SHARED_IMAGE_USAGE_GLES2, gpu::kNullSurfaceHandle);
- auto* gl = context_provider->ContextGL();
- gl->WaitSyncTokenCHROMIUM(sii->GenUnverifiedSyncToken().GetConstData());
- UploadPixels(gl, y_mailbox, coded_size, GL_LUMINANCE, GL_UNSIGNED_BYTE,
- y_pixels.get());
- UploadPixels(gl, u_mailbox, uv_size, GL_LUMINANCE, GL_UNSIGNED_BYTE,
- u_pixels.get());
- UploadPixels(gl, v_mailbox, uv_size, GL_LUMINANCE, GL_UNSIGNED_BYTE,
- v_pixels.get());
- gpu::SyncToken sync_token;
- gl->GenUnverifiedSyncTokenCHROMIUM(sync_token.GetData());
+ gpu::SHARED_IMAGE_USAGE_GLES2, v_pixels);
return CreateSharedImageFrame(
std::move(context_provider), VideoPixelFormat::PIXEL_FORMAT_I420,
- {y_mailbox, u_mailbox, v_mailbox}, sync_token, GL_TEXTURE_2D, coded_size,
+ {y_mailbox, u_mailbox, v_mailbox}, {}, GL_TEXTURE_2D, coded_size,
visible_rect, visible_rect.size(), base::Seconds(1),
std::move(destroyed_callback));
}
@@ -203,8 +170,8 @@ scoped_refptr<VideoFrame> CreateSharedImageNV12Frame(
gfx::Size uv_size(coded_size.width() / 2, coded_size.height() / 2);
size_t y_pixels_size = coded_size.GetArea();
size_t uv_pixels_size = uv_size.GetArea() * 2;
- auto y_pixels = std::make_unique<uint8_t[]>(y_pixels_size);
- auto uv_pixels = std::make_unique<uint8_t[]>(uv_pixels_size);
+ std::vector<uint8_t> y_pixels(y_pixels_size);
+ std::vector<uint8_t> uv_pixels(uv_pixels_size);
size_t y_i = 0;
size_t uv_i = 0;
for (size_t block_y = 0; block_y < 2u; ++block_y) {
@@ -229,25 +196,15 @@ scoped_refptr<VideoFrame> CreateSharedImageNV12Frame(
gpu::Mailbox y_mailbox = sii->CreateSharedImage(
viz::ResourceFormat::LUMINANCE_8, coded_size, gfx::ColorSpace(),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
- gpu::SHARED_IMAGE_USAGE_GLES2, gpu::kNullSurfaceHandle);
+ gpu::SHARED_IMAGE_USAGE_GLES2, y_pixels);
gpu::Mailbox uv_mailbox = sii->CreateSharedImage(
viz::ResourceFormat::RG_88, uv_size, gfx::ColorSpace(),
kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType,
- gpu::SHARED_IMAGE_USAGE_GLES2, gpu::kNullSurfaceHandle);
- auto* gl = context_provider->ContextGL();
- gl->WaitSyncTokenCHROMIUM(sii->GenUnverifiedSyncToken().GetConstData());
- UploadPixels(gl, y_mailbox, coded_size, GL_LUMINANCE, GL_UNSIGNED_BYTE,
- y_pixels.get());
- UploadPixels(gl, uv_mailbox, uv_size, GL_RG, GL_UNSIGNED_BYTE,
- uv_pixels.get());
- gpu::SyncToken sync_token;
- gl->GenUnverifiedSyncTokenCHROMIUM(sync_token.GetData());
-
+ gpu::SHARED_IMAGE_USAGE_GLES2, uv_pixels);
return CreateSharedImageFrame(
std::move(context_provider), VideoPixelFormat::PIXEL_FORMAT_NV12,
- {y_mailbox, uv_mailbox}, sync_token, GL_TEXTURE_2D, coded_size,
- visible_rect, visible_rect.size(), base::Seconds(1),
- std::move(destroyed_callback));
+ {y_mailbox, uv_mailbox}, {}, GL_TEXTURE_2D, coded_size, visible_rect,
+ visible_rect.size(), base::Seconds(1), std::move(destroyed_callback));
}
} // namespace media
diff --git a/chromium/media/renderers/shared_image_video_frame_test_utils.h b/chromium/media/renderers/shared_image_video_frame_test_utils.h
index b8fc8816850..9b0ba1332a3 100644
--- a/chromium/media/renderers/shared_image_video_frame_test_utils.h
+++ b/chromium/media/renderers/shared_image_video_frame_test_utils.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/video_frame_rgba_to_yuva_converter.cc b/chromium/media/renderers/video_frame_rgba_to_yuva_converter.cc
index 80fa9431cd7..c9805bcdac9 100644
--- a/chromium/media/renderers/video_frame_rgba_to_yuva_converter.cc
+++ b/chromium/media/renderers/video_frame_rgba_to_yuva_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/video_frame_rgba_to_yuva_converter.h b/chromium/media/renderers/video_frame_rgba_to_yuva_converter.h
index 3e04b990616..197db79556a 100644
--- a/chromium/media/renderers/video_frame_rgba_to_yuva_converter.h
+++ b/chromium/media/renderers/video_frame_rgba_to_yuva_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/video_frame_yuv_converter.cc b/chromium/media/renderers/video_frame_yuv_converter.cc
index 273f5442cec..177ecfffcfa 100644
--- a/chromium/media/renderers/video_frame_yuv_converter.cc
+++ b/chromium/media/renderers/video_frame_yuv_converter.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
#include <GLES3/gl3.h>
+#include "base/logging.h"
#include "components/viz/common/gpu/raster_context_provider.h"
#include "components/viz/common/resources/resource_format_utils.h"
#include "gpu/command_buffer/client/raster_interface.h"
@@ -67,7 +68,7 @@ GrGLenum GetSurfaceColorFormat(GrGLenum format, GrGLenum type) {
return format;
}
-bool DrawYUVImageToSkSurface(const VideoFrame* video_frame,
+void DrawYUVImageToSkSurface(const VideoFrame* video_frame,
sk_sp<SkImage> image,
sk_sp<SkSurface> surface,
bool use_visible_rect) {
@@ -88,7 +89,6 @@ bool DrawYUVImageToSkSurface(const VideoFrame* video_frame,
}
surface->flushAndSubmit();
- return true;
}
} // namespace
@@ -146,10 +146,10 @@ bool VideoFrameYUVConverter::ConvertYUVVideoFrame(
gpu::Mailbox mailboxes[SkYUVAInfo::kMaxPlanes]{};
holder_->VideoFrameToMailboxes(video_frame, raster_context_provider,
mailboxes);
- ri->ConvertYUVAMailboxesToRGB(
- dest_mailbox_holder.mailbox, holder_->yuva_info().yuvColorSpace(),
- SkColorSpace::MakeSRGB().get(), holder_->yuva_info().planeConfig(),
- holder_->yuva_info().subsampling(), mailboxes);
+ ri->ConvertYUVAMailboxesToRGB(dest_mailbox_holder.mailbox,
+ holder_->yuva_info().yuvColorSpace(), nullptr,
+ holder_->yuva_info().planeConfig(),
+ holder_->yuva_info().subsampling(), mailboxes);
return true;
}
@@ -196,22 +196,31 @@ bool VideoFrameYUVConverter::ConvertFromVideoFrameYUVWithGrContext(
GrBackendTexture result_texture(result_width, result_height, GrMipMapped::kNo,
result_gl_texture_info);
+ // Use the same SkColorSpace for the surface and image, so that no color space
+ // conversion is performed.
+ auto source_and_dest_color_space = SkColorSpace::MakeSRGB();
+
// Use dst texture as SkSurface back resource.
auto surface = SkSurface::MakeFromBackendTexture(
gr_context, result_texture,
gr_params.flip_y ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin,
1, GetCompatibleSurfaceColorType(result_gl_texture_info.fFormat),
- SkColorSpace::MakeSRGB(), nullptr);
+ source_and_dest_color_space, nullptr);
// Terminate if surface cannot be created.
- bool result = true;
+ bool result = false;
if (surface) {
- auto image =
- holder_->VideoFrameToSkImage(video_frame, raster_context_provider);
- result = DrawYUVImageToSkSurface(video_frame, image, surface,
- gr_params.use_visible_rect);
+ auto image = holder_->VideoFrameToSkImage(
+ video_frame, raster_context_provider, source_and_dest_color_space);
+ if (image) {
+ result = true;
+ DrawYUVImageToSkSurface(video_frame, image, surface,
+ gr_params.use_visible_rect);
+ } else {
+ DLOG(ERROR) << "Failed to create YUV SkImage";
+ }
} else {
- result = false;
+ DLOG(ERROR) << "Failed to create SkSurface";
}
// Release textures to guarantee |holder_| doesn't hold read access on
diff --git a/chromium/media/renderers/video_frame_yuv_converter.h b/chromium/media/renderers/video_frame_yuv_converter.h
index 8d907fb5a10..47b9107eb94 100644
--- a/chromium/media/renderers/video_frame_yuv_converter.h
+++ b/chromium/media/renderers/video_frame_yuv_converter.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -28,7 +28,9 @@ class VideoFrameYUVMailboxesHolder;
// I420 or NV12 format. Automatically handles upload of CPU memory backed
// VideoFrames in I420 format. Converting CPU backed VideoFrames requires
// creation of shared images to upload the frame to the GPU where the conversion
-// takes place.
+// takes place. This will not perform any color space conversion besides the
+// YUV to RGB conversion (it will ignore the color space of the SharedImage
+// backing the destination mailbox).
// IMPORTANT: Callers of this function can cache this class and call
// ConvertYUVVideoFrame() to prevent repeated creation/deletion of shared
// images.
@@ -48,6 +50,7 @@ class MEDIA_EXPORT VideoFrameYUVConverter {
VideoFrameYUVConverter();
~VideoFrameYUVConverter();
static bool IsVideoFrameFormatSupported(const VideoFrame& video_frame);
+
static bool ConvertYUVVideoFrameNoCaching(
const VideoFrame* video_frame,
viz::RasterContextProvider* raster_context_provider,
diff --git a/chromium/media/renderers/video_frame_yuv_mailboxes_holder.cc b/chromium/media/renderers/video_frame_yuv_mailboxes_holder.cc
index 1fb194a9bd9..881dd03dee5 100644
--- a/chromium/media/renderers/video_frame_yuv_mailboxes_holder.cc
+++ b/chromium/media/renderers/video_frame_yuv_mailboxes_holder.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -182,16 +182,21 @@ GrYUVABackendTextures VideoFrameYUVMailboxesHolder::VideoFrameToSkiaTextures(
sk_sp<SkImage> VideoFrameYUVMailboxesHolder::VideoFrameToSkImage(
const VideoFrame* video_frame,
- viz::RasterContextProvider* raster_context_provider) {
+ viz::RasterContextProvider* raster_context_provider,
+ sk_sp<SkColorSpace> reinterpret_color_space) {
GrDirectContext* gr_context = raster_context_provider->GrContext();
DCHECK(gr_context);
GrYUVABackendTextures yuva_backend_textures = VideoFrameToSkiaTextures(
video_frame, raster_context_provider, /*for_surface=*/false);
+ auto rgb_color_space =
+ reinterpret_color_space
+ ? reinterpret_color_space
+ : video_frame->ColorSpace().GetAsFullRangeRGB().ToSkColorSpace();
DCHECK(yuva_backend_textures.isValid());
auto result = SkImage::MakeFromYUVATextures(gr_context, yuva_backend_textures,
- SkColorSpace::MakeSRGB());
+ rgb_color_space);
DCHECK(result);
return result;
}
@@ -297,6 +302,7 @@ VideoFrameYUVMailboxesHolder::VideoPixelFormatToSkiaValues(
// we do assume 8 bit formats. With that exception, anything else should work.
switch (video_format) {
case PIXEL_FORMAT_NV12:
+ case PIXEL_FORMAT_P016LE:
return {SkYUVAInfo::PlaneConfig::kY_UV, SkYUVAInfo::Subsampling::k420};
case PIXEL_FORMAT_I420:
return {SkYUVAInfo::PlaneConfig::kY_U_V, SkYUVAInfo::Subsampling::k420};
diff --git a/chromium/media/renderers/video_frame_yuv_mailboxes_holder.h b/chromium/media/renderers/video_frame_yuv_mailboxes_holder.h
index c9f5153b536..5bec323ba33 100644
--- a/chromium/media/renderers/video_frame_yuv_mailboxes_holder.h
+++ b/chromium/media/renderers/video_frame_yuv_mailboxes_holder.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -34,10 +34,14 @@ class MEDIA_EXPORT VideoFrameYUVMailboxesHolder {
viz::RasterContextProvider* raster_context_provider,
gpu::Mailbox mailboxes[SkYUVAInfo::kMaxPlanes]);
- // Returns a YUV SkImage for the specified video frame.
+ // Returns a YUV SkImage for the specified video frame. If
+ // `reinterpret_color_space` is non-nullptr, then the SkImage will be
+ // reinterpreted to be in the specified value. Otherwise, it will be
+ // in `video_frame`'s color space.
sk_sp<SkImage> VideoFrameToSkImage(
const VideoFrame* video_frame,
- viz::RasterContextProvider* raster_context_provider);
+ viz::RasterContextProvider* raster_context_provider,
+ sk_sp<SkColorSpace> reinterpret_color_space);
// Creates SkSurfaces for each plane for the specified video frame. Returns
// true only if surfaces for all planes were created.
diff --git a/chromium/media/renderers/video_overlay_factory.cc b/chromium/media/renderers/video_overlay_factory.cc
index d73990b1174..4bbb14b6c30 100644
--- a/chromium/media/renderers/video_overlay_factory.cc
+++ b/chromium/media/renderers/video_overlay_factory.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/video_overlay_factory.h b/chromium/media/renderers/video_overlay_factory.h
index a5a30c2e801..1f9b6949ef7 100644
--- a/chromium/media/renderers/video_overlay_factory.h
+++ b/chromium/media/renderers/video_overlay_factory.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/video_renderer_impl.cc b/chromium/media/renderers/video_renderer_impl.cc
index 6ddc1bd3a70..a82fa782b26 100644
--- a/chromium/media/renderers/video_renderer_impl.cc
+++ b/chromium/media/renderers/video_renderer_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -53,13 +53,15 @@ VideoRendererImpl::VideoRendererImpl(
const CreateVideoDecodersCB& create_video_decoders_cb,
bool drop_frames,
MediaLog* media_log,
- std::unique_ptr<GpuMemoryBufferVideoFramePool> gmb_pool)
+ std::unique_ptr<GpuMemoryBufferVideoFramePool> gmb_pool,
+ MediaPlayerLoggingID media_player_id)
: task_runner_(media_task_runner),
sink_(sink),
sink_started_(false),
client_(nullptr),
gpu_memory_buffer_pool_(std::move(gmb_pool)),
media_log_(media_log),
+ player_id_(media_player_id),
low_delay_(false),
received_end_of_stream_(false),
rendered_end_of_stream_(false),
@@ -191,7 +193,6 @@ void VideoRendererImpl::Initialize(
}
low_delay_ = ShouldUseLowDelayMode(demuxer_stream_);
- UMA_HISTOGRAM_BOOLEAN("Media.VideoRenderer.LowDelay", low_delay_);
if (low_delay_) {
MEDIA_LOG(DEBUG, media_log_) << "Video rendering in low delay mode.";
@@ -226,8 +227,7 @@ scoped_refptr<VideoFrame> VideoRendererImpl::Render(
base::TimeTicks deadline_min,
base::TimeTicks deadline_max,
RenderingMode rendering_mode) {
- TRACE_EVENT_BEGIN1("media", "VideoRendererImpl::Render", "id",
- media_log_->id());
+ TRACE_EVENT_BEGIN1("media", "VideoRendererImpl::Render", "id", player_id_);
base::AutoLock auto_lock(lock_);
DCHECK_EQ(state_, kPlaying);
last_render_time_ = tick_clock_->NowTicks();
@@ -826,7 +826,7 @@ void VideoRendererImpl::UpdateStats_Locked(bool force_update) {
if (stats_.video_frames_dropped) {
TRACE_EVENT_INSTANT2("media", "VideoFramesDropped",
TRACE_EVENT_SCOPE_THREAD, "count",
- stats_.video_frames_dropped, "id", media_log_->id());
+ stats_.video_frames_dropped, "id", player_id_);
}
const size_t memory_usage = algorithm_->GetMemoryUsage();
diff --git a/chromium/media/renderers/video_renderer_impl.h b/chromium/media/renderers/video_renderer_impl.h
index 1c760273371..7ef5004d070 100644
--- a/chromium/media/renderers/video_renderer_impl.h
+++ b/chromium/media/renderers/video_renderer_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -61,7 +61,8 @@ class MEDIA_EXPORT VideoRendererImpl
const CreateVideoDecodersCB& create_video_decoders_cb,
bool drop_frames,
MediaLog* media_log,
- std::unique_ptr<GpuMemoryBufferVideoFramePool> gmb_pool);
+ std::unique_ptr<GpuMemoryBufferVideoFramePool> gmb_pool,
+ MediaPlayerLoggingID media_player_id);
VideoRendererImpl(const VideoRendererImpl&) = delete;
VideoRendererImpl& operator=(const VideoRendererImpl&) = delete;
@@ -242,6 +243,8 @@ class MEDIA_EXPORT VideoRendererImpl
raw_ptr<MediaLog> media_log_;
+ MediaPlayerLoggingID player_id_;
+
// Flag indicating low-delay mode.
bool low_delay_;
diff --git a/chromium/media/renderers/video_renderer_impl_unittest.cc b/chromium/media/renderers/video_renderer_impl_unittest.cc
index dbc8adf8822..dcd4af2ec0c 100644
--- a/chromium/media/renderers/video_renderer_impl_unittest.cc
+++ b/chromium/media/renderers/video_renderer_impl_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -96,7 +96,7 @@ class VideoRendererImplTest : public testing::Test {
base::ThreadTaskRunnerHandle::Get(), null_video_sink_.get(),
base::BindRepeating(&VideoRendererImplTest::CreateVideoDecodersForTest,
base::Unretained(this)),
- true, &media_log_, nullptr);
+ true, &media_log_, nullptr, 0);
renderer_->SetTickClockForTesting(&tick_clock_);
null_video_sink_->set_tick_clock_for_testing(&tick_clock_);
time_source_.SetTickClockForTesting(&tick_clock_);
@@ -1186,7 +1186,8 @@ class VideoRendererImplAsyncAddFrameReadyTest : public VideoRendererImplTest {
CreateVideoDecodersForTest,
base::Unretained(this)),
true, &media_log_,
- std::make_unique<MockGpuMemoryBufferVideoFramePool>(&frame_ready_cbs_));
+ std::make_unique<MockGpuMemoryBufferVideoFramePool>(&frame_ready_cbs_),
+ 0);
VideoRendererImplTest::Initialize();
}
diff --git a/chromium/media/renderers/video_resource_updater.cc b/chromium/media/renderers/video_resource_updater.cc
index 1b1ed92d4a0..ce834bda9e0 100644
--- a/chromium/media/renderers/video_resource_updater.cc
+++ b/chromium/media/renderers/video_resource_updater.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,7 +7,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <algorithm>
#include <string>
#include "base/atomic_sequence_num.h"
@@ -18,6 +17,7 @@
#include "base/memory/raw_ptr.h"
#include "base/memory/shared_memory_mapping.h"
#include "base/memory/unsafe_shared_memory_region.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_manager.h"
@@ -41,6 +41,7 @@
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_trace_utils.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
+#include "media/base/format_utils.h"
#include "media/base/video_frame.h"
#include "media/renderers/paint_canvas_video_renderer.h"
#include "media/video/half_float_maker.h"
@@ -75,19 +76,32 @@ gfx::ProtectedVideoType ProtectedVideoTypeFromMetadata(
}
VideoFrameResourceType ExternalResourceTypeForHardwarePlanes(
- VideoPixelFormat format,
+ const VideoFrame& frame,
GLuint target,
- int num_textures,
gfx::BufferFormat buffer_formats[VideoFrame::kMaxPlanes],
- bool use_stream_video_draw_quad,
- bool dcomp_surface) {
+ bool use_stream_video_draw_quad) {
+ const VideoPixelFormat format = frame.format();
+ const size_t num_textures = frame.NumTextures();
+
+ if (frame.RequiresExternalSampler()) {
+ // The texture |target| can be 0 for Fuchsia.
+ DCHECK(target == 0 || target == GL_TEXTURE_EXTERNAL_OES)
+ << "Unsupported target " << gl::GLEnums::GetStringEnum(target);
+ DCHECK_EQ(num_textures, 1u);
+ absl::optional<gfx::BufferFormat> buffer_format =
+ VideoPixelFormatToGfxBufferFormat(format);
+ DCHECK(buffer_format.has_value());
+ buffer_formats[0] = buffer_format.value();
+ return VideoFrameResourceType::RGB;
+ }
+
switch (format) {
case PIXEL_FORMAT_ARGB:
case PIXEL_FORMAT_XRGB:
case PIXEL_FORMAT_ABGR:
case PIXEL_FORMAT_XBGR:
case PIXEL_FORMAT_BGRA:
- DCHECK_EQ(num_textures, 1);
+ DCHECK_EQ(num_textures, 1u);
// This maps VideoPixelFormat back to GMB BufferFormat
// NOTE: ABGR == RGBA and ARGB == BGRA, they differ only byte order
// See: VideoFormat function in gpu_memory_buffer_video_frame_pool
@@ -104,7 +118,7 @@ VideoFrameResourceType ExternalResourceTypeForHardwarePlanes(
// TODO(sunnyps): It's odd to reuse the Android path on Windows. There
// could be other unknown assumptions in other parts of the rendering
// stack about stream video quads. Investigate alternative solutions.
- if (use_stream_video_draw_quad || dcomp_surface)
+ if (use_stream_video_draw_quad || frame.metadata().dcomp_surface)
return VideoFrameResourceType::STREAM_TEXTURE;
[[fallthrough]];
case GL_TEXTURE_2D:
@@ -124,7 +138,7 @@ VideoFrameResourceType ExternalResourceTypeForHardwarePlanes(
: gfx::BufferFormat::RGBA_1010102;
return VideoFrameResourceType::RGB;
case PIXEL_FORMAT_I420:
- DCHECK_EQ(num_textures, 3);
+ DCHECK_EQ(num_textures, 3u);
buffer_formats[0] = gfx::BufferFormat::R_8;
buffer_formats[1] = gfx::BufferFormat::R_8;
buffer_formats[2] = gfx::BufferFormat::R_8;
@@ -132,35 +146,37 @@ VideoFrameResourceType ExternalResourceTypeForHardwarePlanes(
case PIXEL_FORMAT_NV12:
// |target| is set to 0 for Vulkan textures.
+ //
+ // TODO(https://crbug.com/1116101): Note that GL_TEXTURE_EXTERNAL_OES is
+ // allowed even for two-texture NV12 frames. This is intended to handle a
+ // couple of cases: a) when these textures are connected to the
+ // corresponding plane of the contents of an EGLStream using
+ // EGL_NV_stream_consumer_gltexture_yuv; b) when gl::GLImageD3D is used
+ // with GL_TEXTURE_EXTERNAL_OES (note that this case should be able to be
+ // migrated to GL_TEXTURE_2D after https://crrev.com/c/3856660).
DCHECK(target == 0 || target == GL_TEXTURE_EXTERNAL_OES ||
target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB)
<< "Unsupported target " << gl::GLEnums::GetStringEnum(target);
-
- if (num_textures == 1) {
- // Single-texture multi-planar frames can be sampled as RGB.
- buffer_formats[0] = gfx::BufferFormat::YUV_420_BIPLANAR;
- return VideoFrameResourceType::RGB;
- }
-
+ DCHECK_EQ(num_textures, 2u);
buffer_formats[0] = gfx::BufferFormat::R_8;
buffer_formats[1] = gfx::BufferFormat::RG_88;
return VideoFrameResourceType::YUV;
case PIXEL_FORMAT_P016LE:
- if (num_textures == 1) {
- // Single-texture multi-planar frames can be sampled as RGB.
- buffer_formats[0] = gfx::BufferFormat::P010;
- return VideoFrameResourceType::RGB;
- }
+ DCHECK_EQ(num_textures, 2u);
// TODO(mcasas): Support other formats such as e.g. P012.
buffer_formats[0] = gfx::BufferFormat::R_16;
// TODO(https://crbug.com/1233228): This needs to be
// gfx::BufferFormat::RG_1616.
+#if BUILDFLAG(IS_MAC)
+ buffer_formats[1] = gfx::BufferFormat::RG_1616;
+#else
buffer_formats[1] = gfx::BufferFormat::RG_88;
+#endif
return VideoFrameResourceType::YUV;
case PIXEL_FORMAT_RGBAF16:
- DCHECK_EQ(num_textures, 1);
+ DCHECK_EQ(num_textures, 1u);
buffer_formats[0] = gfx::BufferFormat::RGBA_F16;
return VideoFrameResourceType::RGBA;
@@ -440,7 +456,7 @@ class VideoResourceUpdater::HardwarePlaneResource
caps.texture_storage_image &&
IsGpuMemoryBufferFormatSupported(format);
uint32_t shared_image_usage =
- gpu::SHARED_IMAGE_USAGE_GLES2 | gpu::SHARED_IMAGE_USAGE_DISPLAY;
+ gpu::SHARED_IMAGE_USAGE_GLES2 | gpu::SHARED_IMAGE_USAGE_DISPLAY_READ;
if (overlay_candidate_) {
shared_image_usage |= gpu::SHARED_IMAGE_USAGE_SCANOUT;
texture_target_ = gpu::GetBufferTextureTarget(gfx::BufferUsage::SCANOUT,
@@ -613,12 +629,6 @@ void VideoResourceUpdater::AppendQuads(
break;
}
case VideoFrameResourceType::YUV: {
- const gfx::Size ya_tex_size = coded_size;
-
- int u_width = frame->columns(VideoFrame::kUPlane);
- int u_height = frame->rows(VideoFrame::kUPlane);
- gfx::Size uv_tex_size(u_width, u_height);
-
DCHECK_EQ(frame_resources_.size(),
VideoFrame::NumPlanes(frame->format()));
if (frame->HasTextures()) {
@@ -627,34 +637,24 @@ void VideoResourceUpdater::AppendQuads(
frame->format() == PIXEL_FORMAT_I420);
}
- // Compute the UV sub-sampling factor based on the ratio between
- // |ya_tex_size| and |uv_tex_size|.
- float uv_subsampling_factor_x =
- static_cast<float>(ya_tex_size.width()) / uv_tex_size.width();
- float uv_subsampling_factor_y =
- static_cast<float>(ya_tex_size.height()) / uv_tex_size.height();
- gfx::RectF ya_tex_coord_rect(visible_rect);
- gfx::RectF uv_tex_coord_rect(
- visible_rect.x() / uv_subsampling_factor_x,
- visible_rect.y() / uv_subsampling_factor_y,
- visible_rect.width() / uv_subsampling_factor_x,
- visible_rect.height() / uv_subsampling_factor_y);
+ // Get the scaling factor of the YA texture relative to the UV texture.
+ const gfx::Size uv_sample_size =
+ VideoFrame::SampleSize(frame->format(), VideoFrame::kUPlane);
auto* yuv_video_quad =
render_pass->CreateAndAppendDrawQuad<viz::YUVVideoDrawQuad>();
yuv_video_quad->SetNew(
shared_quad_state, quad_rect, visible_quad_rect, needs_blending,
- ya_tex_coord_rect, uv_tex_coord_rect, ya_tex_size, uv_tex_size,
- frame_resources_[0].id, frame_resources_[1].id,
+ coded_size, visible_rect, uv_sample_size, frame_resources_[0].id,
+ frame_resources_[1].id,
frame_resources_.size() > 2 ? frame_resources_[2].id
: frame_resources_[1].id,
frame_resources_.size() > 3 ? frame_resources_[3].id
: viz::kInvalidResourceId,
frame->ColorSpace(), frame_resource_offset_,
- frame_resource_multiplier_, frame_bits_per_channel_);
- yuv_video_quad->hdr_metadata = frame->hdr_metadata();
- yuv_video_quad->protected_video_type =
- ProtectedVideoTypeFromMetadata(frame->metadata());
+ frame_resource_multiplier_, frame_bits_per_channel_,
+ ProtectedVideoTypeFromMetadata(frame->metadata()),
+ frame->hdr_metadata());
for (viz::ResourceId resource_id : yuv_video_quad->resources) {
resource_provider_->ValidateResource(resource_id);
@@ -838,11 +838,11 @@ void VideoResourceUpdater::CopyHardwarePlane(
gpu::SyncToken());
gpu::SyncToken sync_token = video_frame->UpdateReleaseSyncToken(&client);
- auto transferable_resource = viz::TransferableResource::MakeGL(
+ auto transferable_resource = viz::TransferableResource::MakeGpu(
hardware_resource->mailbox(), GL_LINEAR, GL_TEXTURE_2D, sync_token,
- output_plane_resource_size, false /* is_overlay_candidate */);
+ output_plane_resource_size, copy_resource_format,
+ false /* is_overlay_candidate */);
transferable_resource.color_space = resource_color_space;
- transferable_resource.format = copy_resource_format;
external_resources->resources.push_back(std::move(transferable_resource));
external_resources->release_callbacks.push_back(base::BindOnce(
@@ -869,18 +869,19 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
gfx::BufferFormat buffer_formats[VideoFrame::kMaxPlanes];
external_resources.type = ExternalResourceTypeForHardwarePlanes(
- video_frame->format(), target, video_frame->NumTextures(), buffer_formats,
- use_stream_video_draw_quad_, video_frame->metadata().dcomp_surface);
+ *video_frame, target, buffer_formats, use_stream_video_draw_quad_);
if (external_resources.type == VideoFrameResourceType::NONE) {
DLOG(ERROR) << "Unsupported Texture format"
<< VideoPixelFormatToString(video_frame->format());
return external_resources;
}
+ absl::optional<gfx::ColorSpace> resource_color_space_when_sampled;
if (external_resources.type == VideoFrameResourceType::RGB ||
external_resources.type == VideoFrameResourceType::RGBA ||
external_resources.type == VideoFrameResourceType::RGBA_PREMULTIPLIED) {
- resource_color_space = resource_color_space.GetAsFullRangeRGB();
+ resource_color_space_when_sampled =
+ resource_color_space.GetAsFullRangeRGB();
}
const size_t num_textures = video_frame->NumTextures();
@@ -890,23 +891,27 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes(
break;
if (copy_required) {
- CopyHardwarePlane(video_frame.get(), resource_color_space, mailbox_holder,
- &external_resources);
+ CopyHardwarePlane(
+ video_frame.get(),
+ resource_color_space_when_sampled.value_or(resource_color_space),
+ mailbox_holder, &external_resources);
} else {
const size_t width = video_frame->columns(i);
const size_t height = video_frame->rows(i);
const gfx::Size plane_size(width, height);
- auto transfer_resource = viz::TransferableResource::MakeGL(
+ auto transfer_resource = viz::TransferableResource::MakeGpu(
mailbox_holder.mailbox, GL_LINEAR, mailbox_holder.texture_target,
mailbox_holder.sync_token, plane_size,
+ viz::GetResourceFormat(buffer_formats[i]),
video_frame->metadata().allow_overlay);
transfer_resource.color_space = resource_color_space;
+ transfer_resource.color_space_when_sampled =
+ resource_color_space_when_sampled;
transfer_resource.hdr_metadata = video_frame->hdr_metadata();
if (video_frame->metadata().read_lock_fences_enabled) {
transfer_resource.synchronization_type = viz::TransferableResource::
SynchronizationType::kGpuCommandsCompleted;
}
- transfer_resource.format = viz::GetResourceFormat(buffer_formats[i]);
transfer_resource.ycbcr_info = video_frame->ycbcr_info();
#if BUILDFLAG(IS_ANDROID)
@@ -944,6 +949,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
input_frame_format == PIXEL_FORMAT_Y16 || is_rgb);
viz::ResourceFormat output_resource_format;
+ absl::optional<viz::ResourceFormat> subplane_resource_format;
gfx::ColorSpace output_color_space = video_frame->ColorSpace();
if (input_frame_format == PIXEL_FORMAT_XBGR) {
output_resource_format = viz::RGBX_8888;
@@ -963,6 +969,25 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
} else if (!software_compositor()) {
// Can be composited directly from yuv planes.
output_resource_format = YuvResourceFormat(bits_per_channel);
+
+ // Some YUV resources have different sized planes. If we lack the proper
+ // ResourceFormat just convert to RGB. We could do something better like
+ // unpacking to I420/I016, but texture_rg and r16 support should be pretty
+ // universal and we expect these frames to be rare.
+ if (input_frame_format == PIXEL_FORMAT_NV12) {
+ if (output_resource_format == viz::RED_8)
+ subplane_resource_format = viz::RG_88;
+ else
+ output_resource_format = viz::RGBA_8888;
+ } else if (input_frame_format == PIXEL_FORMAT_P016LE) {
+ if (output_resource_format == viz::R16_EXT)
+ subplane_resource_format = viz::RG16_EXT;
+ else
+ output_resource_format = viz::RGBA_8888;
+ } else {
+ DCHECK_EQ(VideoFrame::BytesPerElement(input_frame_format, 0),
+ VideoFrame::BytesPerElement(input_frame_format, 1));
+ }
}
// If GPU compositing is enabled, but the output resource format
@@ -1012,13 +1037,16 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
// Delete recycled resources that are the wrong format or wrong size.
auto can_delete_resource_fn =
- [output_resource_format,
+ [output_resource_format, subplane_resource_format,
&outplane_plane_sizes](const std::unique_ptr<PlaneResource>& resource) {
// Resources that are still being used can't be deleted.
if (resource->has_refs())
return false;
- return resource->resource_format() != output_resource_format ||
+ return (resource->resource_format() != output_resource_format &&
+ resource->resource_format() !=
+ subplane_resource_format.value_or(
+ output_resource_format)) ||
!base::Contains(outplane_plane_sizes, resource->resource_size());
};
base::EraseIf(all_resources_, can_delete_resource_fn);
@@ -1028,8 +1056,10 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
plane_resources.reserve(output_plane_count);
for (size_t i = 0; i < output_plane_count; ++i) {
plane_resources.push_back(RecycleOrAllocateResource(
- outplane_plane_sizes[i], output_resource_format, output_color_space,
- video_frame->unique_id(), i));
+ outplane_plane_sizes[i],
+ i == 0 ? output_resource_format
+ : subplane_resource_format.value_or(output_resource_format),
+ output_color_space, video_frame->unique_id(), i));
plane_resources.back()->add_ref();
}
@@ -1117,15 +1147,14 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
gpu::SyncToken sync_token;
auto* gl = ContextGL();
GenerateCompositorSyncToken(gl, &sync_token);
- transferable_resource = viz::TransferableResource::MakeGL(
+ transferable_resource = viz::TransferableResource::MakeGpu(
hardware_resource->mailbox(), GL_LINEAR,
hardware_resource->texture_target(), sync_token,
- hardware_resource->resource_size(),
+ hardware_resource->resource_size(), output_resource_format,
hardware_resource->overlay_candidate());
}
transferable_resource.color_space = output_color_space;
- transferable_resource.format = output_resource_format;
external_resources.resources.push_back(std::move(transferable_resource));
external_resources.release_callbacks.push_back(base::BindOnce(
&VideoResourceUpdater::RecycleResource, weak_ptr_factory_.GetWeakPtr(),
@@ -1134,8 +1163,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
return external_resources;
}
- const viz::ResourceFormat yuv_resource_format =
- YuvResourceFormat(bits_per_channel);
+ const auto yuv_resource_format = output_resource_format;
DCHECK(yuv_resource_format == viz::LUMINANCE_F16 ||
yuv_resource_format == viz::R16_EXT ||
yuv_resource_format == viz::LUMINANCE_8 ||
@@ -1163,10 +1191,9 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
const viz::ResourceFormat plane_resource_format =
plane_resource->resource_format();
- DCHECK_EQ(plane_resource_format, yuv_resource_format);
-
- // TODO(hubbe): Move upload code to media/.
- // TODO(reveman): Can use GpuMemoryBuffers here to improve performance.
+ DCHECK(plane_resource_format == yuv_resource_format ||
+ plane_resource_format ==
+ subplane_resource_format.value_or(yuv_resource_format));
// |video_stride_bytes| is the width of the |video_frame| we are uploading
// (including non-frame data to fill in the stride).
@@ -1238,7 +1265,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
uint16_t* dst = reinterpret_cast<uint16_t*>(
&upload_pixels_[upload_image_stride * row]);
const uint16_t* src = reinterpret_cast<uint16_t*>(
- video_frame->data(i) + (video_stride_bytes * row));
+ video_frame->writable_data(i) + (video_stride_bytes * row));
half_float_maker->MakeHalfFloats(src, bytes_per_row / 2, dst);
}
} else if (needs_bit_downshifting) {
@@ -1246,7 +1273,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
plane_resource_format == viz::RED_8);
const int scale = 0x10000 >> (bits_per_channel - 8);
libyuv::Convert16To8Plane(
- reinterpret_cast<uint16_t*>(video_frame->data(i)),
+ reinterpret_cast<uint16_t*>(video_frame->writable_data(i)),
video_stride_bytes / 2, upload_pixels_.get(), upload_image_stride,
scale, bytes_per_row, resource_size_pixels.height());
} else {
@@ -1284,12 +1311,13 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
for (size_t i = 0; i < plane_resources.size(); ++i) {
HardwarePlaneResource* plane_resource = plane_resources[i]->AsHardware();
- auto transferable_resource = viz::TransferableResource::MakeGL(
+ auto transferable_resource = viz::TransferableResource::MakeGpu(
plane_resource->mailbox(), GL_LINEAR, plane_resource->texture_target(),
sync_token, plane_resource->resource_size(),
+ i == 0 ? output_resource_format
+ : subplane_resource_format.value_or(output_resource_format),
plane_resource->overlay_candidate());
transferable_resource.color_space = output_color_space;
- transferable_resource.format = output_resource_format;
external_resources.resources.push_back(std::move(transferable_resource));
external_resources.release_callbacks.push_back(base::BindOnce(
&VideoResourceUpdater::RecycleResource, weak_ptr_factory_.GetWeakPtr(),
@@ -1323,12 +1351,8 @@ void VideoResourceUpdater::ReturnTexture(scoped_refptr<VideoFrame> video_frame,
void VideoResourceUpdater::RecycleResource(uint32_t plane_resource_id,
const gpu::SyncToken& sync_token,
bool lost_resource) {
- auto matches_id_fn =
- [plane_resource_id](const std::unique_ptr<PlaneResource>& resource) {
- return resource->plane_resource_id() == plane_resource_id;
- };
- auto resource_it =
- std::find_if(all_resources_.begin(), all_resources_.end(), matches_id_fn);
+ auto resource_it = base::ranges::find(all_resources_, plane_resource_id,
+ &PlaneResource::plane_resource_id);
if (resource_it == all_resources_.end())
return;
diff --git a/chromium/media/renderers/video_resource_updater.h b/chromium/media/renderers/video_resource_updater.h
index f717343ca86..a3e3b4f320b 100644
--- a/chromium/media/renderers/video_resource_updater.h
+++ b/chromium/media/renderers/video_resource_updater.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -201,6 +201,7 @@ class MEDIA_EXPORT VideoResourceUpdater
// base::trace_event::MemoryDumpProvider implementation.
bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) override;
+
const raw_ptr<viz::ContextProvider> context_provider_;
const raw_ptr<viz::RasterContextProvider> raster_context_provider_;
const raw_ptr<viz::SharedBitmapReporter> shared_bitmap_reporter_;
diff --git a/chromium/media/renderers/video_resource_updater_unittest.cc b/chromium/media/renderers/video_resource_updater_unittest.cc
index 3cd5e2bdf89..b5b587e85f2 100644
--- a/chromium/media/renderers/video_resource_updater_unittest.cc
+++ b/chromium/media/renderers/video_resource_updater_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -183,6 +183,26 @@ class VideoResourceUpdaterTest : public testing::Test {
return video_frame;
}
+ scoped_refptr<VideoFrame> CreateNV12TestFrame() {
+ const int kDimension = 10;
+ gfx::Size size(kDimension, kDimension);
+
+ scoped_refptr<VideoFrame> video_frame(VideoFrame::CreateFrame(
+ PIXEL_FORMAT_NV12, size, gfx::Rect(size), size, base::TimeDelta()));
+ EXPECT_TRUE(video_frame);
+ return video_frame;
+ }
+
+ scoped_refptr<VideoFrame> CreateP016TestFrame() {
+ const int kDimension = 10;
+ gfx::Size size(kDimension, kDimension);
+
+ scoped_refptr<VideoFrame> video_frame(VideoFrame::CreateFrame(
+ PIXEL_FORMAT_P016LE, size, gfx::Rect(size), size, base::TimeDelta()));
+ EXPECT_TRUE(video_frame);
+ return video_frame;
+ }
+
void SetReleaseSyncToken(const gpu::SyncToken& sync_token) {
release_sync_token_ = sync_token;
}
@@ -278,6 +298,29 @@ TEST_F(VideoResourceUpdaterTest, SoftwareFrame) {
EXPECT_EQ(VideoFrameResourceType::YUV, resources.type);
}
+TEST_F(VideoResourceUpdaterTest, SoftwareFrameNV12) {
+ std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForHardware();
+
+ VideoFrameExternalResources resources =
+ updater->CreateExternalResourcesFromVideoFrame(CreateNV12TestFrame());
+ EXPECT_EQ(VideoFrameResourceType::RGBA, resources.type);
+
+ // Use a different frame for this test since frames with the same unique_id()
+ // expect to use the same resources.
+ gl_->set_supports_texture_rg(true);
+ resources =
+ updater->CreateExternalResourcesFromVideoFrame(CreateNV12TestFrame());
+ EXPECT_EQ(VideoFrameResourceType::YUV, resources.type);
+}
+
+TEST_F(VideoResourceUpdaterTest, SoftwareFrameP016_NoR16Support) {
+ std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForHardware();
+
+ VideoFrameExternalResources resources =
+ updater->CreateExternalResourcesFromVideoFrame(CreateP016TestFrame());
+ EXPECT_EQ(VideoFrameResourceType::RGBA, resources.type);
+}
+
TEST_F(VideoResourceUpdaterTest, SoftwareFrameRGB) {
std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForHardware();
for (const auto& fmt : {PIXEL_FORMAT_XBGR, PIXEL_FORMAT_XRGB,
@@ -332,6 +375,14 @@ class VideoResourceUpdaterTestWithR16 : public VideoResourceUpdaterTest {
}
};
+TEST_F(VideoResourceUpdaterTestWithR16, SoftwareFrameP016) {
+ std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForHardware();
+
+ VideoFrameExternalResources resources =
+ updater->CreateExternalResourcesFromVideoFrame(CreateP016TestFrame());
+ EXPECT_EQ(VideoFrameResourceType::YUV, resources.type);
+}
+
TEST_F(VideoResourceUpdaterTestWithR16, HighBitFrame) {
std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForHardware();
scoped_refptr<VideoFrame> video_frame = CreateTestHighBitFrame();
@@ -354,6 +405,24 @@ TEST_F(VideoResourceUpdaterTestWithR16, HighBitFrame) {
EXPECT_NEAR(resources2.offset, 0.0, 0.1);
}
+TEST_F(VideoResourceUpdaterTest, NV12FrameSoftwareCompositor) {
+ std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForSoftware();
+ scoped_refptr<VideoFrame> video_frame = CreateNV12TestFrame();
+
+ VideoFrameExternalResources resources =
+ updater->CreateExternalResourcesFromVideoFrame(video_frame);
+ EXPECT_EQ(VideoFrameResourceType::RGBA_PREMULTIPLIED, resources.type);
+}
+
+TEST_F(VideoResourceUpdaterTest, P016FrameSoftwareCompositor) {
+ std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForSoftware();
+ scoped_refptr<VideoFrame> video_frame = CreateP016TestFrame();
+
+ VideoFrameExternalResources resources =
+ updater->CreateExternalResourcesFromVideoFrame(video_frame);
+ EXPECT_EQ(VideoFrameResourceType::RGBA_PREMULTIPLIED, resources.type);
+}
+
TEST_F(VideoResourceUpdaterTest, HighBitFrameSoftwareCompositor) {
std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForSoftware();
scoped_refptr<VideoFrame> video_frame = CreateTestHighBitFrame();
@@ -411,6 +480,37 @@ TEST_F(VideoResourceUpdaterTest, ReuseResource) {
EXPECT_EQ(0, gl_->UploadCount());
}
+TEST_F(VideoResourceUpdaterTest, ReuseResourceNV12) {
+ std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForHardware();
+ scoped_refptr<VideoFrame> video_frame = CreateNV12TestFrame();
+ video_frame->set_timestamp(base::Seconds(1234));
+ gl_->set_supports_texture_rg(true);
+
+ // Allocate the resources for a YUV video frame.
+ gl_->ResetUploadCount();
+ VideoFrameExternalResources resources =
+ updater->CreateExternalResourcesFromVideoFrame(video_frame);
+ EXPECT_EQ(VideoFrameResourceType::YUV, resources.type);
+ EXPECT_EQ(2u, resources.resources.size());
+ EXPECT_EQ(2u, resources.release_callbacks.size());
+ // Expect exactly three texture uploads, one for each plane.
+ EXPECT_EQ(2, gl_->UploadCount());
+
+ // Simulate the ResourceProvider releasing the resources back to the video
+ // updater.
+ for (auto& release_callback : resources.release_callbacks)
+ std::move(release_callback).Run(gpu::SyncToken(), false);
+
+ // Allocate resources for the same frame.
+ gl_->ResetUploadCount();
+ resources = updater->CreateExternalResourcesFromVideoFrame(video_frame);
+ EXPECT_EQ(VideoFrameResourceType::YUV, resources.type);
+ EXPECT_EQ(2u, resources.resources.size());
+ EXPECT_EQ(2u, resources.release_callbacks.size());
+ // The data should be reused so expect no texture uploads.
+ EXPECT_EQ(0, gl_->UploadCount());
+}
+
TEST_F(VideoResourceUpdaterTest, ReuseResourceNoDelete) {
std::unique_ptr<VideoResourceUpdater> updater = CreateUpdaterForHardware();
scoped_refptr<VideoFrame> video_frame = CreateTestYUVVideoFrame();
@@ -726,17 +826,8 @@ TEST_F(VideoResourceUpdaterTest, CreateForHardwarePlanes_SingleNV12) {
EXPECT_EQ(1u, resources.resources.size());
EXPECT_EQ((GLenum)GL_TEXTURE_EXTERNAL_OES,
resources.resources[0].mailbox_holder.texture_target);
- EXPECT_EQ(viz::YUV_420_BIPLANAR, resources.resources[0].format);
-
- video_frame = CreateTestYuvHardwareVideoFrame(PIXEL_FORMAT_NV12, 1,
- GL_TEXTURE_RECTANGLE_ARB);
- resources = updater->CreateExternalResourcesFromVideoFrame(video_frame);
- EXPECT_EQ(VideoFrameResourceType::RGB, resources.type);
- EXPECT_EQ(1u, resources.resources.size());
- EXPECT_EQ((GLenum)GL_TEXTURE_RECTANGLE_ARB,
- resources.resources[0].mailbox_holder.texture_target);
- EXPECT_EQ(viz::YUV_420_BIPLANAR, resources.resources[0].format);
-
+ EXPECT_EQ(viz::YUV_420_BIPLANAR,
+ resources.resources[0].format.resource_format());
EXPECT_EQ(0u, GetSharedImageCount());
}
@@ -753,9 +844,11 @@ TEST_F(VideoResourceUpdaterTest, CreateForHardwarePlanes_DualNV12) {
EXPECT_EQ(2u, resources.release_callbacks.size());
EXPECT_EQ((GLenum)GL_TEXTURE_EXTERNAL_OES,
resources.resources[0].mailbox_holder.texture_target);
+ EXPECT_EQ((GLenum)GL_TEXTURE_EXTERNAL_OES,
+ resources.resources[1].mailbox_holder.texture_target);
// |updater| doesn't set |buffer_format| in this case.
- EXPECT_EQ(viz::RED_8, resources.resources[0].format);
- EXPECT_EQ(viz::RG_88, resources.resources[1].format);
+ EXPECT_EQ(viz::RED_8, resources.resources[0].format.resource_format());
+ EXPECT_EQ(viz::RG_88, resources.resources[1].format.resource_format());
video_frame = CreateTestYuvHardwareVideoFrame(PIXEL_FORMAT_NV12, 2,
GL_TEXTURE_RECTANGLE_ARB);
@@ -764,8 +857,10 @@ TEST_F(VideoResourceUpdaterTest, CreateForHardwarePlanes_DualNV12) {
EXPECT_EQ(2u, resources.resources.size());
EXPECT_EQ((GLenum)GL_TEXTURE_RECTANGLE_ARB,
resources.resources[0].mailbox_holder.texture_target);
- EXPECT_EQ(viz::RED_8, resources.resources[0].format);
- EXPECT_EQ(viz::RG_88, resources.resources[1].format);
+ EXPECT_EQ((GLenum)GL_TEXTURE_RECTANGLE_ARB,
+ resources.resources[1].mailbox_holder.texture_target);
+ EXPECT_EQ(viz::RED_8, resources.resources[0].format.resource_format());
+ EXPECT_EQ(viz::RG_88, resources.resources[1].format.resource_format());
EXPECT_EQ(0u, GetSharedImageCount());
}
@@ -786,23 +881,9 @@ TEST_F(VideoResourceUpdaterTest, CreateForHardwarePlanes_SingleP016HDR) {
EXPECT_EQ(1u, resources.resources.size());
EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES),
resources.resources[0].mailbox_holder.texture_target);
- EXPECT_EQ(viz::P010, resources.resources[0].format);
+ EXPECT_EQ(viz::P010, resources.resources[0].format.resource_format());
EXPECT_EQ(kHDR10ColorSpace, resources.resources[0].color_space);
EXPECT_EQ(hdr_metadata, resources.resources[0].hdr_metadata);
-
- video_frame = CreateTestYuvHardwareVideoFrame(PIXEL_FORMAT_P016LE, 1,
- GL_TEXTURE_RECTANGLE_ARB);
- video_frame->set_color_space(kHDR10ColorSpace);
- video_frame->set_hdr_metadata(hdr_metadata);
- resources = updater->CreateExternalResourcesFromVideoFrame(video_frame);
- EXPECT_EQ(VideoFrameResourceType::RGB, resources.type);
- EXPECT_EQ(1u, resources.resources.size());
- EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_RECTANGLE_ARB),
- resources.resources[0].mailbox_holder.texture_target);
- EXPECT_EQ(viz::P010, resources.resources[0].format);
- EXPECT_EQ(kHDR10ColorSpace, resources.resources[0].color_space);
- EXPECT_EQ(hdr_metadata, resources.resources[0].hdr_metadata);
-
EXPECT_EQ(0u, GetSharedImageCount());
}
diff --git a/chromium/media/renderers/win/media_engine_extension.cc b/chromium/media/renderers/win/media_engine_extension.cc
index fcb34978e31..51735b59a50 100644
--- a/chromium/media/renderers/win/media_engine_extension.cc
+++ b/chromium/media/renderers/win/media_engine_extension.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_engine_extension.h b/chromium/media/renderers/win/media_engine_extension.h
index cf5763167ef..4743474ded0 100644
--- a/chromium/media/renderers/win/media_engine_extension.h
+++ b/chromium/media/renderers/win/media_engine_extension.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_engine_notify_impl.cc b/chromium/media/renderers/win/media_engine_notify_impl.cc
index eb4ad5ee058..872b15980d2 100644
--- a/chromium/media/renderers/win/media_engine_notify_impl.cc
+++ b/chromium/media/renderers/win/media_engine_notify_impl.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_engine_notify_impl.h b/chromium/media/renderers/win/media_engine_notify_impl.h
index f94c20938cb..ad7ac6be43a 100644
--- a/chromium/media/renderers/win/media_engine_notify_impl.h
+++ b/chromium/media/renderers/win/media_engine_notify_impl.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_audio_stream.cc b/chromium/media/renderers/win/media_foundation_audio_stream.cc
index 765b083ef8c..1f34d67cf9e 100644
--- a/chromium/media/renderers/win/media_foundation_audio_stream.cc
+++ b/chromium/media/renderers/win/media_foundation_audio_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_audio_stream.h b/chromium/media/renderers/win/media_foundation_audio_stream.h
index 21f3586ee2e..52d5cc359d0 100644
--- a/chromium/media/renderers/win/media_foundation_audio_stream.h
+++ b/chromium/media/renderers/win/media_foundation_audio_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_protection_manager.cc b/chromium/media/renderers/win/media_foundation_protection_manager.cc
index d9c7b087745..d426f0d90b4 100644
--- a/chromium/media/renderers/win/media_foundation_protection_manager.cc
+++ b/chromium/media/renderers/win/media_foundation_protection_manager.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -14,6 +14,7 @@
#include "base/win/core_winrt_util.h"
#include "base/win/scoped_hstring.h"
#include "base/win/windows_types.h"
+#include "media/base/win/hresults.h"
#include "media/base/win/mf_helpers.h"
namespace media {
@@ -37,7 +38,7 @@ HRESULT MediaFoundationProtectionManager::RuntimeClassInitialize(
waiting_cb_ = std::move(waiting_cb);
if (!base::win::ScopedHString::ResolveCoreWinRTStringDelayload())
- return E_FAIL;
+ return kErrorResolveCoreWinRTStringDelayload;
// Init an empty |property_set_| as MFMediaEngine could access it via
// |get_Properties| before we populate it within SetPMPServer.
diff --git a/chromium/media/renderers/win/media_foundation_protection_manager.h b/chromium/media/renderers/win/media_foundation_protection_manager.h
index a9dac608a9e..aad7fff7f05 100644
--- a/chromium/media/renderers/win/media_foundation_protection_manager.h
+++ b/chromium/media/renderers/win/media_foundation_protection_manager.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_renderer.cc b/chromium/media/renderers/win/media_foundation_renderer.cc
index a02877b1e49..d6b9518b840 100644
--- a/chromium/media/renderers/win/media_foundation_renderer.cc
+++ b/chromium/media/renderers/win/media_foundation_renderer.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -179,6 +179,11 @@ void MediaFoundationRenderer::Initialize(MediaResource* media_resource,
}
}
+ // debug, force mode to dcomp
+ if (force_dcomp_mode_for_testing_) {
+ rendering_mode_ = MediaFoundationRenderingMode::DirectComposition;
+ }
+
MEDIA_LOG(INFO, media_log_)
<< "Starting MediaFoundationRenderingMode: " << rendering_mode_;
@@ -498,6 +503,9 @@ void MediaFoundationRenderer::SetMediaFoundationRenderingMode(
if (mf_media_engine_->HasVideo()) {
if (render_mode == MediaFoundationRenderingMode::FrameServer) {
+ // cannot change to frameserver if force_dcomp_mode_for_testing_ is true
+ DCHECK(!force_dcomp_mode_for_testing_);
+
// Make sure we reinitialize the texture pool
hr = InitializeTexturePool(native_video_size_);
} else if (render_mode == MediaFoundationRenderingMode::DirectComposition) {
@@ -569,6 +577,8 @@ void MediaFoundationRenderer::GetDCompSurface(GetDCompSurfaceCB callback) {
HRESULT hr = SetDCompModeInternal();
if (FAILED(hr)) {
+ base::UmaHistogramSparse(
+ "Media.MediaFoundationRenderer.FailedToSetDCompMode", hr);
OnError(PIPELINE_ERROR_COULD_NOT_RENDER, ErrorReason::kFailedToSetDCompMode,
hr);
std::move(callback).Run(base::win::ScopedHandle(), PrintHr(hr));
@@ -828,9 +838,16 @@ void MediaFoundationRenderer::OnLoadedData() {
void MediaFoundationRenderer::OnPlaying() {
DVLOG_FUNC(3);
+
+ has_reported_playing_ = true;
+
OnBufferingStateChange(
BufferingState::BUFFERING_HAVE_ENOUGH,
BufferingStateChangeReason::BUFFERING_CHANGE_REASON_UNKNOWN);
+
+ // Earliest time to request first frame to screen
+ RequestNextFrame();
+
// The OnPlaying callback from MediaEngineNotifyImpl lets us know that an
// MF_MEDIA_ENGINE_EVENT_PLAYING message has been received. At this point we
// can safely start sending Statistics as any asynchronous Flush action in
@@ -950,6 +967,14 @@ void MediaFoundationRenderer::OnError(PipelineStatus status,
// This is not an error, so special case it here.
PipelineStatus new_status = status;
if (hresult == static_cast<HRESULT>(0x8004CD12)) {
+ // TODO(crbug.com/1370844): Remove these after the investigation is done.
+ base::UmaHistogramBoolean(
+ "Media.MediaFoundationRenderer.InvalidHwdrmState.HasReportedPlaying",
+ has_reported_playing_);
+ base::UmaHistogramCounts10000(
+ "Media.MediaFoundationRenderer.InvalidHwdrmState.VideoFrameDecoded",
+ statistics_.video_frames_decoded);
+
new_status = PIPELINE_ERROR_HARDWARE_CONTEXT_RESET;
if (cdm_proxy_)
cdm_proxy_->OnHardwareContextReset();
@@ -966,9 +991,7 @@ void MediaFoundationRenderer::OnError(PipelineStatus status,
renderer_client_->OnError(new_status);
}
-void MediaFoundationRenderer::RequestNextFrameBetweenTimestamps(
- base::TimeTicks deadline_min,
- base::TimeTicks deadline_max) {
+void MediaFoundationRenderer::RequestNextFrame() {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
if (rendering_mode_ != MediaFoundationRenderingMode::FrameServer) {
return;
diff --git a/chromium/media/renderers/win/media_foundation_renderer.h b/chromium/media/renderers/win/media_foundation_renderer.h
index 3fbd9a98303..1df21284f36 100644
--- a/chromium/media/renderers/win/media_foundation_renderer.h
+++ b/chromium/media/renderers/win/media_foundation_renderer.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -94,8 +94,7 @@ class MEDIA_EXPORT MediaFoundationRenderer
void SetOutputRect(const gfx::Rect& output_rect,
SetOutputRectCB callback) override;
void NotifyFrameReleased(const base::UnguessableToken& frame_token) override;
- void RequestNextFrameBetweenTimestamps(base::TimeTicks deadline_min,
- base::TimeTicks deadline_max) override;
+ void RequestNextFrame() override;
void SetMediaFoundationRenderingMode(
MediaFoundationRenderingMode render_mode) override;
@@ -223,6 +222,7 @@ class MEDIA_EXPORT MediaFoundationRenderer
MediaFoundationRenderingMode rendering_mode_ =
MediaFoundationRenderingMode::DirectComposition;
+ bool has_reported_playing_ = false;
bool has_reported_significant_playback_ = false;
// NOTE: Weak pointers must be invalidated before all other member variables.
diff --git a/chromium/media/renderers/win/media_foundation_renderer_extension.h b/chromium/media/renderers/win/media_foundation_renderer_extension.h
index 768e4a317b4..927abb430c3 100644
--- a/chromium/media/renderers/win/media_foundation_renderer_extension.h
+++ b/chromium/media/renderers/win/media_foundation_renderer_extension.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -42,9 +42,7 @@ class MEDIA_EXPORT MediaFoundationRendererExtension {
const base::UnguessableToken& frame_token) = 0;
// Request a new frame to be provided to the client.
- virtual void RequestNextFrameBetweenTimestamps(
- base::TimeTicks deadline_min,
- base::TimeTicks deadline_max) = 0;
+ virtual void RequestNextFrame() = 0;
// Change which mode we are using for video frame rendering.
virtual void SetMediaFoundationRenderingMode(
diff --git a/chromium/media/renderers/win/media_foundation_renderer_integration_test.cc b/chromium/media/renderers/win/media_foundation_renderer_integration_test.cc
index 5a0f7462117..fa6c37f06e0 100644
--- a/chromium/media/renderers/win/media_foundation_renderer_integration_test.cc
+++ b/chromium/media/renderers/win/media_foundation_renderer_integration_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_renderer_unittest.cc b/chromium/media/renderers/win/media_foundation_renderer_unittest.cc
index 2ad5326175c..a2dbc4515bf 100644
--- a/chromium/media/renderers/win/media_foundation_renderer_unittest.cc
+++ b/chromium/media/renderers/win/media_foundation_renderer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -69,7 +69,7 @@ class MockMediaProtectionPMPServer
IMediaProtectionPMPServer> {
public:
MockMediaProtectionPMPServer() = default;
- virtual ~MockMediaProtectionPMPServer() = default;
+ ~MockMediaProtectionPMPServer() override = default;
static HRESULT MakeMockMediaProtectionPMPServer(
IMediaProtectionPMPServer** pmp_server) {
diff --git a/chromium/media/renderers/win/media_foundation_rendering_mode.cc b/chromium/media/renderers/win/media_foundation_rendering_mode.cc
index a1c4d509c6b..ed9461d2840 100644
--- a/chromium/media/renderers/win/media_foundation_rendering_mode.cc
+++ b/chromium/media/renderers/win/media_foundation_rendering_mode.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_rendering_mode.h b/chromium/media/renderers/win/media_foundation_rendering_mode.h
index e82ca89d0c9..ed9ae8567f1 100644
--- a/chromium/media/renderers/win/media_foundation_rendering_mode.h
+++ b/chromium/media/renderers/win/media_foundation_rendering_mode.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_source_wrapper.cc b/chromium/media/renderers/win/media_foundation_source_wrapper.cc
index 8d5d492a201..7f5c7d6bd28 100644
--- a/chromium/media/renderers/win/media_foundation_source_wrapper.cc
+++ b/chromium/media/renderers/win/media_foundation_source_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_source_wrapper.h b/chromium/media/renderers/win/media_foundation_source_wrapper.h
index 5a25e181382..4bc06577ac4 100644
--- a/chromium/media/renderers/win/media_foundation_source_wrapper.h
+++ b/chromium/media/renderers/win/media_foundation_source_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_stream_wrapper.cc b/chromium/media/renderers/win/media_foundation_stream_wrapper.cc
index 2102ff8cc00..2b817dfd5f5 100644
--- a/chromium/media/renderers/win/media_foundation_stream_wrapper.cc
+++ b/chromium/media/renderers/win/media_foundation_stream_wrapper.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_stream_wrapper.h b/chromium/media/renderers/win/media_foundation_stream_wrapper.h
index 22cf6c3a874..2100e93fc86 100644
--- a/chromium/media/renderers/win/media_foundation_stream_wrapper.h
+++ b/chromium/media/renderers/win/media_foundation_stream_wrapper.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_texture_pool.cc b/chromium/media/renderers/win/media_foundation_texture_pool.cc
index 6b1838a4084..34df928ae90 100644
--- a/chromium/media/renderers/win/media_foundation_texture_pool.cc
+++ b/chromium/media/renderers/win/media_foundation_texture_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_texture_pool.h b/chromium/media/renderers/win/media_foundation_texture_pool.h
index fe0105554af..7c427fc57e4 100644
--- a/chromium/media/renderers/win/media_foundation_texture_pool.h
+++ b/chromium/media/renderers/win/media_foundation_texture_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_texture_pool_unittest.cc b/chromium/media/renderers/win/media_foundation_texture_pool_unittest.cc
index e776a2535e7..fb0ca913e91 100644
--- a/chromium/media/renderers/win/media_foundation_texture_pool_unittest.cc
+++ b/chromium/media/renderers/win/media_foundation_texture_pool_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_video_stream.cc b/chromium/media/renderers/win/media_foundation_video_stream.cc
index a2d575118db..95019a21121 100644
--- a/chromium/media/renderers/win/media_foundation_video_stream.cc
+++ b/chromium/media/renderers/win/media_foundation_video_stream.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/renderers/win/media_foundation_video_stream.h b/chromium/media/renderers/win/media_foundation_video_stream.h
index 33e43def6c6..c2c044e0a55 100644
--- a/chromium/media/renderers/win/media_foundation_video_stream.h
+++ b/chromium/media/renderers/win/media_foundation_video_stream.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/test/BUILD.gn b/chromium/media/test/BUILD.gn
index 1d03eca4948..b9339b4369f 100644
--- a/chromium/media/test/BUILD.gn
+++ b/chromium/media/test/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/video/BUILD.gn b/chromium/media/video/BUILD.gn
index 9b7658a09b4..ce155164c82 100644
--- a/chromium/media/video/BUILD.gn
+++ b/chromium/media/video/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/video/av1_video_encoder.cc b/chromium/media/video/av1_video_encoder.cc
index 4c86087bc6c..71e4fa09a65 100644
--- a/chromium/media/video/av1_video_encoder.cc
+++ b/chromium/media/video/av1_video_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -343,21 +343,26 @@ void Av1VideoEncoder::Encode(scoped_refptr<VideoFrame> frame,
: AOM_IMG_FMT_I420;
aom_image_t* image = aom_img_wrap(&image_, fmt, options_.frame_size.width(),
options_.frame_size.height(), 1,
- frame->data(VideoFrame::kYPlane));
+ frame->writable_data(VideoFrame::kYPlane));
DCHECK_EQ(image, &image_);
switch (frame->format()) {
case PIXEL_FORMAT_I420:
- image->planes[AOM_PLANE_Y] = frame->visible_data(VideoFrame::kYPlane);
- image->planes[AOM_PLANE_U] = frame->visible_data(VideoFrame::kUPlane);
- image->planes[AOM_PLANE_V] = frame->visible_data(VideoFrame::kVPlane);
+ image->planes[AOM_PLANE_Y] =
+ frame->GetWritableVisibleData(VideoFrame::kYPlane);
+ image->planes[AOM_PLANE_U] =
+ frame->GetWritableVisibleData(VideoFrame::kUPlane);
+ image->planes[AOM_PLANE_V] =
+ frame->GetWritableVisibleData(VideoFrame::kVPlane);
image->stride[AOM_PLANE_Y] = frame->stride(VideoFrame::kYPlane);
image->stride[AOM_PLANE_U] = frame->stride(VideoFrame::kUPlane);
image->stride[AOM_PLANE_V] = frame->stride(VideoFrame::kVPlane);
break;
case PIXEL_FORMAT_NV12:
- image->planes[AOM_PLANE_Y] = frame->visible_data(VideoFrame::kYPlane);
- image->planes[AOM_PLANE_U] = frame->visible_data(VideoFrame::kUVPlane);
+ image->planes[AOM_PLANE_Y] =
+ frame->GetWritableVisibleData(VideoFrame::kYPlane);
+ image->planes[AOM_PLANE_U] =
+ frame->GetWritableVisibleData(VideoFrame::kUVPlane);
image->planes[AOM_PLANE_V] = nullptr;
image->stride[AOM_PLANE_Y] = frame->stride(VideoFrame::kYPlane);
image->stride[AOM_PLANE_U] = frame->stride(VideoFrame::kUVPlane);
diff --git a/chromium/media/video/av1_video_encoder.h b/chromium/media/video/av1_video_encoder.h
index 4b672ba0fa5..5dd690c1d84 100644
--- a/chromium/media/video/av1_video_encoder.h
+++ b/chromium/media/video/av1_video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/fake_gpu_memory_buffer.cc b/chromium/media/video/fake_gpu_memory_buffer.cc
index ed16744c82b..7dba2a5df7b 100644
--- a/chromium/media/video/fake_gpu_memory_buffer.cc
+++ b/chromium/media/video/fake_gpu_memory_buffer.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/fake_gpu_memory_buffer.h b/chromium/media/video/fake_gpu_memory_buffer.h
index 1d27fb7e833..46aa23acfab 100644
--- a/chromium/media/video/fake_gpu_memory_buffer.h
+++ b/chromium/media/video/fake_gpu_memory_buffer.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/fake_video_encode_accelerator.cc b/chromium/media/video/fake_video_encode_accelerator.cc
index aee0e86a6ef..ad1b9419d02 100644
--- a/chromium/media/video/fake_video_encode_accelerator.cc
+++ b/chromium/media/video/fake_video_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/fake_video_encode_accelerator.h b/chromium/media/video/fake_video_encode_accelerator.h
index cb1a355e909..693ac303b48 100644
--- a/chromium/media/video/fake_video_encode_accelerator.h
+++ b/chromium/media/video/fake_video_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/gpu_memory_buffer_video_frame_pool.cc b/chromium/media/video/gpu_memory_buffer_video_frame_pool.cc
index ef464da6d91..098650db008 100644
--- a/chromium/media/video/gpu_memory_buffer_video_frame_pool.cc
+++ b/chromium/media/video/gpu_memory_buffer_video_frame_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,7 +9,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <algorithm>
#include <list>
#include <memory>
#include <utility>
@@ -26,6 +25,7 @@
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "base/sys_byteorder.h"
#include "base/time/default_tick_clock.h"
@@ -54,82 +54,14 @@
namespace media {
-namespace {
-
-const std::string PixelFormatToString(VideoPixelFormat format) {
- switch (format) {
- case PIXEL_FORMAT_YV12:
- return "YV12";
- case PIXEL_FORMAT_I420:
- return "I420";
- case PIXEL_FORMAT_YUV420P10:
- return "YUV420P10";
- case PIXEL_FORMAT_I420A:
- return "I420A";
- case PIXEL_FORMAT_NV12:
- return "NV12";
- default:
- NOTREACHED();
- return "UNKNOWN";
- }
-}
-
-void RecordVideoFrameSizeAndOffsetHistogram(VideoPixelFormat pixel_format,
- gfx::Size coded_size,
- gfx::Rect visible_rect,
- bool mappable) {
- bool odd_width = (coded_size.width() % 2) == 1;
- bool odd_height = (coded_size.height() % 2) == 1;
- bool odd_x = (visible_rect.x() % 2) == 1;
- bool odd_y = (visible_rect.y() % 2) == 1;
-
- gfx::OddSize size_enum;
- if (odd_width && odd_height)
- size_enum = gfx::OddSize::kOddWidthAndHeight;
- else if (odd_width)
- size_enum = gfx::OddSize::kOddWidthOnly;
- else if (odd_height)
- size_enum = gfx::OddSize::kOddHeightOnly;
- else
- size_enum = gfx::OddSize::kEvenWidthAndHeight;
-
- base::UmaHistogramEnumeration("Media.GpuMemoryBufferVideoFramePool.Size",
- size_enum);
- base::UmaHistogramEnumeration("Media.GpuMemoryBufferVideoFramePool.Size." +
- PixelFormatToString(pixel_format),
- size_enum);
-
- gfx::OddOffset offset_enum;
- if (odd_x && odd_y)
- offset_enum = gfx::OddOffset::kOddXAndY;
- else if (odd_x)
- offset_enum = gfx::OddOffset::kOddXOnly;
- else if (odd_y)
- offset_enum = gfx::OddOffset::kOddYOnly;
- else
- offset_enum = gfx::OddOffset::kEvenXAndY;
-
- base::UmaHistogramEnumeration("Media.GpuMemoryBufferVideoFramePool.Offset",
- offset_enum);
- base::UmaHistogramEnumeration("Media.GpuMemoryBufferVideoFramePool.Offset." +
- PixelFormatToString(pixel_format),
- offset_enum);
-
- // Mappable for video frames with odd offset
- if (offset_enum != gfx::OddOffset::kEvenXAndY)
- base::UmaHistogramBoolean(
- "Media.GpuMemoryBufferVideoFramePool.OddOffset.Mappable", mappable);
-}
-} // namespace
-
-const base::Feature kMultiPlaneSoftwareVideoSharedImages {
- "MultiPlaneSoftwareVideoSharedImages",
+BASE_FEATURE(kMultiPlaneSoftwareVideoSharedImages,
+ "MultiPlaneSoftwareVideoSharedImages",
#if BUILDFLAG(IS_MAC)
- base::FEATURE_ENABLED_BY_DEFAULT
+ base::FEATURE_ENABLED_BY_DEFAULT
#else
- base::FEATURE_DISABLED_BY_DEFAULT
+ base::FEATURE_DISABLED_BY_DEFAULT
#endif
-};
+);
bool GpuMemoryBufferVideoFramePool::MultiPlaneVideoSharedImagesEnabled() {
return base::FeatureList::IsEnabled(kMultiPlaneSoftwareVideoSharedImages);
@@ -455,7 +387,8 @@ size_t NumGpuMemoryBuffers(GpuVideoAcceleratorFactories::OutputFormat format) {
// GpuMemoryBuffer can be mapped to several SharedImages (one for each plane).
size_t NumSharedImages(GpuVideoAcceleratorFactories::OutputFormat format) {
if (GpuMemoryBufferVideoFramePool::MultiPlaneVideoSharedImagesEnabled()) {
- if (format == GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB) {
+ if (format == GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB ||
+ format == GpuVideoAcceleratorFactories::OutputFormat::P010) {
return 2;
}
}
@@ -469,7 +402,8 @@ size_t GpuMemoryBufferPlaneResourceIndexForPlane(
GpuVideoAcceleratorFactories::OutputFormat format,
size_t plane) {
if (GpuMemoryBufferVideoFramePool::MultiPlaneVideoSharedImagesEnabled()) {
- if (format == GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB) {
+ if (format == GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB ||
+ format == GpuVideoAcceleratorFactories::OutputFormat::P010) {
return 0;
}
}
@@ -482,7 +416,8 @@ gfx::BufferPlane GetSharedImageBufferPlane(
GpuVideoAcceleratorFactories::OutputFormat format,
size_t plane) {
if (GpuMemoryBufferVideoFramePool::MultiPlaneVideoSharedImagesEnabled()) {
- if (format == GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB) {
+ if (format == GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB ||
+ format == GpuVideoAcceleratorFactories::OutputFormat::P010) {
switch (plane) {
case 0:
return gfx::BufferPlane::Y;
@@ -822,9 +757,6 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::CreateHardwareFrame(
case PIXEL_FORMAT_YUV420P10:
case PIXEL_FORMAT_I420A:
case PIXEL_FORMAT_NV12:
- RecordVideoFrameSizeAndOffsetHistogram(
- pixel_format, video_frame->coded_size(), video_frame->visible_rect(),
- video_frame->IsMappable());
break;
// Unsupported cases.
case PIXEL_FORMAT_I422:
@@ -1161,8 +1093,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::OnCopiesDoneOnMediaThread(
// Drop the resources if there was an error with them. If we're not in
// shutdown we also need to remove the pool entry for them.
if (!in_shutdown_) {
- auto it = std::find(resources_pool_.begin(), resources_pool_.end(),
- frame_resources);
+ auto it = base::ranges::find(resources_pool_, frame_resources);
DCHECK(it != resources_pool_.end());
resources_pool_.erase(it);
}
@@ -1212,7 +1143,7 @@ scoped_refptr<VideoFrame> GpuMemoryBufferVideoFramePool::PoolImpl::
}
gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes];
- bool is_webgpu_compatible = true;
+ bool is_webgpu_compatible = false;
// Set up the planes creating the mailboxes needed to refer to the textures.
for (size_t plane = 0; plane < NumSharedImages(output_format_); plane++) {
size_t gpu_memory_buffer_plane =
@@ -1223,15 +1154,19 @@ scoped_refptr<VideoFrame> GpuMemoryBufferVideoFramePool::PoolImpl::
frame_resources->plane_resources[gpu_memory_buffer_plane]
.gpu_memory_buffer.get();
+#if BUILDFLAG(IS_MAC)
+ // Shared image uses iosurface as native resource which is compatible to
+ // WebGPU always.
+ is_webgpu_compatible = (gpu_memory_buffer != nullptr);
+#endif
+
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
- is_webgpu_compatible &= (gpu_memory_buffer != nullptr);
+ is_webgpu_compatible = (gpu_memory_buffer != nullptr);
if (is_webgpu_compatible) {
is_webgpu_compatible &=
gpu_memory_buffer->CloneHandle()
.native_pixmap_handle.supports_zero_copy_webgpu_import;
}
-#else
- is_webgpu_compatible = false;
#endif
const gfx::BufferFormat buffer_format =
@@ -1239,11 +1174,12 @@ scoped_refptr<VideoFrame> GpuMemoryBufferVideoFramePool::PoolImpl::
unsigned texture_target = gpu_factories_->ImageTextureTarget(buffer_format);
// Bind the texture and create or rebind the image.
if (gpu_memory_buffer && plane_resource.mailbox.IsZero()) {
- uint32_t usage =
- gpu::SHARED_IMAGE_USAGE_GLES2 | gpu::SHARED_IMAGE_USAGE_RASTER |
- gpu::SHARED_IMAGE_USAGE_DISPLAY | gpu::SHARED_IMAGE_USAGE_SCANOUT;
+ uint32_t usage = gpu::SHARED_IMAGE_USAGE_GLES2 |
+ gpu::SHARED_IMAGE_USAGE_RASTER |
+ gpu::SHARED_IMAGE_USAGE_DISPLAY_READ |
+ gpu::SHARED_IMAGE_USAGE_SCANOUT;
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
// TODO(crbug.com/1241537): Always add the flag once the
// OzoneImageBacking is by default turned on.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -1273,13 +1209,6 @@ scoped_refptr<VideoFrame> GpuMemoryBufferVideoFramePool::PoolImpl::
VideoPixelFormat frame_format = VideoFormat(output_format_);
-#if BUILDFLAG(IS_MAC)
- // TODO(https://crbug.com/1155760): Until individual planes can be bound as
- // their own textures, P010 buffers are copied to F16 textures for sampling.
- if (frame_format == PIXEL_FORMAT_P016LE)
- frame_format = PIXEL_FORMAT_RGBAF16;
-#endif
-
// Create the VideoFrame backed by native textures.
scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTextures(
frame_format, mailbox_holders, VideoFrame::ReleaseMailboxCB(), coded_size,
diff --git a/chromium/media/video/gpu_memory_buffer_video_frame_pool.h b/chromium/media/video/gpu_memory_buffer_video_frame_pool.h
index 5e971f36928..d7bfd314596 100644
--- a/chromium/media/video/gpu_memory_buffer_video_frame_pool.h
+++ b/chromium/media/video/gpu_memory_buffer_video_frame_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -48,11 +48,10 @@ class MEDIA_EXPORT GpuMemoryBufferVideoFramePool {
// after it has been copied to GpuMemoryBuffers.
using FrameReadyCB = base::OnceCallback<void(scoped_refptr<VideoFrame>)>;
- // Calls |cb| on |media_worker_pool| with a new VideoFrame containing only
- // mailboxes to native resources. |cb| will be destroyed on
- // |media_worker_pool|.
- // The content of the new object is copied from the software-allocated
- // |video_frame|.
+ // Calls |cb| with a new VideoFrame containing only mailboxes to native
+ // resources. The content of the new object is copied from the
+ // software-allocated |video_frame|.
+ //
// If it's not possible to create a new hardware VideoFrame, |video_frame|
// itself will passed to |cb|.
virtual void MaybeCreateHardwareFrame(scoped_refptr<VideoFrame> video_frame,
diff --git a/chromium/media/video/gpu_memory_buffer_video_frame_pool_unittest.cc b/chromium/media/video/gpu_memory_buffer_video_frame_pool_unittest.cc
index a9553e080db..0f6cfa7df1f 100644
--- a/chromium/media/video/gpu_memory_buffer_video_frame_pool_unittest.cc
+++ b/chromium/media/video/gpu_memory_buffer_video_frame_pool_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -417,11 +417,11 @@ TEST_F(GpuMemoryBufferVideoFramePoolTest,
const auto* v_memory = reinterpret_cast<uint8_t*>(
mock_gpu_factories_->created_memory_buffers()[2]->memory(0));
- const uint16_t* y_plane_data = reinterpret_cast<uint16_t*>(
+ const uint16_t* y_plane_data = reinterpret_cast<const uint16_t*>(
software_frame->visible_data(VideoFrame::kYPlane));
- const uint16_t* u_plane_data = reinterpret_cast<uint16_t*>(
+ const uint16_t* u_plane_data = reinterpret_cast<const uint16_t*>(
software_frame->visible_data(VideoFrame::kUPlane));
- const uint16_t* v_plane_data = reinterpret_cast<uint16_t*>(
+ const uint16_t* v_plane_data = reinterpret_cast<const uint16_t*>(
software_frame->visible_data(VideoFrame::kVPlane));
// Y plane = 17x17 = 289, U and V plan = 9x9.
@@ -771,13 +771,14 @@ TEST_F(GpuMemoryBufferVideoFramePoolTest, CreateOneHardwareP010Frame) {
RunUntilIdle();
EXPECT_NE(software_frame.get(), frame.get());
+ EXPECT_EQ(PIXEL_FORMAT_P016LE, frame->format());
#if BUILDFLAG(IS_MAC)
- EXPECT_EQ(PIXEL_FORMAT_RGBAF16, frame->format());
+ EXPECT_EQ(2u, frame->NumTextures());
+ EXPECT_EQ(2u, sii_->shared_image_count());
#else
- EXPECT_EQ(PIXEL_FORMAT_P016LE, frame->format());
-#endif
EXPECT_EQ(1u, frame->NumTextures());
EXPECT_EQ(1u, sii_->shared_image_count());
+#endif
EXPECT_TRUE(frame->metadata().read_lock_fences_enabled);
EXPECT_EQ(1u, mock_gpu_factories_->created_memory_buffers().size());
@@ -810,13 +811,14 @@ TEST_F(GpuMemoryBufferVideoFramePoolTest,
if (gfx::IsOddWidthMultiPlanarBuffersAllowed() &&
gfx::IsOddHeightMultiPlanarBuffersAllowed()) {
EXPECT_NE(software_frame.get(), frame.get());
+ EXPECT_EQ(PIXEL_FORMAT_P016LE, frame->format());
#if BUILDFLAG(IS_MAC)
- EXPECT_EQ(PIXEL_FORMAT_RGBAF16, frame->format());
+ EXPECT_EQ(2u, frame->NumTextures());
+ EXPECT_EQ(2u, sii_->shared_image_count());
#else
- EXPECT_EQ(PIXEL_FORMAT_P016LE, frame->format());
-#endif
EXPECT_EQ(1u, frame->NumTextures());
EXPECT_EQ(1u, sii_->shared_image_count());
+#endif
EXPECT_TRUE(frame->metadata().read_lock_fences_enabled);
EXPECT_EQ(1u, mock_gpu_factories_->created_memory_buffers().size());
@@ -828,11 +830,11 @@ TEST_F(GpuMemoryBufferVideoFramePoolTest,
const uint16_t* uv_memory = reinterpret_cast<uint16_t*>(
mock_gpu_factories_->created_memory_buffers()[0]->memory(1));
- const uint16_t* y_plane_data = reinterpret_cast<uint16_t*>(
+ const uint16_t* y_plane_data = reinterpret_cast<const uint16_t*>(
software_frame->visible_data(VideoFrame::kYPlane));
- const uint16_t* u_plane_data = reinterpret_cast<uint16_t*>(
+ const uint16_t* u_plane_data = reinterpret_cast<const uint16_t*>(
software_frame->visible_data(VideoFrame::kUPlane));
- const uint16_t* v_plane_data = reinterpret_cast<uint16_t*>(
+ const uint16_t* v_plane_data = reinterpret_cast<const uint16_t*>(
software_frame->visible_data(VideoFrame::kVPlane));
// Y plane = 7x7 = 49, U and V plan = 4x4 = 16.
diff --git a/chromium/media/video/gpu_video_accelerator_factories.cc b/chromium/media/video/gpu_video_accelerator_factories.cc
index 33956a0c3cd..7d38dea1b48 100644
--- a/chromium/media/video/gpu_video_accelerator_factories.cc
+++ b/chromium/media/video/gpu_video_accelerator_factories.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/gpu_video_accelerator_factories.h b/chromium/media/video/gpu_video_accelerator_factories.h
index a80a9dc7a8c..0b82bfc52a9 100644
--- a/chromium/media/video/gpu_video_accelerator_factories.h
+++ b/chromium/media/video/gpu_video_accelerator_factories.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -15,6 +15,7 @@
#include "base/memory/unsafe_shared_memory_region.h"
#include "base/unguessable_token.h"
#include "gpu/command_buffer/client/gles2_interface.h"
+#include "gpu/command_buffer/common/capabilities.h"
#include "gpu/command_buffer/common/mailbox.h"
#include "gpu/ipc/common/gpu_channel.mojom.h"
#include "media/base/media_export.h"
@@ -202,6 +203,8 @@ class MEDIA_EXPORT GpuVideoAcceleratorFactories {
virtual viz::RasterContextProvider* GetMediaContextProvider() = 0;
+ virtual const gpu::Capabilities* ContextCapabilities() = 0;
+
// Sets or gets the current pipeline rendering color space.
virtual void SetRenderingColorSpace(const gfx::ColorSpace& color_space) = 0;
virtual const gfx::ColorSpace& GetRenderingColorSpace() const = 0;
diff --git a/chromium/media/video/h264_bit_reader.cc b/chromium/media/video/h264_bit_reader.cc
index 45c3d75c00c..dd7ce6581c8 100644
--- a/chromium/media/video/h264_bit_reader.cc
+++ b/chromium/media/video/h264_bit_reader.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -71,7 +71,8 @@ bool H264BitReader::ReadBits(int num_bits, int* out) {
while (num_remaining_bits_in_curr_byte_ < bits_left) {
// Take all that's left in current byte, shift to make space for the rest.
- *out |= (curr_byte_ << (bits_left - num_remaining_bits_in_curr_byte_));
+ *out |= ((curr_byte_ & ((1u << num_remaining_bits_in_curr_byte_) - 1u))
+ << (bits_left - num_remaining_bits_in_curr_byte_));
bits_left -= num_remaining_bits_in_curr_byte_;
if (!UpdateCurrByte())
diff --git a/chromium/media/video/h264_bit_reader.h b/chromium/media/video/h264_bit_reader.h
index 21e6d1bd2eb..f5a21723d90 100644
--- a/chromium/media/video/h264_bit_reader.h
+++ b/chromium/media/video/h264_bit_reader.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -37,7 +37,7 @@ class MEDIA_EXPORT H264BitReader {
// Read |num_bits| next bits from stream and return in |*out|, first bit
// from the stream starting at |num_bits| position in |*out|.
- // |num_bits| may be 1-32, inclusive.
+ // |num_bits| may be 1-31, inclusive.
// Return false if the given number of bits cannot be read (not enough
// bits in the stream), true otherwise.
bool ReadBits(int num_bits, int* out);
diff --git a/chromium/media/video/h264_bit_reader_unittest.cc b/chromium/media/video/h264_bit_reader_unittest.cc
index 2d6f89f88f7..54036fef4c5 100644
--- a/chromium/media/video/h264_bit_reader_unittest.cc
+++ b/chromium/media/video/h264_bit_reader_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h264_level_limits.cc b/chromium/media/video/h264_level_limits.cc
index 6261632c9f1..d973158d52d 100644
--- a/chromium/media/video/h264_level_limits.cc
+++ b/chromium/media/video/h264_level_limits.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h264_level_limits.h b/chromium/media/video/h264_level_limits.h
index 2c46d7d1fbf..b769e793284 100644
--- a/chromium/media/video/h264_level_limits.h
+++ b/chromium/media/video/h264_level_limits.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h264_parser.cc b/chromium/media/video/h264_parser.cc
index 461501de9ba..9d6b5441e91 100644
--- a/chromium/media/video/h264_parser.cc
+++ b/chromium/media/video/h264_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h264_parser.h b/chromium/media/video/h264_parser.h
index 68ed7165ba3..c599e099de0 100644
--- a/chromium/media/video/h264_parser.h
+++ b/chromium/media/video/h264_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/video/h264_parser_fuzzertest.cc b/chromium/media/video/h264_parser_fuzzertest.cc
index 6ded4dcc95c..2fd1ddee948 100644
--- a/chromium/media/video/h264_parser_fuzzertest.cc
+++ b/chromium/media/video/h264_parser_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h264_parser_unittest.cc b/chromium/media/video/h264_parser_unittest.cc
index 9e6779b073a..2debd6442a3 100644
--- a/chromium/media/video/h264_parser_unittest.cc
+++ b/chromium/media/video/h264_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h264_poc.cc b/chromium/media/video/h264_poc.cc
index 5327e43558f..faa702b8af3 100644
--- a/chromium/media/video/h264_poc.cc
+++ b/chromium/media/video/h264_poc.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h264_poc.h b/chromium/media/video/h264_poc.h
index a3d99e359af..fef80110a79 100644
--- a/chromium/media/video/h264_poc.h
+++ b/chromium/media/video/h264_poc.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h264_poc_unittest.cc b/chromium/media/video/h264_poc_unittest.cc
index 49897a7e49c..1f321414fb0 100644
--- a/chromium/media/video/h264_poc_unittest.cc
+++ b/chromium/media/video/h264_poc_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h265_nalu_parser.cc b/chromium/media/video/h265_nalu_parser.cc
index 5734b33de41..342f2ad73b0 100644
--- a/chromium/media/video/h265_nalu_parser.cc
+++ b/chromium/media/video/h265_nalu_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h265_nalu_parser.h b/chromium/media/video/h265_nalu_parser.h
index 6519dbe591b..c080444bbb2 100644
--- a/chromium/media/video/h265_nalu_parser.h
+++ b/chromium/media/video/h265_nalu_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/video/h265_nalu_parser_unittest.cc b/chromium/media/video/h265_nalu_parser_unittest.cc
index 086875f54f7..cb63632932c 100644
--- a/chromium/media/video/h265_nalu_parser_unittest.cc
+++ b/chromium/media/video/h265_nalu_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h265_parser.cc b/chromium/media/video/h265_parser.cc
index 74367e153a7..23f62e77da8 100644
--- a/chromium/media/video/h265_parser.cc
+++ b/chromium/media/video/h265_parser.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -202,6 +202,10 @@ H265SliceHeader::H265SliceHeader() {
memset(reinterpret_cast<void*>(this), 0, sizeof(*this));
}
+H265SEIMessage::H265SEIMessage() {
+ memset(reinterpret_cast<void*>(this), 0, sizeof(*this));
+}
+
H265Parser::H265Parser() : H265NaluParser() {}
H265Parser::~H265Parser() {}
@@ -1012,7 +1016,7 @@ H265Parser::Result H265Parser::ParseSliceHeader(const H265NALU& nalu,
off_t bits_left_prior = br_.NumBitsLeft();
size_t num_epb_prior = br_.NumEmulationPreventionBytesRead();
res = ParseStRefPicSet(sps->num_short_term_ref_pic_sets, *sps,
- &shdr->st_ref_pic_set);
+ &shdr->st_ref_pic_set, true);
if (res != kOk)
return res;
shdr->st_rps_bits =
@@ -1459,10 +1463,10 @@ H265Parser::Result H265Parser::ParseScalingListData(
return kOk;
}
-H265Parser::Result H265Parser::ParseStRefPicSet(
- int st_rps_idx,
- const H265SPS& sps,
- H265StRefPicSet* st_ref_pic_set) {
+H265Parser::Result H265Parser::ParseStRefPicSet(int st_rps_idx,
+ const H265SPS& sps,
+ H265StRefPicSet* st_ref_pic_set,
+ bool is_slice_hdr) {
// 7.4.8
bool inter_ref_pic_set_prediction_flag = false;
if (st_rps_idx != 0) {
@@ -1482,6 +1486,9 @@ H265Parser::Result H265Parser::ParseStRefPicSet(
IN_RANGE_OR_RETURN(abs_delta_rps_minus1, 0, 0x7FFF);
int delta_rps = (1 - 2 * delta_rps_sign) * (abs_delta_rps_minus1 + 1);
const H265StRefPicSet& ref_set = sps.st_ref_pic_set[ref_rps_idx];
+ if (is_slice_hdr) {
+ st_ref_pic_set->rps_idx_num_delta_pocs = ref_set.num_delta_pocs;
+ }
bool used_by_curr_pic_flag[kMaxShortTermRefPicSets];
bool use_delta_flag[kMaxShortTermRefPicSets];
// 7.4.8 - use_delta_flag defaults to 1 if not present.
@@ -1875,4 +1882,84 @@ H265Parser::Result H265Parser::ParsePredWeightTable(
return kOk;
}
+H265Parser::Result H265Parser::ParseSEI(H265SEIMessage* sei_msg) {
+ int byte;
+
+ memset(sei_msg, 0, sizeof(*sei_msg));
+
+ READ_BITS_OR_RETURN(8, &byte);
+ while (byte == 0xff) {
+ sei_msg->type += 255;
+ READ_BITS_OR_RETURN(8, &byte);
+ }
+ sei_msg->type += byte;
+
+ READ_BITS_OR_RETURN(8, &byte);
+ while (byte == 0xff) {
+ sei_msg->payload_size += 255;
+ READ_BITS_OR_RETURN(8, &byte);
+ }
+ sei_msg->payload_size += byte;
+
+ DVLOG(4) << "Found SEI message type: " << sei_msg->type
+ << " payload size: " << sei_msg->payload_size;
+
+ switch (sei_msg->type) {
+ case H265SEIMessage::kSEIAlphaChannelInfo:
+ READ_BOOL_OR_RETURN(
+ &sei_msg->alpha_channel_info.alpha_channel_cancel_flag);
+ if (!sei_msg->alpha_channel_info.alpha_channel_cancel_flag) {
+ READ_BITS_OR_RETURN(3,
+ &sei_msg->alpha_channel_info.alpha_channel_use_idc);
+ READ_BITS_OR_RETURN(
+ 3, &sei_msg->alpha_channel_info.alpha_channel_bit_depth_minus8);
+ READ_BITS_OR_RETURN(
+ sei_msg->alpha_channel_info.alpha_channel_bit_depth_minus8 + 9,
+ &sei_msg->alpha_channel_info.alpha_transparent_value);
+ READ_BITS_OR_RETURN(
+ sei_msg->alpha_channel_info.alpha_channel_bit_depth_minus8 + 9,
+ &sei_msg->alpha_channel_info.alpha_opaque_value);
+ READ_BOOL_OR_RETURN(
+ &sei_msg->alpha_channel_info.alpha_channel_incr_flag);
+ READ_BOOL_OR_RETURN(
+ &sei_msg->alpha_channel_info.alpha_channel_clip_flag);
+ if (sei_msg->alpha_channel_info.alpha_channel_clip_flag) {
+ READ_BOOL_OR_RETURN(
+ &sei_msg->alpha_channel_info.alpha_channel_clip_type_flag);
+ }
+ }
+ break;
+ case H265SEIMessage::kSEIContentLightLevelInfo:
+ READ_BITS_OR_RETURN(
+ 16, &sei_msg->content_light_level_info.max_content_light_level);
+ READ_BITS_OR_RETURN(
+ 16,
+ &sei_msg->content_light_level_info.max_picture_average_light_level);
+ break;
+ case H265SEIMessage::kSEIMasteringDisplayInfo:
+ for (auto& primary : sei_msg->mastering_display_info.display_primaries) {
+ for (auto& component : primary) {
+ READ_BITS_OR_RETURN(16, &component);
+ }
+ }
+ READ_BITS_OR_RETURN(16, &sei_msg->mastering_display_info.white_points[0]);
+ READ_BITS_OR_RETURN(16, &sei_msg->mastering_display_info.white_points[1]);
+ uint32_t luminace_high_31bits, luminance_low_1bit;
+ READ_BITS_OR_RETURN(31, &luminace_high_31bits);
+ READ_BITS_OR_RETURN(1, &luminance_low_1bit);
+ sei_msg->mastering_display_info.max_luminance =
+ (luminace_high_31bits << 1) + (luminance_low_1bit & 0x1);
+ READ_BITS_OR_RETURN(31, &luminace_high_31bits);
+ READ_BITS_OR_RETURN(1, &luminance_low_1bit);
+ sei_msg->mastering_display_info.min_luminance =
+ (luminace_high_31bits << 1) + (luminance_low_1bit & 0x1);
+ break;
+ default:
+ DVLOG(4) << "Unsupported SEI message";
+ break;
+ }
+
+ return kOk;
+}
+
} // namespace media
diff --git a/chromium/media/video/h265_parser.h b/chromium/media/video/h265_parser.h
index 20b7a0a1a5e..1b6fd0131f8 100644
--- a/chromium/media/video/h265_parser.h
+++ b/chromium/media/video/h265_parser.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -95,6 +95,7 @@ struct MEDIA_EXPORT H265StRefPicSet {
// Calculated fields.
int num_delta_pocs;
+ int rps_idx_num_delta_pocs;
};
struct MEDIA_EXPORT H265VUIParameters {
@@ -401,6 +402,54 @@ struct MEDIA_EXPORT H265SliceHeader {
}
};
+struct MEDIA_EXPORT H265SEIAlphaChannelInfo {
+ bool alpha_channel_cancel_flag;
+ int alpha_channel_use_idc;
+ int alpha_channel_bit_depth_minus8;
+ int alpha_transparent_value;
+ int alpha_opaque_value;
+ bool alpha_channel_incr_flag;
+ bool alpha_channel_clip_flag;
+ bool alpha_channel_clip_type_flag;
+};
+
+struct MEDIA_EXPORT H265SEIContentLightLevelInfo {
+ uint16_t max_content_light_level;
+ uint16_t max_picture_average_light_level;
+};
+
+struct MEDIA_EXPORT H265SEIMasteringDisplayInfo {
+ enum {
+ kNumDisplayPrimaries = 3,
+ kDisplayPrimaryComponents = 2,
+ };
+
+ uint16_t display_primaries[kNumDisplayPrimaries][kDisplayPrimaryComponents];
+ uint16_t white_points[2];
+ uint32_t max_luminance;
+ uint32_t min_luminance;
+};
+
+struct MEDIA_EXPORT H265SEIMessage {
+ H265SEIMessage();
+
+ enum Type {
+ kSEIMasteringDisplayInfo = 137,
+ kSEIContentLightLevelInfo = 144,
+ kSEIAlphaChannelInfo = 165,
+ };
+
+ int type;
+ int payload_size;
+ union {
+ // Placeholder; in future more supported types will contribute to more
+ // union members here.
+ H265SEIAlphaChannelInfo alpha_channel_info;
+ H265SEIContentLightLevelInfo content_light_level_info;
+ H265SEIMasteringDisplayInfo mastering_display_info;
+ };
+};
+
// Class to parse an Annex-B H.265 stream.
class MEDIA_EXPORT H265Parser : public H265NaluParser {
public:
@@ -445,6 +494,10 @@ class MEDIA_EXPORT H265Parser : public H265NaluParser {
H265SliceHeader* shdr,
H265SliceHeader* prior_shdr);
+ // Parse a SEI message, returning it in |*sei_msg|, provided and managed
+ // by the caller.
+ Result ParseSEI(H265SEIMessage* sei_msg);
+
static VideoCodecProfile ProfileIDCToVideoCodecProfile(int profile_idc);
private:
@@ -461,7 +514,8 @@ class MEDIA_EXPORT H265Parser : public H265NaluParser {
Result ParseScalingListData(H265ScalingListData* scaling_list_data);
Result ParseStRefPicSet(int st_rps_idx,
const H265SPS& sps,
- H265StRefPicSet* st_ref_pic_set);
+ H265StRefPicSet* st_ref_pic_set,
+ bool is_slice_hdr = false);
Result ParseVuiParameters(const H265SPS& sps, H265VUIParameters* vui);
Result ParseAndIgnoreHrdParameters(bool common_inf_present_flag,
int max_num_sub_layers_minus1);
diff --git a/chromium/media/video/h265_parser_fuzzertest.cc b/chromium/media/video/h265_parser_fuzzertest.cc
index 73e8fdd5c88..1b22198fd23 100644
--- a/chromium/media/video/h265_parser_fuzzertest.cc
+++ b/chromium/media/video/h265_parser_fuzzertest.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,6 +19,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// found.
while (true) {
media::H265NALU nalu;
+ media::H265SEIMessage sei_msg;
media::H265Parser::Result res = parser.AdvanceToNextNALU(&nalu);
if (res != media::H265Parser::kOk)
break;
@@ -38,6 +39,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
int pps_id;
res = parser.ParsePPS(nalu, &pps_id);
break;
+ case media::H265NALU::PREFIX_SEI_NUT:
+ res = parser.ParseSEI(&sei_msg);
+ break;
case media::H265NALU::TRAIL_N:
case media::H265NALU::TRAIL_R:
case media::H265NALU::TSA_N:
diff --git a/chromium/media/video/h265_parser_unittest.cc b/chromium/media/video/h265_parser_unittest.cc
index 1a30b39735f..8a82d8961ef 100644
--- a/chromium/media/video/h265_parser_unittest.cc
+++ b/chromium/media/video/h265_parser_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -66,6 +66,7 @@ TEST_F(H265ParserTest, RawHevcStreamFileParsing) {
int num_parsed_nalus = 0;
while (true) {
H265NALU nalu;
+ H265SEIMessage sei_msg;
H265Parser::Result res = parser_.AdvanceToNextNALU(&nalu);
if (res == H265Parser::kEOStream) {
DVLOG(1) << "Number of successfully parsed NALUs before EOS: "
@@ -95,6 +96,10 @@ TEST_F(H265ParserTest, RawHevcStreamFileParsing) {
res = parser_.ParsePPS(nalu, &pps_id);
EXPECT_TRUE(!!parser_.GetPPS(pps_id));
break;
+ case H265NALU::PREFIX_SEI_NUT:
+ res = parser_.ParseSEI(&sei_msg);
+ EXPECT_EQ(res, H265Parser::kOk);
+ break;
case H265NALU::TRAIL_N:
case H265NALU::TRAIL_R:
case H265NALU::TSA_N:
@@ -351,4 +356,43 @@ TEST_F(H265ParserTest, SliceHeaderParsingNoValidationOnFirstSliceInFrame) {
}
}
}
+
+TEST_F(H265ParserTest, SEIParsing) {
+ LoadParserFile("bear-1280x720-hevc-10bit-hdr10.hevc");
+ H265NALU target_nalu;
+ EXPECT_TRUE(ParseNalusUntilNut(&target_nalu, H265NALU::VPS_NUT));
+ int vps_id;
+ EXPECT_EQ(H265Parser::kOk, parser_.ParseVPS(&vps_id));
+ EXPECT_TRUE(ParseNalusUntilNut(&target_nalu, H265NALU::SPS_NUT));
+ int sps_id;
+ EXPECT_EQ(H265Parser::kOk, parser_.ParseSPS(&sps_id));
+ EXPECT_TRUE(ParseNalusUntilNut(&target_nalu, H265NALU::PPS_NUT));
+ int pps_id;
+ EXPECT_EQ(H265Parser::kOk, parser_.ParsePPS(target_nalu, &pps_id));
+
+ // Parse the next content light level info SEI
+ EXPECT_TRUE(ParseNalusUntilNut(&target_nalu, H265NALU::PREFIX_SEI_NUT));
+ H265SEIMessage clli_sei;
+ EXPECT_EQ(H265Parser::kOk, parser_.ParseSEI(&clli_sei));
+ EXPECT_EQ(clli_sei.type, H265SEIMessage::kSEIContentLightLevelInfo);
+ EXPECT_EQ(clli_sei.content_light_level_info.max_content_light_level, 1000u);
+ EXPECT_EQ(clli_sei.content_light_level_info.max_picture_average_light_level,
+ 400u);
+
+ // Parse the next mastering display colour volume info SEI
+ EXPECT_TRUE(ParseNalusUntilNut(&target_nalu, H265NALU::PREFIX_SEI_NUT));
+ H265SEIMessage mdcv_sei;
+ EXPECT_EQ(H265Parser::kOk, parser_.ParseSEI(&mdcv_sei));
+ EXPECT_EQ(mdcv_sei.type, H265SEIMessage::kSEIMasteringDisplayInfo);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.display_primaries[0][0], 13250u);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.display_primaries[0][1], 34500u);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.display_primaries[1][0], 7500u);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.display_primaries[1][1], 3000u);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.display_primaries[2][0], 34000u);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.display_primaries[2][1], 16000u);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.white_points[0], 15635u);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.white_points[1], 16450u);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.max_luminance, 10000000u);
+ EXPECT_EQ(mdcv_sei.mastering_display_info.min_luminance, 500u);
+}
} // namespace media
diff --git a/chromium/media/video/h265_poc.cc b/chromium/media/video/h265_poc.cc
index 8ac3c70f878..f46c39368a7 100644
--- a/chromium/media/video/h265_poc.cc
+++ b/chromium/media/video/h265_poc.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h265_poc.h b/chromium/media/video/h265_poc.h
index 43a7e9526ab..625f25889c7 100644
--- a/chromium/media/video/h265_poc.h
+++ b/chromium/media/video/h265_poc.h
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/h265_poc_unittest.cc b/chromium/media/video/h265_poc_unittest.cc
index 85a856dc003..4264b9ec3e1 100644
--- a/chromium/media/video/h265_poc_unittest.cc
+++ b/chromium/media/video/h265_poc_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -153,7 +153,7 @@ TEST_F(H265POCTest, PicOrderCnt) {
slice_hdr_.slice_pic_order_cnt_lsb = 15;
ComputePOC();
ASSERT_EQ(15, poc_);
-};
+}
TEST_F(H265POCTest, PicOrderCntInOrder) {
sps_.log2_max_pic_order_cnt_lsb_minus4 = 12;
@@ -389,5 +389,5 @@ TEST_F(H265POCTest, PicOrderCntInOrder) {
slice_hdr_.slice_pic_order_cnt_lsb = 2;
ComputePOC();
ASSERT_EQ(2, poc_);
-};
-} // namespace media \ No newline at end of file
+}
+} // namespace media
diff --git a/chromium/media/video/half_float_maker.cc b/chromium/media/video/half_float_maker.cc
index b200dd06a13..89285638f92 100644
--- a/chromium/media/video/half_float_maker.cc
+++ b/chromium/media/video/half_float_maker.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/half_float_maker.h b/chromium/media/video/half_float_maker.h
index bc5ad0a4494..8df72a928d8 100644
--- a/chromium/media/video/half_float_maker.h
+++ b/chromium/media/video/half_float_maker.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/half_float_maker_unittest.cc b/chromium/media/video/half_float_maker_unittest.cc
index 2b089ee4233..353b8a7de5b 100644
--- a/chromium/media/video/half_float_maker_unittest.cc
+++ b/chromium/media/video/half_float_maker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.cc b/chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.cc
index 80af4a0264a..7783129e381 100644
--- a/chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.cc
+++ b/chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.h b/chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.h
index a514463ecce..9c86ed9f007 100644
--- a/chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.h
+++ b/chromium/media/video/mock_gpu_memory_buffer_video_frame_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/mock_gpu_video_accelerator_factories.cc b/chromium/media/video/mock_gpu_video_accelerator_factories.cc
index c8d9092b902..53c48f0993e 100644
--- a/chromium/media/video/mock_gpu_video_accelerator_factories.cc
+++ b/chromium/media/video/mock_gpu_video_accelerator_factories.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/mock_gpu_video_accelerator_factories.h b/chromium/media/video/mock_gpu_video_accelerator_factories.h
index 71d6522a89f..61196a60a85 100644
--- a/chromium/media/video/mock_gpu_video_accelerator_factories.h
+++ b/chromium/media/video/mock_gpu_video_accelerator_factories.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -58,6 +58,7 @@ class MockGpuVideoAcceleratorFactories : public GpuVideoAcceleratorFactories {
MOCK_METHOD0(GetTaskRunner, scoped_refptr<base::SequencedTaskRunner>());
MOCK_METHOD0(GetMediaContextProvider, viz::RasterContextProvider*());
+ MOCK_METHOD0(ContextCapabilities, gpu::Capabilities*());
MOCK_METHOD1(SetRenderingColorSpace, void(const gfx::ColorSpace&));
MOCK_CONST_METHOD0(GetRenderingColorSpace, const gfx::ColorSpace&());
diff --git a/chromium/media/video/mock_video_decode_accelerator.cc b/chromium/media/video/mock_video_decode_accelerator.cc
index 0f2f1bb7378..89d0667acf7 100644
--- a/chromium/media/video/mock_video_decode_accelerator.cc
+++ b/chromium/media/video/mock_video_decode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/mock_video_decode_accelerator.h b/chromium/media/video/mock_video_decode_accelerator.h
index 39bdb46c12e..a8a3988cda2 100644
--- a/chromium/media/video/mock_video_decode_accelerator.h
+++ b/chromium/media/video/mock_video_decode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/mock_video_encode_accelerator.cc b/chromium/media/video/mock_video_encode_accelerator.cc
index 47bdb5abbfa..03280ed2875 100644
--- a/chromium/media/video/mock_video_encode_accelerator.cc
+++ b/chromium/media/video/mock_video_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/mock_video_encode_accelerator.h b/chromium/media/video/mock_video_encode_accelerator.h
index 4577ee05e46..64222d6d096 100644
--- a/chromium/media/video/mock_video_encode_accelerator.h
+++ b/chromium/media/video/mock_video_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/openh264_video_encoder.cc b/chromium/media/video/openh264_video_encoder.cc
index 6f55b7c1ea3..97346c55f45 100644
--- a/chromium/media/video/openh264_video_encoder.cc
+++ b/chromium/media/video/openh264_video_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -317,9 +317,9 @@ void OpenH264VideoEncoder::Encode(scoped_refptr<VideoFrame> frame,
picture.iPicHeight = frame->visible_rect().height();
picture.iColorFormat = EVideoFormatType::videoFormatI420;
picture.uiTimeStamp = frame->timestamp().InMilliseconds();
- picture.pData[0] = frame->visible_data(VideoFrame::kYPlane);
- picture.pData[1] = frame->visible_data(VideoFrame::kUPlane);
- picture.pData[2] = frame->visible_data(VideoFrame::kVPlane);
+ picture.pData[0] = frame->GetWritableVisibleData(VideoFrame::kYPlane);
+ picture.pData[1] = frame->GetWritableVisibleData(VideoFrame::kUPlane);
+ picture.pData[2] = frame->GetWritableVisibleData(VideoFrame::kVPlane);
picture.iStride[0] = frame->stride(VideoFrame::kYPlane);
picture.iStride[1] = frame->stride(VideoFrame::kUPlane);
picture.iStride[2] = frame->stride(VideoFrame::kVPlane);
diff --git a/chromium/media/video/openh264_video_encoder.h b/chromium/media/video/openh264_video_encoder.h
index fc48a8d39cb..09f4922a672 100644
--- a/chromium/media/video/openh264_video_encoder.h
+++ b/chromium/media/video/openh264_video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/picture.cc b/chromium/media/video/picture.cc
index 216db308485..69ed7da3ef0 100644
--- a/chromium/media/video/picture.cc
+++ b/chromium/media/video/picture.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/picture.h b/chromium/media/video/picture.h
index 088a1c9817a..ef3c23dc385 100644
--- a/chromium/media/video/picture.h
+++ b/chromium/media/video/picture.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc b/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
index dbf2b3e1f42..969a9b1ea68 100644
--- a/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
+++ b/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/bits.h"
#include "base/logging.h"
#include "base/task/bind_post_task.h"
#include "base/threading/sequenced_task_runner_handle.h"
@@ -169,9 +170,17 @@ bool FrameResources::Initialize() {
constexpr gfx::BufferFormat kBufferFormat =
gfx::BufferFormat::YUV_420_BIPLANAR;
+ // Align number of rows to 2, because it's required by YUV_420_BIPLANAR
+ // buffer allocation code.
+ // Align buffer stride to 4, because our rendering code at
+ // GLImageMemory::Initialize() requires it, since it sometimes treats
+ // Y-planes are 4 bytes per pixel textures.
+ gfx::Size buffer_size_in_pixels(base::bits::AlignUp(coded_size_.width(), 4),
+ base::bits::AlignUp(coded_size_.height(), 2));
+
// Create the GpuMemoryBuffer.
- gpu_memory_buffer_ =
- context->CreateGpuMemoryBuffer(coded_size_, kBufferFormat, kBufferUsage);
+ gpu_memory_buffer_ = context->CreateGpuMemoryBuffer(
+ buffer_size_in_pixels, kBufferFormat, kBufferUsage);
if (!gpu_memory_buffer_) {
DLOG(ERROR) << "Failed to allocate GpuMemoryBuffer for frame: coded_size="
<< coded_size_.ToString()
@@ -190,7 +199,7 @@ bool FrameResources::Initialize() {
gpu::SHARED_IMAGE_USAGE_MACOS_VIDEO_TOOLBOX |
#endif
gpu::SHARED_IMAGE_USAGE_GLES2 | gpu::SHARED_IMAGE_USAGE_RASTER |
- gpu::SHARED_IMAGE_USAGE_DISPLAY | gpu::SHARED_IMAGE_USAGE_SCANOUT;
+ gpu::SHARED_IMAGE_USAGE_DISPLAY_READ | gpu::SHARED_IMAGE_USAGE_SCANOUT;
uint32_t texture_target = GL_TEXTURE_2D;
#if BUILDFLAG(IS_MAC)
diff --git a/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.h b/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.h
index 55fc5f2ee54..3268c0ea30e 100644
--- a/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.h
+++ b/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc b/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc
index 95979460c38..ba01d5af388 100644
--- a/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc
+++ b/chromium/media/video/renderable_gpu_memory_buffer_video_frame_pool_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/software_video_encoder_test.cc b/chromium/media/video/software_video_encoder_test.cc
index 97eecc2dabe..2059f4e076f 100644
--- a/chromium/media/video/software_video_encoder_test.cc
+++ b/chromium/media/video/software_video_encoder_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -128,17 +128,19 @@ class SoftwareVideoEncoderTest
auto y = color & 0xFF;
auto u = (color >> 8) & 0xFF;
auto v = (color >> 16) & 0xFF;
- libyuv::I420Rect(
- frame->data(VideoFrame::kYPlane), frame->stride(VideoFrame::kYPlane),
- frame->data(VideoFrame::kUPlane), frame->stride(VideoFrame::kUPlane),
- frame->data(VideoFrame::kVPlane), frame->stride(VideoFrame::kVPlane),
- frame->visible_rect().x(), // x
- frame->visible_rect().y(), // y
- frame->visible_rect().width(), // width
- frame->visible_rect().height(), // height
- y, // Y color
- u, // U color
- v); // V color
+ libyuv::I420Rect(frame->writable_data(VideoFrame::kYPlane),
+ frame->stride(VideoFrame::kYPlane),
+ frame->writable_data(VideoFrame::kUPlane),
+ frame->stride(VideoFrame::kUPlane),
+ frame->writable_data(VideoFrame::kVPlane),
+ frame->stride(VideoFrame::kVPlane),
+ frame->visible_rect().x(), // x
+ frame->visible_rect().y(), // y
+ frame->visible_rect().width(), // width
+ frame->visible_rect().height(), // height
+ y, // Y color
+ u, // U color
+ v); // V color
return frame;
}
@@ -159,7 +161,7 @@ class SoftwareVideoEncoderTest
auto frame = VideoFrame::CreateFrame(PIXEL_FORMAT_XRGB, size,
gfx::Rect(size), size, timestamp);
- libyuv::ARGBRect(frame->data(VideoFrame::kARGBPlane),
+ libyuv::ARGBRect(frame->writable_data(VideoFrame::kARGBPlane),
frame->stride(VideoFrame::kARGBPlane),
frame->visible_rect().x(), // dst_x
frame->visible_rect().y(), // dst_y
@@ -281,9 +283,9 @@ class SoftwareVideoEncoderTest
size_t num_planes = VideoFrame::NumPlanes(format);
gfx::Size visible_size = frame1.visible_rect().size();
for (size_t plane = 0; plane < num_planes; ++plane) {
- uint8_t* data1 = frame1.visible_data(plane);
+ const uint8_t* data1 = frame1.visible_data(plane);
int stride1 = frame1.stride(plane);
- uint8_t* data2 = frame2.visible_data(plane);
+ const uint8_t* data2 = frame2.visible_data(plane);
int stride2 = frame2.stride(plane);
size_t rows = VideoFrame::Rows(plane, format, visible_size.height());
int row_bytes = VideoFrame::RowBytes(plane, format, visible_size.width());
@@ -915,6 +917,10 @@ INSTANTIATE_TEST_SUITE_P(VpxTemporalSvc,
#endif // ENABLE_LIBVPX
#if BUILDFLAG(ENABLE_LIBAOM)
+#if !BUILDFLAG(ENABLE_AV1_DECODER)
+#error PrepareDecoder() requires an AV1 decoder.
+#endif
+
SwVideoTestParams kAv1Params[] = {
{VideoCodec::kAV1, AV1PROFILE_PROFILE_MAIN, PIXEL_FORMAT_I420},
{VideoCodec::kAV1, AV1PROFILE_PROFILE_MAIN, PIXEL_FORMAT_NV12},
diff --git a/chromium/media/video/supported_video_decoder_config_unittest.cc b/chromium/media/video/supported_video_decoder_config_unittest.cc
index 14f0ad9146f..e9356c64c37 100644
--- a/chromium/media/video/supported_video_decoder_config_unittest.cc
+++ b/chromium/media/video/supported_video_decoder_config_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/trace_util.cc b/chromium/media/video/trace_util.cc
index 7557ff6df17..3c99cb26a96 100644
--- a/chromium/media/video/trace_util.cc
+++ b/chromium/media/video/trace_util.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/trace_util.h b/chromium/media/video/trace_util.h
index 83892509641..5597ff4b022 100644
--- a/chromium/media/video/trace_util.h
+++ b/chromium/media/video/trace_util.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/video_decode_accelerator.cc b/chromium/media/video/video_decode_accelerator.cc
index c353138c127..dfc7f705569 100644
--- a/chromium/media/video/video_decode_accelerator.cc
+++ b/chromium/media/video/video_decode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/video_decode_accelerator.h b/chromium/media/video/video_decode_accelerator.h
index 2ea21479065..56659049046 100644
--- a/chromium/media/video/video_decode_accelerator.h
+++ b/chromium/media/video/video_decode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/video_encode_accelerator.cc b/chromium/media/video/video_encode_accelerator.cc
index 9c04460ab99..89a3e68b257 100644
--- a/chromium/media/video/video_encode_accelerator.cc
+++ b/chromium/media/video/video_encode_accelerator.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include <inttypes.h>
#include "base/callback.h"
+#include "base/ranges/algorithm.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
@@ -128,9 +129,9 @@ std::string VideoEncodeAccelerator::Config::AsHumanReadableString() const {
}
bool VideoEncodeAccelerator::Config::HasTemporalLayer() const {
- return std::any_of(
- spatial_layers.begin(), spatial_layers.end(),
- [](const SpatialLayer& sl) { return sl.num_of_temporal_layers > 1u; });
+ return base::ranges::any_of(spatial_layers, [](const SpatialLayer& sl) {
+ return sl.num_of_temporal_layers > 1u;
+ });
}
bool VideoEncodeAccelerator::Config::HasSpatialLayer() const {
@@ -166,11 +167,6 @@ VideoEncodeAccelerator::SupportedProfile::SupportedProfile(
VideoEncodeAccelerator::SupportedProfile::~SupportedProfile() = default;
-VideoEncodeAccelerator::SupportedProfiles
-VideoEncodeAccelerator::GetSupportedProfilesLight() {
- return GetSupportedProfiles();
-}
-
void VideoEncodeAccelerator::Flush(FlushCallback flush_callback) {
// TODO(owenlin): implements this https://crbug.com/755889.
NOTIMPLEMENTED();
diff --git a/chromium/media/video/video_encode_accelerator.h b/chromium/media/video/video_encode_accelerator.h
index 4711981843d..16ce5d2c222 100644
--- a/chromium/media/video/video_encode_accelerator.h
+++ b/chromium/media/video/video_encode_accelerator.h
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -355,14 +355,6 @@ class MEDIA_EXPORT VideoEncodeAccelerator {
// can be called before Initialize().
virtual SupportedProfiles GetSupportedProfiles() = 0;
- // Returns a list of the supported codec profiles of the video encoder,
- // similar to GetSupportedProfiles(), but this function only populates:
- // codec, framerate range and resolution range.
- //
- // Populating things like SVC modes can take a lot of time and they are
- // not always used. See https://crbug.com/1263196
- virtual SupportedProfiles GetSupportedProfilesLight();
-
// Initializes the video encoder with specific configuration. Called once per
// encoder construction. This call is synchronous and returns true iff
// initialization is successful.
diff --git a/chromium/media/video/video_encode_accelerator_adapter.cc b/chromium/media/video/video_encode_accelerator_adapter.cc
index 04ddb35c600..b61a9de4aee 100644
--- a/chromium/media/video/video_encode_accelerator_adapter.cc
+++ b/chromium/media/video/video_encode_accelerator_adapter.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,6 +18,7 @@
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
+#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "media/base/bind_to_current_loop.h"
#include "media/base/bitstream_buffer.h"
#include "media/base/media_log.h"
@@ -130,10 +131,14 @@ VideoEncodeAccelerator::Config SetUpVeaConfig(
config.input_format = PIXEL_FORMAT_I420;
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
- if (storage_type == VideoFrame::STORAGE_DMABUFS ||
- storage_type == VideoFrame::STORAGE_GPU_MEMORY_BUFFER) {
- if (is_rgb)
- config.input_format = PIXEL_FORMAT_NV12;
+ if (format != PIXEL_FORMAT_I420 ||
+ !VideoFrame::IsStorageTypeMappable(storage_type)) {
+ // ChromeOS/Linux hardware video encoders supports I420 on-memory
+ // VideoFrame and NV12 GpuMemoryBuffer VideoFrame.
+ // For other VideoFrames than them, some processing e.g. format conversion
+ // is required. Let the destination buffer be GpuMemoryBuffer because a
+ // hardware encoder can process it more efficiently than on-memory buffer.
+ config.input_format = PIXEL_FORMAT_NV12;
config.storage_type =
VideoEncodeAccelerator::Config::StorageType::kGpuMemoryBuffer;
}
@@ -144,6 +149,146 @@ VideoEncodeAccelerator::Config SetUpVeaConfig(
} // namespace
+class VideoEncodeAcceleratorAdapter::GpuMemoryBufferVideoFramePool
+ : public base::RefCountedThreadSafe<GpuMemoryBufferVideoFramePool> {
+ public:
+ GpuMemoryBufferVideoFramePool(GpuVideoAcceleratorFactories* gpu_factories,
+ const gfx::Size& size)
+ : gpu_factories_(gpu_factories), size_(size) {}
+ GpuMemoryBufferVideoFramePool(const GpuMemoryBufferVideoFramePool&) = delete;
+ GpuMemoryBufferVideoFramePool& operator=(
+ const GpuMemoryBufferVideoFramePool&) = delete;
+
+ scoped_refptr<VideoFrame> MaybeCreateVideoFrame(const gfx::Size& size) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ if (size_ != size)
+ return nullptr;
+
+ if (available_gmbs_.empty()) {
+ constexpr auto kBufferFormat = gfx::BufferFormat::YUV_420_BIPLANAR;
+ constexpr auto kBufferUsage =
+ gfx::BufferUsage::VEA_READ_CAMERA_AND_CPU_READ_WRITE;
+ auto gmb = gpu_factories_->CreateGpuMemoryBuffer(size_, kBufferFormat,
+ kBufferUsage);
+ if (!gmb)
+ return nullptr;
+
+ available_gmbs_.push_back(std::move(gmb));
+ }
+
+ auto gmb = std::move(available_gmbs_.back());
+ available_gmbs_.pop_back();
+
+ VideoFrame::ReleaseMailboxAndGpuMemoryBufferCB reuse_cb = BindToCurrentLoop(
+ base::BindOnce(&GpuMemoryBufferVideoFramePool::ReuseFrame, this));
+ const gpu::MailboxHolder kEmptyMailBoxes[media::VideoFrame::kMaxPlanes] =
+ {};
+ return VideoFrame::WrapExternalGpuMemoryBuffer(
+ gfx::Rect(size_), size_, std::move(gmb), kEmptyMailBoxes,
+ std::move(reuse_cb), base::TimeDelta());
+ }
+
+ private:
+ friend class RefCountedThreadSafe<GpuMemoryBufferVideoFramePool>;
+ ~GpuMemoryBufferVideoFramePool() = default;
+
+ void ReuseFrame(const gpu::SyncToken& token,
+ std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ constexpr size_t kMaxPooledFrames = 5;
+ if (available_gmbs_.size() < kMaxPooledFrames)
+ available_gmbs_.push_back(std::move(gpu_memory_buffer));
+ }
+
+ const raw_ptr<GpuVideoAcceleratorFactories> gpu_factories_;
+ const gfx::Size size_;
+
+ std::vector<std::unique_ptr<gfx::GpuMemoryBuffer>> available_gmbs_;
+
+ SEQUENCE_CHECKER(sequence_checker_);
+};
+
+class VideoEncodeAcceleratorAdapter::ReadOnlyRegionPool
+ : public base::RefCountedThreadSafe<ReadOnlyRegionPool> {
+ public:
+ struct Handle {
+ using ReuseBufferCallback =
+ base::OnceCallback<void(std::unique_ptr<base::MappedReadOnlyRegion>)>;
+ Handle(std::unique_ptr<base::MappedReadOnlyRegion> mapped_region,
+ ReuseBufferCallback reuse_buffer_cb)
+ : owned_mapped_region(std::move(mapped_region)),
+ reuse_buffer_cb(std::move(reuse_buffer_cb)) {
+ DCHECK(owned_mapped_region);
+ }
+
+ ~Handle() {
+ if (reuse_buffer_cb) {
+ DCHECK(owned_mapped_region);
+ std::move(reuse_buffer_cb).Run(std::move(owned_mapped_region));
+ }
+ }
+
+ Handle(const Handle&) = delete;
+ Handle& operator=(const Handle&) = delete;
+
+ bool IsValid() const {
+ return owned_mapped_region && owned_mapped_region->IsValid();
+ }
+ const base::ReadOnlySharedMemoryRegion* region() const {
+ DCHECK(IsValid());
+ return &owned_mapped_region->region;
+ }
+ const base::WritableSharedMemoryMapping* mapping() const {
+ DCHECK(IsValid());
+ return &owned_mapped_region->mapping;
+ }
+
+ private:
+ std::unique_ptr<base::MappedReadOnlyRegion> owned_mapped_region;
+ ReuseBufferCallback reuse_buffer_cb;
+ };
+
+ explicit ReadOnlyRegionPool(size_t buffer_size) : buffer_size_(buffer_size) {}
+ ReadOnlyRegionPool(const ReadOnlyRegionPool&) = delete;
+ ReadOnlyRegionPool& operator=(const ReadOnlyRegionPool&) = delete;
+
+ std::unique_ptr<Handle> MaybeAllocateBuffer() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ if (available_buffers_.empty()) {
+ available_buffers_.push_back(std::make_unique<base::MappedReadOnlyRegion>(
+ base::ReadOnlySharedMemoryRegion::Create(buffer_size_)));
+ if (!available_buffers_.back()->IsValid()) {
+ available_buffers_.pop_back();
+ return nullptr;
+ }
+ }
+
+ auto mapped_region = std::move(available_buffers_.back());
+ available_buffers_.pop_back();
+ DCHECK(mapped_region->IsValid());
+
+ return std::make_unique<Handle>(
+ std::move(mapped_region), BindToCurrentLoop(base::BindOnce(
+ &ReadOnlyRegionPool::ReuseBuffer, this)));
+ }
+
+ private:
+ friend class RefCountedThreadSafe<ReadOnlyRegionPool>;
+ ~ReadOnlyRegionPool() = default;
+
+ void ReuseBuffer(std::unique_ptr<base::MappedReadOnlyRegion> region) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ constexpr size_t kMaxPooledBuffers = 5;
+ if (available_buffers_.size() < kMaxPooledBuffers)
+ available_buffers_.push_back(std::move(region));
+ }
+
+ const size_t buffer_size_;
+ std::vector<std::unique_ptr<base::MappedReadOnlyRegion>> available_buffers_;
+
+ SEQUENCE_CHECKER(sequence_checker_);
+};
+
VideoEncodeAcceleratorAdapter::PendingOp::PendingOp() = default;
VideoEncodeAcceleratorAdapter::PendingOp::~PendingOp() = default;
@@ -152,7 +297,6 @@ VideoEncodeAcceleratorAdapter::VideoEncodeAcceleratorAdapter(
std::unique_ptr<MediaLog> media_log,
scoped_refptr<base::SequencedTaskRunner> callback_task_runner)
: output_pool_(base::MakeRefCounted<base::UnsafeSharedMemoryPool>()),
- input_pool_(base::MakeRefCounted<base::UnsafeSharedMemoryPool>()),
gpu_factories_(gpu_factories),
media_log_(std::move(media_log)),
accelerator_task_runner_(gpu_factories_->GetTaskRunner()),
@@ -162,7 +306,6 @@ VideoEncodeAcceleratorAdapter::VideoEncodeAcceleratorAdapter(
VideoEncodeAcceleratorAdapter::~VideoEncodeAcceleratorAdapter() {
DCHECK_CALLED_ON_VALID_SEQUENCE(accelerator_sequence_checker_);
- input_pool_->Shutdown();
output_pool_->Shutdown();
}
@@ -521,11 +664,8 @@ void VideoEncodeAcceleratorAdapter::RequireBitstreamBuffers(
DCHECK_CALLED_ON_VALID_SEQUENCE(accelerator_sequence_checker_);
input_coded_size_ = input_coded_size;
- input_buffer_size_ =
- VideoFrame::AllocationSize(PIXEL_FORMAT_I420, input_coded_size);
output_handle_holder_ = output_pool_->MaybeAllocateBuffer(output_buffer_size);
-
if (!output_handle_holder_) {
InitCompleted(EncoderStatus::Codes::kEncoderInitializationError);
return;
@@ -735,36 +875,52 @@ VideoEncodeAcceleratorAdapter::PrepareCpuFrame(
const gfx::Size& size,
scoped_refptr<VideoFrame> src_frame) {
TRACE_EVENT0("media", "VideoEncodeAcceleratorAdapter::PrepareCpuFrame");
- auto handle = input_pool_->MaybeAllocateBuffer(input_buffer_size_);
- if (!handle)
- return EncoderStatus(EncoderStatus::Codes::kEncoderFailedEncode);
- const base::UnsafeSharedMemoryRegion& region = handle->GetRegion();
- const base::WritableSharedMemoryMapping& mapping = handle->GetMapping();
+ // The frame whose storage type is STORAGE_OWNED_MEMORY and
+ // STORAGE_UNOWNED_MEMORY is copied here, not in mojo_video_frame_traits.
+ // It is because VEAAdapter recycles the SharedMemoryRegion, but
+ // mojo_video_frame_traits doesn't.
+ if (src_frame->storage_type() == VideoFrame::STORAGE_SHMEM &&
+ src_frame->format() == PIXEL_FORMAT_I420 &&
+ src_frame->visible_rect().size() == size &&
+ src_frame->visible_rect().origin().IsOrigin()) {
+ // Nothing to do here, the input frame is already what we need.
+ return src_frame;
+ }
+
+ if (!input_pool_) {
+ const size_t input_buffer_size =
+ VideoFrame::AllocationSize(PIXEL_FORMAT_I420, size);
+ input_pool_ = base::MakeRefCounted<ReadOnlyRegionPool>(input_buffer_size);
+ }
+ std::unique_ptr<ReadOnlyRegionPool::Handle> handle =
+ input_pool_->MaybeAllocateBuffer();
+ if (!handle || !handle->IsValid())
+ return EncoderStatus(EncoderStatus::Codes::kEncoderFailedEncode);
+
+ const base::WritableSharedMemoryMapping* mapping = handle->mapping();
auto mapped_src_frame = src_frame->HasGpuMemoryBuffer()
? ConvertToMemoryMappedFrame(src_frame)
: src_frame;
auto shared_frame = VideoFrame::WrapExternalData(
PIXEL_FORMAT_I420, size, gfx::Rect(size), size,
- mapping.GetMemoryAsSpan<uint8_t>().data(), mapping.size(),
+ static_cast<uint8_t*>(mapping->memory()), mapping->size(),
src_frame->timestamp());
if (!shared_frame || !mapped_src_frame)
return EncoderStatus(EncoderStatus::Codes::kEncoderFailedEncode);
- shared_frame->BackWithSharedMemory(&region);
- // Keep the SharedMemoryHolder until the frame is destroyed so that the
- // memory is not freed prematurely.
- shared_frame->AddDestructionObserver(BindToCurrentLoop(base::BindOnce(
- [](std::unique_ptr<base::UnsafeSharedMemoryPool::Handle>) {},
- std::move(handle))));
auto status =
ConvertAndScaleFrame(*mapped_src_frame, *shared_frame, resize_buf_);
if (!status.is_ok())
return EncoderStatus(EncoderStatus::Codes::kEncoderFailedEncode)
.AddCause(std::move(status));
+ shared_frame->BackWithSharedMemory(handle->region());
+ shared_frame->AddDestructionObserver(
+ base::BindOnce([](std::unique_ptr<ReadOnlyRegionPool::Handle> handle) {},
+ std::move(handle)));
return shared_frame;
}
@@ -784,19 +940,16 @@ VideoEncodeAcceleratorAdapter::PrepareGpuFrame(
return src_frame;
}
- auto gmb = gpu_factories_->CreateGpuMemoryBuffer(
- size, gfx::BufferFormat::YUV_420_BIPLANAR,
- gfx::BufferUsage::VEA_READ_CAMERA_AND_CPU_READ_WRITE);
+ if (!gmb_frame_pool_) {
+ gmb_frame_pool_ = base::MakeRefCounted<GpuMemoryBufferVideoFramePool>(
+ gpu_factories_, size);
+ }
- if (!gmb)
+ auto gpu_frame = gmb_frame_pool_->MaybeCreateVideoFrame(size);
+ if (!gpu_frame)
return EncoderStatus(EncoderStatus::Codes::kEncoderFailedEncode);
- gmb->SetColorSpace(src_frame->ColorSpace());
- gpu::MailboxHolder empty_mailboxes[media::VideoFrame::kMaxPlanes];
- auto gpu_frame = VideoFrame::WrapExternalGpuMemoryBuffer(
- gfx::Rect(size), size, std::move(gmb), empty_mailboxes,
- base::NullCallback(), src_frame->timestamp());
- gpu_frame->set_color_space(src_frame->ColorSpace());
+ gpu_frame->set_timestamp(src_frame->timestamp());
gpu_frame->metadata().MergeMetadataFrom(src_frame->metadata());
// Don't be scared. ConvertToMemoryMappedFrame() doesn't copy pixel data
@@ -819,6 +972,12 @@ VideoEncodeAcceleratorAdapter::PrepareGpuFrame(
return EncoderStatus(EncoderStatus::Codes::kEncoderFailedEncode)
.AddCause(std::move(status));
+ // |mapped_gpu_frame| has the color space respecting the color conversion in
+ // ConvertAndScaleFrame().
+ gpu_frame->GetGpuMemoryBuffer()->SetColorSpace(
+ mapped_gpu_frame->ColorSpace());
+ gpu_frame->set_color_space(mapped_gpu_frame->ColorSpace());
+
return gpu_frame;
}
diff --git a/chromium/media/video/video_encode_accelerator_adapter.h b/chromium/media/video/video_encode_accelerator_adapter.h
index 65b3cb8e30e..d2aaa14775a 100644
--- a/chromium/media/video/video_encode_accelerator_adapter.h
+++ b/chromium/media/video/video_encode_accelerator_adapter.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,6 +11,7 @@
#include "base/containers/circular_deque.h"
#include "base/containers/queue.h"
#include "base/memory/raw_ptr.h"
+#include "base/memory/read_only_shared_memory_region.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/unsafe_shared_memory_pool.h"
#include "base/synchronization/lock.h"
@@ -79,6 +80,8 @@ class MEDIA_EXPORT VideoEncodeAcceleratorAdapter
static void DestroyAsync(std::unique_ptr<VideoEncodeAcceleratorAdapter> self);
private:
+ class GpuMemoryBufferVideoFramePool;
+ class ReadOnlyRegionPool;
enum class State {
kNotInitialized,
kWaitingForFirstFrame,
@@ -119,10 +122,10 @@ class MEDIA_EXPORT VideoEncodeAcceleratorAdapter
const gfx::Size& size,
scoped_refptr<VideoFrame> src_frame);
+ scoped_refptr<ReadOnlyRegionPool> input_pool_;
scoped_refptr<base::UnsafeSharedMemoryPool> output_pool_;
- scoped_refptr<base::UnsafeSharedMemoryPool> input_pool_;
std::unique_ptr<base::UnsafeSharedMemoryPool::Handle> output_handle_holder_;
- size_t input_buffer_size_;
+ scoped_refptr<GpuMemoryBufferVideoFramePool> gmb_frame_pool_;
std::unique_ptr<VideoEncodeAccelerator> accelerator_;
raw_ptr<GpuVideoAcceleratorFactories> gpu_factories_;
diff --git a/chromium/media/video/video_encode_accelerator_adapter_test.cc b/chromium/media/video/video_encode_accelerator_adapter_test.cc
index 63e8baa0952..9d70cfff078 100644
--- a/chromium/media/video/video_encode_accelerator_adapter_test.cc
+++ b/chromium/media/video/video_encode_accelerator_adapter_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -30,6 +30,7 @@
#include "media/video/mock_video_encode_accelerator.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/libyuv/include/libyuv.h"
+#include "ui/gfx/color_space.h"
using ::testing::_;
using ::testing::AtLeast;
@@ -104,9 +105,11 @@ class VideoEncodeAcceleratorAdapterTest
gmb->Unmap();
gpu::MailboxHolder empty_mailboxes[media::VideoFrame::kMaxPlanes];
- return VideoFrame::WrapExternalGpuMemoryBuffer(
+ auto frame = VideoFrame::WrapExternalGpuMemoryBuffer(
gfx::Rect(gmb_size), size, std::move(gmb), empty_mailboxes,
base::NullCallback(), timestamp);
+ frame->set_color_space(kYUVColorSpace);
+ return frame;
}
scoped_refptr<VideoFrame> CreateGreenCpuFrame(gfx::Size size,
@@ -115,18 +118,21 @@ class VideoEncodeAcceleratorAdapterTest
gfx::Rect(size), size, timestamp);
// Green I420 frame (Y:0x96, U:0x40, V:0x40)
- libyuv::I420Rect(
- frame->data(VideoFrame::kYPlane), frame->stride(VideoFrame::kYPlane),
- frame->data(VideoFrame::kUPlane), frame->stride(VideoFrame::kUPlane),
- frame->data(VideoFrame::kVPlane), frame->stride(VideoFrame::kVPlane),
- 0, // left
- 0, // top
- frame->visible_rect().width(), // right
- frame->visible_rect().height(), // bottom
- 0x96, // Y color
- 0x40, // U color
- 0x40); // V color
+ libyuv::I420Rect(frame->writable_data(VideoFrame::kYPlane),
+ frame->stride(VideoFrame::kYPlane),
+ frame->writable_data(VideoFrame::kUPlane),
+ frame->stride(VideoFrame::kUPlane),
+ frame->writable_data(VideoFrame::kVPlane),
+ frame->stride(VideoFrame::kVPlane),
+ 0, // left
+ 0, // top
+ frame->visible_rect().width(), // right
+ frame->visible_rect().height(), // bottom
+ 0x96, // Y color
+ 0x40, // U color
+ 0x40); // V color
+ frame->set_color_space(kYUVColorSpace);
return frame;
}
@@ -136,7 +142,7 @@ class VideoEncodeAcceleratorAdapterTest
gfx::Rect(size), size, timestamp);
// Green XRGB frame (R:0x3B, G:0xD9, B:0x24)
- libyuv::ARGBRect(frame->data(VideoFrame::kARGBPlane),
+ libyuv::ARGBRect(frame->writable_data(VideoFrame::kARGBPlane),
frame->stride(VideoFrame::kARGBPlane),
0, // left
0, // top
@@ -144,6 +150,7 @@ class VideoEncodeAcceleratorAdapterTest
frame->visible_rect().height(), // bottom
0x24D93B00); // V color
+ frame->set_color_space(kRGBColorSpace);
return frame;
}
@@ -163,6 +170,23 @@ class VideoEncodeAcceleratorAdapterTest
}
}
+ gfx::ColorSpace ExpectedColorSpace(VideoPixelFormat src_format,
+ VideoPixelFormat dst_format) {
+ // Converting between YUV formats doesn't change the color space.
+ if (IsYuvPlanar(src_format) && IsYuvPlanar(dst_format)) {
+ return kYUVColorSpace;
+ }
+
+ // libyuv's RGB to YUV methods always output BT.601.
+ if (IsRGB(src_format) && IsYuvPlanar(dst_format)) {
+ return gfx::ColorSpace::CreateREC601();
+ }
+
+ EXPECT_TRUE(false) << "unexpected formats: src=" << src_format
+ << ", dst=" << dst_format;
+ return gfx::ColorSpace();
+ }
+
VideoEncoder::EncoderStatusCB ValidatingStatusCB(
base::Location loc = FROM_HERE) {
struct CallEnforcer {
@@ -185,6 +209,10 @@ class VideoEncodeAcceleratorAdapterTest
protected:
VideoCodecProfile profile_ = VP8PROFILE_ANY;
+ static constexpr gfx::ColorSpace kRGBColorSpace =
+ gfx::ColorSpace::CreateSRGB();
+ static constexpr gfx::ColorSpace kYUVColorSpace =
+ gfx::ColorSpace::CreateREC709();
std::vector<VideoEncodeAccelerator::SupportedProfile> supported_profiles_;
base::test::TaskEnvironment task_environment_;
raw_ptr<FakeVideoEncodeAccelerator> vea_; // owned by |vae_adapter_|
@@ -211,8 +239,12 @@ TEST_F(VideoEncodeAcceleratorAdapterTest, InitializeAfterFirstFrame) {
options.frame_size = gfx::Size(640, 480);
int outputs_count = 0;
auto pixel_format = PIXEL_FORMAT_I420;
+ const gfx::ColorSpace expected_color_space =
+ ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput output,
+ absl::optional<VideoEncoder::CodecDescription>) {
+ EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
@@ -228,6 +260,7 @@ TEST_F(VideoEncodeAcceleratorAdapterTest, InitializeAfterFirstFrame) {
auto frame =
CreateGreenFrame(options.frame_size, pixel_format, base::Milliseconds(1));
+
adapter()->Encode(frame, true, ValidatingStatusCB());
RunUntilIdle();
EXPECT_EQ(outputs_count, 1);
@@ -239,6 +272,8 @@ TEST_F(VideoEncodeAcceleratorAdapterTest, TemporalSvc) {
options.scalability_mode = SVCScalabilityMode::kL1T3;
int outputs_count = 0;
auto pixel_format = PIXEL_FORMAT_I420;
+ const gfx::ColorSpace expected_color_space =
+ ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
absl::optional<VideoEncoder::CodecDescription>) {
@@ -250,6 +285,8 @@ TEST_F(VideoEncodeAcceleratorAdapterTest, TemporalSvc) {
EXPECT_EQ(output.temporal_id, 2);
else
EXPECT_EQ(output.temporal_id, 2);
+
+ EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
@@ -298,8 +335,12 @@ TEST_F(VideoEncodeAcceleratorAdapterTest, FlushDuringInitialize) {
options.frame_size = gfx::Size(640, 480);
int outputs_count = 0;
auto pixel_format = PIXEL_FORMAT_I420;
+ const gfx::ColorSpace expected_color_space =
+ ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput output,
+ absl::optional<VideoEncoder::CodecDescription>) {
+ EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
@@ -388,30 +429,34 @@ TEST_P(VideoEncodeAcceleratorAdapterTest, TwoFramesResize) {
gfx::Size small_size(480, 320);
gfx::Size large_size(800, 600);
auto pixel_format = GetParam();
+ auto small_frame =
+ CreateGreenFrame(small_size, pixel_format, base::Milliseconds(1));
+ auto large_frame =
+ CreateGreenFrame(large_size, pixel_format, base::Milliseconds(2));
+
+ VideoPixelFormat expected_input_format = PIXEL_FORMAT_I420;
+#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ if (pixel_format != PIXEL_FORMAT_I420 || !small_frame->IsMappable())
+ expected_input_format = PIXEL_FORMAT_NV12;
+#endif
+ const gfx::ColorSpace expected_color_space =
+ ExpectedColorSpace(pixel_format, expected_input_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput output,
+ absl::optional<VideoEncoder::CodecDescription>) {
+ EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
vea()->SetEncodingCallback(base::BindLambdaForTesting(
[&](BitstreamBuffer&, bool keyframe, scoped_refptr<VideoFrame> frame) {
-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
- EXPECT_EQ(frame->format(),
- IsYuvPlanar(pixel_format) ? pixel_format : PIXEL_FORMAT_I420);
-#else
- // Everywhere except on Linux resize switches frame into CPU mode.
- EXPECT_EQ(frame->format(), PIXEL_FORMAT_I420);
-#endif
+ EXPECT_EQ(frame->format(), expected_input_format);
EXPECT_EQ(frame->coded_size(), options.frame_size);
return BitstreamBufferMetadata(1, keyframe, frame->timestamp());
}));
adapter()->Initialize(profile_, options, std::move(output_cb),
ValidatingStatusCB());
- auto small_frame =
- CreateGreenFrame(small_size, pixel_format, base::Milliseconds(1));
- auto large_frame =
- CreateGreenFrame(large_size, pixel_format, base::Milliseconds(2));
adapter()->Encode(small_frame, true, ValidatingStatusCB());
adapter()->Encode(large_frame, false, ValidatingStatusCB());
RunUntilIdle();
@@ -424,8 +469,12 @@ TEST_F(VideoEncodeAcceleratorAdapterTest, AutomaticResizeSupport) {
int outputs_count = 0;
gfx::Size small_size(480, 320);
auto pixel_format = PIXEL_FORMAT_NV12;
+ const gfx::ColorSpace expected_color_space =
+ ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput output,
+ absl::optional<VideoEncoder::CodecDescription>) {
+ EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
@@ -463,15 +512,35 @@ TEST_P(VideoEncodeAcceleratorAdapterTest, RunWithAllPossibleInputConversions) {
: VideoEncodeAcceleratorAdapter::InputBufferKind::CpuMemBuf;
adapter()->SetInputBufferPreferenceForTesting(input_kind);
+ const VideoPixelFormat expected_input_format =
+ input_kind == VideoEncodeAcceleratorAdapter::InputBufferKind::GpuMemBuf
+ ? PIXEL_FORMAT_NV12
+ : PIXEL_FORMAT_I420;
+
+ constexpr auto get_source_format = [](int i) {
+ // Every 4 frames switch between the 3 supported formats.
+ const int rem = i % 12;
+ auto format = PIXEL_FORMAT_XRGB;
+ if (rem < 4)
+ format = PIXEL_FORMAT_I420;
+ else if (rem < 8)
+ format = PIXEL_FORMAT_NV12;
+ return format;
+ };
+
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput output,
+ absl::optional<VideoEncoder::CodecDescription>) {
+ VideoPixelFormat source_frame_format = get_source_format(outputs_count);
+ const gfx::ColorSpace expected_color_space =
+ ExpectedColorSpace(source_frame_format, expected_input_format);
+ EXPECT_EQ(output.color_space, expected_color_space);
outputs_count++;
});
vea()->SetEncodingCallback(base::BindLambdaForTesting(
[&](BitstreamBuffer&, bool keyframe, scoped_refptr<VideoFrame> frame) {
- EXPECT_EQ(frame->format(),
- IsYuvPlanar(pixel_format) ? pixel_format : PIXEL_FORMAT_I420);
+ EXPECT_EQ(frame->format(), expected_input_format);
EXPECT_EQ(frame->coded_size(), options.frame_size);
return BitstreamBufferMetadata(1, keyframe, frame->timestamp());
}));
@@ -487,13 +556,7 @@ TEST_P(VideoEncodeAcceleratorAdapterTest, RunWithAllPossibleInputConversions) {
else
size = same_size;
- // Every 4 frames switch between the 3 supported formats.
- const int rem = frame_index % 12;
- auto format = PIXEL_FORMAT_XRGB;
- if (rem < 4)
- format = PIXEL_FORMAT_I420;
- else if (rem < 8)
- format = PIXEL_FORMAT_NV12;
+ const auto format = get_source_format(frame_index);
bool key = frame_index % 9 == 0;
auto frame =
CreateGreenFrame(size, format, base::Milliseconds(frame_index));
@@ -509,9 +572,12 @@ TEST_F(VideoEncodeAcceleratorAdapterTest, DroppedFrame) {
options.frame_size = gfx::Size(640, 480);
auto pixel_format = PIXEL_FORMAT_I420;
std::vector<base::TimeDelta> output_timestamps;
+ const gfx::ColorSpace expected_color_space =
+ ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB output_cb = base::BindLambdaForTesting(
[&](VideoEncoderOutput output,
absl::optional<VideoEncoder::CodecDescription>) {
+ EXPECT_EQ(output.color_space, expected_color_space);
output_timestamps.push_back(output.timestamp);
});
@@ -546,12 +612,18 @@ TEST_F(VideoEncodeAcceleratorAdapterTest,
auto pixel_format = PIXEL_FORMAT_I420;
int output_count_before_change = 0;
int output_count_after_change = 0;
+ const gfx::ColorSpace expected_color_space =
+ ExpectedColorSpace(pixel_format, pixel_format);
VideoEncoder::OutputCB first_output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput output,
+ absl::optional<VideoEncoder::CodecDescription>) {
+ EXPECT_EQ(output.color_space, expected_color_space);
output_count_before_change++;
});
VideoEncoder::OutputCB second_output_cb = base::BindLambdaForTesting(
- [&](VideoEncoderOutput, absl::optional<VideoEncoder::CodecDescription>) {
+ [&](VideoEncoderOutput output,
+ absl::optional<VideoEncoder::CodecDescription>) {
+ EXPECT_EQ(output.color_space, expected_color_space);
output_count_after_change++;
});
diff --git a/chromium/media/video/video_encoder_fallback.cc b/chromium/media/video/video_encoder_fallback.cc
index 12c78924dfd..91cbcad7a74 100644
--- a/chromium/media/video/video_encoder_fallback.cc
+++ b/chromium/media/video/video_encoder_fallback.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/video_encoder_fallback.h b/chromium/media/video/video_encoder_fallback.h
index 916e4b8b2a3..32dd682ccde 100644
--- a/chromium/media/video/video_encoder_fallback.h
+++ b/chromium/media/video/video_encoder_fallback.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/video_encoder_fallback_test.cc b/chromium/media/video/video_encoder_fallback_test.cc
index 36cbecdf2cf..3d0d0dae1cd 100644
--- a/chromium/media/video/video_encoder_fallback_test.cc
+++ b/chromium/media/video/video_encoder_fallback_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/video_encoder_info.cc b/chromium/media/video/video_encoder_info.cc
index 252925cb339..661fd378047 100644
--- a/chromium/media/video/video_encoder_info.cc
+++ b/chromium/media/video/video_encoder_info.cc
@@ -1,4 +1,4 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/video_encoder_info.h b/chromium/media/video/video_encoder_info.h
index 90324c5edb6..ff44b154bcc 100644
--- a/chromium/media/video/video_encoder_info.h
+++ b/chromium/media/video/video_encoder_info.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/vpx_video_encoder.cc b/chromium/media/video/vpx_video_encoder.cc
index 969e6d2a784..7787b765899 100644
--- a/chromium/media/video/vpx_video_encoder.cc
+++ b/chromium/media/video/vpx_video_encoder.cc
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/video/vpx_video_encoder.h b/chromium/media/video/vpx_video_encoder.h
index a807af45f16..05272d1d7b2 100644
--- a/chromium/media/video/vpx_video_encoder.h
+++ b/chromium/media/video/vpx_video_encoder.h
@@ -1,4 +1,4 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
+// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/webrtc/BUILD.gn b/chromium/media/webrtc/BUILD.gn
index 9b4da7c2e1c..fb23ae23227 100644
--- a/chromium/media/webrtc/BUILD.gn
+++ b/chromium/media/webrtc/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
+# Copyright 2018 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/webrtc/audio_delay_stats_reporter.cc b/chromium/media/webrtc/audio_delay_stats_reporter.cc
index a8072752615..1a2571a3b4e 100644
--- a/chromium/media/webrtc/audio_delay_stats_reporter.cc
+++ b/chromium/media/webrtc/audio_delay_stats_reporter.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/webrtc/audio_delay_stats_reporter.h b/chromium/media/webrtc/audio_delay_stats_reporter.h
index b481d03b20e..3107bd72ce7 100644
--- a/chromium/media/webrtc/audio_delay_stats_reporter.h
+++ b/chromium/media/webrtc/audio_delay_stats_reporter.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/webrtc/audio_processor.cc b/chromium/media/webrtc/audio_processor.cc
index 24d694d0f71..f5aa34725d7 100644
--- a/chromium/media/webrtc/audio_processor.cc
+++ b/chromium/media/webrtc/audio_processor.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -42,11 +42,20 @@ int GetCaptureBufferSize(bool need_webrtc_processing,
#if BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CAST_ANDROID)
// TODO(henrika): Re-evaluate whether to use same logic as other platforms.
// https://crbug.com/638081
+ // Note: This computation does not match 2x10 ms as defined for audio
+ // processing when rates are 50 modulo 100. 22050 Hz here gives buffer size
+ // (2*22050)/100 = 441 samples, while WebRTC processes in chunks of 22050/100
+ // = 220 samples. This leads to unnecessary rebuffering.
return 2 * device_format.sample_rate() / 100;
#else
- // If audio processing is turned on, require 10ms buffers.
- if (need_webrtc_processing)
- return device_format.sample_rate() / 100;
+ const int buffer_size_10_ms = device_format.sample_rate() / 100;
+ // If audio processing is turned on, require 10ms buffers to avoid
+ // rebuffering.
+ if (need_webrtc_processing) {
+ DCHECK_EQ(buffer_size_10_ms, webrtc::AudioProcessing::GetFrameSize(
+ device_format.sample_rate()));
+ return buffer_size_10_ms;
+ }
// If WebRTC audio processing is not required and the native hardware buffer
// size was provided, use it. It can be harmful, in terms of CPU/power
@@ -57,7 +66,7 @@ int GetCaptureBufferSize(bool need_webrtc_processing,
// If the buffer size is missing from the device parameters, provide 10ms as
// a fall-back.
- return device_format.sample_rate() / 100;
+ return buffer_size_10_ms;
#endif
}
} // namespace
@@ -246,11 +255,14 @@ AudioProcessor::AudioProcessor(
CHECK(input_format_.IsValid());
CHECK(output_format_.IsValid());
if (webrtc_audio_processing_) {
- DCHECK_EQ(output_format_.sample_rate() / 100,
- output_format_.frames_per_buffer());
+ DCHECK_EQ(
+ webrtc::AudioProcessing::GetFrameSize(output_format_.sample_rate()),
+ output_format_.frames_per_buffer());
}
if (input_format_.sample_rate() % 100 != 0 ||
output_format_.sample_rate() % 100 != 0) {
+ // The WebRTC audio processing module may simulate clock drift on
+ // non-divisible sample rates.
SendLogMessage(base::StringPrintf(
"%s: WARNING: Sample rate not divisible by 100, processing is provided "
"on a best-effort basis. input rate=[%d], output rate=[%d]",
@@ -261,11 +273,12 @@ AudioProcessor::AudioProcessor(
input_format_.AsHumanReadableString().c_str(),
output_format_.AsHumanReadableString().c_str()));
- // If audio processing is needed, rebuffer to 10 ms. If not, rebuffer to the
- // requested output format.
+ // If audio processing is needed, rebuffer to APM frame size. If not, rebuffer
+ // to the requested output format.
const int fifo_output_frames_per_buffer =
- webrtc_audio_processing_ ? input_format_.sample_rate() / 100
- : output_format_.frames_per_buffer();
+ webrtc_audio_processing_
+ ? webrtc::AudioProcessing::GetFrameSize(input_format_.sample_rate())
+ : output_format_.frames_per_buffer();
SendLogMessage(base::StringPrintf(
"%s => (capture FIFO: fifo_output_frames_per_buffer=%d)", __func__,
fifo_output_frames_per_buffer));
@@ -388,8 +401,9 @@ void AudioProcessor::OnPlayoutData(const AudioBus& audio_bus,
// rate.
// Channel count changes are already handled within the AudioPushFifo.
playout_sample_rate_hz_ = sample_rate;
- const int num_frames_per_10_ms = sample_rate / 100;
- playout_fifo_.Reset(num_frames_per_10_ms);
+ const int samples_per_channel =
+ webrtc::AudioProcessing::GetFrameSize(sample_rate);
+ playout_fifo_.Reset(samples_per_channel);
}
playout_fifo_.Push(audio_bus);
@@ -556,14 +570,14 @@ absl::optional<AudioParameters> AudioProcessor::ComputeInputFormat(
}
AudioParameters params(
- device_format.format(), channel_layout, device_format.sample_rate(),
+ device_format.format(), device_format.channel_layout_config(),
+ device_format.sample_rate(),
GetCaptureBufferSize(
audio_processing_settings.NeedWebrtcAudioProcessing(),
device_format));
params.set_effects(device_format.effects());
if (channel_layout == CHANNEL_LAYOUT_DISCRETE) {
DCHECK_LE(device_format.channels(), 2);
- params.set_channels_for_discrete(device_format.channels());
}
DVLOG(1) << params.AsHumanReadableString();
CHECK(params.IsValid());
@@ -591,9 +605,9 @@ AudioParameters AudioProcessor::GetDefaultOutputFormat(
#endif
: input_format.sample_rate();
- media::ChannelLayout output_channel_layout;
+ media::ChannelLayoutConfig output_channel_layout_config;
if (!need_webrtc_audio_processing) {
- output_channel_layout = input_format.channel_layout();
+ output_channel_layout_config = input_format.channel_layout_config();
} else if (settings.multi_channel_capture_processing) {
// The number of output channels is equal to the number of input channels.
// If the media stream audio processor receives stereo input it will
@@ -607,14 +621,14 @@ AudioParameters AudioProcessor::GetDefaultOutputFormat(
// performing true stereo processing. There will be no need to change the
// output format.
- output_channel_layout = input_format.channel_layout();
+ output_channel_layout_config = input_format.channel_layout_config();
} else {
- output_channel_layout = media::CHANNEL_LAYOUT_MONO;
+ output_channel_layout_config = ChannelLayoutConfig::Mono();
}
- // webrtc::AudioProcessing requires a 10 ms chunk size. We use this native
- // size when processing is enabled. When disabled we use the same size as
- // the source if less than 10 ms.
+ // When processing is enabled, the buffer size is dictated by
+ // webrtc::AudioProcessing (typically 10 ms). When processing is disabled, we
+ // use the same size as the source if it is less than that.
//
// TODO(ajm): This conditional buffer size appears to be assuming knowledge of
// the sink based on the source parameters. PeerConnection sinks seem to want
@@ -622,19 +636,15 @@ AudioParameters AudioProcessor::GetDefaultOutputFormat(
// we can identify WebAudio sinks by the input chunk size. Less fragile would
// be to have the sink actually tell us how much it wants (as in the above
// todo).
- int output_frames = output_sample_rate / 100;
+ int output_frames = webrtc::AudioProcessing::GetFrameSize(output_sample_rate);
if (!need_webrtc_audio_processing &&
input_format.frames_per_buffer() < output_frames) {
output_frames = input_format.frames_per_buffer();
}
- media::AudioParameters output_format =
- media::AudioParameters(input_format.format(), output_channel_layout,
- output_sample_rate, output_frames);
- if (output_channel_layout == media::CHANNEL_LAYOUT_DISCRETE) {
- // Explicitly set number of channels for discrete channel layouts.
- output_format.set_channels_for_discrete(input_format.channels());
- }
+ media::AudioParameters output_format = media::AudioParameters(
+ input_format.format(), output_channel_layout_config, output_sample_rate,
+ output_frames);
return output_format;
}
} // namespace media
diff --git a/chromium/media/webrtc/audio_processor.h b/chromium/media/webrtc/audio_processor.h
index 7186a2e53e4..a21ef78bb7b 100644
--- a/chromium/media/webrtc/audio_processor.h
+++ b/chromium/media/webrtc/audio_processor.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -68,7 +68,7 @@ class COMPONENT_EXPORT(MEDIA_WEBRTC) AudioProcessor {
// |settings|.NeedWebrtcAudioProcessing() is true, then the output must be in
// 10 ms chunks: the formats must specify |sample rate|/100 samples per buffer
// (rounded down). Sample rates which are not divisible by 100 are supported
- // on a best-effort basis, audio quality and stability may suffer.
+ // on a best-effort basis, audio quality may suffer.
static std::unique_ptr<AudioProcessor> Create(
DeliverProcessedAudioCallback deliver_processed_audio_callback,
LogCallback log_callback,
@@ -90,7 +90,7 @@ class COMPONENT_EXPORT(MEDIA_WEBRTC) AudioProcessor {
AudioProcessor(const AudioProcessor&) = delete;
AudioProcessor& operator=(const AudioProcessor&) = delete;
- // Processes and delivers capture audio in chunks of <= 10 ms to
+ // Processes capture audio and delivers in chunks of <= 10 ms to
// |deliver_processed_audio_callback_|: Each call to ProcessCapturedAudio()
// method triggers zero or more calls to |deliver_processed_audio_callback_|,
// depending on internal FIFO size and content. |num_preferred_channels| is
@@ -219,7 +219,8 @@ class COMPONENT_EXPORT(MEDIA_WEBRTC) AudioProcessor {
// Members configured on the owning sequence in the constructor and
// used on the capture thread:
- // FIFO to provide capture audio in chunks of up to 10 ms.
+ // FIFO to provide capture audio in chunks that can be processed by
+ // webrtc::AudioProcessing.
std::unique_ptr<AudioProcessorCaptureFifo> capture_fifo_;
// Receives APM processing output.
@@ -247,7 +248,8 @@ class COMPONENT_EXPORT(MEDIA_WEBRTC) AudioProcessor {
// Members accessed only on the playout thread:
- // FIFO to provide playout audio in 10 ms chunks.
+ // FIFO to provide playout audio in chunks that can be processed by
+ // webrtc::AudioProcessing.
AudioPushFifo playout_fifo_;
// Cached value of the playout delay before adjusting for delay introduced by
diff --git a/chromium/media/webrtc/audio_processor_test.cc b/chromium/media/webrtc/audio_processor_test.cc
index a6f26e65072..9f470f53908 100644
--- a/chromium/media/webrtc/audio_processor_test.cc
+++ b/chromium/media/webrtc/audio_processor_test.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -38,19 +38,9 @@ using ::testing::Return;
namespace media {
namespace {
-// TODO(crbug.com/1334991): Clarify WebRTC audio processing support for 96 kHz
-// input.
-static const int kSupportedSampleRates[] = {8000,
- 16000,
- 22050,
- 32000,
- 44100,
- 48000
-#if BUILDFLAG(IS_CASTOS) || BUILDFLAG(IS_CAST_ANDROID)
- ,
- 96000
-#endif
-};
+// Test all sample rates observed in UMA metric WebRTC.AudioInputSampleRate.
+static const int kSupportedSampleRates[] = {8000, 11025, 16000, 22050, 24000,
+ 32000, 44100, 48000, 96000, 192000};
using MockProcessedCaptureCallback =
base::MockRepeatingCallback<void(const media::AudioBus& audio_bus,
@@ -97,7 +87,7 @@ class AudioProcessorTest : public ::testing::Test {
public:
AudioProcessorTest()
: params_(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_STEREO,
+ ChannelLayoutConfig::Stereo(),
48000,
480) {}
@@ -269,7 +259,7 @@ TEST_P(AudioProcessorTestMultichannelAndFormat, MAYBE_TestAllSampleRates) {
SCOPED_TRACE(testing::Message() << "sample_rate=" << sample_rate);
int buffer_size = sample_rate / 100;
media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_STEREO, sample_rate,
+ ChannelLayoutConfig::Stereo(), sample_rate,
buffer_size);
std::unique_ptr<AudioProcessor> audio_processor = AudioProcessor::Create(
mock_capture_callback_.Get(), LogCallbackForTesting(), settings, params,
@@ -462,7 +452,7 @@ TEST_P(AudioProcessorDefaultOutputFormatTest, GetDefaultOutputFormat) {
media::AudioParameters input_params(
media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_STEREO, sample_rate, sample_rate / 100);
+ ChannelLayoutConfig::Stereo(), sample_rate, sample_rate / 100);
AudioParameters output_params =
AudioProcessor::GetDefaultOutputFormat(input_params, settings);
@@ -488,11 +478,11 @@ TEST_P(AudioProcessorDefaultOutputFormatTest, GetDefaultOutputFormat) {
TEST_F(AudioProcessorTest, DiscreteChannelLayout) {
AudioProcessingSettings settings;
- media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_DISCRETE, 48000, 480);
// Test both 1 and 2 discrete channels.
for (int channels = 1; channels <= 2; ++channels) {
- params.set_channels_for_discrete(channels);
+ media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ {media::CHANNEL_LAYOUT_DISCRETE, channels},
+ 48000, 480);
std::unique_ptr<AudioProcessor> audio_processor = AudioProcessor::Create(
mock_capture_callback_.Get(), LogCallbackForTesting(), settings, params,
AudioProcessor::GetDefaultOutputFormat(params, settings));
@@ -585,7 +575,7 @@ TEST(AudioProcessorCallbackTest,
AudioProcessingSettings settings;
// Set buffer size to 4 ms.
media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_STEREO, 48000,
+ ChannelLayoutConfig::Stereo(), 48000,
48000 * 4 / 1000);
std::unique_ptr<AudioProcessor> audio_processor = AudioProcessor::Create(
mock_capture_callback.Get(), LogCallbackForTesting(), settings, params,
@@ -635,7 +625,7 @@ TEST(AudioProcessorCallbackTest,
AudioProcessingSettings settings;
// Set buffer size to 35 ms.
media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_STEREO, 48000,
+ ChannelLayoutConfig::Stereo(), 48000,
48000 * 35 / 1000);
std::unique_ptr<AudioProcessor> audio_processor = AudioProcessor::Create(
mock_capture_callback.Get(), LogCallbackForTesting(), settings, params,
@@ -675,7 +665,7 @@ TEST(AudioProcessorCallbackTest,
DisableDefaultSettings(settings);
// Set buffer size to 4 ms.
media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_STEREO, 48000,
+ ChannelLayoutConfig::Stereo(), 48000,
48000 * 4 / 1000);
std::unique_ptr<AudioProcessor> audio_processor = AudioProcessor::Create(
mock_capture_callback.Get(), LogCallbackForTesting(), settings, params,
@@ -712,7 +702,7 @@ TEST(AudioProcessorCallbackTest,
DisableDefaultSettings(settings);
// Set buffer size to 35 ms.
media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
- media::CHANNEL_LAYOUT_STEREO, 48000,
+ ChannelLayoutConfig::Stereo(), 48000,
48000 * 35 / 1000);
std::unique_ptr<AudioProcessor> audio_processor = AudioProcessor::Create(
mock_capture_callback.Get(), LogCallbackForTesting(), settings, params,
diff --git a/chromium/media/webrtc/constants.h b/chromium/media/webrtc/constants.h
index cd645800811..d54e3e8d6f1 100644
--- a/chromium/media/webrtc/constants.h
+++ b/chromium/media/webrtc/constants.h
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/webrtc/helpers.cc b/chromium/media/webrtc/helpers.cc
index e2c2bc93a55..d24f6d54875 100644
--- a/chromium/media/webrtc/helpers.cc
+++ b/chromium/media/webrtc/helpers.cc
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/webrtc/helpers.h b/chromium/media/webrtc/helpers.h
index 399aa70ce77..2f7c1bff65c 100644
--- a/chromium/media/webrtc/helpers.h
+++ b/chromium/media/webrtc/helpers.h
@@ -1,4 +1,4 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
+// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/webrtc/helpers_unittests.cc b/chromium/media/webrtc/helpers_unittests.cc
index 73fada885ca..5f425e8a11f 100644
--- a/chromium/media/webrtc/helpers_unittests.cc
+++ b/chromium/media/webrtc/helpers_unittests.cc
@@ -1,4 +1,4 @@
-// Copyright 2021 The Chromium Authors. All rights reserved.
+// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/webrtc/webrtc_features.cc b/chromium/media/webrtc/webrtc_features.cc
index 52e9dd55335..0df461c4972 100644
--- a/chromium/media/webrtc/webrtc_features.cc
+++ b/chromium/media/webrtc/webrtc_features.cc
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -29,26 +29,30 @@ constexpr base::FeatureState kWebRtcAnalogAgcClippingControlState =
// When enabled we will tell WebRTC that we want to use the
// Windows.Graphics.Capture API based DesktopCapturer, if it is available.
-const base::Feature kWebRtcAllowWgcDesktopCapturer{
- "AllowWgcDesktopCapturer", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kWebRtcAllowWgcDesktopCapturer,
+ "AllowWgcDesktopCapturer",
+ base::FEATURE_DISABLED_BY_DEFAULT);
// Kill-switch allowing deactivation of the support for 48 kHz internal
// processing in the WebRTC audio processing module when running on an ARM
// platform.
-const base::Feature kWebRtcAllow48kHzProcessingOnArm{
- "WebRtcAllow48kHzProcessingOnArm", base::FEATURE_ENABLED_BY_DEFAULT};
+BASE_FEATURE(kWebRtcAllow48kHzProcessingOnArm,
+ "WebRtcAllow48kHzProcessingOnArm",
+ base::FEATURE_ENABLED_BY_DEFAULT);
// Enables the WebRTC Hybrid AGC configuration - i.e., AGC1 analog and AGC2
// digital (see http://crbug.com/1231085).
-const base::Feature kWebRtcHybridAgc{"WebRtcHybridAgc", kWebRtcHybridAgcState};
+BASE_FEATURE(kWebRtcHybridAgc, "WebRtcHybridAgc", kWebRtcHybridAgcState);
// Enables and configures the clipping control in the WebRTC analog AGC.
-const base::Feature kWebRtcAnalogAgcClippingControl{
- "WebRtcAnalogAgcClippingControl", kWebRtcAnalogAgcClippingControlState};
+BASE_FEATURE(kWebRtcAnalogAgcClippingControl,
+ "WebRtcAnalogAgcClippingControl",
+ kWebRtcAnalogAgcClippingControlState);
// Enables the override for the default minimum starting volume of the Automatic
// Gain Control algorithm in WebRTC.
-const base::Feature kWebRtcAnalogAgcStartupMinVolume{
- "WebRtcAnalogAgcStartupMinVolume", base::FEATURE_DISABLED_BY_DEFAULT};
+BASE_FEATURE(kWebRtcAnalogAgcStartupMinVolume,
+ "WebRtcAnalogAgcStartupMinVolume",
+ base::FEATURE_DISABLED_BY_DEFAULT);
} // namespace features
diff --git a/chromium/media/webrtc/webrtc_features.h b/chromium/media/webrtc/webrtc_features.h
index eacc42d9204..384d9b75e42 100644
--- a/chromium/media/webrtc/webrtc_features.h
+++ b/chromium/media/webrtc/webrtc_features.h
@@ -1,4 +1,4 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
+// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -13,19 +13,18 @@
namespace features {
COMPONENT_EXPORT(MEDIA_WEBRTC)
-extern const base::Feature kWebRtcAllowWgcDesktopCapturer;
+BASE_DECLARE_FEATURE(kWebRtcAllowWgcDesktopCapturer);
COMPONENT_EXPORT(MEDIA_WEBRTC)
-extern const base::Feature kWebRtcAllow48kHzProcessingOnArm;
+BASE_DECLARE_FEATURE(kWebRtcAllow48kHzProcessingOnArm);
-COMPONENT_EXPORT(MEDIA_WEBRTC)
-extern const base::Feature kWebRtcHybridAgc;
+COMPONENT_EXPORT(MEDIA_WEBRTC) BASE_DECLARE_FEATURE(kWebRtcHybridAgc);
COMPONENT_EXPORT(MEDIA_WEBRTC)
-extern const base::Feature kWebRtcAnalogAgcClippingControl;
+BASE_DECLARE_FEATURE(kWebRtcAnalogAgcClippingControl);
COMPONENT_EXPORT(MEDIA_WEBRTC)
-extern const base::Feature kWebRtcAnalogAgcStartupMinVolume;
+BASE_DECLARE_FEATURE(kWebRtcAnalogAgcStartupMinVolume);
} // namespace features