Commit 9cdc90c8 authored by Michael Froman's avatar Michael Froman
Browse files

Bug 1828517 - Vendor libwebrtc from f7e40717ab

Upstream commit: https://webrtc.googlesource.com/src/+/f7e40717ab3c909f8b98251923dd54f465d59da7
    Only generate codec stats for the video send/recv codec in use

    instead of the full set of codecs that have been negotiated.

    BUG=webrtc:14808

    Change-Id: I464cc1d20e5b5227a09929c909615b432c6be041
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/290885


    Reviewed-by: default avatarHarald Alvestrand <hta@webrtc.org>
    Commit-Queue: Philipp Hancke <phancke@microsoft.com>
    Reviewed-by: default avatarHenrik Boström <hbos@webrtc.org>
    Cr-Commit-Position: refs/heads/main@{#39114}
parent 5d1886f3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -20958,3 +20958,6 @@ c01410ea1e
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
3dd73ae6f4
# MOZ_LIBWEBRTC_SRC=/home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc MOZ_LIBWEBRTC_BRANCH=mozpatches bash dom/media/webrtc/third_party_build/fast-forward-libwebrtc.sh
# base of lastest vendoring
f7e40717ab
+2 −0
Original line number Diff line number Diff line
@@ -13994,3 +13994,5 @@ libwebrtc updated from /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-l
libwebrtc updated from /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-04-21T16:04:02.469043.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-04-21T16:04:57.727902.
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
libwebrtc updated from /home/mfroman/mozilla/moz-central/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2023-04-21T16:06:18.713076.
+19 −9
Original line number Diff line number Diff line
@@ -1745,20 +1745,30 @@ void WebRtcVideoChannel::FillBitrateInfo(BandwidthEstimationInfo* bwe_info) {

void WebRtcVideoChannel::FillSendCodecStats(
    VideoMediaSendInfo* video_media_info) {
  for (const VideoCodec& codec : send_params_.codecs) {
    webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters();
    video_media_info->send_codecs.insert(
        std::make_pair(codec_params.payload_type, std::move(codec_params)));
  RTC_DCHECK_RUN_ON(&thread_checker_);
  if (!send_codec_) {
    return;
  }
  // Note: since RTP stats don't account for RTX and FEC separately (see
  // https://w3c.github.io/webrtc-stats/#dom-rtcstatstype-outbound-rtp)
  // we can omit the codec information for those here and only insert the
  // primary codec that is being used to send here.
  video_media_info->send_codecs.insert(std::make_pair(
      send_codec_->codec.id, send_codec_->codec.ToCodecParameters()));
}

void WebRtcVideoChannel::FillReceiveCodecStats(
    VideoMediaReceiveInfo* video_media_info) {
  // TODO(bugs.webrtc.org/14808): Don't copy codec info around - reference it.
  for (const VideoCodec& codec : recv_params_.codecs) {
    webrtc::RtpCodecParameters codec_params = codec.ToCodecParameters();
  for (const auto& receiver : video_media_info->receivers) {
    auto codec =
        absl::c_find_if(recv_params_.codecs, [&receiver](const VideoCodec& c) {
          return receiver.codec_payload_type &&
                 *receiver.codec_payload_type == c.id;
        });
    if (codec != recv_params_.codecs.end()) {
      video_media_info->receive_codecs.insert(
        std::make_pair(codec_params.payload_type, std::move(codec_params)));
          std::make_pair(codec->id, codec->ToCodecParameters()));
    }
  }
}