| 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
|
|
|