IsAdaptationUpAllowed is moved from Resource to AdaptationConstraint.
OnAdaptationApplied is moved from Resource to AdaptationListener.
In a future CL, Resource will be moved to api/, but
AdaptationConstraint and AdaptationListener will stay in call/.
The processor, encode stream and manager are updated to keep track of
both resources, constraints and listeners. Fakes and tests are updated.
After this CL, the manager's inner classes that prevent adaptation
implement AdaptationConstraint instead of Resource.
Bug: webrtc:11525
Change-Id: Ie9cd5b1ba7d8e161951e131ab8f6bd9d5cf765bf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176368
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31409}
This reverts commit 45bb717a2866c2d836b5332a24af0d09f2b30714.
Reason for revert: Use #if RTC_TRACE_EVENTS_ENABLED to avoid unused variable.
Original change's description:
> Revert "Add trace of enqueued and sent RTP packets"
>
> This reverts commit 45b9192ad981dcdc12ad4aef087fff2195bd030c.
>
> Reason for revert: When tracing is disabled, this results in a clang warning (unused variable), which results in a build error since Werror is enabled by default.
>
> Original change's description:
> > Add trace of enqueued and sent RTP packets
> >
> > This is useful in debugging the latency from a packet
> > is enqueued until it's sent.
> >
> > Bug: webrtc:11617
> > Change-Id: Ic2f194334a2e178de221df3a0838481035bb3505
> > Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176231
> > Reviewed-by: Erik Språng <sprang@webrtc.org>
> > Commit-Queue: Johannes Kron <kron@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#31381}
>
> TBR=sprang@webrtc.org,kron@webrtc.org
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: webrtc:11617
> Change-Id: I854c17e587c624691a0e5e3ec9fd38c2607eda84
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176380
> Commit-Queue: Casey Fischer <caseyfischer@google.com>
> Reviewed-by: Adam Nathan <adamnathan@google.com>
> Cr-Commit-Position: refs/heads/master@{#31399}
TBR=sprang@webrtc.org,yujo@chromium.org,adamnathan@google.com,kron@webrtc.org,caseyfischer@google.com
# Not skipping CQ checks because this is a reland.
Bug: webrtc:11617
Change-Id: I9de7f7ed290481a51c161a693f5b2d5df7d2eae3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176367
Commit-Queue: Johannes Kron <kron@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31407}
This CL is in preparation for moving Resource to the api/ folder. It
does not move it, but makes it such that the moving CL can be a pure
move.
In order to do this, we must stop depending on rtc_base/rtc::TaskQueue
in favor of api/webrtc::TaskQueueBase.
There are also other rtc_base/ dependencies that we do not want to
expose to the api/ folder, like critical sections and thread
annotations which are not publically exposed. To get around this, we
make Resource an abstract interface and move all of the base class
functionality into a new non-api/ class: VideoStreamEncoderResource.
The Resource now has Register/UnregisterAdaptationTaskQueue() methods.
By explicitly unregistering, we can ensure validity of the pointer even
if the Resource outlives the PeerConnection. While public interface
methods are only to be called on the adaptation task queue, posting to
the task queue happens off-queue, so a |lock_| is introduced to guard
it.
Bug: webrtc:11525
Change-Id: I50b3a30960cdec9032016c779b47001c01dad32f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176320
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31402}
This reverts commit 45b9192ad981dcdc12ad4aef087fff2195bd030c.
Reason for revert: When tracing is disabled, this results in a clang warning (unused variable), which results in a build error since Werror is enabled by default.
Original change's description:
> Add trace of enqueued and sent RTP packets
>
> This is useful in debugging the latency from a packet
> is enqueued until it's sent.
>
> Bug: webrtc:11617
> Change-Id: Ic2f194334a2e178de221df3a0838481035bb3505
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176231
> Reviewed-by: Erik Språng <sprang@webrtc.org>
> Commit-Queue: Johannes Kron <kron@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31381}
TBR=sprang@webrtc.org,kron@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: webrtc:11617
Change-Id: I854c17e587c624691a0e5e3ec9fd38c2607eda84
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176380
Commit-Queue: Casey Fischer <caseyfischer@google.com>
Reviewed-by: Adam Nathan <adamnathan@google.com>
Cr-Commit-Position: refs/heads/master@{#31399}
worker_queue is used in many places and it can be confusing. This queue
is the send transport's worker queue. Rename to send_transport_queue to
reflect that.
Bug: none
Change-Id: I43c5c4cbddaee3dae1ff75aa38dc3ddee6585902
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176362
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31396}
This CL moves webrtc::NackModule to a deprecated folder and annotates
the type with RTC_DEPRECATED.
Since the header should not be used outside of WebRTC, this CL doesn't
created a forward header.
Bug: webrtc:11611
Change-Id: I4d5899d473d78b8c7f4a6a018e2805648244b5f1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176360
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31394}
TaskQueuePacedSender::MaybeUpdateStats() is intended to be called when
packets are sent or by a sequence of "scheduled" calls. There should
only be one scheduled call in flight at a time - and that one
reschedules itself if needed when it runs.
A bug however caused the "schedules task in flight" flag to
incorrectly be set to false, leading to more and more schedules tasks
being alive - eating CPU cycles.
This CL fixes that and also makes sure the queue time properly goes
down to zero before the next idle interval check, even if there are no
more packets to send.
Bug: webrtc:10809
Change-Id: I4e13fcf95619a43dcaf0ed38bce9684a5b0d8d5e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176330
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31390}
When video frame encoding is done on an external thread (for example in
the case of hardware encoders), the WebRTC TaskQueueBase::Current() is
null; in this case use the worker queue instead to send transformed
frames.
Bug: chromium:1086373
Change-Id: I903ddc52ad6832557fc5b5f76396fe26cf5a88f3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176303
Reviewed-by: Magnus Flodman <mflodman@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Marina Ciocea <marinaciocea@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31388}
Since we've passed IsConsistent(), if data_ is null, size_ must be
zero, so we might attempt to copy zero bytes from a nullptr. This does
not seem to cause problems in practice, but is still undefined
behaviour. This was caught on an UBsan test run in Firefox.
Bug: webrtc:11613
Change-Id: Iad795bf19ed69b56e066958a54a7e3a434b996cf
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176280
Commit-Queue: Dan Minor <dminor@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31386}
Previously a histogram was added to track the requested buffer size,
this CL adds a histogram for the actually used buffer size.
Bug: b/157429867
Change-Id: I04016760982a4c43b8ba8f0e095fe1171b705258
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176227
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31385}
This is useful in debugging the latency from a packet
is enqueued until it's sent.
Bug: webrtc:11617
Change-Id: Ic2f194334a2e178de221df3a0838481035bb3505
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176231
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31381}
This should help debugging when adaptation is or is not happening
unexpectedly. Log spam is prevented by not logging if the same
result happened to the same resource already and we haven't
adapted since then.
Bug: webrtc:11616
Change-Id: Ia6c5cc35061d252f1c66f2f2bf3b94d2485498d6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176221
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31378}
Increase test duration to make at least one frame to come through on slow
test bots and remove check in echo emulation for same purposes. Logging
for echo queue should be enough.
Bug: None
Change-Id: I0d2d1c2a87e1a2b4cd035828443f428b0983edad
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176300
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31377}
Just use the task queue it represents instead.
Also rename the accessor to not confuse it with the 'network thread'.
Bug: none
Change-Id: Ic6c61652768ca3ff60dc0a2acc4850350feeb98e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176226
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31375}
This CL adds a 1 second cooldown period for QualityScalerResource to
signal kUnderuse due to being disabled.
If underuse is signaled every frame, any RTC_LOGging performed by the
ResourceAdaptationProcessor would become very spammy.
Plus we don't need to adapt every single frame.
Bug: webrtc:11616
Change-Id: Id76e5ca39a5e5dac9b71fdab79fb4f3dd5aeab1f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176228
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31374}
The Android native audio code asks the OS to provide an appropriate
buffer size for real-time audio playout. We should add logging for this
value so we can see what values are used in practice.
Bug: b/157429867
Change-Id: I111a74faefc0e77b5c98921804d6625cba1b84af
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176126
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Henrik Andreasson <henrika@chromium.org>
Commit-Queue: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31368}