Route min/max FPS constraints to VideoStreamEncoder.
This change
- adds new type VideoTrackSourceConstraints expressing min/max FPS
constraints.
- adds new method VideoTrackSourceInterface::ProcessConstraints.
- adds new method VideoSinkInterface<>::OnConstraintsChanged.
- updates AdaptedVideoTrackSource and VideoBroadcaster to forward
the constraints to sinks.
- adds several unit tests for the added functionality.
- and finally, implements OnConstraintsChanged in VideoStreamEncoder.
Chromium will be updated in coming CLs to supply constraints set
through the MediaStream module.
go/rtc-0hz-present
Bug: chromium:1255737
No-Try: true
Change-Id: Iffef239217269c332a1aaa902ddeae2440929e22
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235040
Commit-Queue: Markus Handell <handellm@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35197}
diff --git a/api/media_stream_interface.h b/api/media_stream_interface.h
index 874b4db..ad497d9 100644
--- a/api/media_stream_interface.h
+++ b/api/media_stream_interface.h
@@ -28,6 +28,7 @@
#include "api/video/video_frame.h"
#include "api/video/video_sink_interface.h"
#include "api/video/video_source_interface.h"
+#include "api/video_track_source_constraints.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
#include "rtc_base/ref_count.h"
#include "rtc_base/system/rtc_export.h"
@@ -146,8 +147,6 @@
// Add an encoded video sink to the source and additionally cause
// a key frame to be generated from the source. The sink will be
// invoked from a decoder queue.
- // TODO(bugs.webrtc.org/11114): make pure virtual once downstream project
- // adapts.
virtual void AddEncodedSink(
rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) = 0;
@@ -155,6 +154,13 @@
virtual void RemoveEncodedSink(
rtc::VideoSinkInterface<RecordableEncodedFrame>* sink) = 0;
+ // Notify about constraints set on the source. The information eventually gets
+ // routed to attached sinks via VideoSinkInterface<>::OnConstraintsChanged.
+ // The call is expected to happen on the network thread.
+ // TODO(crbug/1255737): make pure virtual once downstream project adapts.
+ virtual void ProcessConstraints(
+ const webrtc::VideoTrackSourceConstraints& constraints) {}
+
protected:
~VideoTrackSourceInterface() override = default;
};