Webrtc android auto add VUI byte behind h264 sps? How to stop it?

65 views
Skip to first unread message

wei liu

unread,
Dec 21, 2021, 4:05:41 AM12/21/21
to discuss-webrtc
Hi everyone:
    I am developing a home fitness app, only for Android. The app calls the hardware codce of the device to  encoding and decoding of h.264. Everything works fine, except one HiSi CPU (3798mv200), this type of equipment can be hardware encoded, but the hardware decoding does not display anything. I believe that most people will not touch this kind of equipment, but I have millions of them, I must solve this problem.
    So I added a print on the sending device, located in HardwareVideoEncoder.java deliverEncodedImage(), and printed the configBuffer of KeyFrame. I found that there are sps and pps information in the configBuffer, and the vui_parameters_present_flag of sps is set to 0
微信图片_20211221111921.png

On the receiving device, I also added printing, located in AndroidVideoDecoder.java decode(EncodedImage frame, DecodeInfo info)
try {
String path = "/sdcard/workout/hisi.h264";
File file = new File(path);
if (!file.exists()) {
file.createNewFile();
}
FileChannel fc = new FileOutputStream(path,true).getChannel();
fc.write(frame.buffer);
fc.close();
} catch (Exception e) {
Logging.e(TAG, e.getMessage());
}
frame.buffer stores the frame data that enters mediacodec and waitting for decode. I used software to analyze it.
微信图片_20211221112124.png
hisi.h264关键帧分析.png
  It is found that the received key frame contains VUI information. Is this added by the sender or by the receiver? Can I turn off VUI information addition?  Test whether it can decode successfully after closing it.

Thank you, looking forward to your answer !
Reply all
Reply to author
Forward
0 new messages