Implements a two-pass approach to packetization which creates
packets of an even size similar to RtpPacketizer::SplitAboutEqually.
This improves the bandwidth estimation.
The algorithm does a first pass with the existing packetizer, then
iterates through the resulting packet sizes and sums up the bytes left unused in each packet.
It then calculates a new maximum packet length as
configured_max_packet_len - ((unused_bytes - packets + 1) / packets)
adjusts for the overhead and re-runs the packetization algorithm.
For example, a list of OBUs with sizes
{1206, 1476, 1431}
currently gets packetized greedily as payload sizes
{1200, 1200, 1200, 523}
With this change, it gets packetized as
{1032, 1032, 1032, 1028}
This change is guarded by the field trial
WebRTC-Video-AV1EvenPayloadSizes
which is acting as a rollout flag.
BUG=webrtc:15927
Co-authored-by: Shyam Sadhwani <shyamsadhwani@meta.com>
Change-Id: I4f0b3c27de6f06104908dd769c4dd1f34115712c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/348100
Commit-Queue: Philipp Hancke <phancke@meta.com>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42203}
Start introducing ArrayView to AudioFrame and code that flows down
from there. In this first step:
* Add `data_view()` that returns a read-only ArrayView for the
audio buffer. When AudioFrame is not initialized however, data_view()
will return a nullptr whereas the current data() method never returns
nullptr.
* Add `mutable_data()` that requires two arguments for properly setting
the samples per channel and number of channels that's required for
accurately reserving the returned mutable ArrayView.
A notable behavior change is that if the requested number of channels
is larger than supported or the calculated buffer size is too large,
the function will trigger a check.
* Add TODOs for following work.
Bug: chromium:335805780
Change-Id: I2937de800422589ebe6a3840b3caadf3d9ff8b00
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347982
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42202}
Instead of from the global field trial string.
Bug: webrtc:42220378
Change-Id: Iddb41429e388792de02f702b4caa35689c57d9e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347720
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42201}
This is the first new style trace event so this CL adds and updates
WebRTCs Perfetto configuration.
* Changes all #includes to target "third_party/perfetto". Added this
to DEPS.
* Expose the Perfetto public config in the "tracing" group using
an all_dependent_configs statement. This means the config is included
in all parts that include the "//:tracing" group. However, direct
perfetto includes are banned per DEPS.
* In order to expose Perfetto types (ie Flow/TerminatingFlow) the
perfetto headers are a dependancy on all targets. This should not
affect binary size as these are not used when perfetto is not enabled
and will not be linked.
Bug: b/42226290
Change-Id: I5711d81dae95ee907cbcd41bf1ee9b55d2ec595c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/349161
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/main@{#42197}
Environment provides non-null interface for FieldTrialsView and thus VideoCodingModule no longer need to rely on FieldTrialBasedConfig class to provide field_trials when not passed at construction.
Bug: webrtc:10335
Change-Id: Iedfb29e8b29056618a85f2e7a1528da29e3be5c1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347701
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42163}
These are required by the Perfetto API and the missing argument prevents
the use of Perfetto.
Bug: webrtc:15917
Change-Id: Ie40c0344dc9d8cd40f7c751b133d150b975a33c7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347702
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/main@{#42147}
This cl adds an implementation of the RTCP feedback packet as specified in https://www.rfc-editor.org/rfc/rfc8888.html
Bug: webrtc:15368
Change-Id: I0b9a7fb15512ff9f9e721efd8e03ebe981a8d9bd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347901
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42140}
When an IRAP frame was present in the Aggregation Packet,
the control flow was incorrectly transferred to SPS parsing
due to ABSL_FALLTHROUGH_INTENDED within the IRAP case statement,
resulting in a parsing error and generating a warning log.
A break statement has been introduced to prevent this fallthrough.
Bug: webrtc:13485
Change-Id: I523fbf548f14b31eae7c41f607fe33572f094aac
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/346381
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
Commit-Queue: Daniel.L (Byoungchan) Lee <daniel.l@hpcnt.com>
Cr-Commit-Position: refs/heads/main@{#42132}
fuchsia.ui.display.singleton
We previously used fuchsia.ui.scenic.Scenic/GetDisplayInfo to get
fuchsia.ui.gfx.DisplayInfo. This has been migrated to
fuchsia.ui.display.singleton.Info/GetMetrics and
fuchsia.ui.display.singleton.Metrics.
Bug: fuchsia:64206
Test: applied changes manually to local chromium repo's third_party/webrtc directory and compiled
Change-Id: If3c7fbd641ebd3b3333e7e5f1126f8f3ae3b97e7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/322780
Commit-Queue: Caroline Liu <carolineliu@google.com>
Reviewed-by: Emircan Uysaler <emircan@google.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#42104}
That forces external field trials, thus VideoCoding will be able to remove dependency on the global field trials string through FieldTrialBasedConfig class.
Bug: webrtc:10335
Change-Id: I6d22a7d20a4433801a0086b0863cda78e91f4f60
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347646
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42092}
This reverts commit 501c4f37bf.
Patch set 1 contains pure reland.
The reason why we want to do this is because audio can allocate a needed bitrate before video when starting a call, which may lead to a race between the first probe result and updating the allocated bitrate.
That is the, initial probe will try to probe up to the max configured bitrate.
Bug: webrtc:14928
Change-Id: I6a8660da20ac54237f04a29461e03b31bd988bb0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347643
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Erik Språng <sprang@google.com>
Owners-Override: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42086}
This reverts commit 33cc83595a.
Reason for revert: Perf bots showed that this cl cause a change in metrics. It looks like it is for the better, but we want this to be behind a field trial.
Original change's description:
> Ignore allocated bitrate during initial exponential BWE.
>
> The reason why we want to do this is because audio can allocate a needed bitrate before video when starting a call, which may lead to a race between the first probe result and updating the allocated bitrate.
> That is the, initial probe will try to probe up to the max configured bitrate.
>
> ProbeController::SetFirstProbeToMaxBitrate will allow the first probe to
> continue up to the max configured bitrate, regardless of of the max
> allocated bitrate.
>
> Bug: webrtc:14928
> Change-Id: I6e0ae90e21a78466527f3464951e6033dc846470
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/346760
> Reviewed-by: Diep Bui <diepbp@webrtc.org>
> Commit-Queue: Per Kjellander <perkj@webrtc.org>
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Reviewed-by: Per Kjellander <perkj@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#42049}
Bug: webrtc:14928
Change-Id: I56ba58560b6857b6069552c02df822691f7af64d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/347622
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Owners-Override: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42081}
The reason why we want to do this is because audio can allocate a needed bitrate before video when starting a call, which may lead to a race between the first probe result and updating the allocated bitrate.
That is the, initial probe will try to probe up to the max configured bitrate.
ProbeController::SetFirstProbeToMaxBitrate will allow the first probe to
continue up to the max configured bitrate, regardless of of the max
allocated bitrate.
Bug: webrtc:14928
Change-Id: I6e0ae90e21a78466527f3464951e6033dc846470
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/346760
Reviewed-by: Diep Bui <diepbp@webrtc.org>
Commit-Queue: Per Kjellander <perkj@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42049}
The width and height of mapped_buffer must match the d_w and d_h members
of frame_to_encode_, which is passed to aom_codec_encode().
Bug: b:330482827
Change-Id: I85d8c82133768685565f165eafc893c42dc40b12
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/345807
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Wan-Teh Chang <wtc@google.com>
Cr-Commit-Position: refs/heads/main@{#42036}
Instead of relying on the global field trial string
Bug: webrtc:10335
Change-Id: I491be089ffc725fd28483edf10eae4ae5d17d651
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/346263
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42021}
This hard-codes the behavior to mode 3 with a threshold of 0.5 like was
already done by FetchPreEchoConfiguration.
Bug: webrtc:14205
Change-Id: I48d47a77c9df0001460788b504524203417f9647
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/345483
Commit-Queue: Emil Lundmark <lndmrk@webrtc.org>
Reviewed-by: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42015}
This CL partly restores the changes that were introduced in
https://webrtc-review.googlesource.com/c/src/+/344681
The predefined SdpVideoFormat for AV1 causes some backwards
compatibility issues with downstream projects that are using
the preliminary codec name AV1X.
Bug: b/333007070
Change-Id: I2d4df241d47b399b0012e6095dd6c2445e60e2c1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/345941
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42011}
This changes the libvpx VP9 encoder to generate the scalability mode based on the current encoding parameters when using layer activation.
Tested: Ran with L3T3_KEY reduced to L2T3_KEY and L1T3 due to bandwidth or layer activation. Added unit tests.
Bug: webrtc:15892
Change-Id: Iaedca4ea5fc3a692996666ceaf0d6aa03fb058a1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/344760
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42007}
The predefined SdpVideoFormats were not used everywhere,
which caused a discrepancy between send/receive capabilities
for AV1. This CL solves the immediate problems by making sure
send/receive capabilities for AV1 are reported the same way.
Fixed: chromium:331565934
Change-Id: I073091b7b5f987c7f434c17276fd84047ec723c2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/344681
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41991}
This CL updates H26xPacketBuffer to store and prepend SPS and PPS for
H.264 bitstreams when IDR only keyframe is allowed.
Bug: webrtc:13485
Change-Id: Ic1edc623dff568d54d3ce29b42dd8eab3312f5cb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/342225
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41986}
This is a reland of commit 7ae48c452a with updated RtpVp9RefFinder
RtpVp9RefFinder relied on the fact that frames with (inter_pic_predicted=true && inter_layer_predicted=true) were marked as keyframes. Since this is not the case anymore, the related code paths in RtpVp9RefFinder have been deleted.
Calculation of gof_info_[] index for non-keyframes has been updated to account for that fact it is now possible to received multiple T0 frames belonging to the same temporal unit (we don't need to do "unwrapped_tl0 - 1" in this case).
Original change's description:
> Mark frames with inter_layer_predicted=true as delta frames
>
> As it is currently implemented, the VP9 depacketizer decides packet's frame type based on p_bit ("Inter-picture predicted layer frame"). p_bit is set to 0 for upper spatial layer frames of keyframe since they do not have temporal refs. This results in marking packets of upper spatial layer frames, and, eventually these frames, of SVC keyframes as "keyframe" while they are in fact delta frames.
>
> Normally spatial layer frames are merged into a superframe and the superframe is passed to decoder. But passing individual layers to a single decoder instance is a valid scenario too and is used in downstream projects. In this case, an upper layer frame marked as keyframe may cause decoder reset [2] and break decoding.
>
> This CL changes frame type decision logic in the VP9 depacketizer such that only packets with both P and D (inter-layer predicted) bits unset are considered as keyframe packets.
>
> When spatial layer frames are merged into a superframe in CombineAndDeleteFrames [1], frame type of the superframe is inferred from the lowest spatial layer frame.
>
> [1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/modules/video_coding/frame_helpers.cc;l=53
>
> [2] https://source.corp.google.com/piper///depot/google3/third_party/webrtc/files/stable/webrtc/modules/video_coding/codecs/vp9/libvpx_vp9_decoder.cc;l=209
>
> Bug: webrtc:15827
> Change-Id: Idc3445636f0eae0192dac998876fedec48628560
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/343342
> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
> Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#41939}
Bug: webrtc:15827
Change-Id: Ic69b94989919cf6d353bceea85d0eba63bc500ee
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/344144
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41985}