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

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

Issue 1913283004: Aura Window Capture: Ensure capture callback is always run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix hole in ThreadSafeCaptureOracle as well. 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 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 "frame_number", frame_number, "trigger", 134 "frame_number", frame_number, "trigger",
135 VideoCaptureOracle::EventAsString(event)); 135 VideoCaptureOracle::EventAsString(event));
136 136
137 DCHECK_EQ(media::PIXEL_STORAGE_CPU, params_.requested_format.pixel_storage); 137 DCHECK_EQ(media::PIXEL_STORAGE_CPU, params_.requested_format.pixel_storage);
138 *storage = VideoFrame::WrapExternalSharedMemory( 138 *storage = VideoFrame::WrapExternalSharedMemory(
139 params_.requested_format.pixel_format, coded_size, 139 params_.requested_format.pixel_format, coded_size,
140 gfx::Rect(visible_size), visible_size, 140 gfx::Rect(visible_size), visible_size,
141 static_cast<uint8_t*>(output_buffer->data()), 141 static_cast<uint8_t*>(output_buffer->data()),
142 output_buffer->mapped_size(), base::SharedMemory::NULLHandle(), 0u, 142 output_buffer->mapped_size(), base::SharedMemory::NULLHandle(), 0u,
143 base::TimeDelta()); 143 base::TimeDelta());
144 if (!(*storage)) 144 // If creating the VideoFrame wrapper failed, call DidCaptureFrame() with
145 // !success to execute the required post-capture steps (tracing, notification
146 // of failure to VideoCaptureOracle, etc.).
147 if (!(*storage)) {
148 DidCaptureFrame(frame_number, std::move(output_buffer), capture_begin_time,
149 estimated_frame_duration, *storage, event_time, false);
145 return false; 150 return false;
151 }
152
146 *callback = base::Bind(&ThreadSafeCaptureOracle::DidCaptureFrame, this, 153 *callback = base::Bind(&ThreadSafeCaptureOracle::DidCaptureFrame, this,
147 frame_number, base::Passed(&output_buffer), 154 frame_number, base::Passed(&output_buffer),
148 capture_begin_time, estimated_frame_duration); 155 capture_begin_time, estimated_frame_duration);
149 156
150 return true; 157 return true;
151 } 158 }
152 159
153 bool ThreadSafeCaptureOracle::AttemptPassiveRefresh() { 160 bool ThreadSafeCaptureOracle::AttemptPassiveRefresh() {
154 const base::TimeTicks refresh_time = base::TimeTicks::Now(); 161 const base::TimeTicks refresh_time = base::TimeTicks::Now();
155 162
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // destructor. |metadata| is still valid for read-access at this point. 240 // destructor. |metadata| is still valid for read-access at this point.
234 double utilization = -1.0; 241 double utilization = -1.0;
235 if (metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, 242 if (metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION,
236 &utilization)) { 243 &utilization)) {
237 base::AutoLock guard(lock_); 244 base::AutoLock guard(lock_);
238 oracle_.RecordConsumerFeedback(frame_number, utilization); 245 oracle_.RecordConsumerFeedback(frame_number, utilization);
239 } 246 }
240 } 247 }
241 248
242 } // namespace media 249 } // 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