| 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 // For backwards compatiblity, default implementation in terms of old methods. |
| 19 // TODO(nisse): Delete when Chrome's subclass is updated. |
| 20 std::unique_ptr<VideoFrame> VideoFrameFactory::CreateScaledFrame( |
| 21 const CapturedFrame* input_frame, |
| 22 int width, |
| 23 int height) const { |
| 24 return std::unique_ptr<VideoFrame>(CreateAliasedFrame( |
| 25 input_frame, input_frame->width, input_frame->height, width, height)); |
| 26 } |
| 27 |
| 18 VideoFrame* VideoFrameFactory::CreateAliasedFrame( | 28 VideoFrame* VideoFrameFactory::CreateAliasedFrame( |
| 19 const CapturedFrame* input_frame, | 29 const CapturedFrame* input_frame, |
| 20 int cropped_input_width, | 30 int cropped_input_width, |
| 21 int cropped_input_height, | 31 int cropped_input_height, |
| 22 int output_width, | 32 int output_width, |
| 23 int output_height) const { | 33 int output_height) const { |
| 24 std::unique_ptr<VideoFrame> cropped_input_frame(CreateAliasedFrame( | 34 std::unique_ptr<VideoFrame> cropped_input_frame(CreateAliasedFrame( |
| 25 input_frame, cropped_input_width, cropped_input_height)); | 35 input_frame, cropped_input_width, cropped_input_height)); |
| 26 if (!cropped_input_frame) | 36 if (!cropped_input_frame) |
| 27 return nullptr; | 37 return nullptr; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 52 return NULL; | 62 return NULL; |
| 53 } | 63 } |
| 54 } else { | 64 } else { |
| 55 cropped_input_frame->StretchToFrame(output_frame_.get(), true, true); | 65 cropped_input_frame->StretchToFrame(output_frame_.get(), true, true); |
| 56 output_frame_->SetTimeStamp(cropped_input_frame->GetTimeStamp()); | 66 output_frame_->SetTimeStamp(cropped_input_frame->GetTimeStamp()); |
| 57 } | 67 } |
| 58 return output_frame_->Copy(); | 68 return output_frame_->Copy(); |
| 59 } | 69 } |
| 60 | 70 |
| 61 } // namespace cricket | 71 } // namespace cricket |
| OLD | NEW |