简体   繁体   中英

Why WebRTC only support H264 in Chrome but not in native application with some devices

I use official sample to create offer SDP in Android Chrome, we can find a=rtpmap:100 H264/90000 that meant it can support H264.

But if I build AppRTC(official Android sample) and use official prebuilt libraries version 1.0.25821, call createOffer then receive SDP in SdpObserver::onCreateSuccess , the SDP did not contain H264.

My test device is Oppo R15 (with MTK Helio P60, Android 8.1).

So, why WebRTC only support H264 in Chrome but not in native application with some Android devices?

Chrome build uses openh264 which is not used by regular **WebRTC . What I meant by regular is that there is variant with software h.264 encoder from the chrome build which you may use but I wouldn't recommend it.

On Android WebRTC , H.264 is supported only if

  1. device hardware supports it, AND
  2. WebRTC hardware encoder glue logic supports that hardware encoder. Currently only QCOM and EXYNOS devices are supported. So any other devices even if they support h.264 HW encoder, won't be used and won't be added as part of codec factory and you won't see in SDP generated from WebRTC sample apps.

At Java level, you can see that in HardwareVideoEncoderFactory.java which checks for QCOM and EXYNOS devices in isHardwareSupportedInCurrentSdkH264 function.

Interestingly, if you are using native code, even QCOM and EXYNOS hardware encoders are not supported (there is bug filed on Webrtc issue tracker). This is because of tight integration of HW encoding code with JNI code - definitely not a good modular code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM