| 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 |
| 11 #include "webrtc/api/androidvideocapturer.h" | 11 #include "webrtc/api/androidvideocapturer.h" |
| 12 | 12 |
| 13 #include <memory> |
| 14 |
| 13 #include "webrtc/api/java/jni/native_handle_impl.h" | 15 #include "webrtc/api/java/jni/native_handle_impl.h" |
| 14 #include "webrtc/base/common.h" | 16 #include "webrtc/base/common.h" |
| 15 #include "webrtc/base/timeutils.h" | 17 #include "webrtc/base/timeutils.h" |
| 16 #include "webrtc/media/engine/webrtcvideoframe.h" | 18 #include "webrtc/media/engine/webrtcvideoframe.h" |
| 17 | 19 |
| 18 namespace webrtc { | 20 namespace webrtc { |
| 19 | 21 |
| 20 // A hack for avoiding deep frame copies in | 22 // A hack for avoiding deep frame copies in |
| 21 // cricket::VideoCapturer.SignalFrameCaptured() using a custom FrameFactory. | 23 // cricket::VideoCapturer.SignalFrameCaptured() using a custom FrameFactory. |
| 22 // A frame is injected using UpdateCapturedFrame(), and converted into a | 24 // A frame is injected using UpdateCapturedFrame(), and converted into a |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 65 } |
| 64 | 66 |
| 65 cricket::VideoFrame* CreateAliasedFrame( | 67 cricket::VideoFrame* CreateAliasedFrame( |
| 66 const cricket::CapturedFrame* captured_frame, | 68 const cricket::CapturedFrame* captured_frame, |
| 67 int dst_width, | 69 int dst_width, |
| 68 int dst_height) const override { | 70 int dst_height) const override { |
| 69 // Check that captured_frame is actually our frame. | 71 // Check that captured_frame is actually our frame. |
| 70 RTC_CHECK(captured_frame == &captured_frame_); | 72 RTC_CHECK(captured_frame == &captured_frame_); |
| 71 RTC_CHECK(buffer_->native_handle() == nullptr); | 73 RTC_CHECK(buffer_->native_handle() == nullptr); |
| 72 | 74 |
| 73 rtc::scoped_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame( | 75 std::unique_ptr<cricket::VideoFrame> frame(new cricket::WebRtcVideoFrame( |
| 74 ShallowCenterCrop(buffer_, dst_width, dst_height), | 76 ShallowCenterCrop(buffer_, dst_width, dst_height), |
| 75 captured_frame->time_stamp, captured_frame->rotation)); | 77 captured_frame->time_stamp, captured_frame->rotation)); |
| 76 // Caller takes ownership. | 78 // Caller takes ownership. |
| 77 // TODO(magjed): Change CreateAliasedFrame() to return a rtc::scoped_ptr. | 79 // TODO(magjed): Change CreateAliasedFrame() to return a std::unique_ptr. |
| 78 return apply_rotation_ ? frame->GetCopyWithRotationApplied()->Copy() | 80 return apply_rotation_ ? frame->GetCopyWithRotationApplied()->Copy() |
| 79 : frame.release(); | 81 : frame.release(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 cricket::VideoFrame* CreateAliasedFrame( | 84 cricket::VideoFrame* CreateAliasedFrame( |
| 83 const cricket::CapturedFrame* input_frame, | 85 const cricket::CapturedFrame* input_frame, |
| 84 int cropped_input_width, | 86 int cropped_input_width, |
| 85 int cropped_input_height, | 87 int cropped_input_height, |
| 86 int output_width, | 88 int output_width, |
| 87 int output_height) const override { | 89 int output_height) const override { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 198 |
| 197 bool AndroidVideoCapturer::GetBestCaptureFormat( | 199 bool AndroidVideoCapturer::GetBestCaptureFormat( |
| 198 const cricket::VideoFormat& desired, | 200 const cricket::VideoFormat& desired, |
| 199 cricket::VideoFormat* best_format) { | 201 cricket::VideoFormat* best_format) { |
| 200 // Delegate this choice to VideoCapturer.startCapture(). | 202 // Delegate this choice to VideoCapturer.startCapture(). |
| 201 *best_format = desired; | 203 *best_format = desired; |
| 202 return true; | 204 return true; |
| 203 } | 205 } |
| 204 | 206 |
| 205 } // namespace webrtc | 207 } // namespace webrtc |
| OLD | NEW |