Skip to content

Commit

Permalink
Cherry pick PR #2860: Add flag for partial audio frame support (#3436)
Browse files Browse the repository at this point in the history
Refer to the original PR: #2860

Allow Starboard implementations to turn partial audio frames off.

b/324905656

Co-authored-by: Kaido Kert <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and kaidokert authored Jun 4, 2024
1 parent 95f5286 commit 0161530
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 0 deletions.
3 changes: 3 additions & 0 deletions starboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions starboard/android/shared/configuration_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 = true;
#endif
3 changes: 3 additions & 0 deletions starboard/configuration_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
1 change: 1 addition & 0 deletions starboard/elf_loader/exported_symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,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);
Expand Down
3 changes: 3 additions & 0 deletions starboard/linux/shared/configuration_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 = true;
#endif
4 changes: 4 additions & 0 deletions starboard/nplb/player_test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions starboard/raspi/shared/configuration_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 = true;
#endif
3 changes: 3 additions & 0 deletions starboard/stub/configuration_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions starboard/win/shared/configuration_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 = true;
#endif
3 changes: 3 additions & 0 deletions starboard/xb1/shared/configuration_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 = true;
#endif

0 comments on commit 0161530

Please sign in to comment.