简体   繁体   English

为什么WebRTC仅在Chrome中支持H264,而在某些设备的本机应用程序中不支持

[英]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. 我使用官方示例在Android Chrome中创建商品SDP,我们可以找到a=rtpmap:100 H264/90000 ,这意味着它可以支持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. 但是,如果我构建AppRTC(Android官方示例)并使用官方预构建库版本1.0.25821,请调用createOffer,然后在SdpObserver::onCreateSuccess接收SDP,则SDP 包含H264。

My test device is Oppo R15 (with MTK Helio P60, Android 8.1). 我的测试设备是Oppo R15(带有MTK Helio P60,Android 8.1)。

So, why WebRTC only support H264 in Chrome but not in native application with some Android devices? 那么,为什么WebRTC仅在Chrome中支持H264,而在某些Android设备上不支持本机应用程序?

Chrome build uses openh264 which is not used by regular **WebRTC . Chrome版本使用openh264,而常规** 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. 我通常所说的是,您可能会使用chrome版本的h.264编码器软件,但我不建议这样做。

On Android WebRTC , H.264 is supported only if 在Android WebRTC上 ,仅在以下情况下支持H.264

  1. device hardware supports it, AND 设备硬件支持它,并且
  2. WebRTC hardware encoder glue logic supports that hardware encoder. WebRTC硬件编码器粘合逻辑支持该硬件编码器。 Currently only QCOM and EXYNOS devices are supported. 当前仅支持QCOMEXYNOS设备。 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. 因此,即使任何其他设备支持h.264 HW编码器,也不会被使用,也不会作为编解码器工厂的一部分被添加,并且您不会在从WebRTC示例应用程序生成的SDP中看到。

At Java level, you can see that in HardwareVideoEncoderFactory.java which checks for QCOM and EXYNOS devices in isHardwareSupportedInCurrentSdkH264 function. 在Java级别,您可以在HardwareVideoEncoderFactory.java中看到该代码,它在isHardwareSupportedInCurrentSdkH264函数中检查QCOM和EXYNOS设备。

Interestingly, if you are using native code, even QCOM and EXYNOS hardware encoders are not supported (there is bug filed on Webrtc issue tracker). 有趣的是,如果您使用的是本机代码,则甚至不支持QCOM和EXYNOS硬件编码器(Webrtc问题跟踪器中已记录了错误)。 This is because of tight integration of HW encoding code with JNI code - definitely not a good modular code. 这是由于HW编码代码与JNI代码的紧密集成-绝对不是一个好的模块化代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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