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

Skip to first unread message

wei liu

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

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()) {
FileChannel fc = new FileOutputStream(path,true).getChannel();
} 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.
  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
0 new messages