From 8b919343eb2756ddb0130be49b6aaeb1222f1f75 Mon Sep 17 00:00:00 2001 From: xiaomings Date: Sat, 1 Jun 2024 15:26:11 -0700 Subject: [PATCH] [media] Deprecate SbMediaGetBufferStorageType() (#3415) b/343844532 Change-Id: I7eff8b09a9edc0c080972874e5dee640aa603ba9 --- starboard/CHANGELOG.md | 4 ++++ starboard/elf_loader/exported_symbols.cc | 2 ++ starboard/media.h | 4 ++++ starboard/nplb/media_buffer_test.cc | 4 ++++ .../shared/starboard/media/media_get_buffer_storage_type.cc | 2 ++ starboard/shared/stub/media_get_buffer_storage_type.cc | 2 ++ 6 files changed, 18 insertions(+) diff --git a/starboard/CHANGELOG.md b/starboard/CHANGELOG.md index b26f2bd8a334..2652bd01af87 100644 --- a/starboard/CHANGELOG.md +++ b/starboard/CHANGELOG.md @@ -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 diff --git a/starboard/elf_loader/exported_symbols.cc b/starboard/elf_loader/exported_symbols.cc index 421345e1f2b7..801f798aa552 100644 --- a/starboard/elf_loader/exported_symbols.cc +++ b/starboard/elf_loader/exported_symbols.cc @@ -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); diff --git a/starboard/media.h b/starboard/media.h index 09affda1e3a7..b90928763240 100644 --- a/starboard/media.h +++ b/starboard/media.h @@ -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. @@ -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 @@ -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 diff --git a/starboard/nplb/media_buffer_test.cc b/starboard/nplb/media_buffer_test.cc index fc2a52047a0c..f15126cda720 100644 --- a/starboard/nplb/media_buffer_test.cc +++ b/starboard/nplb/media_buffer_test.cc @@ -323,6 +323,7 @@ TEST(SbMediaBufferTest, ProgressiveBudget) { } } +#if SB_API_VERSION < 16 TEST(SbMediaBufferTest, StorageType) { // Just don't crash. SbMediaBufferStorageType type = SbMediaGetBufferStorageType(); @@ -333,6 +334,7 @@ TEST(SbMediaBufferTest, StorageType) { } SB_NOTREACHED(); } +#endif // SB_API_VERSION < 16 TEST(SbMediaBufferTest, UsingMemoryPool) { // Just don't crash. @@ -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 diff --git a/starboard/shared/starboard/media/media_get_buffer_storage_type.cc b/starboard/shared/starboard/media/media_get_buffer_storage_type.cc index 3d8dfcd4cfd8..5cb8977c078b 100644 --- a/starboard/shared/starboard/media/media_get_buffer_storage_type.cc +++ b/starboard/shared/starboard/media/media_get_buffer_storage_type.cc @@ -14,6 +14,8 @@ #include "starboard/media.h" +#if SB_API_VERSION < 16 SbMediaBufferStorageType SbMediaGetBufferStorageType() { return kSbMediaBufferStorageTypeMemory; } +#endif // SB_API_VERSION < 16 diff --git a/starboard/shared/stub/media_get_buffer_storage_type.cc b/starboard/shared/stub/media_get_buffer_storage_type.cc index 802e19dfd701..23db3566c2ea 100644 --- a/starboard/shared/stub/media_get_buffer_storage_type.cc +++ b/starboard/shared/stub/media_get_buffer_storage_type.cc @@ -14,6 +14,8 @@ #include "starboard/media.h" +#if SB_API_VERSION < 16 SbMediaBufferStorageType SbMediaGetBufferStorageType() { return static_cast(0); } +#endif // SB_API_VERSION < 16