| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 return ss.str(); | 176 return ss.str(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void VideoCapturer::set_frame_factory(VideoFrameFactory* frame_factory) { | 179 void VideoCapturer::set_frame_factory(VideoFrameFactory* frame_factory) { |
| 180 frame_factory_.reset(frame_factory); | 180 frame_factory_.reset(frame_factory); |
| 181 if (frame_factory) { | 181 if (frame_factory) { |
| 182 frame_factory->SetApplyRotation(apply_rotation_); | 182 frame_factory->SetApplyRotation(apply_rotation_); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 void VideoCapturer::GetStats(VideoFormat* last_captured_frame_format) { | |
| 187 rtc::CritScope cs(&frame_stats_crit_); | |
| 188 *last_captured_frame_format = last_captured_frame_format_; | |
| 189 } | |
| 190 | |
| 191 void VideoCapturer::RemoveSink( | 186 void VideoCapturer::RemoveSink( |
| 192 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { | 187 rtc::VideoSinkInterface<cricket::VideoFrame>* sink) { |
| 193 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 188 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 194 broadcaster_.RemoveSink(sink); | 189 broadcaster_.RemoveSink(sink); |
| 195 OnSinkWantsChanged(broadcaster_.wants()); | 190 OnSinkWantsChanged(broadcaster_.wants()); |
| 196 } | 191 } |
| 197 | 192 |
| 198 void VideoCapturer::AddOrUpdateSink( | 193 void VideoCapturer::AddOrUpdateSink( |
| 199 rtc::VideoSinkInterface<cricket::VideoFrame>* sink, | 194 rtc::VideoSinkInterface<cricket::VideoFrame>* sink, |
| 200 const rtc::VideoSinkWants& wants) { | 195 const rtc::VideoSinkWants& wants) { |
| 201 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 196 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 202 broadcaster_.AddOrUpdateSink(sink, wants); | 197 broadcaster_.AddOrUpdateSink(sink, wants); |
| 203 OnSinkWantsChanged(broadcaster_.wants()); | 198 OnSinkWantsChanged(broadcaster_.wants()); |
| 204 } | 199 } |
| 205 | 200 |
| 201 void VideoCapturer::GetInfo(rtc::VideoSourceInfo *info) { |
| 202 rtc::CritScope cs(&frame_stats_crit_); |
| 203 info->orig_width = last_captured_frame_format_.width; |
| 204 info->orig_height = last_captured_frame_format_.height; |
| 205 } |
| 206 |
| 207 |
| 206 void VideoCapturer::OnSinkWantsChanged(const rtc::VideoSinkWants& wants) { | 208 void VideoCapturer::OnSinkWantsChanged(const rtc::VideoSinkWants& wants) { |
| 207 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 209 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 208 apply_rotation_ = wants.rotation_applied; | 210 apply_rotation_ = wants.rotation_applied; |
| 209 if (frame_factory_) { | 211 if (frame_factory_) { |
| 210 frame_factory_->SetApplyRotation(apply_rotation_); | 212 frame_factory_->SetApplyRotation(apply_rotation_); |
| 211 } | 213 } |
| 212 | 214 |
| 213 if (video_adapter()) { | 215 if (video_adapter()) { |
| 214 video_adapter()->OnCpuResolutionRequest(wants.max_pixel_count, | 216 video_adapter()->OnCpuResolutionRequest(wants.max_pixel_count, |
| 215 wants.max_pixel_count_step_up); | 217 wants.max_pixel_count_step_up); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 rtc::CritScope cs(&frame_stats_crit_); | 547 rtc::CritScope cs(&frame_stats_crit_); |
| 546 | 548 |
| 547 last_captured_frame_format_.width = captured_frame->width; | 549 last_captured_frame_format_.width = captured_frame->width; |
| 548 last_captured_frame_format_.height = captured_frame->height; | 550 last_captured_frame_format_.height = captured_frame->height; |
| 549 // TODO(ronghuawu): Useful to report interval as well? | 551 // TODO(ronghuawu): Useful to report interval as well? |
| 550 last_captured_frame_format_.interval = 0; | 552 last_captured_frame_format_.interval = 0; |
| 551 last_captured_frame_format_.fourcc = captured_frame->fourcc; | 553 last_captured_frame_format_.fourcc = captured_frame->fourcc; |
| 552 } | 554 } |
| 553 | 555 |
| 554 } // namespace cricket | 556 } // namespace cricket |
| OLD | NEW |