diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml
index 28616c4afed4..927ec0bec326 100644
--- a/.github/actions/build/action.yaml
+++ b/.github/actions/build/action.yaml
@@ -17,14 +17,14 @@ runs:
run: |
set -x
env
- if [ -z ${COBALT_BOOTLOADER+x} ]; then
+ if [ -z ${COBALT_EVERGREEN_LOADER+x} ]; then
BUILD_PLATFORM=${{ matrix.target_platform }}
BUILD_TARGET=all
if [[ "${{matrix.config}}" =~ ^(qa|gold)$ ]]; then
BUILD_TARGET=default
fi
else
- BUILD_PLATFORM=${COBALT_BOOTLOADER}
+ BUILD_PLATFORM=${COBALT_EVERGREEN_LOADER}
BUILD_TARGET='loader_app_install elf_loader_sandbox_install native_target/crashpad_handler'
fi
# GitHub Runners have home set to /github/home.
diff --git a/.github/actions/gn/action.yaml b/.github/actions/gn/action.yaml
index 7afac0350b1e..ba027017a1cd 100644
--- a/.github/actions/gn/action.yaml
+++ b/.github/actions/gn/action.yaml
@@ -22,13 +22,13 @@ runs:
run: |
set -x
extra_arguments="${{matrix.extra_gn_arguments}}"
- if [ -z ${COBALT_BOOTLOADER+x} ]; then
+ if [ -z ${COBALT_EVERGREEN_LOADER+x} ]; then
BUILD_PLATFORM=${{ matrix.target_platform }}
else
- BUILD_PLATFORM=${COBALT_BOOTLOADER}
- if [ ! -z "${{matrix.bootloader_extra_gn_arguments}}" ]
+ BUILD_PLATFORM=${COBALT_EVERGREEN_LOADER}
+ if [ ! -z "${{matrix.evergreen_loader_extra_gn_arguments}}" ]
then
- extra_arguments="${{matrix.bootloader_extra_gn_arguments}}"
+ extra_arguments="${{matrix.evergreen_loader_extra_gn_arguments}}"
fi
fi
gn gen $GITHUB_WORKSPACE/out/${BUILD_PLATFORM}_${{matrix.config}} --args="target_platform=\"${BUILD_PLATFORM}\" ${{matrix.sb_api_version}} ${{matrix.target_os}} ${{matrix.target_cpu}} ${extra_arguments} is_internal_build=false build_type=\"${{matrix.config}}\""
diff --git a/.github/actions/on_device_tests/action.yaml b/.github/actions/on_device_tests/action.yaml
index 7b9ef1e98983..c981288dafe7 100644
--- a/.github/actions/on_device_tests/action.yaml
+++ b/.github/actions/on_device_tests/action.yaml
@@ -23,9 +23,9 @@ runs:
echo "WORKFLOW=${WORKFLOW}" >> $GITHUB_ENV
# Boot loader env
- if [ "${COBALT_BOOTLOADER}" != "null" ]; then
+ if [ "${COBALT_EVERGREEN_LOADER}" != "null" ]; then
echo "LOADER_CONFIG=${{ matrix.config }}" >> $GITHUB_ENV
- echo "LOADER_PLATFORM=${COBALT_BOOTLOADER}" >> $GITHUB_ENV
+ echo "LOADER_PLATFORM=${COBALT_EVERGREEN_LOADER}" >> $GITHUB_ENV
fi
# Dimension env
diff --git a/.github/actions/on_host_test/action.yaml b/.github/actions/on_host_test/action.yaml
index a10a8bf2af5d..c751de0de0f9 100644
--- a/.github/actions/on_host_test/action.yaml
+++ b/.github/actions/on_host_test/action.yaml
@@ -39,21 +39,21 @@ runs:
fi
python3 ${GITHUB_WORKSPACE}/tools/create_archive.py -x -s ${GITHUB_WORKSPACE}/out/tmp/${{matrix.platform}}_${{matrix.config}}.${ARCHIVE_EXTENSION} -d ${GITHUB_WORKSPACE}/out ${parallel}
rm -rf ${GITHUB_WORKSPACE}/out/tmp
- - name: Download Bootloader Archive
- if: ${{ env.COBALT_BOOTLOADER != null && env.COBALT_BOOTLOADER != 'null' }}
+ - name: Download Evergreen loader Archive
+ if: ${{ env.COBALT_EVERGREEN_LOADER != null && env.COBALT_EVERGREEN_LOADER != 'null' }}
shell: bash
env:
WORKFLOW: ${{ github.workflow }}
run: |
set -x
PROJECT_NAME=$(gcloud config get-value project)
- gsutil cp gs://${PROJECT_NAME}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{matrix.platform}}_${{matrix.config}}/${COBALT_BOOTLOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION} ${GITHUB_WORKSPACE}/out/tmp/${COBALT_BOOTLOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION}
- - name: Extract Bootloader Archive
- if: ${{ env.COBALT_BOOTLOADER != null && env.COBALT_BOOTLOADER != 'null' }}
+ gsutil cp gs://${PROJECT_NAME}-test-artifacts/${WORKFLOW}/${GITHUB_RUN_NUMBER}/${{matrix.platform}}_${{matrix.config}}/${COBALT_EVERGREEN_LOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION} ${GITHUB_WORKSPACE}/out/tmp/${COBALT_EVERGREEN_LOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION}
+ - name: Extract Evergreen loader Archive
+ if: ${{ env.COBALT_EVERGREEN_LOADER != null && env.COBALT_EVERGREEN_LOADER != 'null' }}
shell: bash
run: |
set -x
- python3 ${GITHUB_WORKSPACE}/tools/create_archive.py -x -s ${GITHUB_WORKSPACE}/out/tmp/${COBALT_BOOTLOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION} -d ${GITHUB_WORKSPACE}/out --parallel
+ python3 ${GITHUB_WORKSPACE}/tools/create_archive.py -x -s ${GITHUB_WORKSPACE}/out/tmp/${COBALT_EVERGREEN_LOADER}_${{matrix.config}}.${ARCHIVE_EXTENSION} -d ${GITHUB_WORKSPACE}/out --parallel
rm -rf ${GITHUB_WORKSPACE}/out/tmp
- name: Set Env Variables
shell: bash
@@ -66,8 +66,8 @@ runs:
run: |
set -x
loader_args=''
- if [ "${COBALT_BOOTLOADER}" != "null" ]; then
- loader_args="--loader_platform ${COBALT_BOOTLOADER} --loader_config ${{matrix.config}}"
+ if [ "${COBALT_EVERGREEN_LOADER}" != "null" ]; then
+ loader_args="--loader_platform ${COBALT_EVERGREEN_LOADER} --loader_config ${{matrix.config}}"
fi
if [[ "${{matrix.shard}}" == 'integration' ]]; then
xvfb-run -a --server-args="-screen 0 1920x1080x24i +render +extension GLX -noreset" python3 $GITHUB_WORKSPACE/cobalt/black_box_tests/black_box_tests.py --platform ${{matrix.target_platform}} --config ${{matrix.config}} ${loader_args}
diff --git a/.github/actions/upload_test_artifacts/action.yaml b/.github/actions/upload_test_artifacts/action.yaml
index d2923eb553a7..33eaa063fc0f 100644
--- a/.github/actions/upload_test_artifacts/action.yaml
+++ b/.github/actions/upload_test_artifacts/action.yaml
@@ -18,13 +18,13 @@ runs:
run: |
set -x
project_name=$(gcloud config get-value project)
- if [ -z ${COBALT_BOOTLOADER+x} ]
+ if [ -z ${COBALT_EVERGREEN_LOADER+x} ]
then
PLATFORM=${{matrix.platform}}
echo "TARGET_PLATFORM=${{matrix.target_platform}}" >> $GITHUB_ENV
else
- PLATFORM=${COBALT_BOOTLOADER}
- echo "TARGET_PLATFORM=${COBALT_BOOTLOADER}" >> $GITHUB_ENV
+ PLATFORM=${COBALT_EVERGREEN_LOADER}
+ echo "TARGET_PLATFORM=${COBALT_EVERGREEN_LOADER}" >> $GITHUB_ENV
fi
if [ "${{ inputs.type }}" == 'ondevice' ]
@@ -56,9 +56,9 @@ runs:
if [ "${{ inputs.type }}" == 'ondevice' ]
then
outdir="$GITHUB_WORKSPACE/out/${{matrix.target_platform}}_${{matrix.config}}"
- if [ -n "${COBALT_BOOTLOADER}" ]
+ if [ -n "${COBALT_EVERGREEN_LOADER}" ]
then
- outdir="${outdir} $GITHUB_WORKSPACE/out/${COBALT_BOOTLOADER}_${{matrix.config}}"
+ outdir="${outdir} $GITHUB_WORKSPACE/out/${COBALT_EVERGREEN_LOADER}_${{matrix.config}}"
fi
python3 $GITHUB_WORKSPACE/tools/create_archive.py --test_infra -d ${{env.ARCHIVE_FILE}} -s ${outdir}
elif [ "${{ inputs.type }}" == 'onhost' ]
diff --git a/.github/config/evergreen-arm-hardfp.json b/.github/config/evergreen-arm-hardfp.json
index 8067c723440a..13b3cd366bb8 100644
--- a/.github/config/evergreen-arm-hardfp.json
+++ b/.github/config/evergreen-arm-hardfp.json
@@ -1,6 +1,6 @@
{
"docker_service": "build-raspi",
- "bootloader": "raspi-2",
+ "evergreen_loader": "raspi-2",
"on_device_test": {
"enabled": true,
"tests": [
@@ -25,7 +25,7 @@
"target_platform":"evergreen-arm-hardfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
- "bootloader_extra_gn_arguments": "use_asan=false is_clang=false",
+ "evergreen_loader_extra_gn_arguments": "use_asan=false is_clang=false",
"dimension": "release_version=regex:10.*"
},
{
@@ -34,7 +34,7 @@
"target_platform":"evergreen-arm-hardfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
- "bootloader_extra_gn_arguments":"use_asan=false is_clang=false",
+ "evergreen_loader_extra_gn_arguments":"use_asan=false is_clang=false",
"sb_api_version": "sb_api_version=15",
"dimension": "release_version=regex:10.*"
},
@@ -44,7 +44,7 @@
"target_platform":"evergreen-arm-hardfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
- "bootloader_extra_gn_arguments":"use_asan=false is_clang=false",
+ "evergreen_loader_extra_gn_arguments":"use_asan=false is_clang=false",
"sb_api_version": "sb_api_version=14",
"dimension": "release_version=regex:10.*"
},
@@ -54,7 +54,7 @@
"target_platform":"evergreen-arm-hardfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
- "bootloader_extra_gn_arguments":"use_asan=false is_clang=false",
+ "evergreen_loader_extra_gn_arguments":"use_asan=false is_clang=false",
"sb_api_version": "sb_api_version=13",
"dimension": "release_version=regex:10.*"
}
diff --git a/.github/config/evergreen-x64.json b/.github/config/evergreen-x64.json
index b95a3183741a..0f18b571e021 100644
--- a/.github/config/evergreen-x64.json
+++ b/.github/config/evergreen-x64.json
@@ -1,7 +1,7 @@
{
"docker_service": "build-linux-evergreen",
"on_host_test": true,
- "bootloader": "linux-x64x11",
+ "evergreen_loader": "linux-x64x11",
"on_host_test_shards": ["0", "1", "2", "3", "blackbox", "wpt"],
"platforms": [
"evergreen-x64",
diff --git a/.github/config/linux.json b/.github/config/linux.json
index 79ceb0bbd36a..e1efe4b1c102 100644
--- a/.github/config/linux.json
+++ b/.github/config/linux.json
@@ -1,5 +1,6 @@
{
"docker_service": "build-linux",
+ "evergreen_loader": "linux-x64x11",
"on_host_test": true,
"on_host_test_shards": ["0", "1", "2", "3", "blackbox", "wpt"],
"platforms": [
diff --git a/.github/workflows/android_24.lts.1+.yaml b/.github/workflows/android_24.lts.1+.yaml
index cec9f87e4c68..18e7546ca54b 100644
--- a/.github/workflows/android_24.lts.1+.yaml
+++ b/.github/workflows/android_24.lts.1+.yaml
@@ -1,6 +1,8 @@
name: android_24.lts.1+
on:
+ release:
+ types: [prereleased, released, published]
pull_request:
types: [ready_for_review, opened, reopened, synchronize, labeled]
branches:
@@ -28,6 +30,7 @@ jobs:
with:
platform: android-arm64
nightly: ${{ github.event.inputs.nightly }}
+ keep_artifacts: cobalt.apk
android-x86:
uses: ./.github/workflows/main.yaml
permissions:
@@ -36,6 +39,7 @@ jobs:
with:
platform: android-x86
nightly: ${{ github.event.inputs.nightly }}
+ keep_artifacts: cobalt.apk
android-arm:
uses: ./.github/workflows/main.yaml
permissions:
@@ -44,3 +48,49 @@ jobs:
with:
platform: android-arm
nightly: ${{ github.event.inputs.nightly }}
+ keep_artifacts: cobalt.apk
+
+ upload-release-artifacts:
+ runs-on: ubuntu-latest
+ needs: [ android-arm, android-arm64, android-x86 ]
+ permissions:
+ actions: write
+ steps:
+ - name: Download arm-gold apk
+ uses: actions/download-artifact@v4
+ with:
+ name: android-arm-gold
+ path: arm-gold
+ - name: Download arm-qa apk
+ uses: actions/download-artifact@v4
+ with:
+ name: android-arm-qa
+ path: arm-qa
+ - name: Download arm64-gold apk
+ uses: actions/download-artifact@v4
+ with:
+ name: android-arm64-gold
+ path: arm64-gold
+ - name: Download arm64-qa apk
+ uses: actions/download-artifact@v4
+ with:
+ name: android-arm64-gold
+ path: arm64-qa
+ - name: Download x86-gold apk
+ uses: actions/download-artifact@v4
+ with:
+ name: android-x86-gold
+ path: x86-gold
+ - name: Download x86-qa apk
+ uses: actions/download-artifact@v4
+ with:
+ name: android-x86-qa
+ path: x86-qa
+ - name: 'Upload Android APKs'
+ uses: actions/upload-artifact@v4
+ with:
+ name: Android APKs
+ path: ./*
+ retention-days: 90
+ compression-level: 0 # We expect kept artifacts to be already compressed
+ if-no-files-found: error
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index 9ccebb8620df..4717d45d8a5e 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -29,6 +29,11 @@ on:
required: false
type: boolean
default: false
+ keep_artifacts:
+ description: 'Which artifacts to keep for releases'
+ required: false
+ type: string
+ default: ''
# Global env vars.
env:
@@ -100,8 +105,8 @@ jobs:
run: echo "on_host_test=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.on_host_test')" >> $GITHUB_ENV
- id: set-on-host-test-shards
run: echo "on_host_test_shards=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -c '.on_host_test_shards')" >> $GITHUB_ENV
- - id: set-on-host-test-bootloader
- run: echo "bootloader=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.bootloader')" >> $GITHUB_ENV
+ - id: set-on-host-test-evergreen-loader
+ run: echo "evergreen_loader=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -rc '.evergreen_loader')" >> $GITHUB_ENV
- id: set-docker-service
run: |
echo "docker_service=$(cat ${GITHUB_WORKSPACE}/.github/config/${{ inputs.platform }}.json | jq -r '.docker_service')" >> $GITHUB_ENV
@@ -113,7 +118,7 @@ jobs:
on_device_test_attempts: ${{ env.on_device_test_attempts }}
on_host_test: ${{ env.on_host_test }}
on_host_test_shards: ${{ env.on_host_test_shards }}
- bootloader: ${{ env.bootloader }}
+ evergreen_loader: ${{ env.evergreen_loader }}
docker_service: ${{ env.docker_service }}
# Builds, tags, and pushes Cobalt docker build images to ghr.
@@ -210,34 +215,43 @@ jobs:
uses: ./.github/actions/gn
- name: Build Cobalt
uses: ./.github/actions/build
+ - name: 'Upload Artifact'
+ uses: actions/upload-artifact@v4
+ if: inputs.keep_artifacts
+ with:
+ name: ${{ matrix.platform }}-${{ matrix.config }}
+ path: out/${{ matrix.platform }}_${{ matrix.config }}/${{ inputs.keep_artifacts }}
+ retention-days: 7
+ compression-level: 0 # We expect kept artifacts to be already compressed
+ if-no-files-found: error
- name: Run API Leak Detector
uses: ./.github/actions/api_leak_detector
if: inputs.run_api_leak_detector
with:
relative_manifest_path: ${{ inputs.leak_manifest_filename }}
- - name: Upload Nightly Artifacts
- if: ${{ ( inputs.nightly == 'true' || github.event_name == 'schedule' ) && matrix.config != 'debug' }}
- uses: ./.github/actions/upload_nightly_artifacts
- name: Upload On Host Test Artifacts
if: ${{ matrix.config == 'devel' && needs.initialize.outputs.on_host_test == 'true' }}
uses: ./.github/actions/upload_test_artifacts
with:
type: onhost
os: linux
- # For some reason passing needs.initialize.outputs.bootloader as parameter to build
+ # For some reason passing needs.initialize.outputs.evergreen_loader as parameter to build
# action didn't work, so instead we set an env var.
- - name: Set bootloader config
- if: ${{ needs.initialize.outputs.bootloader != 'null' }}
- run: echo "COBALT_BOOTLOADER=${{needs.initialize.outputs.bootloader}}" >> $GITHUB_ENV
- # Build bootloader for on-host tests if necessary.
- - name: Bootloader GN
- if: ${{ needs.initialize.outputs.bootloader != 'null' && matrix.config == 'devel' }}
+ - name: Set Evergreen loader config
+ if: ${{ needs.initialize.outputs.evergreen_loader != 'null' }}
+ run: echo "COBALT_EVERGREEN_LOADER=${{needs.initialize.outputs.evergreen_loader}}" >> $GITHUB_ENV
+ # Build Evergreen loader for on-host tests if necessary.
+ - name: Evergreen loader GN
+ if: ${{ needs.initialize.outputs.evergreen_loader != 'null' && ( matrix.config == 'devel' || matrix.config == 'qa' ) }}
uses: ./.github/actions/gn
- - name: Build Bootloader
- if: ${{ needs.initialize.outputs.bootloader != 'null' && matrix.config == 'devel' }}
+ - name: Build Evergreen loader
+ if: ${{ needs.initialize.outputs.evergreen_loader != 'null' && ( matrix.config == 'devel' || matrix.config == 'qa' ) }}
uses: ./.github/actions/build
- - name: Upload Bootloader On Host Test Artifacts
- if: ${{ needs.initialize.outputs.bootloader != 'null' && matrix.config == 'devel' && needs.initialize.outputs.on_host_test == 'true'}}
+ - name: Upload Nightly Artifacts
+ if: ${{ ( inputs.nightly == 'true' || github.event_name == 'schedule' ) && matrix.config != 'debug' }}
+ uses: ./.github/actions/upload_nightly_artifacts
+ - name: Upload Evergreen loader On Host Test Artifacts
+ if: ${{ needs.initialize.outputs.evergreen_loader != 'null' && matrix.config == 'devel' && needs.initialize.outputs.on_host_test == 'true'}}
uses: ./.github/actions/upload_test_artifacts
with:
type: onhost
@@ -279,7 +293,7 @@ jobs:
shard: ${{ fromJson(needs.initialize.outputs.on_device_test).tests }}
include: ${{ fromJson(needs.initialize.outputs.includes) }}
env:
- COBALT_BOOTLOADER: ${{ needs.initialize.outputs.bootloader }}
+ COBALT_EVERGREEN_LOADER: ${{ needs.initialize.outputs.evergreen_loader }}
ON_DEVICE_TEST_ATTEMPTS: ${{ needs.initialize.outputs.on_device_test_attempts }}
MODULAR_BUILD: ${{ inputs.modular && 1 || 0 }}
steps:
@@ -311,7 +325,7 @@ jobs:
# For some reason tests complaining about HOME set to /github/home
# with permission denied error.
HOME: /root
- COBALT_BOOTLOADER: ${{needs.initialize.outputs.bootloader}}
+ COBALT_EVERGREEN_LOADER: ${{needs.initialize.outputs.evergreen_loader}}
MODULAR_BUILD: ${{ inputs.modular && 1 || 0 }}
steps:
- name: Checkout
diff --git a/cobalt/black_box_tests/black_box_tests.py b/cobalt/black_box_tests/black_box_tests.py
index 7dc6fd7ab359..98430bda0f22 100755
--- a/cobalt/black_box_tests/black_box_tests.py
+++ b/cobalt/black_box_tests/black_box_tests.py
@@ -78,6 +78,7 @@
'disable_eval_with_csp',
'h5vcc_storage_write_verify_test',
'http_cache',
+ 'javascript_profiler',
'persistent_cookie',
'scroll',
'service_worker_add_to_cache_test',
diff --git a/cobalt/black_box_tests/testdata/javascript_profiler.html b/cobalt/black_box_tests/testdata/javascript_profiler.html
new file mode 100644
index 000000000000..f268510db49a
--- /dev/null
+++ b/cobalt/black_box_tests/testdata/javascript_profiler.html
@@ -0,0 +1,88 @@
+
+
+
+ JavaScript Profiler Test
+
+
+
+
+
+
diff --git a/cobalt/black_box_tests/tests/javascript_profiler.py b/cobalt/black_box_tests/tests/javascript_profiler.py
new file mode 100644
index 000000000000..33dabc7a0821
--- /dev/null
+++ b/cobalt/black_box_tests/tests/javascript_profiler.py
@@ -0,0 +1,40 @@
+# 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.
+"""Tests if Cobalt client page can use window.Profiler."""
+
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+
+from cobalt.black_box_tests import black_box_tests
+from cobalt.black_box_tests.threaded_web_server import ThreadedWebServer
+
+
+class JavaScriptProfilerTest(black_box_tests.BlackBoxTestCase):
+ """Ensure that the client can declare a `window.Profiler` object."""
+
+ def test_javascript_profiler_prime_profiler(self):
+ with ThreadedWebServer(binding_address=self.GetBindingAddress()) as server:
+ modes = [
+ 'testPrimeProfiler',
+ 'testSampleBufferFullProfiler',
+ 'testAbruptGarbageCollection',
+ ]
+ for mode in modes:
+ url = server.GetURL(
+ file_name=f'testdata/javascript_profiler.html?mode={mode}')
+ with self.CreateCobaltRunner(url=url) as runner:
+ runner.WaitForJSTestsSetup()
+ self.assertTrue(runner.JSTestsSucceeded(),
+ f'JavaScript profiler failed at case mode="{mode}".')
diff --git a/cobalt/version.h b/cobalt/version.h
index 9509d06eedb0..19c6ec64a383 100644
--- a/cobalt/version.h
+++ b/cobalt/version.h
@@ -35,6 +35,6 @@
// release is cut.
//.
-#define COBALT_VERSION "24.lts.31"
+#define COBALT_VERSION "24.lts.32"
#endif // COBALT_VERSION_H_
diff --git a/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java b/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java
index 2ae4b2306e15..64b1c545985b 100644
--- a/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java
+++ b/starboard/android/apk/app/src/main/java/dev/cobalt/media/MediaCodecBridge.java
@@ -818,6 +818,9 @@ public static void createVideoMediaCodecBridge(
@UsedByNative
public void release() {
try {
+ mMediaCodec.setCallback(null);
+ mCallback = null;
+
String codecName = mMediaCodec.getName();
Log.w(TAG, "calling MediaCodec.release() on " + codecName);
mMediaCodec.release();
diff --git a/starboard/android/shared/BUILD.gn b/starboard/android/shared/BUILD.gn
index 71aad0fbadb2..a34fdd56d6ed 100644
--- a/starboard/android/shared/BUILD.gn
+++ b/starboard/android/shared/BUILD.gn
@@ -166,6 +166,9 @@ static_library("starboard_platform") {
"//starboard/shared/pthread/mutex_destroy.cc",
"//starboard/shared/pthread/mutex_release.cc",
"//starboard/shared/pthread/once.cc",
+ "//starboard/shared/pthread/thread_context_get_pointer.cc",
+ "//starboard/shared/pthread/thread_context_internal.cc",
+ "//starboard/shared/pthread/thread_context_internal.h",
"//starboard/shared/pthread/thread_create_local_key.cc",
"//starboard/shared/pthread/thread_create_priority.h",
"//starboard/shared/pthread/thread_destroy_local_key.cc",
@@ -174,6 +177,13 @@ static_library("starboard_platform") {
"//starboard/shared/pthread/thread_get_local_value.cc",
"//starboard/shared/pthread/thread_is_equal.cc",
"//starboard/shared/pthread/thread_join.cc",
+ "//starboard/shared/pthread/thread_sampler_create.cc",
+ "//starboard/shared/pthread/thread_sampler_destroy.cc",
+ "//starboard/shared/pthread/thread_sampler_freeze.cc",
+ "//starboard/shared/pthread/thread_sampler_internal.cc",
+ "//starboard/shared/pthread/thread_sampler_internal.h",
+ "//starboard/shared/pthread/thread_sampler_is_supported.cc",
+ "//starboard/shared/pthread/thread_sampler_thaw.cc",
"//starboard/shared/pthread/thread_set_local_value.cc",
"//starboard/shared/pthread/thread_yield.cc",
"//starboard/shared/signal/crash_signals.h",
@@ -250,12 +260,6 @@ static_library("starboard_platform") {
"//starboard/shared/stub/system_request_focus.cc",
"//starboard/shared/stub/system_request_reveal.cc",
"//starboard/shared/stub/system_sign_with_certification_secret_key.cc",
- "//starboard/shared/stub/thread_context_get_pointer.cc",
- "//starboard/shared/stub/thread_sampler_create.cc",
- "//starboard/shared/stub/thread_sampler_destroy.cc",
- "//starboard/shared/stub/thread_sampler_freeze.cc",
- "//starboard/shared/stub/thread_sampler_is_supported.cc",
- "//starboard/shared/stub/thread_sampler_thaw.cc",
"//starboard/shared/stub/ui_nav_get_interface.cc",
"accessibility_get_caption_settings.cc",
"accessibility_get_display_settings.cc",
diff --git a/starboard/shared/ffmpeg/ffmpeg_audio_decoder_impl.cc b/starboard/shared/ffmpeg/ffmpeg_audio_decoder_impl.cc
index 1086f3f4f435..6d25689180aa 100644
--- a/starboard/shared/ffmpeg/ffmpeg_audio_decoder_impl.cc
+++ b/starboard/shared/ffmpeg/ffmpeg_audio_decoder_impl.cc
@@ -249,6 +249,11 @@ AudioDecoderImpl::Read(int* samples_per_second) {
void AudioDecoderImpl::Reset() {
SB_DCHECK(BelongsToCurrentThread());
+ TeardownCodec();
+ if ((ffmpeg_->specialization_version()) == FFMPEG) {
+ InitializeCodec();
+ }
+
stream_ended_ = false;
while (!decoded_audios_.empty()) {
decoded_audios_.pop();
diff --git a/starboard/shared/opus/opus_audio_decoder.cc b/starboard/shared/opus/opus_audio_decoder.cc
index 483396471331..85ba47e6eb1f 100644
--- a/starboard/shared/opus/opus_audio_decoder.cc
+++ b/starboard/shared/opus/opus_audio_decoder.cc
@@ -47,31 +47,11 @@ static const VorbisLayout vorbis_mappings[8] = {
OpusAudioDecoder::OpusAudioDecoder(const AudioStreamInfo& audio_stream_info)
: audio_stream_info_(audio_stream_info) {
- int error;
- int channels = audio_stream_info_.number_of_channels;
- if (channels > 8 || channels < 1) {
- SB_LOG(ERROR) << "Can't create decoder with " << channels << " channels";
- return;
- }
-
- decoder_ = opus_multistream_decoder_create(
- audio_stream_info_.samples_per_second, channels,
- vorbis_mappings[channels - 1].nb_streams,
- vorbis_mappings[channels - 1].nb_coupled_streams,
- vorbis_mappings[channels - 1].mapping, &error);
- if (error != OPUS_OK) {
- SB_LOG(ERROR) << "Failed to create decoder with error: "
- << opus_strerror(error);
- decoder_ = NULL;
- return;
- }
- SB_DCHECK(decoder_ != NULL);
+ InitializeCodec();
}
OpusAudioDecoder::~OpusAudioDecoder() {
- if (decoder_) {
- opus_multistream_decoder_destroy(decoder_);
- }
+ TeardownCodec();
}
void OpusAudioDecoder::Initialize(const OutputCB& output_cb,
@@ -215,6 +195,34 @@ void OpusAudioDecoder::WriteEndOfStream() {
Schedule(output_cb_);
}
+void OpusAudioDecoder::InitializeCodec() {
+ int error;
+ int channels = audio_stream_info_.number_of_channels;
+ if (channels > 8 || channels < 1) {
+ SB_LOG(ERROR) << "Can't create decoder with " << channels << " channels";
+ return;
+ }
+
+ decoder_ = opus_multistream_decoder_create(
+ audio_stream_info_.samples_per_second, channels,
+ vorbis_mappings[channels - 1].nb_streams,
+ vorbis_mappings[channels - 1].nb_coupled_streams,
+ vorbis_mappings[channels - 1].mapping, &error);
+ if (error != OPUS_OK) {
+ SB_LOG(ERROR) << "Failed to create decoder with error: "
+ << opus_strerror(error);
+ decoder_ = NULL;
+ return;
+ }
+ SB_DCHECK(decoder_ != NULL);
+}
+
+void OpusAudioDecoder::TeardownCodec() {
+ if (decoder_) {
+ opus_multistream_decoder_destroy(decoder_);
+ }
+}
+
scoped_refptr OpusAudioDecoder::Read(
int* samples_per_second) {
SB_DCHECK(BelongsToCurrentThread());
@@ -233,6 +241,9 @@ scoped_refptr OpusAudioDecoder::Read(
void OpusAudioDecoder::Reset() {
SB_DCHECK(BelongsToCurrentThread());
+ TeardownCodec();
+ InitializeCodec();
+
stream_ended_ = false;
while (!decoded_audios_.empty()) {
decoded_audios_.pop();
diff --git a/starboard/shared/opus/opus_audio_decoder.h b/starboard/shared/opus/opus_audio_decoder.h
index ab3e94751829..a8d59dc8c972 100644
--- a/starboard/shared/opus/opus_audio_decoder.h
+++ b/starboard/shared/opus/opus_audio_decoder.h
@@ -54,6 +54,8 @@ class OpusAudioDecoder
private:
static constexpr int kMinimumBuffersToDecode = 2;
+ void InitializeCodec();
+ void TeardownCodec();
void DecodePendingBuffers();
bool DecodeInternal(const scoped_refptr& input_buffer);
static const int kMaxOpusFramesPerAU = 9600;
diff --git a/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.cc b/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.cc
index 7e748036d5dc..87ba114019b2 100644
--- a/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.cc
+++ b/starboard/shared/starboard/player/filter/adaptive_audio_decoder_internal.cc
@@ -146,7 +146,7 @@ void AdaptiveAudioDecoder::Reset() {
SB_DCHECK(BelongsToCurrentThread());
if (audio_decoder_) {
- TeardownAudioDecoder();
+ audio_decoder_->Reset();
}
CancelPendingJobs();
while (!decoded_audios_.empty()) {
diff --git a/third_party/chromium/media/base/demuxer_memory_limit_starboard.cc b/third_party/chromium/media/base/demuxer_memory_limit_starboard.cc
index d8305f034f95..188878d8715c 100644
--- a/third_party/chromium/media/base/demuxer_memory_limit_starboard.cc
+++ b/third_party/chromium/media/base/demuxer_memory_limit_starboard.cc
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "media/base/demuxer_memory_limit.h"
#include "media/base/decoder_buffer.h"
diff --git a/third_party/chromium/media/base/demuxer_stream.h b/third_party/chromium/media/base/demuxer_stream.h
index 67769b39fd26..f1a975456713 100644
--- a/third_party/chromium/media/base/demuxer_stream.h
+++ b/third_party/chromium/media/base/demuxer_stream.h
@@ -70,7 +70,7 @@ class MEDIA_EXPORT DemuxerStream {
#if defined(STARBOARD)
virtual std::string mime_type() const { return ""; }
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
// Request a buffer to returned via the provided callback.
//
@@ -80,10 +80,10 @@ class MEDIA_EXPORT DemuxerStream {
#if defined(STARBOARD)
typedef base::OnceCallback>&)> ReadCB;
virtual void Read(int max_number_of_buffers_to_read, ReadCB read_cb) = 0;
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
typedef base::OnceCallback)> ReadCB;
virtual void Read(ReadCB read_cb) = 0;
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
// Returns the audio/video decoder configuration. It is an error to call the
// audio method on a video stream and vice versa. After |kConfigChanged| is
diff --git a/third_party/chromium/media/base/starboard_utils.cc b/third_party/chromium/media/base/starboard_utils.cc
index 1518fb9abdf9..786b4b29a54f 100644
--- a/third_party/chromium/media/base/starboard_utils.cc
+++ b/third_party/chromium/media/base/starboard_utils.cc
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "media/base/starboard_utils.h"
#include
diff --git a/third_party/chromium/media/base/starboard_utils.h b/third_party/chromium/media/base/starboard_utils.h
index 50920bd698e5..6f908e5e588e 100644
--- a/third_party/chromium/media/base/starboard_utils.h
+++ b/third_party/chromium/media/base/starboard_utils.h
@@ -15,6 +15,10 @@
#ifndef MEDIA_BASE_STARBOARD_UTILS_H_
#define MEDIA_BASE_STARBOARD_UTILS_H_
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "starboard/drm.h"
#include "starboard/media.h"
#include "media/base/audio_codecs.h"
diff --git a/third_party/chromium/media/base/starboard_utils_test.cc b/third_party/chromium/media/base/starboard_utils_test.cc
index ab5460c1015b..a2feb6d2e101 100644
--- a/third_party/chromium/media/base/starboard_utils_test.cc
+++ b/third_party/chromium/media/base/starboard_utils_test.cc
@@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "media/base/starboard_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/chromium/media/base/status.h b/third_party/chromium/media/base/status.h
index 6101e3f938e7..5ddbda4ac604 100644
--- a/third_party/chromium/media/base/status.h
+++ b/third_party/chromium/media/base/status.h
@@ -17,7 +17,9 @@
#include "media/base/media_export.h"
#include "media/base/media_serializers_base.h"
#include "media/base/status_codes.h"
+#if defined(STARBOARD)
#include "third_party/abseil-cpp/absl/types/optional.h"
+#endif // defined(STARBOARD)
// Mojo namespaces for serialization friend declarations.
namespace mojo {
diff --git a/third_party/chromium/media/cobalt/base/bind_post_task.h b/third_party/chromium/media/cobalt/base/bind_post_task.h
index b914e8adef5b..634a1d7d3411 100644
--- a/third_party/chromium/media/cobalt/base/bind_post_task.h
+++ b/third_party/chromium/media/cobalt/base/bind_post_task.h
@@ -5,6 +5,10 @@
#ifndef BASE_BIND_POST_TASK_H_
#define BASE_BIND_POST_TASK_H_
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "base/location.h"
namespace base {
diff --git a/third_party/chromium/media/cobalt/base/check.h b/third_party/chromium/media/cobalt/base/check.h
index d26320bc304d..17464daa91df 100644
--- a/third_party/chromium/media/cobalt/base/check.h
+++ b/third_party/chromium/media/cobalt/base/check.h
@@ -15,6 +15,10 @@
#ifndef BASE_CHECK_H_
#define BASE_CHECK_H_
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "base/logging.h"
#endif // BASE_CHECK_H_
diff --git a/third_party/chromium/media/cobalt/base/check_op.h b/third_party/chromium/media/cobalt/base/check_op.h
index 296c84f099b8..74e046fcb39f 100644
--- a/third_party/chromium/media/cobalt/base/check_op.h
+++ b/third_party/chromium/media/cobalt/base/check_op.h
@@ -15,6 +15,10 @@
#ifndef BASE_CHECK_OP_H_
#define BASE_CHECK_OP_H_
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "base/logging.h"
#endif // BASE_CHECK_OP_H_
diff --git a/third_party/chromium/media/cobalt/base/cxx17_backports.h b/third_party/chromium/media/cobalt/base/cxx17_backports.h
index a7c1c1305656..2f6e2ac8a508 100644
--- a/third_party/chromium/media/cobalt/base/cxx17_backports.h
+++ b/third_party/chromium/media/cobalt/base/cxx17_backports.h
@@ -15,6 +15,10 @@
#ifndef BASE_CXX17_BACKPORTS_H_
#define BASE_CXX17_BACKPORTS_H_
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "base/stl_util.h"
#endif // BASE_CXX17_BACKPORTS_H_
diff --git a/third_party/chromium/media/cobalt/base/hash/md5.h b/third_party/chromium/media/cobalt/base/hash/md5.h
index 2993131d6091..8f9e6c008f0b 100644
--- a/third_party/chromium/media/cobalt/base/hash/md5.h
+++ b/third_party/chromium/media/cobalt/base/hash/md5.h
@@ -15,6 +15,10 @@
#ifndef BASE_HASH_MD5_H_
#define BASE_HASH_MD5_H_
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "base/md5.h"
#endif // BASE_HASH_MD5_H_
diff --git a/third_party/chromium/media/cobalt/base/notreached.h b/third_party/chromium/media/cobalt/base/notreached.h
index 0afca93445f5..4eb09e6241b4 100644
--- a/third_party/chromium/media/cobalt/base/notreached.h
+++ b/third_party/chromium/media/cobalt/base/notreached.h
@@ -15,6 +15,10 @@
#ifndef BASE_NOTREACHED_H_
#define BASE_NOTREACHED_H_
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include "base/logging.h"
#endif // BASE_NOTREACHED_H_
diff --git a/third_party/chromium/media/cobalt/base/types/strong_alias.h b/third_party/chromium/media/cobalt/base/types/strong_alias.h
index 8c148d46c22f..3fa4447f2387 100644
--- a/third_party/chromium/media/cobalt/base/types/strong_alias.h
+++ b/third_party/chromium/media/cobalt/base/types/strong_alias.h
@@ -5,6 +5,10 @@
#ifndef BASE_TYPES_STRONG_ALIAS_H_
#define BASE_TYPES_STRONG_ALIAS_H_
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
#include
#include
#include
diff --git a/third_party/chromium/media/cobalt/net/cookies/site_for_cookies.h b/third_party/chromium/media/cobalt/net/cookies/site_for_cookies.h
index 296e3e4dad70..cf6b0406dfb9 100644
--- a/third_party/chromium/media/cobalt/net/cookies/site_for_cookies.h
+++ b/third_party/chromium/media/cobalt/net/cookies/site_for_cookies.h
@@ -5,6 +5,10 @@
#ifndef NET_SITE_FOR_COOKIES_H
#define NET_SITE_FOR_COOKIES_H
+#if !defined(STARBOARD)
+#error "This file only works with Cobalt/Starboard."
+#endif // !defined(STARBOARD)
+
namespace net {
// Reduced version enough to make media code depending on it to be built.
diff --git a/third_party/chromium/media/filters/chunk_demuxer.cc b/third_party/chromium/media/filters/chunk_demuxer.cc
index e24189d7fb41..da5b8b109f54 100644
--- a/third_party/chromium/media/filters/chunk_demuxer.cc
+++ b/third_party/chromium/media/filters/chunk_demuxer.cc
@@ -17,7 +17,7 @@
#include "base/strings/string_number_conversions.h"
#if defined(STARBOARD)
#include "base/strings/string_split.h"
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/trace_event.h"
#include "media/base/audio_decoder_config.h"
@@ -63,7 +63,6 @@ std::string ExpectedCodecs(const std::string& content_type,
}
#if defined(STARBOARD)
-
// Parse type and codecs from mime type. It will return "video/mp4" and
// "avc1.42E01E, mp4a.40.2" for "video/mp4; codecs="avc1.42E01E, mp4a.40.2".
// Note that this function does minimum validation as the media stack will check
@@ -95,8 +94,7 @@ bool ParseMimeType(const std::string& mime_type, std::string* type,
// underlying parsers.
return true;
}
-
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
} // namespace
@@ -107,10 +105,10 @@ ChunkDemuxerStream::ChunkDemuxerStream(const std::string& mime_type, Type type,
MediaTrack::Id media_track_id)
: mime_type_(mime_type),
type_(type),
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
ChunkDemuxerStream::ChunkDemuxerStream(Type type, MediaTrack::Id media_track_id)
: type_(type),
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
liveness_(DemuxerStream::LIVENESS_UNKNOWN),
media_track_id_(media_track_id),
state_(UNINITIALIZED),
@@ -132,9 +130,9 @@ void ChunkDemuxerStream::AbortReads() {
if (read_cb_) {
#if defined(STARBOARD)
std::move(read_cb_).Run(kAborted, {});
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
std::move(read_cb_).Run(kAborted, nullptr);
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
}
}
@@ -156,10 +154,10 @@ void ChunkDemuxerStream::Shutdown() {
if (read_cb_) {
#if defined(STARBOARD)
std::move(read_cb_).Run(DemuxerStream::kOk, {StreamParserBuffer::CreateEOSBuffer()});
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
std::move(read_cb_).Run(DemuxerStream::kOk,
StreamParserBuffer::CreateEOSBuffer());
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
}
}
@@ -182,7 +180,7 @@ void ChunkDemuxerStream::Seek(base::TimeDelta time) {
#if defined(STARBOARD)
write_head_ = time;
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
stream_->Seek(time);
}
@@ -229,7 +227,6 @@ bool ChunkDemuxerStream::EvictCodedFrames(base::TimeDelta media_time,
}
#if defined(STARBOARD)
-
base::TimeDelta ChunkDemuxerStream::GetWriteHead() const {
base::AutoLock auto_lock(lock_);
return write_head_;
@@ -246,8 +243,6 @@ void ChunkDemuxerStream::SetStreamMemoryLimitOverride(size_t memory_limit) {
base::AutoLock auto_lock(lock_);
stream_->set_memory_limit_override(memory_limit);
}
-
-
#endif // defined(STARBOARD)
void ChunkDemuxerStream::OnMemoryPressure(
@@ -335,9 +330,9 @@ bool ChunkDemuxerStream::UpdateAudioConfig(const AudioDecoderConfig& config,
DCHECK_EQ(state_, UNINITIALIZED);
#if defined(STARBOARD)
stream_ = std::make_unique(mime_type_, config, media_log);
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
stream_ = std::make_unique(config, media_log);
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
return true;
}
@@ -355,9 +350,9 @@ bool ChunkDemuxerStream::UpdateVideoConfig(const VideoDecoderConfig& config,
DCHECK_EQ(state_, UNINITIALIZED);
#if defined(STARBOARD)
stream_ = std::make_unique(mime_type_, config, media_log);
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
stream_ = std::make_unique(config, media_log);
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
return true;
}
@@ -889,7 +884,6 @@ ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id,
}
#if defined(STARBOARD)
-
ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id,
const std::string& mime_type) {
std::string type, codecs;
@@ -901,8 +895,7 @@ ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id,
id_to_mime_map_[id] = mime_type;
return AddId(id, type, codecs);
}
-
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
ChunkDemuxer::Status ChunkDemuxer::AddIdInternal(
const std::string& id,
@@ -1107,7 +1100,6 @@ bool ChunkDemuxer::EvictCodedFrames(const std::string& id,
}
#if defined(STARBOARD)
-
base::TimeDelta ChunkDemuxer::GetWriteHead(const std::string& id) const {
base::AutoLock auto_lock(lock_);
DCHECK(IsValidId(id));
@@ -1138,7 +1130,6 @@ size_t ChunkDemuxer::GetSourceBufferStreamMemoryLimit(const std::string& id) {
}
return source_state_map_[id]->GetSourceBufferStreamMemoryLimit();
}
-
#endif // defined(STARBOARD)
bool ChunkDemuxer::AppendData(const std::string& id,
@@ -1689,7 +1680,7 @@ ChunkDemuxerStream* ChunkDemuxer::CreateDemuxerStream(
#else // defined(STARBOARD)
std::unique_ptr stream =
std::make_unique(type, media_track_id);
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
DCHECK(track_id_to_demux_stream_map_.find(media_track_id) ==
track_id_to_demux_stream_map_.end());
diff --git a/third_party/chromium/media/filters/chunk_demuxer.h b/third_party/chromium/media/filters/chunk_demuxer.h
index 76a01f414f41..52ebae4f4e94 100644
--- a/third_party/chromium/media/filters/chunk_demuxer.h
+++ b/third_party/chromium/media/filters/chunk_demuxer.h
@@ -43,9 +43,9 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
#if defined(STARBOARD)
ChunkDemuxerStream(const std::string& mime_type, Type type, MediaTrack::Id media_track_id);
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
ChunkDemuxerStream(Type type, MediaTrack::Id media_track_id);
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
~ChunkDemuxerStream() override;
// ChunkDemuxerStream control methods.
@@ -134,14 +134,10 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
std::string mime_type() const override { return mime_type_; }
size_t GetStreamMemoryLimit();
void SetStreamMemoryLimitOverride(size_t memory_limit);
-#endif // defined (STARBOARD)
-
-#if defined(STARBOARD)
void Read(int max_number_of_buffers_to_read, ReadCB read_cb) override;
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
void Read(ReadCB read_cb) override;
-#endif // defined (STARBOARD)
-
+#endif // defined(STARBOARD)
Type type() const override;
Liveness liveness() const override;
AudioDecoderConfig audio_decoder_config() override;
@@ -193,7 +189,7 @@ class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
const std::string mime_type_;
int max_number_of_buffers_to_read_{1};
bool pending_config_change_ {false};
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
// Specifies the type of the stream.
const Type type_;
@@ -295,7 +291,7 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
// Special version of AddId() that retains the |mime_type| from the web app.
Status AddId(const std::string& id, const std::string& mime_type)
WARN_UNUSED_RESULT;
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
// Notifies a caller via |tracks_updated_cb| that the set of media tracks
// for a given |id| has changed. This callback must be set before any calls to
@@ -394,7 +390,6 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
#if defined(STARBOARD)
base::TimeDelta GetWriteHead(const std::string& id) const;
-
void SetSourceBufferStreamMemoryLimit(const std::string& guid, size_t limit);
size_t GetSourceBufferStreamMemoryLimit(const std::string& guid);
#endif // defined(STARBOARD)
@@ -600,7 +595,7 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
#if defined(STARBOARD)
std::map id_to_mime_map_;
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
};
} // namespace media
diff --git a/third_party/chromium/media/filters/source_buffer_stream.cc b/third_party/chromium/media/filters/source_buffer_stream.cc
index 6d6789f0f3c9..f16184b3fde5 100644
--- a/third_party/chromium/media/filters/source_buffer_stream.cc
+++ b/third_party/chromium/media/filters/source_buffer_stream.cc
@@ -165,11 +165,11 @@ SourceBufferStream::SourceBufferStream(const std::string& mime_type,
MediaLog* media_log)
: mime_type_(mime_type),
media_log_(media_log),
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config,
MediaLog* media_log)
: media_log_(media_log),
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
seek_buffer_timestamp_(kNoTimestamp),
coded_frame_group_start_pts_(kNoTimestamp),
range_for_next_append_(ranges_.end()),
@@ -188,11 +188,11 @@ SourceBufferStream::SourceBufferStream(const std::string& mime_type,
MediaLog* media_log)
: mime_type_(mime_type),
media_log_(media_log),
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
SourceBufferStream::SourceBufferStream(const VideoDecoderConfig& video_config,
MediaLog* media_log)
: media_log_(media_log),
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
seek_buffer_timestamp_(kNoTimestamp),
coded_frame_group_start_pts_(kNoTimestamp),
range_for_next_append_(ranges_.end()),
@@ -201,8 +201,12 @@ SourceBufferStream::SourceBufferStream(const VideoDecoderConfig& video_config,
base::Milliseconds(kMinimumInterbufferDistanceInMs)),
memory_limit_(
GetDemuxerStreamVideoMemoryLimit(Demuxer::DemuxerTypes::kChunkDemuxer,
+#if !defined(STARBOARD)
+ &video_config)) {
+#else // !defined(STARBOARD)
&video_config,
mime_type_)) {
+#endif // !defined(STARBOARD)
DCHECK(video_config.IsValidConfig());
video_configs_.push_back(video_config);
DVLOG(2) << __func__ << ": video_buffer_size= " << memory_limit_;
@@ -2086,6 +2090,6 @@ base::TimeDelta SourceBufferStream::GetBufferedDurationForGarbageCollection()
return duration;
}
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
} // namespace media
diff --git a/third_party/chromium/media/filters/source_buffer_stream.h b/third_party/chromium/media/filters/source_buffer_stream.h
index 248b38ed40e9..c073ad94dbfa 100644
--- a/third_party/chromium/media/filters/source_buffer_stream.h
+++ b/third_party/chromium/media/filters/source_buffer_stream.h
@@ -68,12 +68,12 @@ class MEDIA_EXPORT SourceBufferStream {
SourceBufferStream(const std::string& mime_type,
const VideoDecoderConfig& video_config,
MediaLog* media_log);
-#else // defined (STARBOARD)
+#else // defined(STARBOARD)
SourceBufferStream(const AudioDecoderConfig& audio_config,
MediaLog* media_log);
SourceBufferStream(const VideoDecoderConfig& video_config,
MediaLog* media_log);
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
SourceBufferStream(const TextTrackConfig& text_config, MediaLog* media_log);
@@ -196,7 +196,7 @@ class MEDIA_EXPORT SourceBufferStream {
memory_limit_ = memory_limit;
memory_override_ = true;
}
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
private:
friend class SourceBufferStreamTest;
@@ -416,7 +416,7 @@ class MEDIA_EXPORT SourceBufferStream {
const std::string mime_type_;
bool memory_override_ = false;
-#endif // defined (STARBOARD)
+#endif // defined(STARBOARD)
// Used to report log messages that can help the web developer figure out what
// is wrong with the content.