Skip to content

Commit c96500c

Browse files
Merge branch '26.eap' into santo/26.eap11/user-agent-os1
2 parents 105f668 + 438dbf3 commit c96500c

File tree

6 files changed

+47
-19
lines changed

6 files changed

+47
-19
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@
3535
/third_party/blink/ @youtube/cobalt-web-api
3636

3737
*.nplb_filter.json @youtube/nplb-filters
38+
/starboard/contrib/rdk @youtube/starboard-rdk-owners

cobalt/updater/prefs.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ std::unique_ptr<PrefService> CreatePrefService() {
4444
return nullptr;
4545
}
4646
std::string app_key;
47-
app_key.reserve(IM_EXT_MAX_APP_KEY_LENGTH);
48-
if (installation_api->GetAppKey(app_key.data(), app_key.capacity()) ==
47+
app_key.resize(IM_EXT_MAX_APP_KEY_LENGTH);
48+
if (installation_api->GetAppKey(app_key.data(), app_key.size()) ==
4949
IM_EXT_ERROR) {
5050
LOG(ERROR) << "Failed to get app key.";
5151
return nullptr;
5252
}
53+
app_key.resize(strlen(app_key.c_str()));
5354

5455
LOG(INFO) << "Updater: prefs app_key=" << app_key;
5556
PrefServiceFactory pref_service_factory;

components/update_client/persisted_data.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ std::string PersistedData::GetUpdaterChannel(const std::string& id) const {
102102
return GetString(id, "updaterchannel");
103103
}
104104
std::string PersistedData::GetLatestChannel() const {
105+
if (!pref_service_)
106+
return std::string();
105107
const base::Value::Dict* dict =
106108
&pref_service_->GetDict(kPersistedDataPreference);
107109
if (!dict)

media/mojo/clients/mojo_cdm.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,14 @@ void MojoCdm::OnMetricsReceived(
435435
uint32_t promise_id,
436436
const absl::optional<std::string>& metrics_string) {
437437
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
438-
cdm_promise_adapter_.ResolvePromise(promise_id,
439-
metrics_string.value_or(std::string()));
438+
if (metrics_string) {
439+
cdm_promise_adapter_.ResolvePromise(promise_id,
440+
metrics_string.value_or(std::string()));
441+
} else {
442+
cdm_promise_adapter_.RejectPromise(
443+
promise_id, CdmPromise::Exception::NOT_SUPPORTED_ERROR, 0,
444+
"GetMetrics() is not supported.");
445+
}
440446
}
441447
#endif // BUILDFLAG(USE_STARBOARD_MEDIA)
442448

starboard/contrib/rdk/src/third_party/starboard/rdk/shared/drm/drm_system_ocdm.cc

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@ using OcdmGstSessionDecryptBufferFn =
6060
using OcdmGetMetricSystemDataFn =
6161
OpenCDMError(*)(struct OpenCDMSystem* system, uint32_t* bufferLength, uint8_t* buffer);
6262

63+
using OcdmGetMetricsFn =
64+
OpenCDMError(*)(struct OpenCDMSystem* system, std::string& buffer);
65+
6366
static OcdmGstSessionDecryptExFn g_ocdmGstSessionDecryptEx { nullptr };
6467
static OcdmGstSessionDecryptBufferFn g_ocdmGstSessionDecryptBuffer { nullptr };
6568
static OcdmGetMetricSystemDataFn g_ocdmGetMetricSystemData { nullptr };
69+
static OcdmGetMetricsFn g_ocdmGetMetrics { nullptr };
6670

6771
} // namespace
6872

@@ -552,6 +556,14 @@ DrmSystemOcdm::DrmSystemOcdm(
552556
} else {
553557
SB_LOG(INFO) << "No opencdm_get_metric_system_data.";
554558
}
559+
560+
g_ocdmGetMetrics = reinterpret_cast<OcdmGetMetricsFn>(
561+
dlsym(RTLD_DEFAULT, "opencdm_get_metrics"));
562+
if (g_ocdmGetMetrics) {
563+
SB_LOG(INFO) << "Has opencdm_get_metrics";
564+
} else {
565+
SB_LOG(INFO) << "No opencdm_get_metrics.";
566+
}
555567
});
556568
}
557569

@@ -761,13 +773,14 @@ int DrmSystemOcdm::Decrypt(const std::string& id,
761773
}
762774

763775
const void* DrmSystemOcdm::GetMetrics(int* size) {
764-
if ( !g_ocdmGetMetricSystemData )
765-
return nullptr;
766776

767777
SB_CHECK(ocdm_system_ != nullptr);
768778

769779
const int kMaxRetry = 5;
770780
for (int i = 0; i < kMaxRetry; ++i) {
781+
if ( !g_ocdmGetMetricSystemData )
782+
break;
783+
771784
uint32_t buffer_length = ( 1 << i ) * 4 * 1024;
772785

773786
std::vector<uint8_t> tmp;
@@ -792,6 +805,24 @@ const void* DrmSystemOcdm::GetMetrics(int* size) {
792805
break;
793806
}
794807

808+
// Use `opencdm_get_metrics` when `opencdm_get_metric_system_data` fails to
809+
// get mertics data. This is observed in RDK/Amlogic where
810+
// `opencdm_get_metric_system_data` returns with error code
811+
// `INTERFACE_NOT_IMPLEMENTED`.
812+
if (g_ocdmGetMetrics && metrics_.size() == 0) {
813+
std::string buffer;
814+
auto rc = g_ocdmGetMetrics(ocdm_system_, buffer);
815+
if (rc == ERROR_NONE) {
816+
uint16_t buffer_length = buffer.size();
817+
uint16_t out_length = (((buffer_length * 8) / 6) + 4) * sizeof(TCHAR);
818+
metrics_.resize(out_length, '\0');
819+
out_length = WPEFramework::Core::URL::Base64Encode(
820+
reinterpret_cast<const uint8_t*>(buffer.data()), buffer_length,
821+
reinterpret_cast<char*>(metrics_.data()), out_length, false);
822+
metrics_.resize(out_length);
823+
}
824+
}
825+
795826
*size = static_cast<int>(metrics_.size());
796827
return metrics_.data();
797828
}

third_party/musl/src/stdio/perror.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,10 @@
22
#include <string.h>
33
#include <errno.h>
44

5-
#include "build/build_config.h"
6-
#if !BUILDFLAG(ENABLE_COBALT_HERMETIC_HACKS)
75
#include "stdio_impl.h"
8-
#endif // !BUILDFLAG(ENABLE_COBALT_HERMETIC_HACKS)
96

107
void perror(const char *msg)
118
{
12-
#if BUILDFLAG(ENABLE_COBALT_HERMETIC_HACKS)
13-
// TODO: Explore ways to capture standard output and
14-
// standard error for testing. (b/425692168).
15-
16-
// Hack method to introduce the symbol into Chrobalt.
17-
// Once the iobuffer has been implemented into Chrobalt, this
18-
// hack method should be removed with a proper implementation.
19-
printf("%s: %s", msg, strerror(errno));
20-
#else // BUILDFLAG(ENABLE_COBALT_HERMETIC_HACKS)
219
FILE *f = stderr;
2210
char *errstr = strerror(errno);
2311

@@ -40,5 +28,4 @@ void perror(const char *msg)
4028
f->locale = old_locale;
4129

4230
FUNLOCK(f);
43-
#endif // BUILDFLAG(ENABLE_COBALT_HERMETIC_HACKS)
4431
}

0 commit comments

Comments
 (0)