Skip to content

Commit

Permalink
Merge branch 'youtube:main' into kaidokert-x11-stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidokert authored Oct 24, 2023
2 parents ddb014c + a65712a commit 187fb57
Show file tree
Hide file tree
Showing 585 changed files with 4,173 additions and 57,462 deletions.
2 changes: 0 additions & 2 deletions .github/actions/on_host_test/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ runs:
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} --test_set wpt
elif [[ "${{matrix.shard}}" == 'evergreen' ]]; then
xvfb-run -a --server-args="-screen 0 1920x1080x24i +render +extension GLX -noreset" python3 $GITHUB_WORKSPACE/cobalt/evergreen_tests/evergreen_tests.py --platform ${{matrix.target_platform}} --config ${{matrix.config}} ${loader_args} --no-can_mount_tmpfs
elif [[ "${{matrix.shard}}" == 'evergreen-as-blackbox' ]]; 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} --test_set evergreen
elif [[ "${{matrix.shard}}" == 'coverage' ]]; then
xvfb-run -a --server-args="-screen 0 1920x1080x24i +render +extension GLX -noreset" python3 ${GITHUB_WORKSPACE}/starboard/tools/testing/test_runner.py --platform ${{matrix.target_platform}} --config ${{matrix.config}} -r ${loader_args} --xml_output_dir=${XML_FILES_DIR} --coverage_dir=${COVERAGE_DIR} --coverage_report
else
Expand Down
16 changes: 16 additions & 0 deletions .github/config/evergreen-arm-softfp-no-loader.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"docker_service": "build-evergreen",
"platforms": [
"evergreen-arm-softfp-sbversion-13"
],
"includes": [
{
"name":"sbversion-13",
"platform":"evergreen-arm-softfp-sbversion-13",
"target_platform":"evergreen-arm-softfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"sb_api_version=13"
}
]
}
34 changes: 20 additions & 14 deletions .github/config/evergreen-arm-softfp.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,48 @@
{
"docker_service": "build-evergreen",
"docker_service": "build-android-evergreen",
"bootloader": "android-arm",
"on_device_test": {
"enabled": false,
"tests": [
"evergreen_test",
"0",
"1",
"2",
"3"
],
"test_attempts": 2
},
"platforms": [
"evergreen-arm-softfp",
"evergreen-arm-softfp-sbversion-15",
"evergreen-arm-softfp-sbversion-14",
"evergreen-arm-softfp-sbversion-13"
"evergreen-arm-softfp-sbversion-14"
],
"includes": [
{
"name":"softfp",
"platform":"evergreen-arm-softfp",
"target_platform":"evergreen-arm-softfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false"
"extra_gn_arguments":"use_asan=false",
"bootloader_extra_gn_arguments": "target_os=\\\"android\\\" sb_is_evergreen_compatible=true"
},
{
"name":"sbversion-15",
"platform":"evergreen-arm-softfp-sbversion-15",
"target_platform":"evergreen-arm-softfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"sb_api_version=15"
"sb_api_version":"sb_api_version=15",
"bootloader_extra_gn_arguments": "target_os=\\\"android\\\" sb_is_evergreen_compatible=true"
},
{
"name":"sbversion-14",
"platform":"evergreen-arm-softfp-sbversion-14",
"target_platform":"evergreen-arm-softfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"sb_api_version=14"
},
{
"name":"sbversion-13",
"platform":"evergreen-arm-softfp-sbversion-13",
"target_platform":"evergreen-arm-softfp",
"target_cpu":"target_cpu=\\\"arm\\\"",
"extra_gn_arguments":"use_asan=false",
"sb_api_version":"sb_api_version=13"
"sb_api_version":"sb_api_version=14",
"bootloader_extra_gn_arguments": "target_os=\\\"android\\\" sb_is_evergreen_compatible=true"
}
]
}
11 changes: 1 addition & 10 deletions .github/config/evergreen-x64.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@
"docker_service": "build-linux-evergreen",
"on_host_test": true,
"bootloader": "linux-x64x11",
"on_host_test_shards": [
"0",
"1",
"2",
"3",
"blackbox",
"wpt",
"evergreen",
"evergreen-as-blackbox"
],
"on_host_test_shards": ["0", "1", "2", "3", "blackbox", "wpt", "evergreen"],
"platforms": [
"evergreen-x64",
"evergreen-x64-sbversion-15",
Expand Down
4 changes: 3 additions & 1 deletion .github/config/linux-gcc-6-3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"docker_service": "build-linux-gcc",
"on_host_test": true,
"on_host_test_shards": ["0", "1", "2", "3", "blackbox", "wpt"],
"platforms": [
"linux-x64x11-gcc-6-3"
],
Expand All @@ -8,7 +10,7 @@
"name":"gcc-6-3",
"platform":"linux-x64x11-gcc-6-3",
"target_platform":"linux-x64x11-gcc-6-3",
"extra_gn_arguments":"is_clang=false using_old_compiler=true"
"extra_gn_arguments":"using_old_compiler=true build_with_separate_cobalt_toolchain=true"
}
]
}
9 changes: 9 additions & 0 deletions .github/workflows/evergreen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ jobs:
platform: evergreen-arm-softfp
nightly: ${{ github.event.inputs.nightly }}
run_api_leak_detector: true
evergreen-arm-softfp-no-loader:
uses: ./.github/workflows/main.yaml
permissions:
packages: write
pull-requests: write
with:
platform: evergreen-arm-softfp-no-loader
nightly: ${{ github.event.inputs.nightly }}
run_api_leak_detector: true
evergreen-arm64:
uses: ./.github/workflows/main.yaml
permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
with:
platform: linux-gcc-6-3
nightly: ${{ github.event.inputs.nightly }}
modular: true
# TODO(b/285632780): Enable blackbox tests for modular linux workflows.
linux-modular:
uses: ./.github/workflows/main.yaml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ jobs:
- name: Checkout files
uses: kaidokert/[email protected]
with:
fetch-depth: 2
fetch-depth: 0
persist-credentials: false
- name: Login to Docker Registry ${{env.REGISTRY}}
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main_win.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
- name: Checkout files
uses: kaidokert/[email protected]
with:
fetch-depth: 2
fetch-depth: 0
persist-credentials: false
- name: Login to Docker Registry ${{env.REGISTRY}}
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exclude: |
base|
build|
buildtools|
cobalt/updater/win|
cobalt/updater|
components/crash/core/common|
components/metrics_services_manager|
components/metrics|
Expand Down
8 changes: 7 additions & 1 deletion base/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,15 @@ SbLogPriority LogLevelToStarboardLogPriority(int level) {
case LOG_ERROR:
return kSbLogPriorityError;
case LOG_FATAL:
case LOG_VERBOSE:
return kSbLogPriorityFatal;
case LOG_VERBOSE:
default:
if (level <= LOG_VERBOSE) {
// Verbose level can be any negative integer, sanity check its range to
// filter out potential errors.
DCHECK_GE(level, -256);
return kSbLogPriorityInfo;
}
NOTREACHED() << "Unrecognized log level.";
return kSbLogPriorityInfo;
}
Expand Down
18 changes: 13 additions & 5 deletions cobalt/audio/audio_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ typedef media::AudioBus AudioBus;
namespace {
const int kRenderBufferSizeFrames = 1024;
const int kDefaultFramesPerChannel = 8 * kRenderBufferSizeFrames;

int AlignUp(int value, int alignment) {
int decremented_value = value - 1;
return decremented_value + alignment - (decremented_value % alignment);
}
} // namespace

class AudioDevice::Impl {
Expand Down Expand Up @@ -83,11 +88,13 @@ AudioDevice::Impl::Impl(int number_of_channels, RenderCallback* callback)
: number_of_channels_(number_of_channels),
output_sample_type_(GetPreferredOutputStarboardSampleType()),
render_callback_(callback),
frames_per_channel_(std::max(SbAudioSinkGetMinBufferSizeInFrames(
number_of_channels, output_sample_type_,
kStandardOutputSampleRate) +
kRenderBufferSizeFrames * 2,
kDefaultFramesPerChannel)),
frames_per_channel_(
std::max(AlignUp(SbAudioSinkGetMinBufferSizeInFrames(
number_of_channels, output_sample_type_,
kStandardOutputSampleRate) +
kRenderBufferSizeFrames * 2,
kRenderBufferSizeFrames),
kDefaultFramesPerChannel)),
input_audio_bus_(static_cast<size_t>(number_of_channels),
static_cast<size_t>(kRenderBufferSizeFrames),
GetPreferredOutputSampleType(), AudioBus::kPlanar),
Expand All @@ -97,6 +104,7 @@ AudioDevice::Impl::Impl(int number_of_channels, RenderCallback* callback)
DCHECK(number_of_channels_ == 1 || number_of_channels_ == 2)
<< "Invalid number of channels: " << number_of_channels_;
DCHECK(render_callback_);
DCHECK(frames_per_channel_ % kRenderBufferSizeFrames == 0);
DCHECK(SbAudioSinkIsAudioFrameStorageTypeSupported(
kSbMediaAudioFrameStorageTypeInterleaved))
<< "Only interleaved frame storage is supported.";
Expand Down
1 change: 1 addition & 0 deletions cobalt/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ static_library("base") {
"log_message_handler.cc",
"log_message_handler.h",
"message_queue.h",
"on_metric_upload_event.h",
"on_screen_keyboard_hidden_event.h",
"on_screen_keyboard_shown_event.h",
"path_provider.cc",
Expand Down
61 changes: 61 additions & 0 deletions cobalt/base/on_metric_upload_event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2023 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.

#ifndef COBALT_BASE_ON_METRIC_UPLOAD_EVENT_H_
#define COBALT_BASE_ON_METRIC_UPLOAD_EVENT_H_

#include <string>
#include <utility>

#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/strings/string_util.h"
#include "cobalt/base/event.h"
#include "cobalt/base/polymorphic_downcast.h"
#include "cobalt/h5vcc/h5vcc_metric_type.h"

namespace base {

// Event sent when a metric payload is ready for upload.
class OnMetricUploadEvent : public Event {
public:
OnMetricUploadEvent(const cobalt::h5vcc::H5vccMetricType& metric_type,
const std::string& serialized_proto)
: metric_type_(metric_type), serialized_proto_(serialized_proto) {}

explicit OnMetricUploadEvent(const Event* event) {
CHECK(event != nullptr);
const base::OnMetricUploadEvent* on_metric_upload_event =
base::polymorphic_downcast<const base::OnMetricUploadEvent*>(event);
metric_type_ = on_metric_upload_event->metric_type();
serialized_proto_ = on_metric_upload_event->serialized_proto();
}

const cobalt::h5vcc::H5vccMetricType& metric_type() const {
return metric_type_;
}

const std::string& serialized_proto() const { return serialized_proto_; }


BASE_EVENT_SUBCLASS(OnMetricUploadEvent);

private:
cobalt::h5vcc::H5vccMetricType metric_type_;
std::string serialized_proto_;
};

} // namespace base

#endif // COBALT_BASE_ON_METRIC_UPLOAD_EVENT_H_
6 changes: 2 additions & 4 deletions cobalt/black_box_tests/black_box_cobalt_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def __init__(self,
target_params=None,
success_message=None,
poll_until_wait_seconds=POLL_UNTIL_WAIT_SECONDS,
web_server_port=None,
**kwargs):
web_server_port=None):
# For black box tests, don't log inline script warnings, we intend to
# explicitly control timings for suspends and resumes, so we are not
# concerned about a "suspend at the wrong time".
Expand All @@ -66,8 +65,7 @@ def __init__(self,
target_params,
success_message,
poll_until_wait_seconds=poll_until_wait_seconds,
web_server_port=web_server_port,
**kwargs)
web_server_port=web_server_port)

self.poll_until_wait_seconds = poll_until_wait_seconds

Expand Down
Loading

0 comments on commit 187fb57

Please sign in to comment.