Skip to content

Commit

Permalink
[media] Deprecate SbMediaGetBufferStorageType() (#3415)
Browse files Browse the repository at this point in the history
b/343844532

Change-Id: I7eff8b09a9edc0c080972874e5dee640aa603ba9
  • Loading branch information
xiaomings committed Jun 1, 2024
1 parent 8e3a547 commit 8b91934
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
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 @@ -207,7 +207,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

0 comments on commit 8b91934

Please sign in to comment.