Commit graph

29 commits

Author SHA1 Message Date
Ali Tofigh
641a1b11b6 Adopt absl::string_view in call/
Bug: webrtc:13579
Change-Id: Ib616eb3372da341fafb55c23038182751b9da5a2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262780
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36910}
2022-05-17 12:00:45 +00:00
Tommi
62b01db428 VideoStreamEncoder - wait less.
Some of the state that's managed in VideoStreamEncoder, is updated
and accessed on the encoder queue, but a method that's used for testing
only (GetAdaptationResources()), represents a race between PostTask
operations that update state and checking for said state on the worker
thread.

This CL removes Wait() operations related to adaptation resources from
the common path and puts one in the test path instead.

Bug: webrtc:13612
Change-Id: Ie3e018e815e24951bc0634ed70de17eaf336a508
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249220
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35797}
2022-01-26 09:53:33 +00:00
Artem Titov
ea24027e83 Use backticks not vertical bars to denote variables in comments for /call
Bug: webrtc:12338
Change-Id: I8f92127b61352bd4b98a0690e9a0435bb6c6f870
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/226943
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34569}
2021-07-27 18:29:33 +00:00
Evan Shrubsole
8572841131 [Adaptation] Remove resource adaptation queue
Resource adaptation needs refactoring for async adaptations. For now
the resource adaptation processor can work on the encoder thread, until
it is refactored to support async adaptation.

Bug: webrtc:11867
Change-Id: I9c46da356db19c0fd52748c999ccb216f2ca923b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/182040
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31991}
2020-08-25 12:16:20 +00:00
Evan Shrubsole
d73d421565 [Adaptation] Move min pixel limit logic out of adaptation processor
This is in preperation for eventual multi-stream and multi-mitigation
adaptation. This logic only applied to a single stream and thus is
better fit in the VideoStreamAdapter.

Bug: webrtc:11754
Change-Id: Icc5c7920038c82b574f4b5f7efbc92698691076f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181585
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31944}
2020-08-17 10:33:44 +00:00
Evan Shrubsole
64a60835a1 [Adaptation] Remove processing_in_progress_ from ResourceAdaptationProcessor
This flag was used to protect an AdaptationListener from adapting again,
but since AdaptationListener was removed this guard is no longer needed.

Bug: webrtc:11834
Change-Id: If79e960f57aaf56ce2849329ff6737414fc60e9a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181068
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/master@{#31905}
2020-08-11 08:57:10 +00:00
Evan Shrubsole
73ecede5ad [Adaptation] Move AdaptationConstraints to VideoStreamAdapter
Bug: webrtc:11754
Change-Id: Ic51059834ea61c08e977a3a6b5bba48abc86f873
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178906
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31688}
2020-07-09 13:06:56 +00:00
Evan Shrubsole
517f81e0a4 [Adaptation] Make ResourceAdaptationProcessorInterface resources thread-safe
This is one less dependency on the task queue, and will make
things like removing resources and cleanup much easier in the future.

Bug: webrtc:11754
Change-Id: I732f1935d1b58ffe09ca2a2bf59beebc1930214d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178869
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31686}
2020-07-09 12:37:26 +00:00
Evan Shrubsole
dc4d422738 [Adaptation] Move AdaptationListeners to VideoStreamAdapter
This is a step needed for multi-stream and new mitigations. It also
cleans up needing to signal adaptation changes in mutiple places
from ResourceAdaptationProcessor.

R=hbos@webrtc.org

Bug: webrtc:11754
Change-Id: Ib185dc9f66fbb4a087eb9e970c68c3f47eafb17f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178874
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31684}
2020-07-09 11:10:36 +00:00
Evan Shrubsole
3444a49d77 [Adaptation] Remove deg.prefs from ResourceAdaptationProcessor
Changes in effective degradation preference is now done directly
on the VideoStreamAdapter. This means that the
DegradationPreferenceListener class can be removed.

Bug: webrtc:11700
Change-Id: I9ce4b627de0279df5ef2e5a38435a6d352fbb135
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178609
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/master@{#31642}
2020-07-07 08:37:05 +00:00
Evan Shrubsole
afd1dcbde0 [Adaptation] Move TriggerAdaptationDueToFrameDroppedDueToSize
It has no relevance in ResourceAdaptationProcessorInterface.
The logic moves to an interaction directly on the VideoStreamAdapter.

Bug: webrtc:11700
Change-Id: I4c7b3e1e1361722a69b71e8f9bde33f5909c011a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178380
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31634}
2020-07-06 11:45:30 +00:00
Evan Shrubsole
d7d2f27b1b [Adaptation] Adaptation holds restrictions
This refactoring enables us to do multi-step adaptations
instead of the normal single step adaptations.

This work is required pre-requisite work to remove the
DropDueToSize methods from the ResourceAdaptationProcessorInterface.

This work also gives a path to fixing webrtc:11719, since double
adaptations can be done in a controlled manner with this API.


Bug: webrtc:11700,webrtc:11719
Change-Id: Ic7d27a49c82d0cf7ebaf79d7bdf0bc6f382770ed
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/178200
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31631}
2020-07-06 09:12:23 +00:00
Evan Shrubsole
9492d500dd [Adaptation] Move deg.pref. out of ResourceAdaptationProcessor
This patch creates a new class which provides the DegradationPreference
thread safe to all classes that need if (BalancedConstraint and
QpScalerResource). It also broadcasts to all listeners when the
preferences are updated, so the ResourceAdaptationProcessor can update
the video if needed.

In future work, this could be used to remove the need for two task
queues for the VideoStreamEncoder resources.

Bug: webrtc:11700
Change-Id: I05480db8b7157b5643f6f86ec9c64850839b3e76
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177522
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31623}
2020-07-03 13:10:27 +00:00
Evan Shrubsole
34b1a42de8 [Adaptation] Move input state into VideoStreamAdapter
Bug: webrtc:11700
Change-Id: I81a060b914f91f6724f13a9b672234c9c4a65fae
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177104
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/master@{#31616}
2020-07-02 14:01:58 +00:00
Evan Shrubsole
ec0af26ff8 [Adaptation] VideoStreamAdapter broadcasts adaptations
This moves this responsibility from the ResourceAdaptaitonProcessor
to the VideoStreamAdapter. A new interface for listening to adaptation
changes was added, and the ResourceAdaptationProcessor now listens on
the VideoStreamAdapter for those changes.

This means that going forward,

1. We can do adaptations outside of resource limitations, like setting
prior adaptations on a resource like initial frame dropper is designed
to.
2. Adaptations can be on a different queue than the
ResourceAdaptaitonProcessor's queue since updates are pushed through
the listener.


Bug: webrtc:11700
Change-Id: I6de0dec748dba095e702f0b9893c5afa50b51aa9
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176859
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/master@{#31615}
2020-07-02 12:16:25 +00:00
Evan Shrubsole
ce971b0f10 [Adaptation] Implement remove for most limited resources.
When a resource is removed from the ResourceAdaptationProcessor,
and the resource is the most limited resource, we reset the current
adaptation to the next most limited resource level. In the case that
this resource is the only adapted resource then we reset all adaptations.

Bug: webrtc:11636
Change-Id: I29acc5a3934f42f00db79b3bb2171156b1313937
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176406
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31520}
2020-06-15 09:39:04 +00:00
Henrik Boström
f4a9991cce [Adaptation] Adding adaptation resources from Call.
This CL adds AddAdaptationResource to Call and
AddAdaptationResource/GetAdaptationResources method to relevant
VideoSendStream and VideoStreamEncoder interfaces and implementations.

Unittests are added to ensure that resources can be added to the Call
both before and after the creation of a VideoSendStream and that the
resources always gets added to the streams.

In a follow-up CL, we will continue to plumb the resources all the way
to PeerConnectionInterface, and an integration test will then be added
to ensure that injected resources are capable of triggering adaptation.

Bug: webrtc:11525
Change-Id: I499e9c23c3e359df943414d420b2e0ce2e9b2d56
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177002
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31499}
2020-06-11 12:43:21 +00:00
Evan Shrubsole
64469037b7 Only allow most limited resource to trigger adapt up
A more detailed explaination is in the bug, but this changes
the way that adaptation happens when multiple resources are
limited. Only the one that is most limited can trigger an
adaptation up. If multiple resources are most limited both
need to underuse to adapt up.

Some of the changes in this patch to make it all work:

* VideoStreamEncoder unittests that did not reflect this
new behaviour have been changed.

* PeekNextRestrictions returns the adaptation counters as
well as the restrictions.

* Adaptation statstics have changed so that when adapting
up all resources are tagged as triggering the adaptation.
Additionally the statistics for the current adaptation is
now the total number of adaptations per reason, rather then
the number of adaptations due to that reason.

* PreventAdaptUpDueToActiveCounts is removed as most limited
resource is a strong implementation of that.

Bug: webrtc:11553
Change-Id: If1545a201c8e019598edf82657a1befde8b05268
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176128
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31497}
2020-06-11 09:59:42 +00:00
Henrik Boström
e2e8c17cbf [Adaptation] Move Resource to api/ folder.
This is a prerequisite to implementing it externally.

Bug: webrtc:11525
Change-Id: I9cb3b4418396485d3eb9f25cafa51cbff6db7817
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176401
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31418}
2020-06-03 08:51:29 +00:00
Henrik Boström
39ab1b547c [Adaptation] Remove Resource::UsageState() and ClearUsageState().
ResourceListener::OnResourceUsageStateMeasured() now takes
ResourceUsageState as argument, making Resource::UsageState()
superfluous.

With the existing "fire-and-forget" behavior of always clearing usage
state on reacting to a signal, there is no longer a need to call
ClearUsageState() so this too is removed. (We may want to have a
callback in the future to hint to the Resource that it is a good idea
to clear internal measurement samples, i.e. because the load of the
system is about to change, but we can revisit that when we need it.)

Moving the usage state to the callback has the benefit of getting rid
of the assumption that UsageState() has to return the same value every
time it is called in the same task.

This CL is also the final nail in the coffin for Resource needing to
know about the adaptation task queue: ResourceAdaptationProcessor's
ResourceListener now takes care of posting to the adaptation task
queue. To support this, the processor's SequenceChecker is replaced
by a TaskQueueBase pointer.

Bug: webrtc:11525, webrtc:11618
Change-Id: I2277e71cc3759c85b62465020935603f03792c94
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176376
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/master@{#31416}
2020-06-03 08:27:49 +00:00
Henrik Boström
0f0aa9c7a8 [Adaptation] Move IsAdaptationUpAllowed/OnAdaptationApplied out of API.
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}
2020-06-02 13:02:36 +00:00
Henrik Boström
f0eef12e68 [Adaptation] Add more ResourceAdaptationProcessor logging.
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}
2020-05-28 15:06:46 +00:00
Henrik Boström
c55516dd55 [Adaptation] Make Resources reference counted and add more DCHECKs.
In a future CL, adaptation processing and stream encoder resource
management will happen on different task queues. When this is the case,
asynchronous tasks will be posted in both directions and some resources
will have internal states used on multiple threads.

This CL makes the Resource class reference counted in order to support
posting tasks to a different threads without risk of use-after-free
when a posted task is executed with a delay. This is preferred over
WeakPtr strategies because WeakPtrs are single-threaded and preferred
over raw pointer usage because the reference counted approach enables
more compile-time and run-time assurance. This is also "future proof";
when resources can be injected through public APIs, ownership needs to
be shared between libwebrtc and the application (e.g. Chrome).

To reduce the risk of making mistakes in the future CL, sequence
checkers and task queue DCHECKs are added as well as other DCHECKs to
make sure things have been cleaned up before destruction, e.g:
- Processor gets a sequence checker. It is entirely single-threaded.
- Processor must not have any attached listeners or resources on
  destruction.
- Resources must not have any listeners on destruction.
- The Manager, EncodeUsageResource and QualityScalerResource DCHECKs
  they are running on the encoder queue.
- TODOs are added illustrating where we want to add PostTasks in the
  future CL.

Lastly, upon VideoStreamEncoder::Stop() we delete the
ResourceAdaptationProcessor. Because the Processor is already used in
posted tasks, some if statements are added to ensure the Processor is
not used after destruction.

Bug: webrtc:11542, webrtc:11520
Change-Id: Ibaa8a61d86d87a71f477d1075a117c28d9d2d285
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174760
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31217}
2020-05-11 20:35:30 +00:00
Evan Shrubsole
0dcb470cfe [Adaptation] Adapt up requires previous underuse
The problem is that a resource that signals Underuse would be
able to trigger an adapt up when it was never limited in the past.
This means that an underused resource would be able to negate the
adaptations made for an overused one.

For example, consider a fast CPU on a bad link. The QP for the image
is high but the CPU is underused. Without requiring previous underuse,
everytime the QP would signal overuse and trigger an adpatation down,
the CPU would signal underuse and trigger an adaptation up.

This works today as we want by using the active counts in the
VideoStreamEncoderResourceManager. This change
makes it a normal behaviour independant of active counts.
The problem with active counts is that is only works with 2 resources.
When resources are injectable it no longer works as expected.

Bug: webrtc:11522, webrtc:11523
Change-Id: I140636ce206d74e00a6b6f8558162bb8afffda1c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174482
Commit-Queue: Evan Shrubsole <eshr@google.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31181}
2020-05-07 12:22:10 +00:00
Henrik Boström
3745d3fc93 [Adaptation] Use ResourceAdaptationProcessorInterface* instead of impl.
This replaces references to the ResourceAdaptationProcessor with
references to its interface. This would make it possible to have
alternative implementations or inject fake/mock implementations for
testing.

The VideoStreamAdapter is still responsible for constructing the
ResourceAdaptationProcessor, but beyond construction it is agnostic
towards the implementation.

With this CL, I claim https://crbug.com/webrtc/11222 complete.

TBR=ilnik@webrtc.org

Bug: webrtc:11222
Change-Id: I6e7a73bf1d0b5e97bc694f66180a747b27ffb018
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174160
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31148}
2020-04-30 09:16:41 +00:00
Henrik Boström
91aa73255e [Adaptation] Add OnAdaptationApplied(), remove ResourceListenerResponse.
This CL is part of the Call-Level Adaptation Processing design doc:
https://docs.google.com/document/d/1ZyC26yOCknrrcYa839ZWLxD6o6Gig5A3lVTh4E41074/edit?usp=sharing

The ResourceListenerResponse was used to make the QualityScaler
not clear QP samples and instead increase its frequency of checking for
QP under certain circumstances, see enum description:
https://webrtc.googlesource.com/src.git/+/c70b1028d47c1aee4892545190cd66e97d09cd55/call/adaptation/resource.h#33

Because the QualityScaler depends on whether and how adaptation
happened it should listen to adaptation happening.

This CL moves the logic that was previously in VideoStreamAdapter closer
to the QualityScaler: QualityScalerResource::OnAdaptationApplied().

This would allow the VideoStreamAdapter to operate on a separate task
queue in the future, with no dependencies on any stream-specific
resources that might operate on other task queues.

Bug: webrtc:11172, webrtc:11521
Change-Id: I07971a8a5fab5715f4ccb7d2c63f1b92bd47170f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173090
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Cr-Commit-Position: refs/heads/master@{#31143}
2020-04-29 09:08:46 +00:00
Henrik Boström
87eece9421 [Adaptation] Introducing call/adaptation/ResourceAdaptationProcessor.
This CL is part of the Call-Level Adaptation Processing design doc:
https://docs.google.com/document/d/1ZyC26yOCknrrcYa839ZWLxD6o6Gig5A3lVTh4E41074/edit?usp=sharing

This gets to the heart of unblocking call-level adaptation, largely
made possible due to the previous CLs in the chain.

The parts of the code that are responsible for responding to resource
usage signals, obtaining adaptations and applying them are moved to
ResourceAdaptationProcessor in call/adaptation/.

The parts of the code that are responsible for managing
VideoStreamEncoder-specific resources stay inside the
VideoStreamEncoderResourceManager class in video/adaptation/.

After this CL lands it should soon be possible to move the Processor
over to a separate task queue and let the Manager stay on the encoder
queue if PostTasks are added for communication between the two objects.

Bug: webrtc:11172
Change-Id: Ifa212467b4afd16e7ebfb9adfe17d2dca1cb7d67
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/173021
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31105}
2020-04-17 16:39:21 +00:00
Henrik Boström
62057627ef [Adaptation] Rename and move resource adaptation module/processor stuff.
Rename:
- call/adaptation/resource_adaptation_module_interface.[h/cc] -->
  call/adaptation/resource_adaptation_processor_interface.[h/cc]
- call/adaptation/resource_adaptation_processor.[h/cc] -->
  call/adaptation/new_resource_adaptation_processor_poc.[h/cc]

Move + Rename:
- video/overuse_frame_detector_resource_adaptation_module.[h/cc] -->
  video/adaptation/resource_adaptation_processor.[h/cc]

Move:
- video/encode_usage_resource.[h/cc] --> video/adaptation/...
- video/overuse_frame_detector.[h/cc] --> video/adaptation/...
- video/quality_scaler_resource.[h/cc] --> video/adaptation/...

Unittests are also moved. In order to avoid a circular dependency,
VideoStreamEncoder::kDefaultLastFrameInfo[Width/Height] is moved and
renamed to kDefaultInputPixels[Width/Height] in
video/adaptation/resource_adaptation_processor.[h/cc].

Bug: webrtc:11222
Change-Id: Icf920e8a7362002b1c63c42b2d9e2e63c990b532
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/170117
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30754}
2020-03-11 09:30:16 +00:00
Henrik Boström
b04b2a1719 Initial version of ResourceAdaptationProcessor and friends.
This CL adds Resource, ResourceConsumer, ResourceConsumerConfiguration
and ResourceAdaptationProcessor and implements the algorithm outlined
in
https://docs.google.com/presentation/d/13jyqCWNpIa873iKT6yDuB5Q5ma-c0CvxBpX--0tCclY/edit?usp=sharing.

Simply put, if any resource (such as "CPU") is overusing, the most
expensive consumer (e.g. encoded stream) is adapted one step down.
If all resources are underusing, the least expensive consumer is
adapted one step up.

The current resources, consumers and configurations are all fakes;
this CL has no effect on the current adaptation algorithms used in
practise, but it lays down the foundation for future work in this
area.

Bug: webrtc:11167, webrtc:11168, webrtc:11169
Change-Id: I4054ec7728a52a49e137eee6fa67fa27debd9254
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161237
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Evan Shrubsole <eshr@google.com>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30053}
2019-12-10 15:31:43 +00:00