From bce31914d76b65d8f2148f7e391e40877b617b37 Mon Sep 17 00:00:00 2001 From: xiaomings Date: Thu, 20 Apr 2023 12:47:01 -0700 Subject: [PATCH] [media] Support configurable audio write ahead Enables the web app to configure the audio write ahead duration through an extension, and enables the extension for linux-x64x11. Se the original PR https://github.com/youtube/cobalt/pull/121 for details. b/267678497 b/267678497 --- .../src/components/player.ts | 55 +++++-- .../src/components/source_buffer_info.ts | 7 +- .../src/components/video_info.ts | 6 +- cobalt/dom/html_media_element.cc | 33 +++++ cobalt/dom/html_media_element.h | 8 ++ cobalt/dom/html_media_element.idl | 6 + cobalt/dom/source_buffer.cc | 11 ++ cobalt/dom/source_buffer.h | 3 + cobalt/dom/source_buffer.idl | 6 + cobalt/extension/audio_write_ahead.h | 83 +++++++++++ cobalt/media/base/pipeline.h | 4 + cobalt/media/base/sbplayer_bridge.cc | 30 ++++ cobalt/media/base/sbplayer_bridge.h | 2 + cobalt/media/base/sbplayer_interface.cc | 32 +++++ cobalt/media/base/sbplayer_interface.h | 19 +++ cobalt/media/base/sbplayer_pipeline.cc | 136 +++++++++++++++--- cobalt/media/media_module.cc | 23 ++- cobalt/media/media_module.h | 7 + cobalt/media/player/web_media_player.h | 3 + cobalt/media/player/web_media_player_impl.cc | 7 + cobalt/media/player/web_media_player_impl.h | 5 + starboard/common/media.cc | 49 +++++++ starboard/common/media.h | 4 + starboard/linux/shared/BUILD.gn | 3 + .../linux/shared/system_get_extensions.cc | 6 + .../media_set_audio_write_duration_test.cc | 13 ++ .../audio_write_ahead/audio_write_ahead.cc | 45 ++++++ .../audio_write_ahead/audio_write_ahead.gni | 22 +++ .../audio_write_ahead/audio_write_ahead.h | 28 ++++ ...ite_ahead_media_get_audio_configuration.cc | 46 ++++++ ...rite_ahead_media_get_audio_configuration.h | 32 +++++ ...te_ahead_player_get_audio_configuration.cc | 61 ++++++++ ...ite_ahead_player_get_audio_configuration.h | 35 +++++ .../filter/testing/audio_decoder_test.cc | 25 +++- .../chromium/media/filters/chunk_demuxer.cc | 35 +++++ .../chromium/media/filters/chunk_demuxer.h | 11 ++ 36 files changed, 864 insertions(+), 37 deletions(-) create mode 100644 cobalt/extension/audio_write_ahead.h create mode 100644 starboard/shared/audio_write_ahead/audio_write_ahead.cc create mode 100644 starboard/shared/audio_write_ahead/audio_write_ahead.gni create mode 100644 starboard/shared/audio_write_ahead/audio_write_ahead.h create mode 100644 starboard/shared/audio_write_ahead/audio_write_ahead_media_get_audio_configuration.cc create mode 100644 starboard/shared/audio_write_ahead/audio_write_ahead_media_get_audio_configuration.h create mode 100644 starboard/shared/audio_write_ahead/audio_write_ahead_player_get_audio_configuration.cc create mode 100644 starboard/shared/audio_write_ahead/audio_write_ahead_player_get_audio_configuration.h diff --git a/cobalt/demos/content/media-element-demo/src/components/player.ts b/cobalt/demos/content/media-element-demo/src/components/player.ts index 7bd9c1710583..60e3a5c2d7dd 100644 --- a/cobalt/demos/content/media-element-demo/src/components/player.ts +++ b/cobalt/demos/content/media-element-demo/src/components/player.ts @@ -25,6 +25,18 @@ export class Player extends Component { /** The