| 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_format == | 309 if (capture_params_.requested_format.pixel_storage == |
| 310 media::PIXEL_FORMAT_TEXTURE) { | 310 media::PIXEL_STORAGE_TEXTURE) { |
| 311 DCHECK_EQ(capture_params_.requested_format.pixel_format, |
| 312 media::PIXEL_FORMAT_ARGB); |
| 311 DCHECK(!video_frame.get()); | 313 DCHECK(!video_frame.get()); |
| 312 cc::TextureMailbox texture_mailbox; | 314 cc::TextureMailbox texture_mailbox; |
| 313 scoped_ptr<cc::SingleReleaseCallback> release_callback; | 315 scoped_ptr<cc::SingleReleaseCallback> release_callback; |
| 314 result->TakeTexture(&texture_mailbox, &release_callback); | 316 result->TakeTexture(&texture_mailbox, &release_callback); |
| 315 DCHECK(texture_mailbox.IsTexture()); | 317 DCHECK(texture_mailbox.IsTexture()); |
| 316 if (!texture_mailbox.IsTexture()) | 318 if (!texture_mailbox.IsTexture()) |
| 317 return false; | 319 return false; |
| 318 video_frame = media::VideoFrame::WrapNativeTexture( | 320 video_frame = media::VideoFrame::WrapNativeTexture( |
| 319 media::VideoFrame::ARGB, | 321 media::VideoFrame::ARGB, |
| 320 gpu::MailboxHolder(texture_mailbox.mailbox(), texture_mailbox.target(), | 322 gpu::MailboxHolder(texture_mailbox.mailbox(), texture_mailbox.target(), |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 479 |
| 478 void AuraWindowCaptureMachine::OnCompositingEnded( | 480 void AuraWindowCaptureMachine::OnCompositingEnded( |
| 479 ui::Compositor* compositor) { | 481 ui::Compositor* compositor) { |
| 480 // TODO(miu): The CopyOutputRequest should be made earlier, at WillCommit(). | 482 // TODO(miu): The CopyOutputRequest should be made earlier, at WillCommit(). |
| 481 // http://crbug.com/492839 | 483 // http://crbug.com/492839 |
| 482 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( | 484 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( |
| 483 &AuraWindowCaptureMachine::Capture, AsWeakPtr(), true)); | 485 &AuraWindowCaptureMachine::Capture, AsWeakPtr(), true)); |
| 484 } | 486 } |
| 485 | 487 |
| 486 } // namespace content | 488 } // namespace content |
| OLD | NEW |