OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 SinkPair* sink_pair = FindSinkPair(sink); | 27 SinkPair* sink_pair = FindSinkPair(sink); |
28 if (!sink_pair) { | 28 if (!sink_pair) { |
29 sinks_.push_back(SinkPair(sink, wants)); | 29 sinks_.push_back(SinkPair(sink, wants)); |
30 } else { | 30 } else { |
31 sink_pair->wants = wants; | 31 sink_pair->wants = wants; |
32 } | 32 } |
33 | 33 |
34 // Rotation must be applied by the source if one sink wants it. | 34 // Rotation must be applied by the source if one sink wants it. |
35 current_wants_.rotation_applied = false; | 35 current_wants_.rotation_applied = false; |
36 current_wants_.max_number_of_pixels = rtc::Optional<int>(); | |
36 for (auto& sink_pair : sinks_) { | 37 for (auto& sink_pair : sinks_) { |
37 current_wants_.rotation_applied |= sink_pair.wants.rotation_applied; | 38 current_wants_.rotation_applied |= sink_pair.wants.rotation_applied; |
39 | |
40 if (!current_wants_.max_number_of_pixels) { | |
nisse-webrtc
2016/02/18 14:03:42
I liked using SIZE_T_MAX (or whatever it's called)
| |
41 current_wants_.max_number_of_pixels = | |
42 sink_pair.wants.max_number_of_pixels; | |
43 continue; | |
44 } | |
45 | |
46 if (sink_pair.wants.max_number_of_pixels && | |
47 *current_wants_.max_number_of_pixels > | |
48 *sink_pair.wants.max_number_of_pixels) { | |
49 current_wants_.max_number_of_pixels = | |
50 sink_pair.wants.max_number_of_pixels; | |
51 } | |
38 } | 52 } |
39 } | 53 } |
40 | 54 |
41 void VideoBroadcaster::RemoveSink( | 55 void VideoBroadcaster::RemoveSink( |
42 VideoSinkInterface<cricket::VideoFrame>* sink) { | 56 VideoSinkInterface<cricket::VideoFrame>* sink) { |
43 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 57 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
44 RTC_DCHECK(sink != nullptr); | 58 RTC_DCHECK(sink != nullptr); |
45 RTC_DCHECK(FindSinkPair(sink)); | 59 RTC_DCHECK(FindSinkPair(sink)); |
46 | 60 |
47 sinks_.erase(std::remove_if(sinks_.begin(), sinks_.end(), | 61 sinks_.erase(std::remove_if(sinks_.begin(), sinks_.end(), |
(...skipping 25 matching lines...) Expand all Loading... | |
73 auto sink_pair_it = std::find_if( | 87 auto sink_pair_it = std::find_if( |
74 sinks_.begin(), sinks_.end(), | 88 sinks_.begin(), sinks_.end(), |
75 [sink](const SinkPair& sink_pair) { return sink_pair.sink == sink; }); | 89 [sink](const SinkPair& sink_pair) { return sink_pair.sink == sink; }); |
76 if (sink_pair_it != sinks_.end()) { | 90 if (sink_pair_it != sinks_.end()) { |
77 return &*sink_pair_it; | 91 return &*sink_pair_it; |
78 } | 92 } |
79 return nullptr; | 93 return nullptr; |
80 } | 94 } |
81 | 95 |
82 } // namespace rtc | 96 } // namespace rtc |
OLD | NEW |