| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 Construct(); | 65 Construct(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void VideoCapturer::Construct() { | 68 void VideoCapturer::Construct() { |
| 69 ratio_w_ = 0; | 69 ratio_w_ = 0; |
| 70 ratio_h_ = 0; | 70 ratio_h_ = 0; |
| 71 enable_camera_list_ = false; | 71 enable_camera_list_ = false; |
| 72 square_pixel_aspect_ratio_ = false; | 72 square_pixel_aspect_ratio_ = false; |
| 73 capture_state_ = CS_STOPPED; | 73 capture_state_ = CS_STOPPED; |
| 74 SignalFrameCaptured.connect(this, &VideoCapturer::OnFrameCaptured); | 74 SignalFrameCaptured.connect(this, &VideoCapturer::OnFrameCaptured); |
| 75 // TODO(perkj) SignalVideoFrame is used directly by Chrome remoting. | |
| 76 // Before that is refactored, SignalVideoFrame must forward frames to the | |
| 77 // |VideoBroadcaster|; | |
| 78 SignalVideoFrame.connect(this, &VideoCapturer::OnFrame); | |
| 79 scaled_width_ = 0; | 75 scaled_width_ = 0; |
| 80 scaled_height_ = 0; | 76 scaled_height_ = 0; |
| 81 enable_video_adapter_ = true; | 77 enable_video_adapter_ = true; |
| 82 // There are lots of video capturers out there that don't call | 78 // There are lots of video capturers out there that don't call |
| 83 // set_frame_factory. We can either go change all of them, or we | 79 // set_frame_factory. We can either go change all of them, or we |
| 84 // can set this default. | 80 // can set this default. |
| 85 // TODO(pthatcher): Remove this hack and require the frame factory | 81 // TODO(pthatcher): Remove this hack and require the frame factory |
| 86 // to be passed in the constructor. | 82 // to be passed in the constructor. |
| 87 set_frame_factory(new WebRtcVideoFrameFactory()); | 83 set_frame_factory(new WebRtcVideoFrameFactory()); |
| 88 } | 84 } |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 adapted_width, adapted_height)); | 383 adapted_width, adapted_height)); |
| 388 | 384 |
| 389 if (!adapted_frame) { | 385 if (!adapted_frame) { |
| 390 // TODO(fbarchard): LOG more information about captured frame attributes. | 386 // TODO(fbarchard): LOG more information about captured frame attributes. |
| 391 LOG(LS_ERROR) << "Couldn't convert to I420! " | 387 LOG(LS_ERROR) << "Couldn't convert to I420! " |
| 392 << "From " << ToString(captured_frame) << " To " | 388 << "From " << ToString(captured_frame) << " To " |
| 393 << cropped_width << " x " << cropped_height; | 389 << cropped_width << " x " << cropped_height; |
| 394 return; | 390 return; |
| 395 } | 391 } |
| 396 | 392 |
| 397 SignalVideoFrame(this, adapted_frame.get()); | 393 OnFrame(this, adapted_frame.get()); |
| 398 UpdateStats(captured_frame); | 394 UpdateStats(captured_frame); |
| 399 } | 395 } |
| 400 | 396 |
| 401 void VideoCapturer::OnFrame(VideoCapturer* capturer, const VideoFrame* frame) { | 397 void VideoCapturer::OnFrame(VideoCapturer* capturer, const VideoFrame* frame) { |
| 402 broadcaster_.OnFrame(*frame); | 398 broadcaster_.OnFrame(*frame); |
| 403 } | 399 } |
| 404 | 400 |
| 405 void VideoCapturer::SetCaptureState(CaptureState state) { | 401 void VideoCapturer::SetCaptureState(CaptureState state) { |
| 406 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 402 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| 407 if (state == capture_state_) { | 403 if (state == capture_state_) { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 rtc::CritScope cs(&frame_stats_crit_); | 541 rtc::CritScope cs(&frame_stats_crit_); |
| 546 | 542 |
| 547 last_captured_frame_format_.width = captured_frame->width; | 543 last_captured_frame_format_.width = captured_frame->width; |
| 548 last_captured_frame_format_.height = captured_frame->height; | 544 last_captured_frame_format_.height = captured_frame->height; |
| 549 // TODO(ronghuawu): Useful to report interval as well? | 545 // TODO(ronghuawu): Useful to report interval as well? |
| 550 last_captured_frame_format_.interval = 0; | 546 last_captured_frame_format_.interval = 0; |
| 551 last_captured_frame_format_.fourcc = captured_frame->fourcc; | 547 last_captured_frame_format_.fourcc = captured_frame->fourcc; |
| 552 } | 548 } |
| 553 | 549 |
| 554 } // namespace cricket | 550 } // namespace cricket |
| OLD | NEW |