It replaces the relative arrival delay tracker which is equivalent.
This results in a slight bit-exactness change but nothing that should affect quality.
Bug: webrtc:13322
Change-Id: I6ed5d6fdfa724859122928a8838acce27ac2e5d0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/263380
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37004}
A packet arrival history is used to store the timing of incoming packets and tracks the earliest and latest packets by taking the difference between rtp timestamp and arrival time. The history is windowed to 2 seconds by default. The packet arrival history will replace the relative arrival delay tracker in a follow up cl.
The playout delay is estimated by taking the difference between the current playout timestamp and the earliest packet arrival in the history. This method works better when DTX is used compared to the buffer level filter that it replaces.
The threshold for acceleration is changed to be the maximum of the target delay and the maximum packet arrival delay in the history. This prevents any acceleration immediately after an underrun and gives some time to adapt the target delay to new network conditions.
The logic when to decode the next packet after a packet loss is also changed to do concealment for the full loss duration unless the delay is too high.
The new mode is default disabled and can be enabled using a field trial.
Bug: webrtc:13322,webrtc:13966
Change-Id: Idfa0020584591261475b9ca350cc7c6531de9911
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259820
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36899}
This is done by adding a reorder optimizer that estimates the probability of receiving reordered packets.
The optimal delay is decided by balancing the cost of increasing the delay against the probability of missing a reordered packet, resulting in a loss. This balance is decided using the `ms_per_loss_percent` parameter.
The usage and parameters can be controlled via field trial.
Bug: webrtc:10178
Change-Id: Ic484df0412af35610e74b3a6070f2bac7a926a63
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/231541
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34954}
Split out `RelativeArrivalDelayTracker` and `DelayOptimizer` logic.
This is in preparation for adding another `DelayOptimizer` specialized in handling reordered packets.
Bug: webrtc:10178
Change-Id: Id3c1746d91980b171fa524f9b2b71cf11fc75f64
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/231224
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34938}
This changes behavior slightly but results in a better delay estimate and cleaner code.
Bug: webrtc:10178
Change-Id: If150258bc1ea58149940f17c5660733ff61159c3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/230740
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#34883}
This CL completes the removal of assert() and relative headers from
the codebase (excluded
//examples/objc/AppRTCMobile/third_party/SocketRocket which is in a
third_party sub-directory).
Bug: webrtc:6779
Change-Id: I93ed57168d2c0e011626873d66529488c5f484f2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/225546
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34528}
I was not able to reproduce chromium:1146676 locally, so the change in merge.cc is a speculative fix.
Bug: chromium:1146835, chromium:1146676, chromium:1137226
Change-Id: I14472ba5b41e58b2d5f27d9833249c14505af18f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/194264
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32759}
Add a new field trial with more flexible parsing and new options:
- Resample packet delays to only update histogram with maximum observed
delay every X ms.
- Setting the maximum history size (in ms) used for calculating the
relative arrival delay.
Legacy field trial used for configuration is maintained.
Bug: webrtc:10333
Change-Id: I35b004f5d8209c85b33cb49def3816db51650946
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/192789
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32591}
This is a reland of 2a7c57c34f
Original change's description:
> Reland "Refactor NetEq delay manager logic."
>
> This is a reland of f8e62fcb14
>
> Original change's description:
> > Refactor NetEq delay manager logic.
> >
> > - Removes dependence on sequence number for calculating target delay.
> > - Changes target delay unit to milliseconds instead of number of
> > packets.
> > - Moves acceleration/preemptive expand thresholds to decision logic.
> > Tests for this will be added in a follow up cl.
> >
> > Bug: webrtc:10333
> > Change-Id: If690aae4abf41ef1d9353f0ff01fb7d121cf8a26
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186265
> > Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
> > Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#32326}
>
> Bug: webrtc:10333
> Change-Id: Iad5e7063f63b84762959ee5b412f5f14a7b2cd06
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186943
> Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
> Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32332}
Bug: webrtc:10333
Change-Id: If2244ee9a3d56a0cfa9b602e7bdf448dc6340147
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/187356
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32367}
This is a reland of f8e62fcb14
Original change's description:
> Refactor NetEq delay manager logic.
>
> - Removes dependence on sequence number for calculating target delay.
> - Changes target delay unit to milliseconds instead of number of
> packets.
> - Moves acceleration/preemptive expand thresholds to decision logic.
> Tests for this will be added in a follow up cl.
>
> Bug: webrtc:10333
> Change-Id: If690aae4abf41ef1d9353f0ff01fb7d121cf8a26
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186265
> Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
> Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32326}
Bug: webrtc:10333
Change-Id: Iad5e7063f63b84762959ee5b412f5f14a7b2cd06
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186943
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32332}
This reverts commit f8e62fcb14.
Reason for revert: breaks downstream test.
Original change's description:
> Refactor NetEq delay manager logic.
>
> - Removes dependence on sequence number for calculating target delay.
> - Changes target delay unit to milliseconds instead of number of
> packets.
> - Moves acceleration/preemptive expand thresholds to decision logic.
> Tests for this will be added in a follow up cl.
>
> Bug: webrtc:10333
> Change-Id: If690aae4abf41ef1d9353f0ff01fb7d121cf8a26
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186265
> Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
> Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#32326}
TBR=ivoc@webrtc.org,jakobi@webrtc.org
Change-Id: I1bdeacce61b902a0003a40c740f6acccf1443e3e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:10333
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186942
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32329}
- Removes dependence on sequence number for calculating target delay.
- Changes target delay unit to milliseconds instead of number of
packets.
- Moves acceleration/preemptive expand thresholds to decision logic.
Tests for this will be added in a follow up cl.
Bug: webrtc:10333
Change-Id: If690aae4abf41ef1d9353f0ff01fb7d121cf8a26
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/186265
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32326}
This CL was generated by running:
git ls-files | grep ".cc" | xargs perl -i -ne 'BEGIN {undef $/}; s/("[\s\n]*<<[\s\n]*")/" "/g; print;'; git cl format
After that I manually edited modules/audio_processing/gain_controller2.cc to preserve its original
formatting.
This primary benefit of this change is a small reduction in binary size.
Bug: None
Change-Id: I689fa7ba9c717c314bb167e5d592c3c4e0871e29
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165961
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Jonas Olsson <jonasolsson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30251}
Also remove the delay peak detector which is no longer used.
This should be a no-op since relative arrival delay mode is used by default.
Bug: webrtc:10333
Change-Id: Ifa326b762d52f16f9dc5f3da2874139faf1022da
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/164462
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30179}
This interface is implemented by the DecisionLogic class, which now contains the DelayManager and DelayPeakDetector.
Bug: webrtc:11005
Change-Id: I4fb69fa359e60831cf153e41f101d5b623749380
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155176
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29613}
This metric is not used anywhere and is not calculated correctly when the delay manager is in relative arrival delay mode.
Bug: webrtc:10333
Change-Id: Iac79ab40b79b17802ad9d626c130e82f761bae26
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150786
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29037}
This fixes a bug in delay manager relative arrival delay mode that caused the effective minimum target level to be 2 packets instead of 1.
Bug: webrtc:10333
Change-Id: I33d32c8da692a3db22179edb923873d307f740fd
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150785
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29002}
Storing a fixed amount of packets does not work well with DTX since the history could include up to 20 seconds of packets which can potentially be negative in the event of clock drift or delay shifts.
Bug: webrtc:10333
Change-Id: Ifb8543b7e999e17845cb0e4171066862941f370e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/149832
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28942}
Change the way the forget factor converge to the steady state so that we don't overemphasize the first packets received.
The logic is controlled by the delay histogram field trial which has an added parameter to control if emphasis should be even (c=1, default) or put on later packets (c>1) until we reach our steady state forget factor.
Bug: webrtc:10411
Change-Id: Ia5d46c22d1a4a66994652f71c8cde664362bfacb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/137050
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Chen Xing <chxg@google.com>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28039}
This change allows NetEq to reach preferred jitter buffer size much faster
for high target delays because it uses absolute units instead of relative ones
during computation of lower_limit.
More details can be found here:
https://docs.google.com/document/d/12qPMJYFhGXrA_o_nvz9VshpzAJX6aULxFig1fTzBzDI/edit
Change-Id: I21ce0e35e25166d935fdf0325c083bcf990899f5
Bug: webrtc:10619
Change-Id: I21ce0e35e25166d935fdf0325c083bcf990899f5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/135745
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Jakob Ivarsson <jakobi@webrtc.org>
Commit-Queue: Ruslan Burakov <kuddai@google.com>
Cr-Commit-Position: refs/heads/master@{#27970}
When we offset the measured inter-arrival time due to packet loss, it will sometimes be less than zero. This is the correct value to use when calculating the relative packet arrival delay.
Bug: webrtc:10333
Change-Id: I14a68563a379fa0b9444684304362503a6f1bfca
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/127547
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27164}
- This mode estimates relative packet arrival delay for each incoming packet and adds that value to the histogram.
- The histogram buckets are 20 milliseconds each instead of whole packets.
- The functionality is enabled with a field trial for experimentation.
Bug: webrtc:10333
Change-Id: I8f7499c56802fc1aa1ced2f5310fdd2ef1403515
Reviewed-on: https://webrtc-review.googlesource.com/c/123923
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26871}
For e.g. when audio receiver is recreated during SetRtpExtensionsAndRecreateStream in webrtc_voice_engine.h,
the audio minimum delay can't go down.
Imagine we set base minimum playout delay when audio receiver stream is created, then its value will be cached, to be applied during recreation. Then SetRtpExtensionsAndRecreateStream is fired, and audio receiver stream is recreated with the cached value, but currently it in the constructor it is used to initialize both base minimum playout delay and minimum playout delay. Which leads to the bug that effective minimum playout delay can't go down anymore as if you set base minimum playout delay to the low value then effective delay use the biggest value which minimum playout delay.
This didn't come up during previous trials because of
https://webrtc-review.googlesource.com/c/src/+/122280
It was reseting minimum playout delay to 0 asynchronously, that is why you couldn't see this bug.
Bug: webrtc:10287
Change-Id: I924446bfcb33ac94f7e5bf987a1868acaf1b0346
Reviewed-on: https://webrtc-review.googlesource.com/c/124000
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Ruslan Burakov <kuddai@google.com>
Cr-Commit-Position: refs/heads/master@{#26832}
On NetEq level latency corresponds to delay and two terms can be used interchangeably here.
In order to implement latency constraint we need to provide a range of possible values which should be constant. See getCapabilities() here:
https://www.w3.org/TR/mediacapture-streams/#dfn-applyconstraints-algorithm
Lowest possible value accepted value is constant and equals 0. But because |packet_len_ms_| and |maximum_delay_ms_| may be updated during live of DelayManager upper bound is not constant. Moreover, due to change in |packet_len_ms_| the |minimum_delay_ms_| which was valid when its was set may be considered invalid later on.
To circumvent that and provide constant range for capabilities we separate base minimum delay and minimum delay. ApplyConstraints algorithm will set base minimum delay. Base minimum delay will act as recommendation for lower bound of minimum delay and will be used to limit target delay. If user sets base minimum delay through ApplyConstraints which is bigger than currently
possible maximum (e.g. bigger than NetEq maximum buffer size in milliseconds) then base minimum delay will be clamped to currently possible maximum to match user's intentions as best as possible.
Note, that we keep original behavior when minimum_delay_ms_ (effective_minimum_delay_ms after this CL) in LimitTargetLevel method may be above upper bound due to changing packet audio length.
Bug: webrtc:10287
Change-Id: I06b8f5cd3fd1bc36800af0447f91f7c4dc21a766
Reviewed-on: https://webrtc-review.googlesource.com/c/121700
Commit-Queue: Ruslan Burakov <kuddai@google.com>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26666}
Currently, if the last packet was reordered (e.g. due to retransmission) then the next packet's inter-arrival time will be estimated incorrectly due to the jump in sequence numbers. This change prevents that by not resetting the stopwatch on reordered packets.
This will also better estimate inter-arrival times when we have multiple reordered packets in a burst. Currently we would only measure the iat of the first reordered packet correctly and not the ones coming after it.
There is a slight risk introducing this: If we would receive an out of order packet far into the future (in sequence numbers) and then continue getting packets in the normal order, then we would not update the current sequence number for these and incorrectly estimate their inter-arrival times since they would all be considered reordered.
Change-Id: Ic938a37cbddf1cb9c30b610218f56794568d3d01
Bug: webrtc:10178
Reviewed-on: https://webrtc-review.googlesource.com/c/119949
Reviewed-by: Minyue Li <minyue@webrtc.org>
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26572}
This is first step to allow to set latency
from client code in Chromium.
Existing minimum latency hasn't been used because it can clash
with video syncronization code.
Bug: webrtc:10287
Change-Id: Ia38906506069a1abfa01698dc62df283fc15cfbc
Reviewed-on: https://webrtc-review.googlesource.com/c/121423
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Ruslan Burakov <kuddai@google.com>
Cr-Commit-Position: refs/heads/master@{#26536}
When enabled, the delay manager is updated with reordered packets. It also makes the peak detector ignore the reordered packets.
Change-Id: I2bdc99764cc76b15e613ed3dc75f83aaf66eee4e
Bug: webrtc:10178
Reviewed-on: https://webrtc-review.googlesource.com/c/116481
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26187}
Note that this value will override the minimum delay that is used for audio/video sync.
Bug: webrtc:10053
Change-Id: Ia129f6c9ee9da5d00a3d955afaaa6e8f0c2bee33
Reviewed-on: https://webrtc-review.googlesource.com/c/112121
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Commit-Queue: Jakob Ivarsson <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25805}
This CL is the result of running include-what-you-use tool on part
of the code base (audio target and dependencies) plus manual fixes.
bug: webrtc:8311
Change-Id: I277d281ce943c3ecc1bd45fd8d83055931743604
Reviewed-on: https://webrtc-review.googlesource.com/c/106280
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25311}
Running clang-format with chromium's style guide.
The goal is n-fold:
* providing consistency and readability (that's what code guidelines are for)
* preventing noise with presubmit checks and git cl format
* building on the previous point: making it easier to automatically fix format issues
* you name it
Please consider using git-hyper-blame to ignore this commit.
Bug: webrtc:9340
Change-Id: I694567c4cdf8cee2860958cfe82bfaf25848bb87
Reviewed-on: https://webrtc-review.googlesource.com/81185
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23660}