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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 } | 91 } |
92 // Select the minimum requested target_pixel_count, if any, of all sinks so | 92 // Select the minimum requested target_pixel_count, if any, of all sinks so |
93 // that we don't over utilize the resources for any one. | 93 // that we don't over utilize the resources for any one. |
94 // TODO(sprang): Consider using the median instead, since the limit can be | 94 // TODO(sprang): Consider using the median instead, since the limit can be |
95 // expressed by max_pixel_count. | 95 // expressed by max_pixel_count. |
96 if (sink.wants.target_pixel_count && | 96 if (sink.wants.target_pixel_count && |
97 (!wants.target_pixel_count || | 97 (!wants.target_pixel_count || |
98 (*sink.wants.target_pixel_count < *wants.target_pixel_count))) { | 98 (*sink.wants.target_pixel_count < *wants.target_pixel_count))) { |
99 wants.target_pixel_count = sink.wants.target_pixel_count; | 99 wants.target_pixel_count = sink.wants.target_pixel_count; |
100 } | 100 } |
| 101 // Select the minimum for the requested max framerates. |
| 102 if (sink.wants.max_framerate_fps_ && |
| 103 (!wants.max_framerate_fps_ || |
| 104 (*sink.wants.max_framerate_fps_ < *wants.max_framerate_fps_))) { |
| 105 wants.max_framerate_fps_ = sink.wants.max_framerate_fps_; |
| 106 } |
101 } | 107 } |
102 | 108 |
103 if (wants.max_pixel_count && wants.target_pixel_count && | 109 if (wants.max_pixel_count && wants.target_pixel_count && |
104 *wants.target_pixel_count >= *wants.max_pixel_count) { | 110 *wants.target_pixel_count >= *wants.max_pixel_count) { |
105 wants.target_pixel_count = wants.max_pixel_count; | 111 wants.target_pixel_count = wants.max_pixel_count; |
106 } | 112 } |
107 current_wants_ = wants; | 113 current_wants_ = wants; |
108 } | 114 } |
109 | 115 |
110 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& | 116 const rtc::scoped_refptr<webrtc::VideoFrameBuffer>& |
111 VideoBroadcaster::GetBlackFrameBuffer(int width, int height) { | 117 VideoBroadcaster::GetBlackFrameBuffer(int width, int height) { |
112 if (!black_frame_buffer_ || black_frame_buffer_->width() != width || | 118 if (!black_frame_buffer_ || black_frame_buffer_->width() != width || |
113 black_frame_buffer_->height() != height) { | 119 black_frame_buffer_->height() != height) { |
114 rtc::scoped_refptr<webrtc::I420Buffer> buffer = | 120 rtc::scoped_refptr<webrtc::I420Buffer> buffer = |
115 webrtc::I420Buffer::Create(width, height); | 121 webrtc::I420Buffer::Create(width, height); |
116 webrtc::I420Buffer::SetBlack(buffer.get()); | 122 webrtc::I420Buffer::SetBlack(buffer.get()); |
117 black_frame_buffer_ = buffer; | 123 black_frame_buffer_ = buffer; |
118 } | 124 } |
119 | 125 |
120 return black_frame_buffer_; | 126 return black_frame_buffer_; |
121 } | 127 } |
122 | 128 |
123 } // namespace rtc | 129 } // namespace rtc |
OLD | NEW |