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

Side by Side Diff: content/browser/media/capture/desktop_capture_device_aura.cc

Issue 312803002: Android media: VideoFrame should not store so many sync points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ios build Created 6 years, 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/desktop_capture_device_aura.h" 5 #include "content/browser/media/capture/desktop_capture_device_aura.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "cc/output/copy_output_request.h" 10 #include "cc/output/copy_output_request.h"
11 #include "cc/output/copy_output_result.h" 11 #include "cc/output/copy_output_result.h"
12 #include "content/browser/compositor/image_transport_factory.h" 12 #include "content/browser/compositor/image_transport_factory.h"
13 #include "content/browser/media/capture/content_video_capture_device_core.h" 13 #include "content/browser/media/capture/content_video_capture_device_core.h"
14 #include "content/browser/media/capture/desktop_capture_device_uma_types.h" 14 #include "content/browser/media/capture/desktop_capture_device_uma_types.h"
15 #include "content/common/gpu/client/gl_helper.h" 15 #include "content/common/gpu/client/gl_helper.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "media/base/bind_to_current_loop.h"
18 #include "media/base/video_util.h" 17 #include "media/base/video_util.h"
19 #include "media/video/capture/video_capture_types.h" 18 #include "media/video/capture/video_capture_types.h"
20 #include "skia/ext/image_operations.h" 19 #include "skia/ext/image_operations.h"
21 #include "third_party/skia/include/core/SkBitmap.h" 20 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "ui/aura/client/screen_position_client.h" 21 #include "ui/aura/client/screen_position_client.h"
23 #include "ui/aura/env.h" 22 #include "ui/aura/env.h"
24 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
25 #include "ui/aura/window_observer.h" 24 #include "ui/aura/window_observer.h"
26 #include "ui/aura/window_tree_host.h" 25 #include "ui/aura/window_tree_host.h"
27 #include "ui/base/cursor/cursors_aura.h" 26 #include "ui/base/cursor/cursors_aura.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 const gfx::Point& cursor_position, 288 const gfx::Point& cursor_position,
290 scoped_ptr<cc::SingleReleaseCallback> release_callback, 289 scoped_ptr<cc::SingleReleaseCallback> release_callback,
291 bool result) { 290 bool result) {
292 if (!cursor_bitmap.isNull()) 291 if (!cursor_bitmap.isNull())
293 RenderCursorOnVideoFrame(target, cursor_bitmap, cursor_position); 292 RenderCursorOnVideoFrame(target, cursor_bitmap, cursor_position);
294 release_callback->Run(0, false); 293 release_callback->Run(0, false);
295 capture_frame_cb.Run(target, start_time, result); 294 capture_frame_cb.Run(target, start_time, result);
296 } 295 }
297 296
298 void RunSingleReleaseCallback(scoped_ptr<cc::SingleReleaseCallback> cb, 297 void RunSingleReleaseCallback(scoped_ptr<cc::SingleReleaseCallback> cb,
299 const std::vector<uint32>& sync_points) { 298 uint32 sync_point) {
300 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 299 cb->Run(sync_point, false);
301 GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper();
302 DCHECK(gl_helper);
303 for (unsigned i = 0; i < sync_points.size(); i++)
304 gl_helper->WaitSyncPoint(sync_points[i]);
305 uint32 new_sync_point = gl_helper->InsertSyncPoint();
306 cb->Run(new_sync_point, false);
307 } 300 }
308 301
309 void DesktopVideoCaptureMachine::DidCopyOutput( 302 void DesktopVideoCaptureMachine::DidCopyOutput(
310 scoped_refptr<media::VideoFrame> video_frame, 303 scoped_refptr<media::VideoFrame> video_frame,
311 base::TimeTicks start_time, 304 base::TimeTicks start_time,
312 const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb, 305 const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb,
313 scoped_ptr<cc::CopyOutputResult> result) { 306 scoped_ptr<cc::CopyOutputResult> result) {
314 static bool first_call = true; 307 static bool first_call = true;
315 308
316 bool succeeded = ProcessCopyOutputResponse( 309 bool succeeded = ProcessCopyOutputResponse(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 cc::TextureMailbox texture_mailbox; 343 cc::TextureMailbox texture_mailbox;
351 scoped_ptr<cc::SingleReleaseCallback> release_callback; 344 scoped_ptr<cc::SingleReleaseCallback> release_callback;
352 result->TakeTexture(&texture_mailbox, &release_callback); 345 result->TakeTexture(&texture_mailbox, &release_callback);
353 DCHECK(texture_mailbox.IsTexture()); 346 DCHECK(texture_mailbox.IsTexture());
354 if (!texture_mailbox.IsTexture()) 347 if (!texture_mailbox.IsTexture())
355 return false; 348 return false;
356 video_frame = media::VideoFrame::WrapNativeTexture( 349 video_frame = media::VideoFrame::WrapNativeTexture(
357 make_scoped_ptr(new gpu::MailboxHolder(texture_mailbox.mailbox(), 350 make_scoped_ptr(new gpu::MailboxHolder(texture_mailbox.mailbox(),
358 texture_mailbox.target(), 351 texture_mailbox.target(),
359 texture_mailbox.sync_point())), 352 texture_mailbox.sync_point())),
360 media::BindToCurrentLoop(base::Bind(&RunSingleReleaseCallback, 353 base::Bind(&RunSingleReleaseCallback, base::Passed(&release_callback)),
361 base::Passed(&release_callback))),
362 result->size(), 354 result->size(),
363 gfx::Rect(result->size()), 355 gfx::Rect(result->size()),
364 result->size(), 356 result->size(),
365 base::TimeDelta(), 357 base::TimeDelta(),
366 media::VideoFrame::ReadPixelsCB()); 358 media::VideoFrame::ReadPixelsCB());
367 capture_frame_cb.Run(video_frame, start_time, true); 359 capture_frame_cb.Run(video_frame, start_time, true);
368 return true; 360 return true;
369 } 361 }
370 362
371 // Compute the dest size we want after the letterboxing resize. Make the 363 // Compute the dest size we want after the letterboxing resize. Make the
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 scoped_ptr<Client> client) { 524 scoped_ptr<Client> client) {
533 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); 525 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
534 core_->AllocateAndStart(params, client.Pass()); 526 core_->AllocateAndStart(params, client.Pass());
535 } 527 }
536 528
537 void DesktopCaptureDeviceAura::StopAndDeAllocate() { 529 void DesktopCaptureDeviceAura::StopAndDeAllocate() {
538 core_->StopAndDeAllocate(); 530 core_->StopAndDeAllocate();
539 } 531 }
540 532
541 } // namespace content 533 } // namespace content
OLDNEW
« no previous file with comments | « cc/resources/video_resource_updater.cc ('k') | content/browser/renderer_host/image_transport_factory_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698