Skip to content

Commit

Permalink
[media] Implement SbPlayer based video playback
Browse files Browse the repository at this point in the history
The implementation was based on SbPlayerPipeline, with many features
disabled (e.g. suspend/resume, UMA metrics) or unimplemented.  The
former are tracked by feature macros in //media/starboard/BUILD.gn
linked with tracking bugs, the latters are marked with TODOs with
tracking bugs.

It also
1. Removed support of old Starboard versions (e.g. the EnhancedAudio
   starboard extension).
2. Worked around for incomplete type in SbPlayerBridge::CallbackHelper
   (see b/375665361).

b/328305706
  • Loading branch information
xiaomings committed Oct 30, 2024
1 parent fbe3fb9 commit 3e56903
Show file tree
Hide file tree
Showing 19 changed files with 873 additions and 1,781 deletions.
4 changes: 4 additions & 0 deletions media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ test("media_unittests") {
"//media/webrtc:unit_tests",
]

if (is_cobalt) {
deps += ["//media/starboard:unit_tests"]
}

data = [
"test/data/",
"formats/mp4/h264_annex_b_fuzz_corpus/",
Expand Down
4 changes: 4 additions & 0 deletions media/media_options.gni
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ media_subcomponent_deps = [
"//media/video",
]

if (is_cobalt) {
media_subcomponent_deps += [ "//media/starboard" ]
}

if (is_fuchsia) {
media_subcomponent_deps += [ "//media/fuchsia/common" ]
}
Expand Down
96 changes: 96 additions & 0 deletions media/starboard/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Copyright 2024 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

source_set("starboard") {
visibility = [ "//media" ]

defines = [
"STARBOARD",

# TODO(b/326652276): Support audio write ahead
"COBALT_MEDIA_ENABLE_AUDIO_DURATION=0",

# TODO(b/326508279): Revisit background mode
"COBALT_MEDIA_ENABLE_BACKGROUND_MODE=0",

# TODO(b/375069564): Revisit CValStats
"COBALT_MEDIA_ENABLE_CVAL=0",

# TODO(b/374822966): Revisit DecoderBuffer budget
"COBALT_MEDIA_ENABLE_DECODE_BUFFER_BUDGET=0",

# TODO(b/375070492): Revisit decode-to-texture
"COBALT_MEDIA_ENABLE_DECODE_TARGET_PROVIDER=0",

# TODO(b/328305808): Enable encrypted playbacks
"COBALT_MEDIA_ENABLE_ENCRYPTED_PLAYBACKS=0",

# TODO(b/375218518): Revisit FormatSupportQueryMetrics
"COBALT_MEDIA_ENABLE_FORMAT_SUPPORT_QUERY_METRICS=0",

# TODO(b/375232937): Enable IAMF
"COBALT_MEDIA_ENABLE_IAMF_SUPPORT=0",

# TODO(b/326654546): Revisit max video input size
"COBALT_MEDIA_ENABLE_PLAYER_SET_MAX_VIDEO_INPUT_SIZE=0",

# TODO(b/375059645): Revisit side data (aka hdr10+) support
"COBALT_MEDIA_ENABLE_SIDE_DATA=0",

# TODO(b/375234428): Revisit startup latency tracking
"COBALT_MEDIA_ENABLE_STARTUP_LATENCY_TRACKING=0",

# TODO(b/326497953): Revisit suspend/resume support
"COBALT_MEDIA_ENABLE_SUSPEND_RESUME=0",

# TODO(b/375241265): Re-enable UMA metrics
"COBALT_MEDIA_ENABLE_UMA_METRICS=0",
]

sources = [
"sbplayer_bridge.cc",
"sbplayer_bridge.h",
"sbplayer_interface.cc",
"sbplayer_interface.h",
"sbplayer_set_bounds_helper.cc",
"sbplayer_set_bounds_helper.h",
"starboard_renderer.cc",
"starboard_renderer.h",
"starboard_utils.cc",
"starboard_utils.h",
]

deps = [
"//base",
"//media:media_buildflags",
"//media/base",
"//starboard($starboard_toolchain)",
]

configs += [ "//media:subcomponent_config" ]
}

source_set("unit_tests") {
testonly = true
sources = [ "starboard_utils_test.cc" ]
configs += [ "//media:media_config" ]
deps = [
"//base",
"//base/test:test_support",
"//media:test_support",
"//starboard($starboard_toolchain)",
"//testing/gmock",
"//testing/gtest",
]
}
Loading

0 comments on commit 3e56903

Please sign in to comment.