OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/renderer_host/media/video_capture_device_client.h" | 5 #include "content/browser/renderer_host/media/video_capture_device_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 case media::PIXEL_STORAGE_CPU: | 360 case media::PIXEL_STORAGE_CPU: |
361 frame = VideoFrame::WrapExternalSharedMemory( | 361 frame = VideoFrame::WrapExternalSharedMemory( |
362 media::PIXEL_FORMAT_I420, frame_format.frame_size, | 362 media::PIXEL_FORMAT_I420, frame_format.frame_size, |
363 gfx::Rect(frame_format.frame_size), frame_format.frame_size, | 363 gfx::Rect(frame_format.frame_size), frame_format.frame_size, |
364 reinterpret_cast<uint8*>(buffer->data()), | 364 reinterpret_cast<uint8*>(buffer->data()), |
365 VideoFrame::AllocationSize(media::PIXEL_FORMAT_I420, | 365 VideoFrame::AllocationSize(media::PIXEL_FORMAT_I420, |
366 frame_format.frame_size), | 366 frame_format.frame_size), |
367 base::SharedMemory::NULLHandle(), 0u, base::TimeDelta()); | 367 base::SharedMemory::NULLHandle(), 0u, base::TimeDelta()); |
368 break; | 368 break; |
369 } | 369 } |
370 DCHECK(frame.get()); | 370 if (!frame) |
| 371 return; |
371 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, | 372 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, |
372 frame_format.frame_rate); | 373 frame_format.frame_rate); |
373 OnIncomingCapturedVideoFrame(buffer.Pass(), frame, timestamp); | 374 OnIncomingCapturedVideoFrame(buffer.Pass(), frame, timestamp); |
374 } | 375 } |
375 | 376 |
376 void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame( | 377 void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame( |
377 scoped_ptr<Buffer> buffer, | 378 scoped_ptr<Buffer> buffer, |
378 const scoped_refptr<VideoFrame>& frame, | 379 const scoped_refptr<VideoFrame>& frame, |
379 const base::TimeTicks& timestamp) { | 380 const base::TimeTicks& timestamp) { |
380 BrowserThread::PostTask( | 381 BrowserThread::PostTask( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 reinterpret_cast<uint8*>(buffer->data(VideoFrame::kUPlane)); | 455 reinterpret_cast<uint8*>(buffer->data(VideoFrame::kUPlane)); |
455 *v_plane_data = | 456 *v_plane_data = |
456 reinterpret_cast<uint8*>(buffer->data(VideoFrame::kVPlane)); | 457 reinterpret_cast<uint8*>(buffer->data(VideoFrame::kVPlane)); |
457 return buffer.Pass(); | 458 return buffer.Pass(); |
458 } | 459 } |
459 NOTREACHED(); | 460 NOTREACHED(); |
460 return scoped_ptr<Buffer>(); | 461 return scoped_ptr<Buffer>(); |
461 } | 462 } |
462 | 463 |
463 } // namespace content | 464 } // namespace content |
OLD | NEW |