Skip to content

Commit 5154a23

Browse files
committed
[fix]修复多度Android5.1设备无法正常编码推送音视频问题。
Change-Id: I746ae50cade1e973a6c428de9f4abb5b6b298552
1 parent 5f6a574 commit 5154a23

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

explorer/explorer-device-video/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ dependencies {
5252
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
5353
implementation 'com.alibaba:fastjson:1.2.73'
5454
api 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4'
55-
api 'com.tencent.iot.thirdparty.android:xp2p-sdk:2.4.34'
55+
api 'com.tencent.iot.thirdparty.android:xp2p-sdk:2.4.34-SNAPSHOT'
5656
api 'com.tencent.iot.thirdparty.android:ijkplayer-java:2.0.7'
5757
api 'com.tencent.iot.thirdparty.android:ijkplayer-armv7a:2.0.7'
5858
api 'com.tencent.iot.thirdparty.android:ijkplayer-arm64:2.0.7'

explorer/explorer-device-video/src/main/java/com/tencent/iot/explorer/device/video/recorder/encoder/VideoEncoder.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private void initMediaCodec() {
6161
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
6262
mediaFormat.setInteger(MediaFormat.KEY_LEVEL, MediaCodecInfo.CodecProfileLevel.AVCLevel3);
6363
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
64-
mediaFormat.setInteger(MediaFormat.KEY_PROFILE, MediaCodecInfo.CodecProfileLevel.AVCProfileMain);
64+
// mediaFormat.setInteger(MediaFormat.KEY_PROFILE, MediaCodecInfo.CodecProfileLevel.AVCProfileMain);
6565
}
6666
mediaCodec.configure(mediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
6767
//开始编码
@@ -291,5 +291,7 @@ public void setEncoderListener(OnEncodeListener listener) {
291291

292292
public void stop() {
293293
executor.shutdown();
294+
mediaCodec.stop();
295+
mediaCodec.release();
294296
}
295297
}

explorer/explorer-device-video/src/main/java/com/tencent/iot/explorer/device/video/recorder/param/AudioEncodeParam.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
public class AudioEncodeParam {
99

10-
private int bitRate = 96000; // 比特率
10+
private int bitRate = 16000; // 比特率
1111
private int maxInputSize = 1024 * 1024; // 最大输入数据大小
1212
private String mime = MediaFormat.MIMETYPE_AUDIO_AAC; // 编码格式: 默认 AAC
1313

0 commit comments

Comments
 (0)