| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 buffer_ = nullptr; | 57 buffer_ = nullptr; |
| 58 captured_frame_.width = 0; | 58 captured_frame_.width = 0; |
| 59 captured_frame_.height = 0; | 59 captured_frame_.height = 0; |
| 60 captured_frame_.time_stamp = 0; | 60 captured_frame_.time_stamp = 0; |
| 61 } | 61 } |
| 62 | 62 |
| 63 const cricket::CapturedFrame* GetCapturedFrame() const { | 63 const cricket::CapturedFrame* GetCapturedFrame() const { |
| 64 return &captured_frame_; | 64 return &captured_frame_; |
| 65 } | 65 } |
| 66 | 66 |
| 67 std::unique_ptr<cricket::VideoFrame> CreateScaledCroppedFrame( |
| 68 const cricket::CapturedFrame* input_frame, |
| 69 int crop_x, |
| 70 int crop_y, |
| 71 int crop_width, |
| 72 int crop_height, |
| 73 int dst_width, |
| 74 int dst_height) const { |
| 75 // Check that input_frame is actually our frame. |
| 76 RTC_CHECK(input_frame == &captured_frame_); |
| 77 RTC_CHECK(buffer_->native_handle() == nullptr); |
| 78 |
| 79 rtc::scoped_refptr<VideoFrameBuffer> scaled_buffer; |
| 80 if (dst_width == crop_width && dst_height == crop_height) { |
| 81 if (dst_width == buffer_->width() && dst_height == buffer_->height()) { |
| 82 scaled_buffer = buffer_; |
| 83 } else { |
| 84 scaled_buffer = WrappedI420Buffer::ShallowCrop( |
| 85 buffer_, crop_x, crop_y, dst_width, dst_height); |
| 86 } |
| 87 } |
| 88 else { |
| 89 scaled_buffer = I420Buffer::CropAndScale( |
| 90 buffer_, crop_x, crop_y, crop_width, crop_height, |
| 91 dst_width, dst_height); |
| 92 } |
| 93 std::unique_ptr<cricket::VideoFrame> frame( |
| 94 new cricket::WebRtcVideoFrame(scaled_buffer, |
| 95 input_frame->time_stamp, |
| 96 input_frame->rotation)); |
| 97 return apply_rotation_ ? std::unique_ptr<cricket::VideoFrame>( |
| 98 frame->GetCopyWithRotationApplied()->Copy()) |
| 99 : std::move(frame); |
| 100 } |
| 101 |
| 67 cricket::VideoFrame* CreateAliasedFrame( | 102 cricket::VideoFrame* CreateAliasedFrame( |
| 68 const cricket::CapturedFrame* captured_frame, | 103 const cricket::CapturedFrame* captured_frame, |
| 69 int dst_width, | 104 int dst_width, |
| 70 int dst_height) const override { | 105 int dst_height) const override { |
| 71 // Check that captured_frame is actually our frame. | 106 // Check that captured_frame is actually our frame. |
| 72 RTC_CHECK(captured_frame == &captured_frame_); | 107 RTC_CHECK(captured_frame == &captured_frame_); |
| 73 RTC_CHECK(buffer_->native_handle() == nullptr); | 108 RTC_CHECK(buffer_->native_handle() == nullptr); |
| 74 | 109 |
| 75 std::unique_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame( | 110 std::unique_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame( |
| 76 ShallowCenterCrop(buffer_, dst_width, dst_height), | 111 ShallowCenterCrop(buffer_, dst_width, dst_height), |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 233 |
| 199 bool AndroidVideoCapturer::GetBestCaptureFormat( | 234 bool AndroidVideoCapturer::GetBestCaptureFormat( |
| 200 const cricket::VideoFormat& desired, | 235 const cricket::VideoFormat& desired, |
| 201 cricket::VideoFormat* best_format) { | 236 cricket::VideoFormat* best_format) { |
| 202 // Delegate this choice to VideoCapturer.startCapture(). | 237 // Delegate this choice to VideoCapturer.startCapture(). |
| 203 *best_format = desired; | 238 *best_format = desired; |
| 204 return true; | 239 return true; |
| 205 } | 240 } |
| 206 | 241 |
| 207 } // namespace webrtc | 242 } // namespace webrtc |
| OLD | NEW |