OLD | NEW |
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/aura_window_capture_machine.h" | 5 #include "content/browser/media/capture/aura_window_capture_machine.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" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 bool AuraWindowCaptureMachine::ProcessCopyOutputResponse( | 299 bool AuraWindowCaptureMachine::ProcessCopyOutputResponse( |
300 scoped_refptr<media::VideoFrame> video_frame, | 300 scoped_refptr<media::VideoFrame> video_frame, |
301 base::TimeTicks start_time, | 301 base::TimeTicks start_time, |
302 const CaptureFrameCallback& capture_frame_cb, | 302 const CaptureFrameCallback& capture_frame_cb, |
303 scoped_ptr<cc::CopyOutputResult> result) { | 303 scoped_ptr<cc::CopyOutputResult> result) { |
304 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 304 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
305 | 305 |
306 if (result->IsEmpty() || result->size().IsEmpty() || !desktop_window_) | 306 if (result->IsEmpty() || result->size().IsEmpty() || !desktop_window_) |
307 return false; | 307 return false; |
308 | 308 |
309 if (capture_params_.requested_format.pixel_storage == | 309 if (capture_params_.requested_format.pixel_format == |
310 media::PIXEL_STORAGE_TEXTURE) { | 310 media::PIXEL_FORMAT_TEXTURE) { |
311 DCHECK_EQ(capture_params_.requested_format.pixel_format, | |
312 media::PIXEL_FORMAT_ARGB); | |
313 DCHECK(!video_frame.get()); | 311 DCHECK(!video_frame.get()); |
314 cc::TextureMailbox texture_mailbox; | 312 cc::TextureMailbox texture_mailbox; |
315 scoped_ptr<cc::SingleReleaseCallback> release_callback; | 313 scoped_ptr<cc::SingleReleaseCallback> release_callback; |
316 result->TakeTexture(&texture_mailbox, &release_callback); | 314 result->TakeTexture(&texture_mailbox, &release_callback); |
317 DCHECK(texture_mailbox.IsTexture()); | 315 DCHECK(texture_mailbox.IsTexture()); |
318 if (!texture_mailbox.IsTexture()) | 316 if (!texture_mailbox.IsTexture()) |
319 return false; | 317 return false; |
320 video_frame = media::VideoFrame::WrapNativeTexture( | 318 video_frame = media::VideoFrame::WrapNativeTexture( |
321 media::VideoFrame::ARGB, | 319 media::VideoFrame::ARGB, |
322 gpu::MailboxHolder(texture_mailbox.mailbox(), texture_mailbox.target(), | 320 gpu::MailboxHolder(texture_mailbox.mailbox(), texture_mailbox.target(), |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 | 477 |
480 void AuraWindowCaptureMachine::OnCompositingEnded( | 478 void AuraWindowCaptureMachine::OnCompositingEnded( |
481 ui::Compositor* compositor) { | 479 ui::Compositor* compositor) { |
482 // TODO(miu): The CopyOutputRequest should be made earlier, at WillCommit(). | 480 // TODO(miu): The CopyOutputRequest should be made earlier, at WillCommit(). |
483 // http://crbug.com/492839 | 481 // http://crbug.com/492839 |
484 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 482 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
485 &AuraWindowCaptureMachine::Capture, AsWeakPtr(), true)); | 483 &AuraWindowCaptureMachine::Capture, AsWeakPtr(), true)); |
486 } | 484 } |
487 | 485 |
488 } // namespace content | 486 } // namespace content |
OLD | NEW |