Skip to content
This repository was archived by the owner on Mar 18, 2023. It is now read-only.

Commit d80bc5d

Browse files
committed
android: optimize oboe build size
1 parent c25cb40 commit d80bc5d

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.changeset/unlucky-bikes-design.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"auph": patch
3+
---
4+
5+
android: optimize oboe build size

android/oboe/include/oboe/ResultWithValue.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
#define OBOE_RESULT_WITH_VALUE_H
1919

2020
#include "oboe/Definitions.h"
21+
22+
#ifdef OBOE_ENABLE_LOGGING
2123
#include <iostream>
2224
#include <sstream>
25+
#endif //OBOE_ENABLE_LOGGING
2326

2427
namespace oboe {
2528

@@ -136,6 +139,7 @@ class ResultWithValue {
136139
const oboe::Result mError;
137140
};
138141

142+
#ifdef OBOE_ENABLE_LOGGING
139143
/**
140144
* If the result is `OK` then return the value, otherwise return a human-readable error message.
141145
*/
@@ -148,6 +152,7 @@ std::ostream& operator<<(std::ostream &strm, const ResultWithValue<T> &result) {
148152
}
149153
return strm;
150154
}
155+
#endif //OBOE_ENABLE_LOGGING
151156

152157
} // namespace oboe
153158

android/oboe/src/common/Utilities.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717

1818
#include <stdlib.h>
1919
#include <unistd.h>
20+
21+
#ifdef OBOE_ENABLE_LOGGING
2022
#include <sstream>
23+
#endif //OBOE_ENABLE_LOGGING
2124

2225
#ifdef __ANDROID__
2326
#include <sys/system_properties.h>
@@ -72,6 +75,8 @@ int32_t convertFormatToSizeInBytes(AudioFormat format) {
7275
return size;
7376
}
7477

78+
#ifdef OBOE_ENABLE_LOGGING
79+
7580
template<>
7681
const char *convertToText<Result>(Result returnCode) {
7782
switch (returnCode) {
@@ -274,6 +279,15 @@ const char *convertToText<ChannelCount>(ChannelCount channelCount) {
274279
}
275280
}
276281

282+
#else
283+
284+
template<typename FromType>
285+
const char *convertToText(FromType) {
286+
return "";
287+
}
288+
289+
#endif //OBOE_ENABLE_LOGGING
290+
277291
std::string getPropertyString(const char * name) {
278292
std::string result;
279293
#ifdef __ANDROID__

0 commit comments

Comments
 (0)