| 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 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( | 38 rtc::scoped_refptr<webrtc::VideoFrameBuffer> buffer( |
| 39 frame.video_frame_buffer()); | 39 frame.video_frame_buffer()); |
| 40 /* Note that this is a "best effort" approach to | 40 /* Note that this is a "best effort" approach to |
| 41 wants.rotation_applied; apply_rotation_ can change from false to | 41 wants.rotation_applied; apply_rotation_ can change from false to |
| 42 true between the check of apply_rotation() and the call to | 42 true between the check of apply_rotation() and the call to |
| 43 broadcaster_.OnFrame(), in which case we generate a frame with | 43 broadcaster_.OnFrame(), in which case we generate a frame with |
| 44 pending rotation despite some sink with wants.rotation_applied == | 44 pending rotation despite some sink with wants.rotation_applied == |
| 45 true was just added. The VideoBroadcaster enforces | 45 true was just added. The VideoBroadcaster enforces |
| 46 synchronization for us in this case, by not passing the frame on | 46 synchronization for us in this case, by not passing the frame on |
| 47 to sinks which don't want it. */ | 47 to sinks which don't want it. */ |
| 48 if (apply_rotation() && | 48 if (apply_rotation() && frame.rotation() != webrtc::kVideoRotation_0 && |
| 49 frame.rotation() != webrtc::kVideoRotation_0 && | 49 buffer->type() == webrtc::VideoFrameBuffer::Type::kI420) { |
| 50 !buffer->native_handle()) { | |
| 51 /* Apply pending rotation. */ | 50 /* Apply pending rotation. */ |
| 52 broadcaster_.OnFrame(webrtc::VideoFrame( | 51 broadcaster_.OnFrame(webrtc::VideoFrame( |
| 53 webrtc::I420Buffer::Rotate(*buffer, frame.rotation()), | 52 webrtc::I420Buffer::Rotate(*buffer->GetI420(), frame.rotation()), |
| 54 webrtc::kVideoRotation_0, frame.timestamp_us())); | 53 webrtc::kVideoRotation_0, frame.timestamp_us())); |
| 55 } else { | 54 } else { |
| 56 broadcaster_.OnFrame(frame); | 55 broadcaster_.OnFrame(frame); |
| 57 } | 56 } |
| 58 } | 57 } |
| 59 | 58 |
| 60 void AdaptedVideoTrackSource::AddOrUpdateSink( | 59 void AdaptedVideoTrackSource::AddOrUpdateSink( |
| 61 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink, | 60 rtc::VideoSinkInterface<webrtc::VideoFrame>* sink, |
| 62 const rtc::VideoSinkWants& wants) { | 61 const rtc::VideoSinkWants& wants) { |
| 63 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 62 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // VideoAdapter dropped the frame. | 108 // VideoAdapter dropped the frame. |
| 110 return false; | 109 return false; |
| 111 } | 110 } |
| 112 | 111 |
| 113 *crop_x = (width - *crop_width) / 2; | 112 *crop_x = (width - *crop_width) / 2; |
| 114 *crop_y = (height - *crop_height) / 2; | 113 *crop_y = (height - *crop_height) / 2; |
| 115 return true; | 114 return true; |
| 116 } | 115 } |
| 117 | 116 |
| 118 } // namespace rtc | 117 } // namespace rtc |
| OLD | NEW |