tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 4e5fb22d6ad08de4e28f7502ccbac2e90bb10556
parent ab81fc29e02545f15964faa5f16a7676560565ef
Author: Dan Baker <dbaker@mozilla.com>
Date:   Thu, 23 Oct 2025 17:43:00 -0600

Bug 1995393 - Vendor libwebrtc from 921ba4cd77

Upstream commit: https://webrtc.googlesource.com/src/+/921ba4cd77eea38c941a62da3e1d9166dea462f1
    clang-tidy: apply modernize-use-designated-initializer to api/ pc/

    split from
      https://webrtc-review.googlesource.com/c/src/+/404061
    see there for full history and manual changes

    Bug: webrtc:424706384
    Change-Id: I4c5ed424481735961c51a1f226fac940767fba4f
    Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/405061
    Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
    Reviewed-by: Harald Alvestrand <hta@webrtc.org>
    Commit-Queue: Philipp Hancke <phancke@meta.com>
    Cr-Commit-Position: refs/heads/main@{#45385}

Diffstat:
Mthird_party/libwebrtc/README.mozilla.last-vendor | 4++--
Mthird_party/libwebrtc/api/audio_codecs/audio_decoder.cc | 3++-
Mthird_party/libwebrtc/api/numerics/samples_stats_counter.cc | 11++++++-----
Mthird_party/libwebrtc/api/video/frame_buffer.cc | 6++++--
Mthird_party/libwebrtc/api/video/video_frame.cc | 4++--
Mthird_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc | 104+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
Mthird_party/libwebrtc/api/video_codecs/h265_profile_tier_level.cc | 65++++++++++++++++++++++++++++++++++++++++++++++++++++-------------
Mthird_party/libwebrtc/api/video_codecs/libaom_av1_encoder_factory.cc | 11+++++++++--
Mthird_party/libwebrtc/api/video_codecs/libaom_av1_encoder_factory_test.cc | 10+++++-----
Mthird_party/libwebrtc/api/video_codecs/simple_encoder_wrapper.cc | 14++++++++------
Mthird_party/libwebrtc/api/video_codecs/simple_encoder_wrapper_unittests.cc | 6+++---
Mthird_party/libwebrtc/api/video_codecs/video_codec.cc | 2+-
Mthird_party/libwebrtc/api/video_codecs/video_encoder_software_fallback_wrapper.cc | 7+++++--
Mthird_party/libwebrtc/moz-patch-stack/s0057.patch | 8++++----
Mthird_party/libwebrtc/moz-patch-stack/s0059.patch | 4++--
Mthird_party/libwebrtc/pc/jsep_transport_unittest.cc | 186+++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Mthird_party/libwebrtc/pc/peer_connection_histogram_unittest.cc | 14+++++++-------
Mthird_party/libwebrtc/pc/sctp_data_channel.cc | 12+++++++++---
Mthird_party/libwebrtc/pc/test/svc_e2e_tests.cc | 6++++--
Mthird_party/libwebrtc/pc/used_ids_unittest.cc | 6++++--
Mthird_party/libwebrtc/pc/video_rtp_track_source_unittest.cc | 2+-
Mthird_party/libwebrtc/pc/webrtc_sdp.cc | 26+++++++++++++++++++-------
22 files changed, 351 insertions(+), 160 deletions(-)

diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T23:40:15.076596+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-23T23:42:48.011803+00:00. # base of lastest vendoring -114566aba4 +921ba4cd77 diff --git a/third_party/libwebrtc/api/audio_codecs/audio_decoder.cc b/third_party/libwebrtc/api/audio_codecs/audio_decoder.cc @@ -48,7 +48,8 @@ class OldStyleEncodedFrame final : public AudioDecoder::EncodedAudioFrame { decoded.size() * sizeof(int16_t), decoded.data(), &speech_type); return ret < 0 ? std::nullopt : std::optional<DecodeResult>( - {static_cast<size_t>(ret), speech_type}); + {.num_decoded_samples = static_cast<size_t>(ret), + .speech_type = speech_type}); } private: diff --git a/third_party/libwebrtc/api/numerics/samples_stats_counter.cc b/third_party/libwebrtc/api/numerics/samples_stats_counter.cc @@ -35,7 +35,8 @@ SamplesStatsCounter& SamplesStatsCounter::operator=(SamplesStatsCounter&&) = default; void SamplesStatsCounter::AddSample(double value) { - AddSample(StatsSample{value, Timestamp::Micros(TimeMicros())}); + AddSample( + StatsSample{.value = value, .time = Timestamp::Micros(TimeMicros())}); } void SamplesStatsCounter::AddSample(StatsSample sample) { @@ -85,8 +86,8 @@ SamplesStatsCounter operator*(const SamplesStatsCounter& counter, double value) { SamplesStatsCounter out; for (const auto& sample : counter.GetTimedSamples()) { - out.AddSample( - SamplesStatsCounter::StatsSample{sample.value * value, sample.time}); + out.AddSample(SamplesStatsCounter::StatsSample{ + .value = sample.value * value, .time = sample.time}); } return out; } @@ -95,8 +96,8 @@ SamplesStatsCounter operator/(const SamplesStatsCounter& counter, double value) { SamplesStatsCounter out; for (const auto& sample : counter.GetTimedSamples()) { - out.AddSample( - SamplesStatsCounter::StatsSample{sample.value / value, sample.time}); + out.AddSample(SamplesStatsCounter::StatsSample{ + .value = sample.value / value, .time = sample.time}); } return out; } diff --git a/third_party/libwebrtc/api/video/frame_buffer.cc b/third_party/libwebrtc/api/video/frame_buffer.cc @@ -127,7 +127,8 @@ bool FrameBuffer::InsertFrame(std::unique_ptr<EncodedFrame> frame) { } const int64_t frame_id = frame->Id(); - auto insert_res = frames_.emplace(frame_id, FrameInfo{std::move(frame)}); + auto insert_res = + frames_.emplace(frame_id, FrameInfo{.encoded_frame = std::move(frame)}); if (!insert_res.second) { // Frame has already been inserted. return false; @@ -312,7 +313,8 @@ void FrameBuffer::FindNextAndLastDecodableTemporalUnit() { if (temporal_unit_decodable) { if (!next_decodable_temporal_unit_) { - next_decodable_temporal_unit_ = {first_frame_it, last_frame_it}; + next_decodable_temporal_unit_ = {.first_frame = first_frame_it, + .last_frame = last_frame_it}; } last_decodable_temporal_unit_timestamp = GetTimestamp(first_frame_it); diff --git a/third_party/libwebrtc/api/video/video_frame.cc b/third_party/libwebrtc/api/video/video_frame.cc @@ -92,7 +92,7 @@ VideoFrame::UpdateRect VideoFrame::UpdateRect::ScaleWithFrame( // Check if update rect is out of the cropped area. if (offset_x + width < crop_x || offset_x > crop_x + crop_width || offset_y + height < crop_y || offset_y > crop_y + crop_width) { - return {0, 0, 0, 0}; + return {.offset_x = 0, .offset_y = 0, .width = 0, .height = 0}; } int x = offset_x - crop_x; @@ -162,7 +162,7 @@ VideoFrame::UpdateRect VideoFrame::UpdateRect::ScaleWithFrame( y = 0; } - return {x, y, w, h}; + return {.offset_x = x, .offset_y = y, .width = w, .height = h}; } VideoFrame::Builder::Builder() = default; diff --git a/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc b/third_party/libwebrtc/api/video_codecs/h264_profile_level_id.cc @@ -63,15 +63,33 @@ struct ProfilePattern { // This is from https://tools.ietf.org/html/rfc6184#section-8.1. constexpr ProfilePattern kProfilePatterns[] = { - {0x42, BitPattern("x1xx0000"), H264Profile::kProfileConstrainedBaseline}, - {0x4D, BitPattern("1xxx0000"), H264Profile::kProfileConstrainedBaseline}, - {0x58, BitPattern("11xx0000"), H264Profile::kProfileConstrainedBaseline}, - {0x42, BitPattern("x0xx0000"), H264Profile::kProfileBaseline}, - {0x58, BitPattern("10xx0000"), H264Profile::kProfileBaseline}, - {0x4D, BitPattern("0x0x0000"), H264Profile::kProfileMain}, - {0x64, BitPattern("00000000"), H264Profile::kProfileHigh}, - {0x64, BitPattern("00001100"), H264Profile::kProfileConstrainedHigh}, - {0xF4, BitPattern("00000000"), H264Profile::kProfilePredictiveHigh444}}; + {.profile_idc = 0x42, + .profile_iop = BitPattern("x1xx0000"), + .profile = H264Profile::kProfileConstrainedBaseline}, + {.profile_idc = 0x4D, + .profile_iop = BitPattern("1xxx0000"), + .profile = H264Profile::kProfileConstrainedBaseline}, + {.profile_idc = 0x58, + .profile_iop = BitPattern("11xx0000"), + .profile = H264Profile::kProfileConstrainedBaseline}, + {.profile_idc = 0x42, + .profile_iop = BitPattern("x0xx0000"), + .profile = H264Profile::kProfileBaseline}, + {.profile_idc = 0x58, + .profile_iop = BitPattern("10xx0000"), + .profile = H264Profile::kProfileBaseline}, + {.profile_idc = 0x4D, + .profile_iop = BitPattern("0x0x0000"), + .profile = H264Profile::kProfileMain}, + {.profile_idc = 0x64, + .profile_iop = BitPattern("00000000"), + .profile = H264Profile::kProfileHigh}, + {.profile_idc = 0x64, + .profile_iop = BitPattern("00001100"), + .profile = H264Profile::kProfileConstrainedHigh}, + {.profile_idc = 0xF4, + .profile_iop = BitPattern("00000000"), + .profile = H264Profile::kProfilePredictiveHigh444}}; struct LevelConstraint { const int max_macroblocks_per_second; @@ -81,23 +99,57 @@ struct LevelConstraint { // This is from ITU-T H.264 (02/2016) Table A-1 – Level limits. constexpr LevelConstraint kLevelConstraints[] = { - {1485, 99, H264Level::kLevel1}, - {1485, 99, H264Level::kLevel1_b}, - {3000, 396, H264Level::kLevel1_1}, - {6000, 396, H264Level::kLevel1_2}, - {11880, 396, H264Level::kLevel1_3}, - {11880, 396, H264Level::kLevel2}, - {19800, 792, H264Level::kLevel2_1}, - {20250, 1620, H264Level::kLevel2_2}, - {40500, 1620, H264Level::kLevel3}, - {108000, 3600, H264Level::kLevel3_1}, - {216000, 5120, H264Level::kLevel3_2}, - {245760, 8192, H264Level::kLevel4}, - {245760, 8192, H264Level::kLevel4_1}, - {522240, 8704, H264Level::kLevel4_2}, - {589824, 22080, H264Level::kLevel5}, - {983040, 36864, H264Level::kLevel5_1}, - {2073600, 36864, H264Level::kLevel5_2}, + {.max_macroblocks_per_second = 1485, + .max_macroblock_frame_size = 99, + .level = H264Level::kLevel1}, + {.max_macroblocks_per_second = 1485, + .max_macroblock_frame_size = 99, + .level = H264Level::kLevel1_b}, + {.max_macroblocks_per_second = 3000, + .max_macroblock_frame_size = 396, + .level = H264Level::kLevel1_1}, + {.max_macroblocks_per_second = 6000, + .max_macroblock_frame_size = 396, + .level = H264Level::kLevel1_2}, + {.max_macroblocks_per_second = 11880, + .max_macroblock_frame_size = 396, + .level = H264Level::kLevel1_3}, + {.max_macroblocks_per_second = 11880, + .max_macroblock_frame_size = 396, + .level = H264Level::kLevel2}, + {.max_macroblocks_per_second = 19800, + .max_macroblock_frame_size = 792, + .level = H264Level::kLevel2_1}, + {.max_macroblocks_per_second = 20250, + .max_macroblock_frame_size = 1620, + .level = H264Level::kLevel2_2}, + {.max_macroblocks_per_second = 40500, + .max_macroblock_frame_size = 1620, + .level = H264Level::kLevel3}, + {.max_macroblocks_per_second = 108000, + .max_macroblock_frame_size = 3600, + .level = H264Level::kLevel3_1}, + {.max_macroblocks_per_second = 216000, + .max_macroblock_frame_size = 5120, + .level = H264Level::kLevel3_2}, + {.max_macroblocks_per_second = 245760, + .max_macroblock_frame_size = 8192, + .level = H264Level::kLevel4}, + {.max_macroblocks_per_second = 245760, + .max_macroblock_frame_size = 8192, + .level = H264Level::kLevel4_1}, + {.max_macroblocks_per_second = 522240, + .max_macroblock_frame_size = 8704, + .level = H264Level::kLevel4_2}, + {.max_macroblocks_per_second = 589824, + .max_macroblock_frame_size = 22080, + .level = H264Level::kLevel5}, + {.max_macroblocks_per_second = 983040, + .max_macroblock_frame_size = 36864, + .level = H264Level::kLevel5_1}, + {.max_macroblocks_per_second = 2073600, + .max_macroblock_frame_size = 36864, + .level = H264Level::kLevel5_2}, }; } // anonymous namespace diff --git a/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.cc b/third_party/libwebrtc/api/video_codecs/h265_profile_tier_level.cc @@ -46,19 +46,58 @@ struct LevelConstraint { // 8) = 543.06. The largest integer that is multiple of 8 and less than 543.06 // is 536. constexpr LevelConstraint kLevelConstraints[] = { - {36864, 552960, 536, H265Level::kLevel1}, - {122880, 3686400, 984, H265Level::kLevel2}, - {245760, 7372800, 1400, H265Level::kLevel2_1}, - {552960, 16588800, 2096, H265Level::kLevel3}, - {983040, 33177600, 2800, H265Level::kLevel3_1}, - {2228224, 66846720, 4216, H265Level::kLevel4}, - {2228224, 133693400, 4216, H265Level::kLevel4_1}, - {8912896, 267386880, 8440, H265Level::kLevel5}, - {8912896, 534773760, 8440, H265Level::kLevel5_1}, - {8912896, 1069547520, 8440, H265Level::kLevel5_2}, - {35651584, 1069547520, 16888, H265Level::kLevel6}, - {35651584, 2139095040, 16888, H265Level::kLevel6_1}, - {35651584, 4278190080, 16888, H265Level::kLevel6_2}, + {.max_luma_picture_size = 36864, + .max_luma_sample_rate = 552960, + .max_pic_width_or_height_in_pixels = 536, + .level = H265Level::kLevel1}, + {.max_luma_picture_size = 122880, + .max_luma_sample_rate = 3686400, + .max_pic_width_or_height_in_pixels = 984, + .level = H265Level::kLevel2}, + {.max_luma_picture_size = 245760, + .max_luma_sample_rate = 7372800, + .max_pic_width_or_height_in_pixels = 1400, + .level = H265Level::kLevel2_1}, + {.max_luma_picture_size = 552960, + .max_luma_sample_rate = 16588800, + .max_pic_width_or_height_in_pixels = 2096, + .level = H265Level::kLevel3}, + {.max_luma_picture_size = 983040, + .max_luma_sample_rate = 33177600, + .max_pic_width_or_height_in_pixels = 2800, + .level = H265Level::kLevel3_1}, + {.max_luma_picture_size = 2228224, + .max_luma_sample_rate = 66846720, + .max_pic_width_or_height_in_pixels = 4216, + .level = H265Level::kLevel4}, + {.max_luma_picture_size = 2228224, + .max_luma_sample_rate = 133693400, + .max_pic_width_or_height_in_pixels = 4216, + .level = H265Level::kLevel4_1}, + {.max_luma_picture_size = 8912896, + .max_luma_sample_rate = 267386880, + .max_pic_width_or_height_in_pixels = 8440, + .level = H265Level::kLevel5}, + {.max_luma_picture_size = 8912896, + .max_luma_sample_rate = 534773760, + .max_pic_width_or_height_in_pixels = 8440, + .level = H265Level::kLevel5_1}, + {.max_luma_picture_size = 8912896, + .max_luma_sample_rate = 1069547520, + .max_pic_width_or_height_in_pixels = 8440, + .level = H265Level::kLevel5_2}, + {.max_luma_picture_size = 35651584, + .max_luma_sample_rate = 1069547520, + .max_pic_width_or_height_in_pixels = 16888, + .level = H265Level::kLevel6}, + {.max_luma_picture_size = 35651584, + .max_luma_sample_rate = 2139095040, + .max_pic_width_or_height_in_pixels = 16888, + .level = H265Level::kLevel6_1}, + {.max_luma_picture_size = 35651584, + .max_luma_sample_rate = 4278190080, + .max_pic_width_or_height_in_pixels = 16888, + .level = H265Level::kLevel6_2}, }; } // anonymous namespace diff --git a/third_party/libwebrtc/api/video_codecs/libaom_av1_encoder_factory.cc b/third_party/libwebrtc/api/video_codecs/libaom_av1_encoder_factory.cc @@ -80,7 +80,13 @@ constexpr std::array<VideoFrameBuffer::Type, 2> kSupportedInputFormats = { VideoFrameBuffer::Type::kI420, VideoFrameBuffer::Type::kNV12}; constexpr std::array<Rational, 7> kSupportedScalingFactors = { - {{8, 1}, {4, 1}, {2, 1}, {1, 1}, {1, 2}, {1, 4}, {1, 8}}}; + {{.numerator = 8, .denominator = 1}, + {.numerator = 4, .denominator = 1}, + {.numerator = 2, .denominator = 1}, + {.numerator = 1, .denominator = 1}, + {.numerator = 1, .denominator = 2}, + {.numerator = 1, .denominator = 4}, + {.numerator = 1, .denominator = 8}}}; std::optional<Rational> GetScalingFactor(const Resolution& from, const Resolution& to) { @@ -561,7 +567,8 @@ aom_svc_params_t GetSvcParams( for (const VideoEncoderInterface::FrameEncodeSettings& settings : frame_settings) { std::optional<Rational> scaling_factor = GetScalingFactor( - {frame_buffer.width(), frame_buffer.height()}, settings.resolution); + {.width = frame_buffer.width(), .height = frame_buffer.height()}, + settings.resolution); RTC_CHECK(scaling_factor); svc_params.scaling_factor_num[settings.spatial_id] = scaling_factor->numerator; diff --git a/third_party/libwebrtc/api/video_codecs/libaom_av1_encoder_factory_test.cc b/third_party/libwebrtc/api/video_codecs/libaom_av1_encoder_factory_test.cc @@ -172,7 +172,7 @@ class FrameEncoderSettingsBuilder { } FrameEncoderSettingsBuilder& Res(int width, int height) { - frame_encode_settings_.resolution = {width, height}; + frame_encode_settings_.resolution = {.width = width, .height = height}; return *this; } @@ -390,16 +390,16 @@ TEST(LibaomAv1Encoder, InputResolutionSwitching) { scoped_refptr<I420Buffer> in1 = frame_reader->PullFrame( /*frame_num=*/nullptr, - /*resolution=*/{320, 180}, - /*framerate_scale=*/{1, 1}); + /*resolution=*/{.width = 320, .height = 180}, + /*framerate_scale=*/{.num = 1, .den = 1}); EncOut tu1; enc->Encode(in1, {.presentation_timestamp = Timestamp::Millis(100)}, ToVec({Fb().Rate(kCbr).Res(160, 90).Ref({0}).Out(tu1)})); scoped_refptr<I420Buffer> in2 = frame_reader->PullFrame( /*frame_num=*/nullptr, - /*resolution=*/{160, 90}, - /*framerate_scale=*/{1, 1}); + /*resolution=*/{.width = 160, .height = 90}, + /*framerate_scale=*/{.num = 1, .den = 1}); EncOut tu2; enc->Encode(in2, {.presentation_timestamp = Timestamp::Millis(200)}, ToVec({Fb().Rate(kCbr).Res(160, 90).Ref({0}).Out(tu2)})); diff --git a/third_party/libwebrtc/api/video_codecs/simple_encoder_wrapper.cc b/third_party/libwebrtc/api/video_codecs/simple_encoder_wrapper.cc @@ -75,10 +75,12 @@ std::vector<std::string> SimpleEncoderWrapper::SupportedWebrtcSvcModes( std::min(3, prediction_constraints.max_spatial_layers); const int max_temporal_layers = std::min(3, prediction_constraints.max_temporal_layers); - const bool scale_by_half = absl::c_linear_search( - prediction_constraints.scaling_factors, Rational{1, 2}); - const bool scale_by_two_thirds = absl::c_linear_search( - prediction_constraints.scaling_factors, Rational{2, 3}); + const bool scale_by_half = + absl::c_linear_search(prediction_constraints.scaling_factors, + Rational{.numerator = 1, .denominator = 2}); + const bool scale_by_two_thirds = + absl::c_linear_search(prediction_constraints.scaling_factors, + Rational{.numerator = 2, .denominator = 3}); const bool inter_layer = prediction_constraints.max_references > 1 && prediction_constraints.buffer_space_type != @@ -170,8 +172,8 @@ void SimpleEncoderWrapper::Encode(scoped_refptr<VideoFrameBuffer> frame_buffer, settings.temporal_id = config.TemporalId(); const int num = layer_configs_.scaling_factor_num[s]; const int den = layer_configs_.scaling_factor_den[s]; - settings.resolution = {(frame_buffer->width() * num / den), - (frame_buffer->height() * num / den)}; + settings.resolution = {.width = (frame_buffer->width() * num / den), + .height = (frame_buffer->height() * num / den)}; bool buffer_updated = false; for (const CodecBufferUsage& buffer : config.Buffers()) { diff --git a/third_party/libwebrtc/api/video_codecs/simple_encoder_wrapper_unittests.cc b/third_party/libwebrtc/api/video_codecs/simple_encoder_wrapper_unittests.cc @@ -133,7 +133,7 @@ TEST(SimpleEncoderWrapper, SupportedSvcModesUpToL3T3KeyWithHScaling) { // implementation for testing, but hey, this is just a PoC. TEST(SimpleEncoderWrapper, EncodeL1T1) { auto encoder = LibaomAv1EncoderFactory().CreateEncoder( - {.max_encode_dimensions = {1080, 720}, + {.max_encode_dimensions = {.width = 1080, .height = 720}, .encoding_format = {.sub_sampling = EncodingFormat::k420, .bit_depth = 8}, .rc_mode = VideoEncoderFactoryInterface::StaticEncoderSettings::Cqp(), @@ -177,7 +177,7 @@ TEST(SimpleEncoderWrapper, EncodeL1T1) { TEST(SimpleEncoderWrapper, EncodeL2T2_KEY) { auto encoder = LibaomAv1EncoderFactory().CreateEncoder( - {.max_encode_dimensions = {1080, 720}, + {.max_encode_dimensions = {.width = 1080, .height = 720}, .encoding_format = {.sub_sampling = EncodingFormat::k420, .bit_depth = 8}, .rc_mode = VideoEncoderFactoryInterface::StaticEncoderSettings::Cqp(), @@ -237,7 +237,7 @@ TEST(SimpleEncoderWrapper, EncodeL2T2_KEY) { TEST(SimpleEncoderWrapper, EncodeL1T3ForceKeyframe) { auto encoder = LibaomAv1EncoderFactory().CreateEncoder( - {.max_encode_dimensions = {1080, 720}, + {.max_encode_dimensions = {.width = 1080, .height = 720}, .encoding_format = {.sub_sampling = EncodingFormat::k420, .bit_depth = 8}, .rc_mode = VideoEncoderFactoryInterface::StaticEncoderSettings::Cqp(), diff --git a/third_party/libwebrtc/api/video_codecs/video_codec.cc b/third_party/libwebrtc/api/video_codecs/video_codec.cc @@ -70,7 +70,7 @@ VideoCodec::VideoCodec() spatialLayers(), mode(VideoCodecMode::kRealtimeVideo), expect_encode_from_texture(false), - timing_frame_thresholds({0, 0}), + timing_frame_thresholds({.delay_ms = 0, .outlier_ratio_percent = 0}), legacy_conference_mode(false), codec_specific_(), complexity_(VideoCodecComplexity::kComplexityNormal) {} diff --git a/third_party/libwebrtc/api/video_codecs/video_encoder_software_fallback_wrapper.cc b/third_party/libwebrtc/api/video_codecs/video_encoder_software_fallback_wrapper.cc @@ -421,8 +421,11 @@ int32_t VideoEncoderSoftwareFallbackWrapper::EncodeWithMainEncoder( } VideoFrame scaled_frame = frame; scaled_frame.set_video_frame_buffer(dst_buffer); - scaled_frame.set_update_rect(VideoFrame::UpdateRect{ - 0, 0, scaled_frame.width(), scaled_frame.height()}); + scaled_frame.set_update_rect( + VideoFrame::UpdateRect{.offset_x = 0, + .offset_y = 0, + .width = scaled_frame.width(), + .height = scaled_frame.height()}); return fallback_encoder_->Encode(scaled_frame, frame_types); } } diff --git a/third_party/libwebrtc/moz-patch-stack/s0057.patch b/third_party/libwebrtc/moz-patch-stack/s0057.patch @@ -30,10 +30,10 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/ee566d1bfb654d36e 12 files changed, 70 insertions(+), 8 deletions(-) diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc -index 17a030b2c4..251b464f37 100644 +index 78426db4f6..467ceaa42d 100644 --- a/api/video/frame_buffer.cc +++ b/api/video/frame_buffer.cc -@@ -149,14 +149,29 @@ void FrameBuffer::DropNextDecodableTemporalUnit() { +@@ -150,14 +150,29 @@ void FrameBuffer::DropNextDecodableTemporalUnit() { } auto end_it = std::next(next_decodable_temporal_unit_->last_frame); @@ -66,7 +66,7 @@ index 17a030b2c4..251b464f37 100644 std::optional<int64_t> FrameBuffer::LastContinuousFrameId() const { return last_continuous_frame_id_; } -@@ -176,6 +191,9 @@ int FrameBuffer::GetTotalNumberOfContinuousTemporalUnits() const { +@@ -177,6 +192,9 @@ int FrameBuffer::GetTotalNumberOfContinuousTemporalUnits() const { int FrameBuffer::GetTotalNumberOfDroppedFrames() const { return num_dropped_frames_; } @@ -76,7 +76,7 @@ index 17a030b2c4..251b464f37 100644 size_t FrameBuffer::CurrentSize() const { return frames_.size(); -@@ -278,6 +296,7 @@ void FrameBuffer::FindNextAndLastDecodableTemporalUnit() { +@@ -280,6 +298,7 @@ void FrameBuffer::FindNextAndLastDecodableTemporalUnit() { } void FrameBuffer::Clear() { diff --git a/third_party/libwebrtc/moz-patch-stack/s0059.patch b/third_party/libwebrtc/moz-patch-stack/s0059.patch @@ -23,7 +23,7 @@ Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/8e9a326a99cd5eaa6 4 files changed, 55 insertions(+) diff --git a/api/video/frame_buffer.cc b/api/video/frame_buffer.cc -index 251b464f37..90fbb7780f 100644 +index 467ceaa42d..b6e67a4309 100644 --- a/api/video/frame_buffer.cc +++ b/api/video/frame_buffer.cc @@ -25,6 +25,7 @@ @@ -83,7 +83,7 @@ index 251b464f37..90fbb7780f 100644 return false; } } -@@ -158,16 +176,31 @@ void FrameBuffer::DropNextDecodableTemporalUnit() { +@@ -159,16 +177,31 @@ void FrameBuffer::DropNextDecodableTemporalUnit() { void FrameBuffer::UpdateDroppedFramesAndDiscardedPackets(FrameIterator begin_it, FrameIterator end_it) { diff --git a/third_party/libwebrtc/pc/jsep_transport_unittest.cc b/third_party/libwebrtc/pc/jsep_transport_unittest.cc @@ -470,19 +470,31 @@ TEST_P(JsepTransport2WithRtcpMux, ValidDtlsRoleNegotiation) { // Parameters which set the SSL role to SSL_CLIENT. NegotiateRoleParams valid_client_params[] = { - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_ACTPASS, SdpType::kAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_ACTPASS, SdpType::kPrAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_PASSIVE, SdpType::kOffer, - SdpType::kAnswer}, - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_PASSIVE, SdpType::kOffer, - SdpType::kPrAnswer}, + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kPrAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kAnswer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kPrAnswer}, // Combinations permitted by RFC 8842 section 5.3 - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_PASSIVE, SdpType::kAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_PASSIVE, SdpType::kPrAnswer, - SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kPrAnswer, + .remote_type = SdpType::kOffer}, }; for (auto& param : valid_client_params) { @@ -517,17 +529,27 @@ TEST_P(JsepTransport2WithRtcpMux, ValidDtlsRoleNegotiation) { // Parameters which set the SSL role to SSL_SERVER. NegotiateRoleParams valid_server_params[] = { - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_ACTPASS, SdpType::kAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_ACTPASS, SdpType::kPrAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_ACTIVE, SdpType::kOffer, - SdpType::kAnswer}, - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_ACTIVE, SdpType::kOffer, - SdpType::kPrAnswer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kPrAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_ACTIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kAnswer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_ACTIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kPrAnswer}, // Combinations permitted by RFC 8842 section 5.3 - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_ACTIVE, SdpType::kPrAnswer, - SdpType::kOffer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_ACTIVE, + .local_type = SdpType::kPrAnswer, + .remote_type = SdpType::kOffer}, }; for (auto& param : valid_server_params) { @@ -575,30 +597,54 @@ TEST_P(JsepTransport2WithRtcpMux, InvalidDtlsRoleNegotiation) { rtcp_mux_enabled, kIceUfrag2, kIcePwd2, certificate); NegotiateRoleParams duplicate_params[] = { - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_ACTIVE, SdpType::kAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_ACTPASS, SdpType::kAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_PASSIVE, SdpType::kAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_ACTIVE, SdpType::kPrAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_ACTPASS, SdpType::kPrAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_PASSIVE, SdpType::kPrAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_ACTIVE, SdpType::kOffer, - SdpType::kAnswer}, - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_ACTPASS, SdpType::kOffer, - SdpType::kAnswer}, - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_PASSIVE, SdpType::kOffer, - SdpType::kAnswer}, - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_ACTIVE, SdpType::kOffer, - SdpType::kPrAnswer}, - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_ACTPASS, SdpType::kOffer, - SdpType::kPrAnswer}, - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_PASSIVE, SdpType::kOffer, - SdpType::kPrAnswer}}; + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_ACTIVE, + .local_type = SdpType::kAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_ACTIVE, + .local_type = SdpType::kPrAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kPrAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kPrAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_ACTIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kAnswer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kAnswer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kAnswer}, + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_ACTIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kPrAnswer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kPrAnswer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kPrAnswer}}; for (auto& param : duplicate_params) { jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled); @@ -632,23 +678,39 @@ TEST_P(JsepTransport2WithRtcpMux, InvalidDtlsRoleNegotiation) { // state NegotiateRoleParams offerer_without_actpass_params[] = { // Cannot use ACTPASS in an answer - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_PASSIVE, SdpType::kAnswer, - SdpType::kOffer}, - {CONNECTIONROLE_ACTPASS, CONNECTIONROLE_PASSIVE, SdpType::kPrAnswer, - SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kAnswer, + .remote_type = SdpType::kOffer}, + {.local_role = CONNECTIONROLE_ACTPASS, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kPrAnswer, + .remote_type = SdpType::kOffer}, // Cannot send ACTIVE or PASSIVE in an offer (must handle, must not send) - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_PASSIVE, SdpType::kOffer, - SdpType::kAnswer}, - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_ACTIVE, SdpType::kOffer, - SdpType::kAnswer}, - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_ACTPASS, SdpType::kOffer, - SdpType::kAnswer}, - {CONNECTIONROLE_ACTIVE, CONNECTIONROLE_PASSIVE, SdpType::kOffer, - SdpType::kPrAnswer}, - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_ACTIVE, SdpType::kOffer, - SdpType::kPrAnswer}, - {CONNECTIONROLE_PASSIVE, CONNECTIONROLE_ACTPASS, SdpType::kOffer, - SdpType::kPrAnswer}}; + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kAnswer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_ACTIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kAnswer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kAnswer}, + {.local_role = CONNECTIONROLE_ACTIVE, + .remote_role = CONNECTIONROLE_PASSIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kPrAnswer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_ACTIVE, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kPrAnswer}, + {.local_role = CONNECTIONROLE_PASSIVE, + .remote_role = CONNECTIONROLE_ACTPASS, + .local_type = SdpType::kOffer, + .remote_type = SdpType::kPrAnswer}}; for (auto& param : offerer_without_actpass_params) { jsep_transport_ = CreateJsepTransport2(rtcp_mux_enabled); diff --git a/third_party/libwebrtc/pc/peer_connection_histogram_unittest.cc b/third_party/libwebrtc/pc/peer_connection_histogram_unittest.cc @@ -608,13 +608,13 @@ struct IPAddressTypeTestConfig { absl::string_view address; IPAddressType address_type; } const kAllCandidateIPAddressTypeTestConfigs[] = { - {"127.0.0.1", IPAddressType::kLoopback}, - {"::1", IPAddressType::kLoopback}, - {"localhost", IPAddressType::kLoopback}, - {"10.0.0.3", IPAddressType::kPrivate}, - {"FE80::3", IPAddressType::kPrivate}, - {"1.1.1.1", IPAddressType::kPublic}, - {"2001:4860:4860::8888", IPAddressType::kPublic}, + {.address = "127.0.0.1", .address_type = IPAddressType::kLoopback}, + {.address = "::1", .address_type = IPAddressType::kLoopback}, + {.address = "localhost", .address_type = IPAddressType::kLoopback}, + {.address = "10.0.0.3", .address_type = IPAddressType::kPrivate}, + {.address = "FE80::3", .address_type = IPAddressType::kPrivate}, + {.address = "1.1.1.1", .address_type = IPAddressType::kPublic}, + {.address = "2001:4860:4860::8888", .address_type = IPAddressType::kPublic}, }; // Used by the test framework to print the param value for parameterized tests. diff --git a/third_party/libwebrtc/pc/sctp_data_channel.cc b/third_party/libwebrtc/pc/sctp_data_channel.cc @@ -681,9 +681,15 @@ void SctpDataChannel::OnBufferedAmountLow() { DataChannelStats SctpDataChannel::GetStats() const { RTC_DCHECK_RUN_ON(network_thread_); - DataChannelStats stats{internal_id_, id(), label(), - protocol(), state(), messages_sent(), - messages_received(), bytes_sent(), bytes_received()}; + DataChannelStats stats{.internal_id = internal_id_, + .id = id(), + .label = label(), + .protocol = protocol(), + .state = state(), + .messages_sent = messages_sent(), + .messages_received = messages_received(), + .bytes_sent = bytes_sent(), + .bytes_received = bytes_received()}; return stats; } diff --git a/third_party/libwebrtc/pc/test/svc_e2e_tests.cc b/third_party/libwebrtc/pc/test/svc_e2e_tests.cc @@ -104,8 +104,10 @@ struct SvcTestParameters { int num_temporal_layers = ScalabilityModeToNumTemporalLayers(*scalability_mode); - return SvcTestParameters{codec_name, scalability_mode_str, - num_spatial_layers, num_temporal_layers}; + return SvcTestParameters{.codec_name = codec_name, + .scalability_mode = scalability_mode_str, + .expected_spatial_layers = num_spatial_layers, + .expected_temporal_layers = num_temporal_layers}; } std::string codec_name; diff --git a/third_party/libwebrtc/pc/used_ids_unittest.cc b/third_party/libwebrtc/pc/used_ids_unittest.cc @@ -78,9 +78,11 @@ class UsedRtpHeaderExtensionIdsTest : public ::testing::TestWithParam<TestParams> {}; constexpr TestParams kOneByteTestParams = { - UsedRtpHeaderExtensionIds::IdDomain::kOneByteOnly, 14}; + .id_domain = UsedRtpHeaderExtensionIds::IdDomain::kOneByteOnly, + .max_id = 14}; constexpr TestParams kTwoByteTestParams = { - UsedRtpHeaderExtensionIds::IdDomain::kTwoByteAllowed, 255}; + .id_domain = UsedRtpHeaderExtensionIds::IdDomain::kTwoByteAllowed, + .max_id = 255}; INSTANTIATE_TEST_SUITE_P(All, UsedRtpHeaderExtensionIdsTest, diff --git a/third_party/libwebrtc/pc/video_rtp_track_source_unittest.cc b/third_party/libwebrtc/pc/video_rtp_track_source_unittest.cc @@ -127,7 +127,7 @@ class TestFrame : public RecordableEncodedFrame { VideoCodecType codec() const override { return kVideoCodecGeneric; } bool is_key_frame() const override { return false; } EncodedResolution resolution() const override { - return EncodedResolution{0, 0}; + return EncodedResolution{.width = 0, .height = 0}; } Timestamp render_time() const override { return Timestamp::Zero(); } }; diff --git a/third_party/libwebrtc/pc/webrtc_sdp.cc b/third_party/libwebrtc/pc/webrtc_sdp.cc @@ -1993,13 +1993,25 @@ struct StaticPayloadAudioCodec { size_t channels; }; const StaticPayloadAudioCodec kStaticPayloadAudioCodecs[] = { - {"PCMU", 8000, 1}, {"reserved", 0, 0}, {"reserved", 0, 0}, - {"GSM", 8000, 1}, {"G723", 8000, 1}, {"DVI4", 8000, 1}, - {"DVI4", 16000, 1}, {"LPC", 8000, 1}, {"PCMA", 8000, 1}, - {"G722", 8000, 1}, {"L16", 44100, 2}, {"L16", 44100, 1}, - {"QCELP", 8000, 1}, {"CN", 8000, 1}, {"MPA", 90000, 1}, - {"G728", 8000, 1}, {"DVI4", 11025, 1}, {"DVI4", 22050, 1}, - {"G729", 8000, 1}, + {.name = "PCMU", .clockrate = 8000, .channels = 1}, + {.name = "reserved", .clockrate = 0, .channels = 0}, + {.name = "reserved", .clockrate = 0, .channels = 0}, + {.name = "GSM", .clockrate = 8000, .channels = 1}, + {.name = "G723", .clockrate = 8000, .channels = 1}, + {.name = "DVI4", .clockrate = 8000, .channels = 1}, + {.name = "DVI4", .clockrate = 16000, .channels = 1}, + {.name = "LPC", .clockrate = 8000, .channels = 1}, + {.name = "PCMA", .clockrate = 8000, .channels = 1}, + {.name = "G722", .clockrate = 8000, .channels = 1}, + {.name = "L16", .clockrate = 44100, .channels = 2}, + {.name = "L16", .clockrate = 44100, .channels = 1}, + {.name = "QCELP", .clockrate = 8000, .channels = 1}, + {.name = "CN", .clockrate = 8000, .channels = 1}, + {.name = "MPA", .clockrate = 90000, .channels = 1}, + {.name = "G728", .clockrate = 8000, .channels = 1}, + {.name = "DVI4", .clockrate = 11025, .channels = 1}, + {.name = "DVI4", .clockrate = 22050, .channels = 1}, + {.name = "G729", .clockrate = 8000, .channels = 1}, }; void MaybeCreateStaticPayloadAudioCodecs(const std::vector<int>& fmts,