From 3d9fa0d6b0ba233fb8a8eb99194fed141f598a4c Mon Sep 17 00:00:00 2001 From: Kaido Kert Date: Sat, 6 Apr 2024 12:52:01 -0700 Subject: [PATCH 1/3] Add flag for partial audio frame support Allow Starboard implementations to turn partial audio frames off. b/324905656 --- starboard/CHANGELOG.md | 3 +++ starboard/android/shared/configuration_constants.cc | 3 +++ starboard/configuration_constants.h | 3 +++ starboard/linux/shared/configuration_constants.cc | 3 +++ starboard/nplb/player_test_util.cc | 4 ++++ starboard/raspi/shared/configuration_constants.cc | 3 +++ starboard/stub/configuration_constants.cc | 3 +++ starboard/win/shared/configuration_constants.cc | 3 +++ starboard/xb1/shared/configuration_constants.cc | 3 +++ 9 files changed, 28 insertions(+) diff --git a/starboard/CHANGELOG.md b/starboard/CHANGELOG.md index 2652bd01af87..93dbedbc3cc2 100644 --- a/starboard/CHANGELOG.md +++ b/starboard/CHANGELOG.md @@ -9,6 +9,9 @@ since the version previous to it. ## Version 16 +## Added new configuration constant `kHasPartialAudioFramesSupport` +Set this to true if your platform supports partial audio frames. + ### Deprecated `SbMutex`, `SbConditionVariable` and `SbThread`. The standard POSIX `pthread` APIs replace the Starboard concurrency primitives. diff --git a/starboard/android/shared/configuration_constants.cc b/starboard/android/shared/configuration_constants.cc index 357c4a495645..241ac5e155d1 100644 --- a/starboard/android/shared/configuration_constants.cc +++ b/starboard/android/shared/configuration_constants.cc @@ -142,4 +142,7 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB // Whether this platform can map executable memory. This is required for // platforms that want to JIT. SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; + +// Platform can support partial audio frames +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; #endif diff --git a/starboard/configuration_constants.h b/starboard/configuration_constants.h index cb6bb6877b52..061208a18a55 100644 --- a/starboard/configuration_constants.h +++ b/starboard/configuration_constants.h @@ -157,6 +157,9 @@ SB_EXPORT extern const uint32_t kSbMaxSystemPathCacheDirectorySize; // Whether this platform can map executable memory. This is required for // platforms that want to JIT. SB_EXPORT extern const bool kSbCanMapExecutableMemory; + +// Platform can support partial audio frames +SB_EXPORT extern const bool kHasPartialAudioFramesSupport; #endif #endif // STARBOARD_CONFIGURATION_CONSTANTS_H_ diff --git a/starboard/linux/shared/configuration_constants.cc b/starboard/linux/shared/configuration_constants.cc index 640f9f606b86..182dc0356fd9 100644 --- a/starboard/linux/shared/configuration_constants.cc +++ b/starboard/linux/shared/configuration_constants.cc @@ -139,4 +139,7 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB #if SB_API_VERSION >= 16 SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; + +// Platform can support partial audio frames +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; #endif diff --git a/starboard/nplb/player_test_util.cc b/starboard/nplb/player_test_util.cc index 8b63655f71d7..4bcc1385d6a4 100644 --- a/starboard/nplb/player_test_util.cc +++ b/starboard/nplb/player_test_util.cc @@ -402,7 +402,11 @@ bool IsOutputModeSupported(SbPlayerOutputMode output_mode, bool IsPartialAudioSupported() { #if SB_API_VERSION >= 15 +#if SB_API_VERSION >= 16 + return kHasPartialAudioFramesSupport; +#else return true; +#endif #else // SB_API_VERSION >= 15 return SbSystemGetExtension(kCobaltExtensionEnhancedAudioName) != nullptr; #endif // SB_API_VERSION >= 15 diff --git a/starboard/raspi/shared/configuration_constants.cc b/starboard/raspi/shared/configuration_constants.cc index 77275c19b294..7ac418e343fe 100644 --- a/starboard/raspi/shared/configuration_constants.cc +++ b/starboard/raspi/shared/configuration_constants.cc @@ -143,4 +143,7 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB // Whether this platform can map executable memory. This is required for // platforms that want to JIT. SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; + +// Platform can support partial audio frames +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; #endif diff --git a/starboard/stub/configuration_constants.cc b/starboard/stub/configuration_constants.cc index 9fedf69850e7..7b4a5cd4fec4 100644 --- a/starboard/stub/configuration_constants.cc +++ b/starboard/stub/configuration_constants.cc @@ -140,4 +140,7 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB // Whether this platform can map executable memory. This is required for // platforms that want to JIT. SB_EXPORT extern const bool kSbCanMapExecutableMemory = false; + +// Platform can support partial audio frames +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; #endif diff --git a/starboard/win/shared/configuration_constants.cc b/starboard/win/shared/configuration_constants.cc index a70cdd43cc1c..cffa351e70e2 100644 --- a/starboard/win/shared/configuration_constants.cc +++ b/starboard/win/shared/configuration_constants.cc @@ -149,4 +149,7 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB // Whether this platform can map executable memory. This is required for // platforms that want to JIT. SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; + +// Platform can support partial audio frames +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; #endif diff --git a/starboard/xb1/shared/configuration_constants.cc b/starboard/xb1/shared/configuration_constants.cc index 8fe8d744ece8..466c45d30d7f 100644 --- a/starboard/xb1/shared/configuration_constants.cc +++ b/starboard/xb1/shared/configuration_constants.cc @@ -146,4 +146,7 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB // Whether this platform can map executable memory. This is required for // platforms that want to JIT. SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; + +// Platform can support partial audio frames +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; #endif From 6d28e3e09f9a3a96062789d36bba36d1c4b20186 Mon Sep 17 00:00:00 2001 From: Kaido Kert Date: Thu, 30 May 2024 23:27:27 -0700 Subject: [PATCH 2/3] Change the default to true --- starboard/android/shared/configuration_constants.cc | 2 +- starboard/linux/shared/configuration_constants.cc | 2 +- starboard/raspi/shared/configuration_constants.cc | 2 +- starboard/win/shared/configuration_constants.cc | 2 +- starboard/xb1/shared/configuration_constants.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/starboard/android/shared/configuration_constants.cc b/starboard/android/shared/configuration_constants.cc index 241ac5e155d1..0691cff41d12 100644 --- a/starboard/android/shared/configuration_constants.cc +++ b/starboard/android/shared/configuration_constants.cc @@ -144,5 +144,5 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; // Platform can support partial audio frames -SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = true; #endif diff --git a/starboard/linux/shared/configuration_constants.cc b/starboard/linux/shared/configuration_constants.cc index 182dc0356fd9..341512540dad 100644 --- a/starboard/linux/shared/configuration_constants.cc +++ b/starboard/linux/shared/configuration_constants.cc @@ -141,5 +141,5 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; // Platform can support partial audio frames -SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = true; #endif diff --git a/starboard/raspi/shared/configuration_constants.cc b/starboard/raspi/shared/configuration_constants.cc index 7ac418e343fe..d1163c476cfd 100644 --- a/starboard/raspi/shared/configuration_constants.cc +++ b/starboard/raspi/shared/configuration_constants.cc @@ -145,5 +145,5 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; // Platform can support partial audio frames -SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = true; #endif diff --git a/starboard/win/shared/configuration_constants.cc b/starboard/win/shared/configuration_constants.cc index cffa351e70e2..8486d3b96f0d 100644 --- a/starboard/win/shared/configuration_constants.cc +++ b/starboard/win/shared/configuration_constants.cc @@ -151,5 +151,5 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; // Platform can support partial audio frames -SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = true; #endif diff --git a/starboard/xb1/shared/configuration_constants.cc b/starboard/xb1/shared/configuration_constants.cc index 466c45d30d7f..6a15e19925ca 100644 --- a/starboard/xb1/shared/configuration_constants.cc +++ b/starboard/xb1/shared/configuration_constants.cc @@ -148,5 +148,5 @@ const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB SB_EXPORT extern const bool kSbCanMapExecutableMemory = true; // Platform can support partial audio frames -SB_EXPORT extern const bool kHasPartialAudioFramesSupport = false; +SB_EXPORT extern const bool kHasPartialAudioFramesSupport = true; #endif From 83584cdf20719941b6af416fc4b1aaa4aee80b27 Mon Sep 17 00:00:00 2001 From: Kaido Kert Date: Mon, 3 Jun 2024 11:14:21 -0700 Subject: [PATCH 3/3] Add missing symbol --- starboard/elf_loader/exported_symbols.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/starboard/elf_loader/exported_symbols.cc b/starboard/elf_loader/exported_symbols.cc index 801f798aa552..c73c55bab79c 100644 --- a/starboard/elf_loader/exported_symbols.cc +++ b/starboard/elf_loader/exported_symbols.cc @@ -119,6 +119,7 @@ ExportedSymbols::ExportedSymbols() { #endif // SB_API_VERSION < 16 #if SB_API_VERSION >= 16 REGISTER_SYMBOL(kSbCanMapExecutableMemory); + REGISTER_SYMBOL(kHasPartialAudioFramesSupport); #endif REGISTER_SYMBOL(SbAccessibilityGetCaptionSettings); REGISTER_SYMBOL(SbAccessibilityGetDisplaySettings);