Skip to content

Commit 94cbae9

Browse files
iBxsrbxsr
andauthored
fix:hisi chip Error 0x80001001 (flutter-webrtc#1969)
Huawei Phone use MediaRecorder failed. Exception: android.media.MediaCodec$CodecException: Error 0x80001001 @cloudwebrtc Please check! Co-authored-by: bxsr <[email protected]>
1 parent 694e8cf commit 94cbae9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

android/src/main/java/com/cloudwebrtc/webrtc/record/VideoFileRenderer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,18 @@ private boolean tryConfigureEncoder(EncoderConfig config) {
9494
// Use YUV420 semi-planar size (1.5 bytes per pixel) to reduce memory usage
9595
format.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, config.width * config.height * 3 / 2);
9696
format.setInteger(MediaFormat.KEY_PRIORITY, 0);
97-
format.setInteger(MediaFormat.KEY_PROFILE, config.profile);
9897

9998
Log.d(TAG, "Trying encoder config: " + config);
10099

101100
encoder = MediaCodec.createEncoderByType(MIME_TYPE);
102101
String codecName = encoder.getName();
103102
Log.d(TAG, "Codec name: " + codecName);
103+
if ("OMX.hisi.video.encoder.avc".equals(codecName)) {
104+
Log.w(TAG, "hisi h264 encoder does not set 'MediaFormat.KEY_PROFILE'.");
105+
//format.setInteger(MediaFormat.KEY_PROFILE, config.profile);
106+
}else{
107+
format.setInteger(MediaFormat.KEY_PROFILE, config.profile);
108+
}
104109

105110
encoder.configure(format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
106111
// Create input surface *before* starting the encoder

0 commit comments

Comments
 (0)