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 "media/capture/content/thread_safe_capture_oracle.h" | 5 #include "media/capture/content/thread_safe_capture_oracle.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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 const int frame_number = oracle_.RecordCapture(attenuated_utilization); | 113 const int frame_number = oracle_.RecordCapture(attenuated_utilization); |
114 TRACE_EVENT_ASYNC_BEGIN2("gpu.capture", "Capture", output_buffer.get(), | 114 TRACE_EVENT_ASYNC_BEGIN2("gpu.capture", "Capture", output_buffer.get(), |
115 "frame_number", frame_number, "trigger", event_name); | 115 "frame_number", frame_number, "trigger", event_name); |
116 // Texture frames wrap a texture mailbox, which we don't have at the moment. | 116 // Texture frames wrap a texture mailbox, which we don't have at the moment. |
117 // We do not construct those frames. | 117 // We do not construct those frames. |
118 if (params_.requested_format.pixel_storage != media::PIXEL_STORAGE_TEXTURE) { | 118 if (params_.requested_format.pixel_storage != media::PIXEL_STORAGE_TEXTURE) { |
119 *storage = VideoFrame::WrapExternalData( | 119 *storage = VideoFrame::WrapExternalData( |
120 media::PIXEL_FORMAT_I420, coded_size, gfx::Rect(visible_size), | 120 media::PIXEL_FORMAT_I420, coded_size, gfx::Rect(visible_size), |
121 visible_size, static_cast<uint8*>(output_buffer->data()), | 121 visible_size, static_cast<uint8*>(output_buffer->data()), |
122 output_buffer->size(), base::TimeDelta()); | 122 output_buffer->mapped_size(), base::TimeDelta()); |
123 DCHECK(*storage); | 123 DCHECK(*storage); |
124 } | 124 } |
125 *callback = | 125 *callback = |
126 base::Bind(&ThreadSafeCaptureOracle::DidCaptureFrame, this, frame_number, | 126 base::Bind(&ThreadSafeCaptureOracle::DidCaptureFrame, this, frame_number, |
127 base::Passed(&output_buffer), capture_begin_time, | 127 base::Passed(&output_buffer), capture_begin_time, |
128 oracle_.estimated_frame_duration()); | 128 oracle_.estimated_frame_duration()); |
129 return true; | 129 return true; |
130 } | 130 } |
131 | 131 |
132 gfx::Size ThreadSafeCaptureOracle::GetCaptureSize() const { | 132 gfx::Size ThreadSafeCaptureOracle::GetCaptureSize() const { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // destructor. |metadata| is still valid for read-access at this point. | 194 // destructor. |metadata| is still valid for read-access at this point. |
195 double utilization = -1.0; | 195 double utilization = -1.0; |
196 if (metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, | 196 if (metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, |
197 &utilization)) { | 197 &utilization)) { |
198 base::AutoLock guard(lock_); | 198 base::AutoLock guard(lock_); |
199 oracle_.RecordConsumerFeedback(frame_number, utilization); | 199 oracle_.RecordConsumerFeedback(frame_number, utilization); |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 } // namespace media | 203 } // namespace media |
OLD | NEW |