Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick PR #3415: [media] Deprecate SbMediaGetBufferStorageType() #3423

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions starboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ verified explicitly using nplb tests.
An implementation that has specific padding requirement should make a copy of
the incoming buffer when necessary.

### Deprecated SbMediaGetBufferStorageType()
The SbMediaGetBufferPadding() API was deprecated. SbMediaBufferStorageType was
also deprecated as a result.

### Removed SbUser from SbStorageOpenRecord and SbStorageDeleteRecord
The `SbStorageOpenRecord` and `SbStorageDeleteRecord` APIs defined in
`starboard/storage.h` no longer have a parameter for `SbUser` as the APIs are
Expand Down
2 changes: 2 additions & 0 deletions starboard/elf_loader/exported_symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ ExportedSymbols::ExportedSymbols() {
REGISTER_SYMBOL(SbMediaGetBufferAllocationUnit);
REGISTER_SYMBOL(SbMediaGetBufferGarbageCollectionDurationThreshold);
REGISTER_SYMBOL(SbMediaGetBufferPadding);
#if SB_API_VERSION < 16
REGISTER_SYMBOL(SbMediaGetBufferStorageType);
#endif // SB_API_VERSION < 16
REGISTER_SYMBOL(SbMediaGetInitialBufferCapacity);
REGISTER_SYMBOL(SbMediaGetMaxBufferCapacity);
REGISTER_SYMBOL(SbMediaGetProgressiveBufferBudget);
Expand Down
4 changes: 4 additions & 0 deletions starboard/media.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,12 @@ SB_EXPORT bool SbMediaGetAudioConfiguration(
// Value used when a video's bits per pixel is not known.
#define kSbMediaBitsPerPixelInvalid 0

#if SB_API_VERSION < 16
typedef enum SbMediaBufferStorageType {
kSbMediaBufferStorageTypeMemory,
kSbMediaBufferStorageTypeFile,
} SbMediaBufferStorageType;
#endif // SB_API_VERSION < 16

// The media buffer will be allocated using the returned alignment. Set this to
// a larger value may increase the memory consumption of media buffers.
Expand Down Expand Up @@ -802,6 +804,7 @@ SB_EXPORT int SbMediaGetProgressiveBufferBudget(SbMediaVideoCodec codec,
int resolution_height,
int bits_per_pixel);

#if SB_API_VERSION < 16
// Returns SbMediaBufferStorageType of type |SbMediaStorageTypeMemory| or
// |SbMediaStorageTypeFile|. For memory storage, the media buffers will be
// stored in main memory allocated by malloc functions. For file storage, the
Expand All @@ -810,6 +813,7 @@ SB_EXPORT int SbMediaGetProgressiveBufferBudget(SbMediaVideoCodec codec,
// Note that when its value is "file" the media stack will still allocate memory
// to cache the buffers in use.
SB_EXPORT SbMediaBufferStorageType SbMediaGetBufferStorageType();
#endif // SB_API_VERSION < 16

// If SbMediaGetBufferUsingMemoryPool returns true, it indicates that media
// buffer pools should be allocated on demand, as opposed to using malloc
Expand Down
4 changes: 4 additions & 0 deletions starboard/nplb/media_buffer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ TEST(SbMediaBufferTest, ProgressiveBudget) {
}
}

#if SB_API_VERSION < 16
TEST(SbMediaBufferTest, StorageType) {
// Just don't crash.
SbMediaBufferStorageType type = SbMediaGetBufferStorageType();
Expand All @@ -333,6 +334,7 @@ TEST(SbMediaBufferTest, StorageType) {
}
SB_NOTREACHED();
}
#endif // SB_API_VERSION < 16

TEST(SbMediaBufferTest, UsingMemoryPool) {
// Just don't crash.
Expand Down Expand Up @@ -360,7 +362,9 @@ TEST(SbMediaBufferTest, ValidatePerformance) {
SbMediaGetBufferGarbageCollectionDurationThreshold);
TEST_PERF_FUNCNOARGS_DEFAULT(SbMediaGetInitialBufferCapacity);
TEST_PERF_FUNCNOARGS_DEFAULT(SbMediaIsBufferPoolAllocateOnDemand);
#if SB_API_VERSION < 16
TEST_PERF_FUNCNOARGS_DEFAULT(SbMediaGetBufferStorageType);
#endif // SB_API_VERSION < 16
TEST_PERF_FUNCNOARGS_DEFAULT(SbMediaIsBufferUsingMemoryPool);

#if SB_API_VERSION < 16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "starboard/media.h"

#if SB_API_VERSION < 16
SbMediaBufferStorageType SbMediaGetBufferStorageType() {
return kSbMediaBufferStorageTypeMemory;
}
#endif // SB_API_VERSION < 16
2 changes: 2 additions & 0 deletions starboard/shared/stub/media_get_buffer_storage_type.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#include "starboard/media.h"

#if SB_API_VERSION < 16
SbMediaBufferStorageType SbMediaGetBufferStorageType() {
return static_cast<SbMediaBufferStorageType>(0);
}
#endif // SB_API_VERSION < 16
Loading