Chromium Code Reviews| 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> CreateCroppedAndScaledFrame( | |
| 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 override { | |
| 75 // Check that input_frame is actually our frame. | |
| 76 RTC_CHECK(input_frame == &captured_frame_); | |
| 77 // TODO(nisse): Must handle texture frames too. | |
|
perkj_webrtc
2016/05/16 06:48:46
I think you have to do this now. CreateAliasedFram
| |
| 78 RTC_CHECK(buffer_->native_handle() == nullptr); | |
| 79 | |
| 80 rtc::scoped_refptr<VideoFrameBuffer> scaled_buffer; | |
| 81 if (dst_width == crop_width && dst_height == crop_height) { | |
| 82 if (dst_width == buffer_->width() && dst_height == buffer_->height()) { | |
| 83 scaled_buffer = buffer_; | |
| 84 } else { | |
| 85 scaled_buffer = WrappedI420Buffer::ShallowCrop( | |
| 86 buffer_, crop_x, crop_y, dst_width, dst_height); | |
| 87 } | |
| 88 } | |
| 89 else { | |
| 90 scaled_buffer = I420Buffer::CropAndScale( | |
| 91 buffer_, crop_x, crop_y, crop_width, crop_height, | |
| 92 dst_width, dst_height); | |
| 93 } | |
| 94 std::unique_ptr<cricket::VideoFrame> frame( | |
| 95 new cricket::WebRtcVideoFrame(scaled_buffer, | |
| 96 input_frame->time_stamp, | |
| 97 input_frame->rotation)); | |
| 98 return apply_rotation_ ? std::unique_ptr<cricket::VideoFrame>( | |
| 99 frame->GetCopyWithRotationApplied()->Copy()) | |
|
perkj_webrtc
2016/05/16 06:48:46
nit: Should there be a TODO here to fix GetCopyWit
| |
| 100 : std::move(frame); | |
| 101 } | |
| 102 | |
| 67 cricket::VideoFrame* CreateAliasedFrame( | 103 cricket::VideoFrame* CreateAliasedFrame( |
| 68 const cricket::CapturedFrame* captured_frame, | 104 const cricket::CapturedFrame* captured_frame, |
| 69 int dst_width, | 105 int dst_width, |
| 70 int dst_height) const override { | 106 int dst_height) const override { |
| 71 // Check that captured_frame is actually our frame. | 107 // Check that captured_frame is actually our frame. |
| 72 RTC_CHECK(captured_frame == &captured_frame_); | 108 RTC_CHECK(captured_frame == &captured_frame_); |
| 73 RTC_CHECK(buffer_->native_handle() == nullptr); | 109 RTC_CHECK(buffer_->native_handle() == nullptr); |
| 74 | 110 |
| 75 std::unique_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame( | 111 std::unique_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame( |
| 76 ShallowCenterCrop(buffer_, dst_width, dst_height), | 112 ShallowCenterCrop(buffer_, dst_width, dst_height), |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 | 234 |
| 199 bool AndroidVideoCapturer::GetBestCaptureFormat( | 235 bool AndroidVideoCapturer::GetBestCaptureFormat( |
| 200 const cricket::VideoFormat& desired, | 236 const cricket::VideoFormat& desired, |
| 201 cricket::VideoFormat* best_format) { | 237 cricket::VideoFormat* best_format) { |
| 202 // Delegate this choice to VideoCapturer.startCapture(). | 238 // Delegate this choice to VideoCapturer.startCapture(). |
| 203 *best_format = desired; | 239 *best_format = desired; |
| 204 return true; | 240 return true; |
| 205 } | 241 } |
| 206 | 242 |
| 207 } // namespace webrtc | 243 } // namespace webrtc |
| OLD | NEW |