Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: media/capture/content/thread_safe_capture_oracle.cc

Issue 1941523002: Aura Window Capture: Ensure capture callback is always run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/capture/content/thread_safe_capture_oracle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 "frame_number", frame_number, "trigger", 133 "frame_number", frame_number, "trigger",
134 VideoCaptureOracle::EventAsString(event)); 134 VideoCaptureOracle::EventAsString(event));
135 135
136 DCHECK_EQ(media::PIXEL_STORAGE_CPU, params_.requested_format.pixel_storage); 136 DCHECK_EQ(media::PIXEL_STORAGE_CPU, params_.requested_format.pixel_storage);
137 *storage = VideoFrame::WrapExternalSharedMemory( 137 *storage = VideoFrame::WrapExternalSharedMemory(
138 params_.requested_format.pixel_format, coded_size, 138 params_.requested_format.pixel_format, coded_size,
139 gfx::Rect(visible_size), visible_size, 139 gfx::Rect(visible_size), visible_size,
140 static_cast<uint8_t*>(output_buffer->data()), 140 static_cast<uint8_t*>(output_buffer->data()),
141 output_buffer->mapped_size(), base::SharedMemory::NULLHandle(), 0u, 141 output_buffer->mapped_size(), base::SharedMemory::NULLHandle(), 0u,
142 base::TimeDelta()); 142 base::TimeDelta());
143 if (!(*storage)) 143 // If creating the VideoFrame wrapper failed, call DidCaptureFrame() with
144 // !success to execute the required post-capture steps (tracing, notification
145 // of failure to VideoCaptureOracle, etc.).
146 if (!(*storage)) {
147 DidCaptureFrame(frame_number, std::move(output_buffer), capture_begin_time,
148 estimated_frame_duration, *storage, event_time, false);
144 return false; 149 return false;
150 }
151
145 *callback = base::Bind(&ThreadSafeCaptureOracle::DidCaptureFrame, this, 152 *callback = base::Bind(&ThreadSafeCaptureOracle::DidCaptureFrame, this,
146 frame_number, base::Passed(&output_buffer), 153 frame_number, base::Passed(&output_buffer),
147 capture_begin_time, estimated_frame_duration); 154 capture_begin_time, estimated_frame_duration);
148 155
149 return true; 156 return true;
150 } 157 }
151 158
152 bool ThreadSafeCaptureOracle::AttemptPassiveRefresh() { 159 bool ThreadSafeCaptureOracle::AttemptPassiveRefresh() {
153 const base::TimeTicks refresh_time = base::TimeTicks::Now(); 160 const base::TimeTicks refresh_time = base::TimeTicks::Now();
154 161
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // destructor. |metadata| is still valid for read-access at this point. 239 // destructor. |metadata| is still valid for read-access at this point.
233 double utilization = -1.0; 240 double utilization = -1.0;
234 if (metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, 241 if (metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION,
235 &utilization)) { 242 &utilization)) {
236 base::AutoLock guard(lock_); 243 base::AutoLock guard(lock_);
237 oracle_.RecordConsumerFeedback(frame_number, utilization); 244 oracle_.RecordConsumerFeedback(frame_number, utilization);
238 } 245 }
239 } 246 }
240 247
241 } // namespace media 248 } // namespace media
OLDNEW
« no previous file with comments | « media/capture/content/thread_safe_capture_oracle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698