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 DLOG(ERROR) << "Couldn't create video frame"; |
| 372 return; |
| 373 } |
371 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, | 374 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, |
372 frame_format.frame_rate); | 375 frame_format.frame_rate); |
373 OnIncomingCapturedVideoFrame(buffer.Pass(), frame, timestamp); | 376 OnIncomingCapturedVideoFrame(buffer.Pass(), frame, timestamp); |
374 } | 377 } |
375 | 378 |
376 void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame( | 379 void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame( |
377 scoped_ptr<Buffer> buffer, | 380 scoped_ptr<Buffer> buffer, |
378 const scoped_refptr<VideoFrame>& frame, | 381 const scoped_refptr<VideoFrame>& frame, |
379 const base::TimeTicks& timestamp) { | 382 const base::TimeTicks& timestamp) { |
380 BrowserThread::PostTask( | 383 BrowserThread::PostTask( |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 reinterpret_cast<uint8*>(buffer->data(VideoFrame::kUPlane)); | 457 reinterpret_cast<uint8*>(buffer->data(VideoFrame::kUPlane)); |
455 *v_plane_data = | 458 *v_plane_data = |
456 reinterpret_cast<uint8*>(buffer->data(VideoFrame::kVPlane)); | 459 reinterpret_cast<uint8*>(buffer->data(VideoFrame::kVPlane)); |
457 return buffer.Pass(); | 460 return buffer.Pass(); |
458 } | 461 } |
459 NOTREACHED(); | 462 NOTREACHED(); |
460 return scoped_ptr<Buffer>(); | 463 return scoped_ptr<Buffer>(); |
461 } | 464 } |
462 | 465 |
463 } // namespace content | 466 } // namespace content |
OLD | NEW |