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/browser/media/capture/content_video_capture_device_core.h" | 5 #include "content/browser/media/capture/content_video_capture_device_core.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 "trigger", event_name); | 111 "trigger", event_name); |
112 return false; | 112 return false; |
113 } | 113 } |
114 int frame_number = oracle_.RecordCapture(); | 114 int frame_number = oracle_.RecordCapture(); |
115 TRACE_EVENT_ASYNC_BEGIN2("gpu.capture", "Capture", output_buffer.get(), | 115 TRACE_EVENT_ASYNC_BEGIN2("gpu.capture", "Capture", output_buffer.get(), |
116 "frame_number", frame_number, | 116 "frame_number", frame_number, |
117 "trigger", event_name); | 117 "trigger", event_name); |
118 // NATIVE_TEXTURE frames wrap a texture mailbox, which we don't have at the | 118 // NATIVE_TEXTURE frames wrap a texture mailbox, which we don't have at the |
119 // moment. We do not construct those frames. | 119 // moment. We do not construct those frames. |
120 if (params_.requested_format.pixel_format != media::PIXEL_FORMAT_TEXTURE) { | 120 if (params_.requested_format.pixel_format != media::PIXEL_FORMAT_TEXTURE) { |
121 *storage = media::VideoFrame::WrapExternalPackedMemory( | 121 *storage = media::VideoFrame::WrapExternalData( |
122 media::VideoFrame::I420, | 122 media::VideoFrame::I420, |
123 coded_size, | 123 coded_size, |
124 gfx::Rect(visible_size), | 124 gfx::Rect(visible_size), |
125 visible_size, | 125 visible_size, |
126 static_cast<uint8*>(output_buffer->data()), | 126 static_cast<uint8*>(output_buffer->data()), |
127 output_buffer->size(), | 127 output_buffer->size(), |
128 base::SharedMemory::NULLHandle(), | |
129 0, | |
130 base::TimeDelta()); | 128 base::TimeDelta()); |
131 DCHECK(*storage); | 129 DCHECK(*storage); |
132 } | 130 } |
133 *callback = base::Bind(&ThreadSafeCaptureOracle::DidCaptureFrame, | 131 *callback = base::Bind(&ThreadSafeCaptureOracle::DidCaptureFrame, |
134 this, | 132 this, |
135 frame_number, | 133 frame_number, |
136 base::Passed(&output_buffer), | 134 base::Passed(&output_buffer), |
137 capture_begin_time, | 135 capture_begin_time, |
138 oracle_.estimated_frame_duration()); | 136 oracle_.estimated_frame_duration()); |
139 return true; | 137 return true; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 return; | 316 return; |
319 | 317 |
320 if (oracle_proxy_.get()) | 318 if (oracle_proxy_.get()) |
321 oracle_proxy_->ReportError(reason); | 319 oracle_proxy_->ReportError(reason); |
322 | 320 |
323 StopAndDeAllocate(); | 321 StopAndDeAllocate(); |
324 TransitionStateTo(kError); | 322 TransitionStateTo(kError); |
325 } | 323 } |
326 | 324 |
327 } // namespace content | 325 } // namespace content |
OLD | NEW |