Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

H264 HW encoder with 83-sdk hang on huawei mobile phone #117

Open
herryfan opened this issue Jan 22, 2021 · 5 comments
Open

H264 HW encoder with 83-sdk hang on huawei mobile phone #117

herryfan opened this issue Jan 22, 2021 · 5 comments

Comments

@herryfan
Copy link

Hi, using 83-sdk for android, HW H264 encoder will hang after several seconds on Huawei P30(kirin 980).
E org.webrtc.Logging: HardwareVideoEncoder: Dropped frame, encoder queue full
E org.webrtc.Logging: HardwareVideoEncoder: Dropped frame, encoder queue full
...
Would you give some suggestion?

@zhoufeng1213
Copy link

出现丢弃帧的时候,重置编码器
if (outputBuilders.size() > MAX_ENCODER_Q_SIZE) {
// Too many frames in the encoder. Drop this frame.
Logging.e(TAG, "Dropped frame, encoder queue full");
VideoCodecStatus status = resetCodec(frameWidth, frameHeight, shouldUseSurfaceMode);
if (status != VideoCodecStatus.OK) {
return status;
}
return VideoCodecStatus.NO_OUTPUT;
}

@WOSHINPC
Copy link

WOSHINPC commented Sep 1, 2022

万分感谢,我个搞java后台的脑子一抽主动要了个在安卓上接srs-webrtc的活,在华为android8的平板上功能很快做完了,用小米android12也没问题,结果换个华为harmony2.0和android10的测试就废了,只要多来几个播流,视频推流就断了,偏偏声音还正常,还伴随各种其他奇葩情况,底层码农对这些又不是很懂,折腾了快一星期,原来丢帧的时候重置一下编码器就行了

@sheng930920
Copy link

@WOSHINPC 咨询一下这个问题你解决了么,遇到同样的问题,出现这个问题应该怎么解决

@WOSHINPC
Copy link

@sheng930920 先找到源码里的HardwareVideoEncoderFactory和HardwareVideoEncoder,复制一份自定义个名字,包名要和源码一样,在HardwareVideoEncoder里找到"Dropped frame, encoder queue full"这个错误提示,把下面的代码改成上面那位大佬写的那样,再把HardwareVideoEncoderFactory里用到HardwareVideoEncoder都改成自定义的,PeerConnectionFactory.builder().setVideoEncoderFactory()设置一下自定义的HardwareVideoEncoderFactory

@dou23
Copy link

dou23 commented Dec 13, 2023

https://github.com/moonlight-stream/moonlight-android/blob/master/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java
参考一下这个类,setDecoderLowLatencyOptions方法中MediaFormat根据了各家芯片做了对应的设置。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants