Skip to content

Commit

Permalink
Merge branch 'main' into narrow-iamf-mime-check
Browse files Browse the repository at this point in the history
  • Loading branch information
osagie98 committed Sep 9, 2024
2 parents de2e7ed + 13e5773 commit a73ca31
Show file tree
Hide file tree
Showing 196 changed files with 948 additions and 244 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ jobs:
uses: ./.github/actions/build
- name: 'Check Artifact Size'
uses: ./.github/actions/check_artifact_size
if: ${{ inputs.artifact_size_increase_thresholds }}
if: ${{ false }} # ${{ inputs.artifact_size_increase_thresholds }}
with:
workflow: ${{ github.workflow }}
name: ${{ matrix.platform }}-${{ matrix.config }}
Expand Down
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ repos:
(?x)^(
(internal/)?starboard/[^/]+/i18n/|
cobalt/content/licenses/|
cobalt/content/ssl/|
cobalt/fetch/embedded_scripts|
cobalt/streams/embedded_scripts|
cobalt/loader/cors_preflight.cc|
internal/cobalt/browser/splash_screen/youtube_splash_screen.html|
internal/starboard/shared/playstation/storage_internal.cc|
starboard/content/ssl/certs/|
starboard/loader_app/app_key_test.cc|
starboard/shared/starboard/player/testdata|
starboard/shared/win32/media_transform.cc
Expand Down Expand Up @@ -166,6 +166,7 @@ repos:
entry: python ./download_resources.py
language: python
stages: [post-checkout]
additional_dependencies: [certifi]
always_run: true
- id: test-download-from-gcs-helper
name: test download from gcs helper
Expand All @@ -175,7 +176,7 @@ repos:
always_run: true
stages: [push]
additional_dependencies: [certifi]
args: [-m, unittest, cobalt/tools/download_from_gcs_test.py]
args: [-m, unittest, starboard/tools/download_from_gcs_test.py]
- id: test-python3-compatibility
name: Test Python 3 Compatibility
description: Checks that scripts can be run in Python 3
Expand Down
2 changes: 1 addition & 1 deletion base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3667,7 +3667,7 @@ test("base_unittests") {
if (is_starboard){
data_deps += [
":base_unittests_bundle_data",
"//cobalt/network:copy_ssl_certificates",
"//starboard/content/ssl:copy_ssl_certificates",
]
}

Expand Down
2 changes: 1 addition & 1 deletion cobalt/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,5 @@ target(gtest_target_type, "base_test") {
"//testing/gmock",
"//testing/gtest",
]
data_deps = [ "//cobalt/network:copy_ssl_certificates" ]
data_deps = [ "//starboard/content/ssl:copy_ssl_certificates" ]
}
2 changes: 1 addition & 1 deletion cobalt/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ target(final_executable_type, "cobalt") {
"//cobalt/css_parser",
"//net",
]
data_deps = [ "//cobalt/network:copy_ssl_certificates" ]
data_deps = [ "//starboard/content/ssl:copy_ssl_certificates" ]
if (cobalt_font_package == "empty") {
data_deps += [ "//starboard/content/fonts:copy_font_data" ]
} else {
Expand Down
6 changes: 6 additions & 0 deletions cobalt/browser/browser_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,12 @@ BrowserModule::~BrowserModule() {
}

void BrowserModule::Navigate(const GURL& url_reference) {
if (network_module_) {
// If protocolfilter setting was updated, the setting does not take effect
// until the next page load.
network_module_->SetProtocolFilterFromPersistentSettings();
}

// The argument is sometimes |pending_navigate_url_|, and Navigate can modify
// |pending_navigate_url_|, so we want to keep a copy of the argument to
// preserve its original value.
Expand Down
5 changes: 4 additions & 1 deletion cobalt/browser/device_authentication.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ namespace cobalt {
namespace browser {

// Returns a base64 encoded SHA256 hash representing the device authentication
// signature based on the device certification scope and the current time.
// signature, the device certification scope, and the current time as query
// parameters in a string. The signature is the result of signing a message,
// containing the certification scope and the current time, with a secret key
// provided by the device.
std::string GetDeviceAuthenticationSignedURLQueryString();

// The following methods are deterministic helper functions used in the
Expand Down
2 changes: 1 addition & 1 deletion cobalt/encoding/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ target(gtest_target_type, "text_encoding_test") {
"//testing/gtest",
]

data_deps = [ "//cobalt/network:copy_ssl_certificates" ]
data_deps = [ "//starboard/content/ssl:copy_ssl_certificates" ]
}
33 changes: 33 additions & 0 deletions cobalt/h5vcc/h5vcc_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,32 @@ bool H5vccSettings::Set(const std::string& name, SetValueType value) const {
}
}

if (name.compare(network::kProtocolFilterKey) == 0 &&
value.IsType<std::string>() &&
value.AsType<std::string>().size() < 16384) {
std::string raw_json = value.AsType<std::string>();
base::Value old_config_json;
persistent_settings_->Get(network::kProtocolFilterKey, &old_config_json);

if (raw_json.empty() && (!old_config_json.is_string() ||
!old_config_json.GetString().empty())) {
persistent_settings_->Set(network::kProtocolFilterKey, base::Value());
network_module_->SetProtocolFilterUpdatePending();
return true;
}

absl::optional<base::Value> old_config =
base::JSONReader::Read(old_config_json.GetString());
absl::optional<base::Value> new_config = base::JSONReader::Read(raw_json);
if (!new_config) return false;
if (old_config && *old_config == *new_config) return false;

persistent_settings_->Set(network::kProtocolFilterKey,
base::Value(raw_json));
network_module_->SetProtocolFilterUpdatePending();
return true;
}

if (name.compare("cpu_usage_tracker_intervals") == 0 &&
value.IsType<std::string>() && value.AsType<std::string>().size() < 512) {
absl::optional<base::Value> config =
Expand Down Expand Up @@ -193,6 +219,13 @@ std::string H5vccSettings::GetPersistentSettingAsString(
absl::optional<std::string> json = base::WriteJson(value);
return json.value_or(std::string());
}

if (key.compare(network::kProtocolFilterKey) == 0) {
base::Value value;
persistent_settings_->Get(network::kProtocolFilterKey, &value);
if (!value.is_string()) return std::string();
return value.GetString();
}
return std::string();
}

Expand Down
14 changes: 2 additions & 12 deletions cobalt/input/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
static_library("input") {
sources = [
"camera_3d.h",
"camera_3d_input_poller.cc",
"camera_3d_input_poller.h",
"create_default_camera_3d.h",
"input_device_manager.h",
"input_device_manager_desktop.cc",
Expand All @@ -33,18 +35,6 @@ static_library("input") {
"keypress_generator_filter.h",
]

if (enable_vr) {
sources += [
"//internal/cobalt/input/private/camera_3d_vr.cc",
"//internal/cobalt/input/private/camera_3d_vr.h",
]
} else {
sources += [
"camera_3d_input_poller.cc",
"camera_3d_input_poller.h",
]
}

deps = [
"//cobalt/base",
"//cobalt/dom",
Expand Down
2 changes: 1 addition & 1 deletion cobalt/layout_tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ target(gtest_target_type, "layout_tests") {

data_deps = [
"//cobalt/layout_tests/testdata:layout_copy_test_data",
"//cobalt/network:copy_ssl_certificates",
"//starboard/content/ssl:copy_ssl_certificates",
]
if (cobalt_font_package == "empty") {
data_deps += [ "//starboard/content/fonts:copy_font_data" ]
Expand Down
22 changes: 20 additions & 2 deletions cobalt/media/base/drm_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@
namespace cobalt {
namespace media {

SbDrmSystem CreateSbDrmSystemWithHistogram(
const char* key_system, void* context,
SbDrmSessionUpdateRequestFunc update_request_callback,
SbDrmSessionUpdatedFunc session_updated_callback,
SbDrmSessionKeyStatusesChangedFunc key_statuses_changed_callback,
SbDrmServerCertificateUpdatedFunc server_certificate_updated_callback,
SbDrmSessionClosedFunc session_closed_callback,
MediaMetricsProvider& media_metrics_provider) {
media_metrics_provider.StartTrackingAction(MediaAction::SBDRM_CREATE);
auto drm_system = SbDrmCreateSystem(
key_system, context, update_request_callback, session_updated_callback,
key_statuses_changed_callback, server_certificate_updated_callback,
session_closed_callback);
media_metrics_provider.EndTrackingAction(MediaAction::SBDRM_CREATE);
return drm_system;
}

DECLARE_INSTANCE_COUNTER(DrmSystem);

DrmSystem::Session::Session(
Expand Down Expand Up @@ -80,10 +97,11 @@ void DrmSystem::Session::Close() {
}

DrmSystem::DrmSystem(const char* key_system)
: wrapped_drm_system_(SbDrmCreateSystem(
: wrapped_drm_system_(CreateSbDrmSystemWithHistogram(
key_system, this, OnSessionUpdateRequestGeneratedFunc,
OnSessionUpdatedFunc, OnSessionKeyStatusesChangedFunc,
OnServerCertificateUpdatedFunc, OnSessionClosedFunc)),
OnServerCertificateUpdatedFunc, OnSessionClosedFunc,
media_metrics_provider_)),
task_runner_(base::SequencedTaskRunner::GetCurrentDefault()),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
weak_this_(weak_ptr_factory_.GetWeakPtr()) {
Expand Down
3 changes: 1 addition & 2 deletions cobalt/media/base/drm_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ class DrmSystem : public base::RefCounted<DrmSystem> {
SbDrmStatus status,
const char* error_message);

MediaMetricsProvider media_metrics_provider_;
const SbDrmSystem wrapped_drm_system_;
scoped_refptr<base::SequencedTaskRunner> const task_runner_;

Expand All @@ -253,8 +254,6 @@ class DrmSystem : public base::RefCounted<DrmSystem> {
// Supports concurrent calls to |Session::Update|.
TicketToSessionUpdateMap ticket_to_session_update_map_;

MediaMetricsProvider media_metrics_provider_;

DISALLOW_COPY_AND_ASSIGN(DrmSystem);
};

Expand Down
66 changes: 66 additions & 0 deletions cobalt/media/base/metrics_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,72 @@ void MediaMetricsProvider::ReportActionLatencyUMA(
UMA_HISTOGRAM_TIMES("Cobalt.Media.SbPlayer.Destroy.LatencyTiming",
action_duration);
break;
case MediaAction::SBPLAYER_GET_PREFERRED_OUTPUT_MODE:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.GetPreferredOutputMode.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMicroseconds(100), 50);
break;
case MediaAction::SBPLAYER_SEEK:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.Seek.LatencyTiming", action_duration,
base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMicroseconds(800), 50);
break;
case MediaAction::SBPLAYER_WRITE_END_OF_STREAM_AUDIO:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.WriteEndOfStream.Audio.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(25), 50);
break;
case MediaAction::SBPLAYER_WRITE_END_OF_STREAM_VIDEO:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.WriteEndOfStream.Video.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(25), 50);
break;
case MediaAction::SBPLAYER_SET_BOUNDS:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.SetBounds.LatencyTiming", action_duration,
base::TimeDelta::FromMicroseconds(50),
base::TimeDelta::FromMilliseconds(60), 50);
break;
case MediaAction::SBPLAYER_SET_PLAYBACK_RATE:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.SetPlaybackRate.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(50), 50);
break;
case MediaAction::SBPLAYER_SET_VOLUME:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.SetVolume.LatencyTiming", action_duration,
base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(50), 50);
break;
case MediaAction::SBPLAYER_GET_INFO:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.GetInfo.LatencyTiming", action_duration,
base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(20), 50);
break;
case MediaAction::SBPLAYER_GET_CURRENT_FRAME:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.GetCurrentFrame.LatencyTiming",
action_duration, base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(250), 50);
break;
case MediaAction::SBPLAYER_GET_AUDIO_CONFIG:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbPlayer.GetAudioConfig.LatencyTiming", action_duration,
base::TimeDelta::FromMicroseconds(1),
base::TimeDelta::FromMilliseconds(50), 50);
break;
case MediaAction::SBDRM_CREATE:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbDrm.Create.LatencyTiming", action_duration,
base::TimeDelta::FromMicroseconds(500),
base::TimeDelta::FromMilliseconds(250), 50);
break;
case MediaAction::SBDRM_DESTROY:
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"Cobalt.Media.SbDrm.Destroy.LatencyTiming", action_duration,
Expand Down
11 changes: 11 additions & 0 deletions cobalt/media/base/metrics_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ enum class MediaAction : uint8_t {
SBPLAYER_CREATE,
SBPLAYER_CREATE_URL_PLAYER,
SBPLAYER_DESTROY,
SBPLAYER_GET_PREFERRED_OUTPUT_MODE,
SBPLAYER_SEEK,
SBPLAYER_WRITE_END_OF_STREAM_AUDIO,
SBPLAYER_WRITE_END_OF_STREAM_VIDEO,
SBPLAYER_SET_BOUNDS,
SBPLAYER_SET_PLAYBACK_RATE,
SBPLAYER_SET_VOLUME,
SBPLAYER_GET_INFO,
SBPLAYER_GET_CURRENT_FRAME,
SBPLAYER_GET_AUDIO_CONFIG,
SBDRM_CREATE,
SBDRM_DESTROY,
SBDRM_GENERATE_SESSION_UPDATE_REQUEST,
SBDRM_UPDATE_SESSION,
Expand Down
Loading

0 comments on commit a73ca31

Please sign in to comment.