简体   繁体   English

Chrome Android 未使用 SDP 提供的所有编解码器选项

[英]Chrome Android not using all codec options in SDP offer

When I run RTCRtpSender.getCapabilities("video").codecs;当我运行RTCRtpSender.getCapabilities("video").codecs; on Chrome Android it includes H264.在 Chrome Android 上,它包括 H264。 However, I run var offer = RTCPeerConnection.createOffer() and look at offer.sdp it will only sometimes include H264 in the offer.但是,我运行var offer = RTCPeerConnection.createOffer()并查看offer.sdp ,它有时只会在报价中包含 H264。 This is causing me issues with an application that requires H264 - it works inconsistently as a result of rejecting those offers that don't include H264, and I don't know how to force the SDP offer to include it.这导致我使用需要 H264 的应用程序出现问题 - 由于拒绝那些不包含 H264 的报价,它的工作方式不一致,而且我不知道如何强制 SDP 报价包含它。 How do I make sure createOffer includes all available codecs?如何确保createOffer包含所有可用的编解码器? I would prefer not to have to do any manual editing of the SDP.我宁愿不必对 SDP 进行任何手动编辑。

I've been facing the same problem.我一直面临着同样的问题。 As Pedro Vergara commented, it looks like a bug introduced in recent versions of Chrome Android.正如 Pedro Vergara 评论的那样,它看起来像是 Chrome Android 的最新版本中引入的一个错误。 For now, I did a simple workaround by keep calling RTCRtpSender.getCapabilities('video') until it lists the expected H.264 codec support, before any attempt to create the SDP offer.目前,我通过继续调用RTCRtpSender.getCapabilities('video')做了一个简单的解决方法,直到它列出了预期的 H.264 编解码器支持,然后再尝试创建 SDP 报价。 Something like this:像这样的东西:

console.log('Waiting for H.264 codec support');
checkH264(20);

function checkH264(count) {
  if (count > 0) {
    console.log('Getting video codec capabilities');
    let capabilities = JSON.stringify(RTCRtpSender.getCapabilities('video').codecs);
    console.log(capabilities);
    if (capabilities.toLowerCase().includes('video/h264')) {
      console.log('H.264 support found. Ready to proceed now! =)');
      // Proceed to SDP offer creation...
    } else {
      setTimeout(checkH264, 1000, count - 1);
    }
  } else {
    console.warn('H.264 support not found');
    // Proceed with caution. SDP offer may not contain H.264...
  }
}

Notice that the code above gives some time for Chrome to make H.264 available, by using setTimeout() .请注意,上面的代码通过使用setTimeout()为 Chrome 提供了一些时间来使 H.264 可用。 Just calling RTCRtpSender.getCapabilities('video') twice or more without really waiting may not work.只是在没有真正等待的情况下调用RTCRtpSender.getCapabilities('video')两次或更多次可能行不通。

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

相关问题 设置远程答案sdp webrtc android后再次创建的报价 - offer created again after setting remote answer sdp webrtc android Android AudioRecord和AudioTrack编解码器选项? - Android AudioRecord and AudioTrack codec options? kurento android客户端库:如何从sdp提供视频流? - kurento android client library: how to get video stream from sdp offer? 了解如何为android / iphone之间的要约/答案(webrtc)生成正确的sdp - Understanding how to generate correct sdp for offer/answer (webrtc) between android/Iphone 在Android Webrtc上生成本地SDP报价时发生“ EGL上下文未设置”错误 - “ EGL context not set ” Error Occurs while generating local SDP offer on android Webrtc 无法设置远程报价sdp:在没有SDES加密的情况下使用SDP调用 - Failed to set remote offer sdp: Called with SDP without SDES crypto Chrome / Android Jingle-SDP ICE连接失败 - Chrome / Android Jingle-SDP ICE connection failure 无法在Chrome / Android的多选字段中取消选择所有选项 - Can't deselect all options in a multi select field on Chrome/Android 由于 session 选项无效,Android webrtc 无法创建报价 - Android webrtc cannot create offer due to invalid session options Android到Chrome的选项 - Android to Chrome Options
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM