Skip to content

Commit 915ec8a

Browse files
committed
[Android]adapt to 4003 version rtc sdk and etc.
1 parent b1a33b0 commit 915ec8a

22 files changed

Lines changed: 109 additions & 415 deletions

File tree

.github/ci/build/build_android.sh

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
# pr: output test.zip to workspace dir
3838
# others: Rename the zip package name yourself, But need copy it to workspace dir
3939
##################################
40-
4140
echo Package_Publish: $Package_Publish
4241
echo is_tag_fetch: $is_tag_fetch
4342
echo arch: $arch
@@ -72,3 +71,39 @@ cp -rf ./Android/APIExample$(echo $sdk_url | cut -d "/" -f 9 | grep audio_only |
7271

7372
7za a -tzip result.zip -r $unzip_name
7473
cp result.zip $WORKSPACE/withAPIExample_$zip_name
74+
75+
# install android sdk
76+
which java
77+
java --version
78+
echo ${ANDROID_HOME}
79+
ls -al ${ANDROID_HOME}/*
80+
81+
cd ./$unzip_name/samples/
82+
mkdir AndroidSDK
83+
export ANDROID_HOME=$(pwd)/AndroidSDK
84+
cd -
85+
cd ${ANDROID_HOME}
86+
wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
87+
unzip commandlinetools-linux-8512546_latest.zip
88+
export PATH=$(pwd)/cmdline-tools/bin:$PATH
89+
yes | sdkmanager --licenses --sdk_root=${ANDROID_HOME}
90+
yes | sdkmanager "platform-tools" "platforms;android-31" --sdk_root=${ANDROID_HOME}
91+
cd -
92+
93+
# compile apk
94+
cd ./$unzip_name/samples/API-example
95+
pwd
96+
ls -al
97+
sed -i -e "s#YOUR APP ID#${APP_ID}#g" app/src/main/res/values/string_configs.xml
98+
sed -i -e "s#YOUR APP CERTIFICATE##g" app/src/main/res/values/string_configs.xml
99+
sed -i -e "s#YOUR ACCESS TOKEN##g" app/src/main/res/values/string_configs.xml
100+
rm -f app/src/main/res/values/string_configs.xml-e
101+
cat app/src/main/res/values/string_configs.xml
102+
./gradlew clean
103+
./gradlew :app:assembleDebug
104+
cp app/build/outputs/apk/debug/app-debug.apk ./APIExample_Android_$(date "+%y%m%d%H").apk
105+
7za a -tzip result.zip -r *.apk
106+
cp result.zip $WORKSPACE/APIExample_Android_apk.zip
107+
ls $WORKSPACE
108+
cd -
109+

Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/advanced/PreCallTest.java

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public class PreCallTest extends BaseFragment implements View.OnClickListener {
4141

4242
private RtcEngine engine;
4343
private int myUid;
44-
private Button btn_lastmile, btn_echo, btn_device_test;
44+
private Button btn_lastmile, btn_echo;
4545
private StatisticsInfo statisticsInfo;
46-
private TextView lastmileQuality, lastmileResult, labelDeviceTest;
46+
private TextView lastmileQuality, lastmileResult;
4747
private static final Integer MAX_COUNT_DOWN = 8;
4848
private int num;
4949
private Timer echoTimer;
@@ -121,9 +121,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat
121121
btn_echo.setOnClickListener(this);
122122
btn_lastmile = view.findViewById(R.id.btn_lastmile);
123123
btn_lastmile.setOnClickListener(this);
124-
btn_device_test = view.findViewById(R.id.btn_device_test);
125-
btn_device_test.setOnClickListener(this);
126-
labelDeviceTest = view.findViewById(R.id.lb_device_test);
127124
lastmileQuality = view.findViewById(R.id.lastmile_quality);
128125
lastmileResult = view.findViewById(R.id.lastmile_result);
129126
}
@@ -178,19 +175,6 @@ else if(num >= MAX_COUNT_DOWN) {
178175
}
179176
}
180177
}, 1000, 1000);
181-
}else if(v.getId() == R.id.btn_device_test){
182-
boolean enable = btn_device_test.getTag() instanceof Boolean && (Boolean) btn_device_test.getTag();
183-
if(!enable){
184-
engine.startRecordingDeviceTest(500);
185-
btn_device_test.setText(R.string.stop);
186-
btn_device_test.setTag(true);
187-
handler.postDelayed(() -> onClick(v), 10* 1000);
188-
}else{
189-
engine.stopRecordingDeviceTest();
190-
btn_device_test.setText(R.string.start);
191-
btn_device_test.setTag(null);
192-
labelDeviceTest.setText("");
193-
}
194178
}
195179
}
196180

@@ -322,11 +306,6 @@ public void onLastmileProbeResult(LastmileProbeResult lastmileProbeResult) {
322306
});
323307
}
324308

325-
@Override
326-
public void onAudioVolumeIndication(AudioVolumeInfo[] speakers, int totalVolume) {
327-
super.onAudioVolumeIndication(speakers, totalVolume);
328-
runOnUIThread(() -> labelDeviceTest.append("totalVolume=" + totalVolume + "\n"));
329-
}
330309
};
331310

332311
private void updateLastMileResult() {

Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/advanced/ProcessAudioRawData.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,6 @@ public boolean onMixedAudioFrame(String channel, int audioFrameType, int samples
321321
return false;
322322
}
323323

324-
@Override
325-
public boolean onEarMonitoringAudioFrame(int type, int samplesPerChannel, int bytesPerSample, int channels, int samplesPerSec, ByteBuffer buffer, long renderTimeMs, int avsync_type) {
326-
return false;
327-
}
328-
329324
@Override
330325
public boolean onPlaybackAudioFrameBeforeMixing(String channel, int uid, int audioFrameType, int samples, int bytesPerSample, int channels, int samplesPerSec, ByteBuffer byteBuffer, long renderTimeMs, int bufferLength) {
331326
return false;
@@ -351,10 +346,6 @@ public AudioParams getMixedAudioParams() {
351346
return null;
352347
}
353348

354-
@Override
355-
public AudioParams getEarMonitoringAudioParams() {
356-
return null;
357-
}
358349
};
359350

360351
/**

Android/APIExample-Audio/app/src/main/java/io/agora/api/example/examples/advanced/SpatialSound.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ public void onPreloadEvent(String src, Constants.MediaPlayerPreloadEvent event)
239239

240240
}
241241

242+
@Override
243+
public void onCompleted() {
244+
245+
}
246+
242247
@Override
243248
public void onAgoraCDNTokenWillExpire() {
244249

Android/APIExample-Audio/app/src/main/res/layout/fragment_precall_test.xml

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,4 @@
6868

6969
</RelativeLayout>
7070

71-
<LinearLayout
72-
android:layout_width="match_parent"
73-
android:layout_height="0dp"
74-
android:layout_weight="1"
75-
android:layout_marginHorizontal="16dp"
76-
android:orientation="vertical"
77-
android:layout_marginTop="16dp">
78-
79-
<TextView
80-
android:layout_width="wrap_content"
81-
android:layout_height="wrap_content"
82-
android:text="RecordingDeviceTest" />
83-
84-
<androidx.appcompat.widget.AppCompatButton
85-
android:id="@+id/btn_device_test"
86-
android:layout_width="wrap_content"
87-
android:layout_height="wrap_content"
88-
android:text="@string/start" />
89-
90-
<TextView
91-
android:id="@+id/lb_device_test"
92-
android:layout_width="wrap_content"
93-
android:layout_height="wrap_content"
94-
android:layout_marginTop="8dp"
95-
android:gravity="bottom"/>
96-
97-
</LinearLayout>
98-
9971
</LinearLayout>

Android/APIExample/agora-simple-filter/src/main/cpp/AgoraRtcKit/AgoraBase.h

Lines changed: 12 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,6 @@ enum INTERFACE_ID_TYPE {
845845
AGORA_IID_CLOUD_SPATIAL_AUDIO = 10,
846846
AGORA_IID_LOCAL_SPATIAL_AUDIO = 11,
847847
AGORA_IID_MEDIA_RECORDER = 12,
848-
AGORA_IID_STATE_SYNC = 13,
849-
AGORA_IID_METACHAT_SERVICE = 14,
850848
};
851849

852850
/**
@@ -1500,7 +1498,6 @@ struct EncodedVideoFrameInfo {
15001498
rotation(VIDEO_ORIENTATION_0),
15011499
trackId(0),
15021500
captureTimeMs(0),
1503-
decodeTimeMs(0),
15041501
uid(0),
15051502
streamType(VIDEO_STREAM_HIGH) {}
15061503

@@ -1513,7 +1510,6 @@ struct EncodedVideoFrameInfo {
15131510
rotation(rhs.rotation),
15141511
trackId(rhs.trackId),
15151512
captureTimeMs(rhs.captureTimeMs),
1516-
decodeTimeMs(rhs.decodeTimeMs),
15171513
uid(rhs.uid),
15181514
streamType(rhs.streamType) {}
15191515

@@ -1527,7 +1523,6 @@ struct EncodedVideoFrameInfo {
15271523
rotation = rhs.rotation;
15281524
trackId = rhs.trackId;
15291525
captureTimeMs = rhs.captureTimeMs;
1530-
decodeTimeMs = rhs.decodeTimeMs;
15311526
uid = rhs.uid;
15321527
streamType = rhs.streamType;
15331528
return *this;
@@ -1568,10 +1563,6 @@ struct EncodedVideoFrameInfo {
15681563
* This is a input parameter which means the timestamp for capturing the video.
15691564
*/
15701565
int64_t captureTimeMs;
1571-
/**
1572-
* The timestamp for decoding the video.
1573-
*/
1574-
int64_t decodeTimeMs;
15751566
/**
15761567
* ID of the user.
15771568
*/
@@ -1605,7 +1596,7 @@ enum VIDEO_MIRROR_MODE_TYPE {
16051596
*/
16061597
struct VideoEncoderConfiguration {
16071598
/**
1608-
* The video encoder code type: #VIDEO_CODEC_TYPE.
1599+
* The video encoder code type: #VIDEO_CODEC_TYPE. reserved , not used now
16091600
*/
16101601
VIDEO_CODEC_TYPE codecType;
16111602
/**
@@ -1776,7 +1767,7 @@ enum SIMULCAST_STREAM_MODE {
17761767
/*
17771768
* disable simulcast stream
17781769
*/
1779-
DISABLE_SIMULCAST_STREM = 0,
1770+
DISABLE_SIMULCAST_STREAM = 0,
17801771
/*
17811772
* always enable simulcast stream
17821773
*/
@@ -1794,14 +1785,14 @@ struct SimulcastStreamConfig {
17941785
/**
17951786
* The video bitrate (Kbps).
17961787
*/
1797-
int kBitrate;
1788+
int bitrate;
17981789
/**
17991790
* The video framerate.
18001791
*/
18011792
int framerate;
1802-
SimulcastStreamConfig() : dimensions(160, 120), kBitrate(65), framerate(5) {}
1793+
SimulcastStreamConfig() : dimensions(160, 120), bitrate(65), framerate(5) {}
18031794
bool operator==(const SimulcastStreamConfig& rhs) const {
1804-
return dimensions == rhs.dimensions && kBitrate == rhs.kBitrate && framerate == rhs.framerate;
1795+
return dimensions == rhs.dimensions && bitrate == rhs.bitrate && framerate == rhs.framerate;
18051796
}
18061797
};
18071798

@@ -4374,20 +4365,6 @@ enum VOICE_CONVERSION_PRESET {
43744365
VOICE_CHANGER_BASS = 0x03010400
43754366
};
43764367

4377-
/** The options for SDK preset headphone equalizer.
4378-
*/
4379-
enum HEADPHONE_EQUALIZER_PRESET {
4380-
/** Turn off headphone EQ and use the original voice.
4381-
*/
4382-
HEADPHONE_EQUALIZER_OFF = 0x00000000,
4383-
/** For over-ear headphones.
4384-
*/
4385-
HEADPHONE_EQUALIZER_OVEREAR = 0x04000001,
4386-
/** For in-ear headphones.
4387-
*/
4388-
HEADPHONE_EQUALIZER_INEAR = 0x04000002
4389-
};
4390-
43914368
/**
43924369
* The screen sharing encoding parameters.
43934370
*/
@@ -5351,37 +5328,33 @@ class LicenseCallback {
53515328
*/
53525329
struct SpatialAudioParams {
53535330
/**
5354-
* Speaker azimuth in a spherical coordinate system centered on the listener.
5331+
* optional azimuth: speaker azimuth in a spherical coordinate system centered on the listener
53555332
*/
53565333
Optional<double> speaker_azimuth;
53575334
/**
5358-
* Speaker elevation in a spherical coordinate system centered on the listener.
5335+
* optional azimuth: speaker elevation in a spherical coordinate system centered on the listener
53595336
*/
53605337
Optional<double> speaker_elevation;
53615338
/**
5362-
* Distance between speaker and listener.
5339+
* distance between speaker and listener
53635340
*/
53645341
Optional<double> speaker_distance;
53655342
/**
5366-
* Speaker orientation [0-180], 0 degree is the same with listener orientation.
5343+
* speaker orientation [0-180]: 0 degree is the same with listener orientation
53675344
*/
53685345
Optional<int> speaker_orientation;
53695346
/**
5370-
* Enable blur or not for the speaker.
5347+
* enable blur or not for the speaker
53715348
*/
53725349
Optional<bool> enable_blur;
53735350
/**
5374-
* Enable air absorb or not for the speaker.
5351+
* enable air absorb or not for the speaker
53755352
*/
53765353
Optional<bool> enable_air_absorb;
53775354
/**
5378-
* Speaker attenuation factor.
5355+
* speaker attenuation factor
53795356
*/
53805357
Optional<double> speaker_attenuation;
5381-
/**
5382-
* Enable doppler factor.
5383-
*/
5384-
Optional<bool> enable_doppler;
53855358
};
53865359

53875360
} // namespace agora
@@ -5444,28 +5417,3 @@ AGORA_API void setAgoraLicenseCallback(agora::base::LicenseCallback *callback);
54445417
*/
54455418

54465419
AGORA_API agora::base::LicenseCallback* getAgoraLicenseCallback();
5447-
5448-
/*
5449-
* Get monotonic time in ms which can be used by capture time,
5450-
* typical scenario is as follows:
5451-
*
5452-
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5453-
* | // custom audio/video base capture time, e.g. the first audio/video capture time. |
5454-
* | int64_t custom_capture_time_base; |
5455-
* | |
5456-
* | int64_t agora_monotonic_time = getAgoraCurrentMonotonicTimeInMs(); |
5457-
* | |
5458-
* | // offset is fixed once calculated in the begining. |
5459-
* | const int64_t offset = agora_monotonic_time - custom_capture_time_base; |
5460-
* | |
5461-
* | // realtime_custom_audio/video_capture_time is the origin capture time that customer provided.|
5462-
* | // actual_audio/video_capture_time is the actual capture time transfered to sdk. |
5463-
* | int64_t actual_audio_capture_time = realtime_custom_audio_capture_time + offset; |
5464-
* | int64_t actual_video_capture_time = realtime_custom_video_capture_time + offset; |
5465-
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5466-
*
5467-
* @return
5468-
* - >= 0: Success.
5469-
* - < 0: Failure.
5470-
*/
5471-
AGORA_API int64_t AGORA_CALL getAgoraCurrentMonotonicTimeInMs();

Android/APIExample/agora-simple-filter/src/main/cpp/AgoraRtcKit/AgoraMediaBase.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -603,9 +603,6 @@ struct ExternalVideoFrame {
603603
/**
604604
* The timestamp (ms) of the incoming video frame. An incorrect timestamp results in a frame loss or
605605
* unsynchronized audio and video.
606-
*
607-
* Please refer to getAgoraCurrentMonotonicTimeInMs or getCurrentMonotonicTimeInMs
608-
* to determine how to fill this filed.
609606
*/
610607
long long timestamp;
611608
/**
@@ -863,9 +860,6 @@ class IAudioFrameObserverBase {
863860
/** The position for observing the audio of a single remote user before mixing
864861
*/
865862
AUDIO_FRAME_POSITION_BEFORE_MIXING = 0x0008,
866-
/** The position for observing the ear monitoring audio of the local user
867-
*/
868-
AUDIO_FRAME_POSITION_EAR_MONITORING = 0x0010,
869863
};
870864

871865
struct AudioParams {
@@ -929,14 +923,6 @@ class IAudioFrameObserverBase {
929923
* - false: The mixed audio data is invalid and is not encoded or sent.
930924
*/
931925
virtual bool onMixedAudioFrame(const char* channelId, AudioFrame& audioFrame) = 0;
932-
/**
933-
* Occurs when the ear monitoring audio frame is received.
934-
* @param audioFrame The reference to the audio frame: AudioFrame.
935-
* @return
936-
* - true: The ear monitoring audio data is valid and is encoded and sent.
937-
* - false: The ear monitoring audio data is invalid and is not encoded or sent.
938-
*/
939-
virtual bool onEarMonitoringAudioFrame(AudioFrame& audioFrame) = 0;
940926
/**
941927
* Occurs when the before-mixing playback audio frame is received.
942928
* @param channelId The channel name
@@ -1006,18 +992,6 @@ class IAudioFrameObserverBase {
1006992
@return Sets the audio format. See AgoraAudioParams.
1007993
*/
1008994
virtual AudioParams getMixedAudioParams() = 0;
1009-
1010-
/** Sets the ear monitoring audio format
1011-
**Note**:
1012-
- The SDK calculates the sample interval according to the `AudioParams`
1013-
you set in the return value of this callback and triggers the
1014-
`onEarMonitoringAudioFrame` callback at the calculated sample interval.
1015-
Sample interval (seconds) = `samplesPerCall`/(`sampleRate` × `channel`).
1016-
Ensure that the value of sample interval is equal to or greater than 0.01.
1017-
1018-
@return Sets the audio format. See AgoraAudioParams.
1019-
*/
1020-
virtual AudioParams getEarMonitoringAudioParams() = 0;
1021995
};
1022996

1023997
/**

0 commit comments

Comments
 (0)