Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: webrtc/media/base/videobroadcaster.cc

Issue 1695263002: Move direct use of VideoCapturer::VideoAdapter to VideoSinkWants. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebased Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/base/videobroadcaster.h ('k') | webrtc/media/base/videobroadcaster_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/videobroadcaster.cc
diff --git a/webrtc/media/base/videobroadcaster.cc b/webrtc/media/base/videobroadcaster.cc
index e369ee07c632480404080415271572d593c87f06..5fa3db733bbb66d410d3b2f8bf230c5d498cf83f 100644
--- a/webrtc/media/base/videobroadcaster.cc
+++ b/webrtc/media/base/videobroadcaster.cc
@@ -10,6 +10,8 @@
#include "webrtc/media/base/videobroadcaster.h"
+#include <limits>
+
#include "webrtc/base/checks.h"
namespace rtc {
@@ -30,12 +32,7 @@ void VideoBroadcaster::AddOrUpdateSink(
} else {
sink_pair->wants = wants;
}
-
- // Rotation must be applied by the source if one sink wants it.
- current_wants_.rotation_applied = false;
- for (auto& sink_pair : sinks_) {
- current_wants_.rotation_applied |= sink_pair.wants.rotation_applied;
- }
+ UpdateWants();
}
void VideoBroadcaster::RemoveSink(
@@ -49,6 +46,7 @@ void VideoBroadcaster::RemoveSink(
return sink_pair.sink == sink;
}),
sinks_.end());
+ UpdateWants();
}
bool VideoBroadcaster::frame_wanted() const {
@@ -79,4 +77,36 @@ VideoBroadcaster::SinkPair* VideoBroadcaster::FindSinkPair(
return nullptr;
}
+void VideoBroadcaster::UpdateWants() {
+ RTC_DCHECK(thread_checker_.CalledOnValidThread());
+
+ VideoSinkWants wants;
+ wants.rotation_applied = false;
+ for (auto& sink : sinks_) {
+ // wants.rotation_applied == ANY(sink.wants.rotation_applied)
+ if (sink.wants.rotation_applied) {
+ wants.rotation_applied = true;
+ }
+ // wants.max_pixel_count == MIN(sink.wants.max_pixel_count)
+ if (sink.wants.max_pixel_count &&
+ (!wants.max_pixel_count ||
+ (*sink.wants.max_pixel_count < *wants.max_pixel_count))) {
+ wants.max_pixel_count = sink.wants.max_pixel_count;
+ }
+ // wants.max_pixel_count_step_up == MIN(sink.wants.max_pixel_count_step_up)
+ if (sink.wants.max_pixel_count_step_up &&
+ (!wants.max_pixel_count_step_up ||
+ (*sink.wants.max_pixel_count_step_up <
+ *wants.max_pixel_count_step_up))) {
+ wants.max_pixel_count_step_up = sink.wants.max_pixel_count_step_up;
+ }
+ }
+
+ if (wants.max_pixel_count && wants.max_pixel_count_step_up &&
+ *wants.max_pixel_count_step_up >= *wants.max_pixel_count) {
+ wants.max_pixel_count_step_up = Optional<int>();
+ }
+ current_wants_ = wants;
+}
+
} // namespace rtc
« no previous file with comments | « webrtc/media/base/videobroadcaster.h ('k') | webrtc/media/base/videobroadcaster_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698