Skip to content

Commit

Permalink
Remove missed SB_API_VERSION >= 14 blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
oxve committed May 29, 2024
1 parent 3477c91 commit 2817bd8
Show file tree
Hide file tree
Showing 45 changed files with 12 additions and 213 deletions.
2 changes: 0 additions & 2 deletions cobalt/browser/user_agent_platform_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ const DeviceTypeName kDeviceTypeStrings[] = {
{kSbSystemDeviceTypeTV, "TV"},
{kSbSystemDeviceTypeAndroidTV, "ATV"},
{kSbSystemDeviceTypeDesktopPC, "DESKTOP"},
#if SB_API_VERSION >= 14
{kSbSystemDeviceTypeVideoProjector, "PROJECTOR"},
#endif // SB_API_VERSION >= 14
{kSbSystemDeviceTypeUnknown, "UNKNOWN"}};

std::string CreateDeviceTypeString(SbSystemDeviceType device_type) {
Expand Down
4 changes: 0 additions & 4 deletions cobalt/h5vcc/h5vcc_storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,7 @@ H5vccStorageSetQuotaResponse H5vccStorage::SetQuota(
quota.cache_api() + quota.service_worker_js();

uint32_t max_quota_size = 24 * 1024 * 1024;
#if SB_API_VERSION >= 14
max_quota_size = kSbMaxSystemPathCacheDirectorySize;
#endif
// Assume the non-http-cache memory in kSbSystemPathCacheDirectory
// is less than 1 mb and subtract this from the max_quota_size.
max_quota_size -= (1 << 20);
Expand Down Expand Up @@ -359,9 +357,7 @@ H5vccStorageResourceTypeQuotaBytesDictionary H5vccStorage::GetQuota() {
network::disk_cache::kServiceWorkerScript));

uint32_t max_quota_size = 24 * 1024 * 1024;
#if SB_API_VERSION >= 14
max_quota_size = kSbMaxSystemPathCacheDirectorySize;
#endif
// Assume the non-http-cache memory in kSbSystemPathCacheDirectory
// is less than 1 mb and subtract this from the max_quota_size.
max_quota_size -= (1 << 20);
Expand Down
22 changes: 0 additions & 22 deletions cobalt/h5vcc/h5vcc_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,45 +84,23 @@ std::string H5vccSystem::platform() const {
std::string H5vccSystem::advertising_id() const {
std::string result;
char property[kSystemPropertyMaxLength] = {0};
#if SB_API_VERSION >= 14
if (!SbSystemGetProperty(kSbSystemPropertyAdvertisingId, property,
SB_ARRAY_SIZE_INT(property))) {
DLOG(INFO) << "Failed to get kSbSystemPropertyAdvertisingId.";
} else {
result = property;
}
#else
if (ifa_extension_ && ifa_extension_->version >= 1) {
if (!ifa_extension_->GetAdvertisingId(property,
SB_ARRAY_SIZE_INT(property))) {
DLOG(FATAL) << "Failed to get AdvertisingId from IFA extension.";
} else {
result = property;
}
}
#endif
return result;
}
bool H5vccSystem::limit_ad_tracking() const {
bool result = false;
char property[kSystemPropertyMaxLength] = {0};
#if SB_API_VERSION >= 14
if (!SbSystemGetProperty(kSbSystemPropertyLimitAdTracking, property,
SB_ARRAY_SIZE_INT(property))) {
DLOG(INFO) << "Failed to get kSbSystemPropertyAdvertisingId.";
} else {
result = std::atoi(property);
}
#else
if (ifa_extension_ && ifa_extension_->version >= 1) {
if (!ifa_extension_->GetLimitAdTracking(property,
SB_ARRAY_SIZE_INT(property))) {
DLOG(FATAL) << "Failed to get LimitAdTracking from IFA extension.";
} else {
result = std::atoi(property);
}
}
#endif
return result;
}

Expand Down
10 changes: 0 additions & 10 deletions cobalt/media/decoder_buffer_allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,24 +155,14 @@ int DecoderBufferAllocator::GetAudioBufferBudget() const {

int DecoderBufferAllocator::GetBufferAlignment() const {
#if SB_API_VERSION < 16
#if SB_API_VERSION >= 14
return SbMediaGetBufferAlignment();
#else // SB_API_VERSION >= 14
return std::max(SbMediaGetBufferAlignment(kSbMediaTypeAudio),
SbMediaGetBufferAlignment(kSbMediaTypeVideo));
#endif // SB_API_VERSION >= 14
#else
return sizeof(void*);
#endif // SB_API_VERSION < 16
}

int DecoderBufferAllocator::GetBufferPadding() const {
#if SB_API_VERSION >= 14
return SbMediaGetBufferPadding();
#else // SB_API_VERSION >= 14
return std::max(SbMediaGetBufferPadding(kSbMediaTypeAudio),
SbMediaGetBufferPadding(kSbMediaTypeVideo));
#endif // SB_API_VERSION >= 14
}

base::TimeDelta
Expand Down
2 changes: 0 additions & 2 deletions cobalt/network/url_request_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,7 @@ URLRequestContext::URLRequestContext(
using_http_cache_ = true;

int max_cache_bytes = 24 * 1024 * 1024;
#if SB_API_VERSION >= 14
max_cache_bytes = kSbMaxSystemPathCacheDirectorySize;
#endif
// Assume the non-http-cache memory in kSbSystemPathCacheDirectory
// is less than 1 mb and subtract this from the max_cache_bytes.
max_cache_bytes -= (1 << 20);
Expand Down
4 changes: 0 additions & 4 deletions cobalt/renderer/rasterizer/skia/hardware_resource_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ uint32_t DecodeTargetFormatToGLFormat(
}
} break;
case kSbDecodeTargetFormat3Plane10BitYUVI420:
#if SB_API_VERSION >= 14
case kSbDecodeTargetFormat3Plane10BitYUVI420Compact:
#endif // SB_API_VERSION >= 14
case kSbDecodeTargetFormat3PlaneYUVI420: {
DCHECK_LT(plane, 3);
#if defined(GL_RED_EXT)
Expand Down Expand Up @@ -238,11 +236,9 @@ DecodeTargetFormatToRenderTreeMultiPlaneFormat(SbDecodeTargetFormat format) {
case kSbDecodeTargetFormat3Plane10BitYUVI420: {
return render_tree::kMultiPlaneImageFormatYUV3Plane10BitBT2020;
} break;
#if SB_API_VERSION >= 14
case kSbDecodeTargetFormat3Plane10BitYUVI420Compact: {
return render_tree::kMultiPlaneImageFormatYUV3Plane10BitCompactedBT2020;
}
#endif // SB_API_VERSION >= 14
default: {
NOTREACHED();
}
Expand Down
4 changes: 0 additions & 4 deletions media/base/starboard_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,12 @@ SbMediaAudioCodec MediaAudioCodecToSbMediaAudioCodec(AudioCodec codec) {
return kSbMediaAudioCodecVorbis;
case AudioCodec::kOpus:
return kSbMediaAudioCodecOpus;
#if SB_API_VERSION >= 14
case AudioCodec::kMP3:
return kSbMediaAudioCodecMp3;
case AudioCodec::kFLAC:
return kSbMediaAudioCodecFlac;
case AudioCodec::kPCM:
return kSbMediaAudioCodecPcm;
#endif // SB_API_VERSION >= 14
#if SB_API_VERSION >= 15
case AudioCodec::kIAMF:
return kSbMediaAudioCodecIamf;
Expand Down Expand Up @@ -308,9 +306,7 @@ ENUM_EQ(kSbMediaMatrixIdBt2020ConstantLuminance,
VideoColorSpace::MatrixID::BT2020_CL);
ENUM_EQ(kSbMediaMatrixIdYDzDx, VideoColorSpace::MatrixID::YDZDX);

#if SB_API_VERSION >= 14
ENUM_EQ(kSbMediaMatrixIdInvalid, VideoColorSpace::MatrixID::INVALID);
#endif // SB_API_VERSION >= 14

// Ensure RangeId enums convert correctly.
ENUM_EQ(kSbMediaRangeIdUnspecified, gfx::ColorSpace::RangeID::INVALID);
Expand Down
2 changes: 0 additions & 2 deletions starboard/android/shared/configuration_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,8 @@ const int kSbPreferredRgbaByteOrder = SB_PREFERRED_RGBA_BYTE_ORDER_RGBA;
const uint32_t kSbUserMaxSignedIn = 1;
#endif // SB_API_VERSION < 16

#if SB_API_VERSION >= 14
// The maximum size the cache directory is allowed to use in bytes.
const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB
#endif

#if SB_API_VERSION >= 16
// Whether this platform can map executable memory. This is required for
Expand Down
2 changes: 0 additions & 2 deletions starboard/android/shared/system_get_property.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ bool SbSystemGetProperty(SbSystemPropertyId property_id,
CopyStringAndTestIfSuccess(out_value, value_length, utf_str.c_str());
return success;
}
#if SB_API_VERSION >= 14
case kSbSystemPropertyAdvertisingId: {
JniEnvExt* env = JniEnvExt::Get();
ScopedLocalJavaRef<jstring> id_string(
Expand All @@ -162,7 +161,6 @@ bool SbSystemGetProperty(SbSystemPropertyId property_id,
return CopyStringAndTestIfSuccess(out_value, value_length,
limit_ad_tracking_enabled ? "1" : "0");
}
#endif
#if SB_API_VERSION >= 15
case kSbSystemPropertyDeviceType:
return CopyStringAndTestIfSuccess(out_value, value_length,
Expand Down
7 changes: 0 additions & 7 deletions starboard/common/media.cc
Original file line number Diff line number Diff line change
Expand Up @@ -605,14 +605,12 @@ const char* GetMediaAudioCodecName(SbMediaAudioCodec codec) {
return "opus";
case kSbMediaAudioCodecVorbis:
return "vorbis";
#if SB_API_VERSION >= 14
case kSbMediaAudioCodecMp3:
return "mp3";
case kSbMediaAudioCodecFlac:
return "flac";
case kSbMediaAudioCodecPcm:
return "pcm";
#endif // SB_API_VERSION >= 14
#if SB_API_VERSION >= 15
case kSbMediaAudioCodecIamf:
return "iamf";
Expand Down Expand Up @@ -804,13 +802,8 @@ const char* GetMediaMatrixIdName(SbMediaMatrixId matrix_id) {
return "Bt2020ConstantLuminance";
case kSbMediaMatrixIdYDzDx:
return "YDzDx";
#if SB_API_VERSION >= 14
case kSbMediaMatrixIdInvalid:
return "Invalid";
#else // SB_API_VERSION >= 14
case kSbMediaMatrixIdUnknown:
return "Unknown";
#endif // SB_API_VERSION >= 14
}
SB_NOTREACHED();
return "Invalid";
Expand Down
2 changes: 0 additions & 2 deletions starboard/configuration_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,8 @@ SB_EXPORT extern const char* kSbPathSepString;
SB_EXPORT extern const uint32_t kSbUserMaxSignedIn;
#endif // SB_API_VERSION < 16

#if SB_API_VERSION >= 14
// The maximum size the cache directory is allowed to use in bytes.
SB_EXPORT extern const uint32_t kSbMaxSystemPathCacheDirectorySize;
#endif

#if SB_API_VERSION >= 16
// Whether this platform can map executable memory. This is required for
Expand Down
4 changes: 0 additions & 4 deletions starboard/decode_target.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,10 @@ typedef enum SbDecodeTargetFormat {
// order. Each pixel is stored in 16 bits.
kSbDecodeTargetFormat3Plane10BitYUVI420,

#if SB_API_VERSION >= 14
// A decoder target format consisting of 10bit Y, U, and V planes, in that
// order. The plane data is stored in a compact format. Every three 10-bit
// pixels are packed into 32 bits.
kSbDecodeTargetFormat3Plane10BitYUVI420Compact,
#endif // SB_API_VERSION >= 14

// A decoder target format consisting of a single plane with pixels laid out
// in the format UYVY. Since there are two Y values per sample, but only one
Expand Down Expand Up @@ -285,9 +283,7 @@ static inline int SbDecodeTargetNumberOfPlanesForFormat(
case kSbDecodeTargetFormat2PlaneYUVNV12:
return 2;
case kSbDecodeTargetFormat3Plane10BitYUVI420:
#if SB_API_VERSION >= 14
case kSbDecodeTargetFormat3Plane10BitYUVI420Compact:
#endif // SB_API_VERSION >= 14
case kSbDecodeTargetFormat3PlaneYUVI420:
return 3;
default:
Expand Down
2 changes: 0 additions & 2 deletions starboard/elf_loader/exported_symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ ExportedSymbols::ExportedSymbols() {
REGISTER_SYMBOL(kSbHasMediaWebmVp9Support);
REGISTER_SYMBOL(kSbHasThreadPrioritySupport);
REGISTER_SYMBOL(kSbMallocAlignment);
#if SB_API_VERSION >= 14
REGISTER_SYMBOL(kSbMaxSystemPathCacheDirectorySize);
#endif // SB_API_VERSION >= 14
REGISTER_SYMBOL(kSbMaxThreadLocalKeys);
REGISTER_SYMBOL(kSbMaxThreadNameLength);
REGISTER_SYMBOL(kSbMaxThreads);
Expand Down
2 changes: 0 additions & 2 deletions starboard/linux/shared/configuration_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,8 @@ const int kSbPreferredRgbaByteOrder = SB_PREFERRED_RGBA_BYTE_ORDER_RGBA;
const uint32_t kSbUserMaxSignedIn = 1;
#endif // SB_API_VERSION < 16

#if SB_API_VERSION >= 14
// The maximum size the cache directory is allowed to use in bytes.
const uint32_t kSbMaxSystemPathCacheDirectorySize = 24 << 20; // 24MiB
#endif

#if SB_API_VERSION >= 16
SB_EXPORT extern const bool kSbCanMapExecutableMemory = true;
Expand Down
2 changes: 0 additions & 2 deletions starboard/linux/shared/media_is_audio_supported.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ bool SbMediaIsAudioSupported(SbMediaAudioCodec audio_codec,
if (audio_codec == kSbMediaAudioCodecVorbis) {
return bitrate <= kSbMediaMaxAudioBitrateInBitsPerSecond;
}
#if SB_API_VERSION >= 14
if (audio_codec == kSbMediaAudioCodecMp3) {
return bitrate <= kSbMediaMaxAudioBitrateInBitsPerSecond;
}
Expand All @@ -55,7 +54,6 @@ bool SbMediaIsAudioSupported(SbMediaAudioCodec audio_codec,
if (audio_codec == kSbMediaAudioCodecFlac) {
return bitrate <= kSbMediaMaxAudioBitrateInBitsPerSecond;
}
#endif // SB_API_VERSION >= 14

return false;
}
6 changes: 0 additions & 6 deletions starboard/linux/x64x11/system_get_property_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ const char kModelName[] = "ModelName";
const char kPlatformName[] = "X11; Linux x86_64";
const char kSystemIntegratorName[] = "SystemIntegratorName";

#if SB_API_VERSION >= 14
const char kModelYear[] = "2023";
#else
const char kModelYear[] = "2022";
#endif // SB_API_VERSION
} // namespace

// Omit namespace linux due to symbol name conflict.
Expand Down Expand Up @@ -109,7 +105,6 @@ bool GetSystemProperty(SbSystemPropertyId property_id,
case kSbSystemPropertySpeechApiKey:
case kSbSystemPropertyUserAgentAuxField:
return false;
#if SB_API_VERSION >= 14
// Implementation provided for testing purposes only
case kSbSystemPropertyAdvertisingId:
return CopyStringAndTestIfSuccess(
Expand All @@ -119,7 +114,6 @@ bool GetSystemProperty(SbSystemPropertyId property_id,
return CopyStringAndTestIfSuccess(
out_value, value_length,
GetEnvironment("COBALT_LIMIT_AD_TRACKING").c_str());
#endif
#if SB_API_VERSION >= 15
case kSbSystemPropertyDeviceType:
return CopyStringAndTestIfSuccess(out_value, value_length,
Expand Down
18 changes: 0 additions & 18 deletions starboard/media.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@ typedef enum SbMediaAudioCodec {
kSbMediaAudioCodecEac3,
kSbMediaAudioCodecOpus,
kSbMediaAudioCodecVorbis,
#if SB_API_VERSION >= 14
kSbMediaAudioCodecMp3,
kSbMediaAudioCodecFlac,
kSbMediaAudioCodecPcm,
#endif // SB_API_VERSION >= 14
#if SB_API_VERSION >= 15
kSbMediaAudioCodecIamf,
#endif // SB_API_VERSION >= 15
Expand Down Expand Up @@ -279,14 +277,8 @@ typedef enum SbMediaMatrixId {
kSbMediaMatrixIdYDzDx = 11,

kSbMediaMatrixIdLastStandardValue = kSbMediaMatrixIdYDzDx,
#if SB_API_VERSION >= 14
kSbMediaMatrixIdInvalid = 255,
kSbMediaMatrixIdLast = kSbMediaMatrixIdInvalid,
#else // SB_API_VERSION >= 14
kSbMediaMatrixIdUnknown = 1000,
kSbMediaMatrixIdLast = kSbMediaMatrixIdUnknown,
#endif // SB_API_VERSION >= 14

} SbMediaMatrixId;

// This corresponds to the WebM Range enum which is part of WebM color data (see
Expand Down Expand Up @@ -702,12 +694,7 @@ typedef enum SbMediaBufferStorageType {
// a larger value may increase the memory consumption of media buffers.
//
#if SB_API_VERSION < 16
#if SB_API_VERSION >= 14
SB_EXPORT int SbMediaGetBufferAlignment();
#else // SB_API_VERSION >= 14
// |type|: the media type of the stream (audio or video).
SB_EXPORT int SbMediaGetBufferAlignment(SbMediaType type);
#endif // SB_API_VERSION >= 14
#endif // SB_API_VERSION < 16

// When the media stack needs more memory to store media buffers, it will
Expand Down Expand Up @@ -767,12 +754,7 @@ SB_EXPORT int SbMediaGetMaxBufferCapacity(SbMediaVideoCodec codec,
// can be use optimally by specific instructions like SIMD. Set to 0 to remove
// any padding.
//
#if SB_API_VERSION >= 14
SB_EXPORT int SbMediaGetBufferPadding();
#else // SB_API_VERSION >= 14
// |type|: the media type of the stream (audio or video).
SB_EXPORT int SbMediaGetBufferPadding(SbMediaType type);
#endif // SB_API_VERSION >= 14

// When either SbMediaGetInitialBufferCapacity or SbMediaGetBufferAllocationUnit
// isn't zero, media buffers will be allocated using a memory pool. Set the
Expand Down
Loading

0 comments on commit 2817bd8

Please sign in to comment.