| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" | 5 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/aligned_memory.h" | 8 #include "base/memory/aligned_memory.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "content/renderer/media/webrtc/webrtc_video_frame_adapter.h" | 10 #include "content/renderer/media/webrtc/webrtc_video_frame_adapter.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 &adapted_width, &adapted_height, | 128 &adapted_width, &adapted_height, |
| 129 &crop_width, &crop_height, &crop_x, &crop_y, | 129 &crop_width, &crop_height, &crop_x, &crop_y, |
| 130 &translated_camera_time_us)) { | 130 &translated_camera_time_us)) { |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Return |frame| directly if it is texture backed, because there is no | 134 // Return |frame| directly if it is texture backed, because there is no |
| 135 // cropping support for texture yet. See http://crbug/503653. | 135 // cropping support for texture yet. See http://crbug/503653. |
| 136 // Return |frame| directly if it is GpuMemoryBuffer backed, as we want to | 136 // Return |frame| directly if it is GpuMemoryBuffer backed, as we want to |
| 137 // keep the frame on native buffers. | 137 // keep the frame on native buffers. |
| 138 if (frame->HasTextures() || | 138 if (frame->HasTextures()) { |
| 139 frame->storage_type() == media::VideoFrame::STORAGE_GPU_MEMORY_BUFFERS) { | |
| 140 OnFrame(cricket::WebRtcVideoFrame( | 139 OnFrame(cricket::WebRtcVideoFrame( |
| 141 new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(frame), | 140 new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(frame), |
| 142 webrtc::kVideoRotation_0, translated_camera_time_us), | 141 webrtc::kVideoRotation_0, translated_camera_time_us), |
| 143 orig_width, orig_height); | 142 orig_width, orig_height); |
| 144 return; | 143 return; |
| 145 } | 144 } |
| 146 | 145 |
| 147 // Translate crop rectangle from natural size to visible size. | 146 // Translate crop rectangle from natural size to visible size. |
| 148 gfx::Rect cropped_visible_rect( | 147 gfx::Rect cropped_visible_rect( |
| 149 frame->visible_rect().x() + | 148 frame->visible_rect().x() + |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 scaled_frame->stride(media::VideoFrame::kVPlane), | 191 scaled_frame->stride(media::VideoFrame::kVPlane), |
| 193 adapted_width, adapted_height, libyuv::kFilterBilinear); | 192 adapted_width, adapted_height, libyuv::kFilterBilinear); |
| 194 | 193 |
| 195 OnFrame(cricket::WebRtcVideoFrame( | 194 OnFrame(cricket::WebRtcVideoFrame( |
| 196 new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(scaled_frame), | 195 new rtc::RefCountedObject<WebRtcVideoFrameAdapter>(scaled_frame), |
| 197 webrtc::kVideoRotation_0, translated_camera_time_us), | 196 webrtc::kVideoRotation_0, translated_camera_time_us), |
| 198 orig_width, orig_height); | 197 orig_width, orig_height); |
| 199 } | 198 } |
| 200 | 199 |
| 201 } // namespace content | 200 } // namespace content |
| OLD | NEW |