Skip to content

Commit

Permalink
[media] Implement SbPlayer based video playback
Browse files Browse the repository at this point in the history
1. Remove support of old Starboard versions
2. Disabled media statistics support.
3. Disabled set max input size support.
4. Disabled suspend/resume.
5. Disabled CVal stats.
6. Disabled URL player.
7. Workaround for incomplete type in SbPlayerBridge::CallbackHelper.

b/328305706
  • Loading branch information
xiaomings committed Oct 23, 2024
1 parent d4f184e commit 661a460
Show file tree
Hide file tree
Showing 18 changed files with 1,112 additions and 203 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
91 changes: 91 additions & 0 deletions media/starboard/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# 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/326508279): Revisit background mode support
"COBALT_MEDIA_ENABLE_BACKGROUND_MODE_SUPPORT=0",

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

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

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

"COBALT_MEDIA_ENABLE_FORMAT_SUPPORT_QUERY_METRICS=0",

"COBALT_MEDIA_ENABLE_IAMF_SUPPORT=0",

# TODO: 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: Revisit Statistics
"COBALT_MEDIA_ENABLE_STATISTICS=0",

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

# TODO(b/375060471): Re-enable TRACE_EVENT()s
"COBALT_MEDIA_ENABLE_TRACE_EVENT=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($starboard_toolchain)",
"//starboard/common",
]

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/common",
"//testing/gmock",
"//testing/gtest",
]
}
Loading

0 comments on commit 661a460

Please sign in to comment.