| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 19 matching lines...) Expand all Loading... |
| 30 // Drop frame in order to respect frame rate constraint. | 30 // Drop frame in order to respect frame rate constraint. |
| 31 return rtc::Optional<VideoFrame>(); | 31 return rtc::Optional<VideoFrame>(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 rtc::Optional<VideoFrame> out_frame; | 34 rtc::Optional<VideoFrame> out_frame; |
| 35 if (out_height != frame.height() || out_width != frame.width()) { | 35 if (out_height != frame.height() || out_width != frame.width()) { |
| 36 // Video adapter has requested a down-scale. Allocate a new buffer and | 36 // Video adapter has requested a down-scale. Allocate a new buffer and |
| 37 // return scaled version. | 37 // return scaled version. |
| 38 rtc::scoped_refptr<I420Buffer> scaled_buffer = | 38 rtc::scoped_refptr<I420Buffer> scaled_buffer = |
| 39 I420Buffer::Create(out_width, out_height); | 39 I420Buffer::Create(out_width, out_height); |
| 40 scaled_buffer->ScaleFrom(*frame.video_frame_buffer().get()); | 40 scaled_buffer->ScaleFrom(*frame.video_frame_buffer()->ToI420()); |
| 41 out_frame.emplace( | 41 out_frame.emplace( |
| 42 VideoFrame(scaled_buffer, kVideoRotation_0, frame.timestamp_us())); | 42 VideoFrame(scaled_buffer, kVideoRotation_0, frame.timestamp_us())); |
| 43 } else { | 43 } else { |
| 44 // No adaptations needed, just return the frame as is. | 44 // No adaptations needed, just return the frame as is. |
| 45 out_frame.emplace(frame); | 45 out_frame.emplace(frame); |
| 46 } | 46 } |
| 47 | 47 |
| 48 return out_frame; | 48 return out_frame; |
| 49 } | 49 } |
| 50 | 50 |
| 51 void VideoCapturer::AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, | 51 void VideoCapturer::AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink, |
| 52 const rtc::VideoSinkWants& wants) { | 52 const rtc::VideoSinkWants& wants) { |
| 53 video_adapter_->OnResolutionFramerateRequest( | 53 video_adapter_->OnResolutionFramerateRequest( |
| 54 wants.target_pixel_count, wants.max_pixel_count, wants.max_framerate_fps); | 54 wants.target_pixel_count, wants.max_pixel_count, wants.max_framerate_fps); |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace test | 57 } // namespace test |
| 58 } // namespace webrtc | 58 } // namespace webrtc |
| OLD | NEW |