| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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/adaptedvideotracksource.h" | 11 #include "webrtc/media/base/adaptedvideotracksource.h" |
| 12 | 12 |
| 13 #include "webrtc/api/video/i420_buffer.h" |
| 14 |
| 13 namespace rtc { | 15 namespace rtc { |
| 14 | 16 |
| 15 AdaptedVideoTrackSource::AdaptedVideoTrackSource() { | 17 AdaptedVideoTrackSource::AdaptedVideoTrackSource() { |
| 16 thread_checker_.DetachFromThread(); | 18 thread_checker_.DetachFromThread(); |
| 17 } | 19 } |
| 18 | 20 |
| 19 bool AdaptedVideoTrackSource::GetStats(Stats* stats) { | 21 bool AdaptedVideoTrackSource::GetStats(Stats* stats) { |
| 20 rtc::CritScope lock(&stats_crit_); | 22 rtc::CritScope lock(&stats_crit_); |
| 21 | 23 |
| 22 if (!stats_) { | 24 if (!stats_) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 36 broadcaster_.OnFrame(), in which case we generate a frame with | 38 broadcaster_.OnFrame(), in which case we generate a frame with |
| 37 pending rotation despite some sink with wants.rotation_applied == | 39 pending rotation despite some sink with wants.rotation_applied == |
| 38 true was just added. The VideoBroadcaster enforces | 40 true was just added. The VideoBroadcaster enforces |
| 39 synchronization for us in this case, by not passing the frame on | 41 synchronization for us in this case, by not passing the frame on |
| 40 to sinks which don't want it. */ | 42 to sinks which don't want it. */ |
| 41 if (apply_rotation() && | 43 if (apply_rotation() && |
| 42 frame.rotation() != webrtc::kVideoRotation_0 && | 44 frame.rotation() != webrtc::kVideoRotation_0 && |
| 43 !buffer->native_handle()) { | 45 !buffer->native_handle()) { |
| 44 /* Apply pending rotation. */ | 46 /* Apply pending rotation. */ |
| 45 broadcaster_.OnFrame(webrtc::VideoFrame( | 47 broadcaster_.OnFrame(webrtc::VideoFrame( |
| 46 webrtc::I420Buffer::Rotate(buffer, frame.rotation()), | 48 webrtc::I420Buffer::Rotate(*buffer, frame.rotation()), |
| 47 webrtc::kVideoRotation_0, frame.timestamp_us())); | 49 webrtc::kVideoRotation_0, frame.timestamp_us())); |
| 48 } else { | 50 } else { |
| 49 broadcaster_.OnFrame(frame); | 51 broadcaster_.OnFrame(frame); |
| 50 } | 52 } |
| 51 } | 53 } |
| 52 | 54 |
| 53 void AdaptedVideoTrackSource::AddOrUpdateSink( | 55 void AdaptedVideoTrackSource::AddOrUpdateSink( |
| 54 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink, | 56 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink, |
| 55 const rtc::VideoSinkWants& wants) { | 57 const rtc::VideoSinkWants& wants) { |
| 56 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 58 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // VideoAdapter dropped the frame. | 104 // VideoAdapter dropped the frame. |
| 103 return false; | 105 return false; |
| 104 } | 106 } |
| 105 | 107 |
| 106 *crop_x = (width - *crop_width) / 2; | 108 *crop_x = (width - *crop_width) / 2; |
| 107 *crop_y = (height - *crop_height) / 2; | 109 *crop_y = (height - *crop_height) / 2; |
| 108 return true; | 110 return true; |
| 109 } | 111 } |
| 110 | 112 |
| 111 } // namespace rtc | 113 } // namespace rtc |
| OLD | NEW |