| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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/media/base/videoframefactory.h" | 11 #include "webrtc/media/base/videoframefactory.h" |
| 12 | 12 |
| 13 #include <algorithm> | 13 #include <algorithm> |
| 14 #include "webrtc/media/base/videocapturer.h" | 14 #include "webrtc/media/base/videocapturer.h" |
| 15 | 15 |
| 16 namespace cricket { | 16 namespace cricket { |
| 17 | 17 |
| 18 VideoFrame* VideoFrameFactory::CreateAliasedFrame( | 18 VideoFrame* VideoFrameFactory::CreateAliasedFrame( |
| 19 const CapturedFrame* input_frame, | 19 const CapturedFrame* input_frame, |
| 20 int cropped_input_width, | 20 int cropped_input_width, |
| 21 int cropped_input_height, | 21 int cropped_input_height, |
| 22 int output_width, | 22 int output_width, |
| 23 int output_height) const { | 23 int output_height) const { |
| 24 rtc::scoped_ptr<VideoFrame> cropped_input_frame(CreateAliasedFrame( | 24 std::unique_ptr<VideoFrame> cropped_input_frame(CreateAliasedFrame( |
| 25 input_frame, cropped_input_width, cropped_input_height)); | 25 input_frame, cropped_input_width, cropped_input_height)); |
| 26 if (!cropped_input_frame) | 26 if (!cropped_input_frame) |
| 27 return nullptr; | 27 return nullptr; |
| 28 | 28 |
| 29 if (cropped_input_width == output_width && | 29 if (cropped_input_width == output_width && |
| 30 cropped_input_height == output_height) { | 30 cropped_input_height == output_height) { |
| 31 // No scaling needed. | 31 // No scaling needed. |
| 32 return cropped_input_frame.release(); | 32 return cropped_input_frame.release(); |
| 33 } | 33 } |
| 34 | 34 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 52 return NULL; | 52 return NULL; |
| 53 } | 53 } |
| 54 } else { | 54 } else { |
| 55 cropped_input_frame->StretchToFrame(output_frame_.get(), true, true); | 55 cropped_input_frame->StretchToFrame(output_frame_.get(), true, true); |
| 56 output_frame_->SetTimeStamp(cropped_input_frame->GetTimeStamp()); | 56 output_frame_->SetTimeStamp(cropped_input_frame->GetTimeStamp()); |
| 57 } | 57 } |
| 58 return output_frame_->Copy(); | 58 return output_frame_->Copy(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // namespace cricket | 61 } // namespace cricket |
| OLD | NEW |