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

Side by Side Diff: content/browser/renderer_host/media/video_capture_device_client.cc

Issue 1476523005: Verify returned frames from media::VideoFrame::Wrap*() methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: halliwell@ comments. Created 4 years, 11 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 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 case media::PIXEL_STORAGE_CPU: 361 case media::PIXEL_STORAGE_CPU:
362 frame = VideoFrame::WrapExternalSharedMemory( 362 frame = VideoFrame::WrapExternalSharedMemory(
363 media::PIXEL_FORMAT_I420, frame_format.frame_size, 363 media::PIXEL_FORMAT_I420, frame_format.frame_size,
364 gfx::Rect(frame_format.frame_size), frame_format.frame_size, 364 gfx::Rect(frame_format.frame_size), frame_format.frame_size,
365 reinterpret_cast<uint8_t*>(buffer->data()), 365 reinterpret_cast<uint8_t*>(buffer->data()),
366 VideoFrame::AllocationSize(media::PIXEL_FORMAT_I420, 366 VideoFrame::AllocationSize(media::PIXEL_FORMAT_I420,
367 frame_format.frame_size), 367 frame_format.frame_size),
368 base::SharedMemory::NULLHandle(), 0u, base::TimeDelta()); 368 base::SharedMemory::NULLHandle(), 0u, base::TimeDelta());
369 break; 369 break;
370 } 370 }
371 DCHECK(frame.get()); 371 if (!frame)
372 return;
372 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, 373 frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE,
373 frame_format.frame_rate); 374 frame_format.frame_rate);
374 OnIncomingCapturedVideoFrame(std::move(buffer), frame, timestamp); 375 OnIncomingCapturedVideoFrame(std::move(buffer), frame, timestamp);
375 } 376 }
376 377
377 void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame( 378 void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame(
378 scoped_ptr<Buffer> buffer, 379 scoped_ptr<Buffer> buffer,
379 const scoped_refptr<VideoFrame>& frame, 380 const scoped_refptr<VideoFrame>& frame,
380 const base::TimeTicks& timestamp) { 381 const base::TimeTicks& timestamp) {
381 BrowserThread::PostTask( 382 BrowserThread::PostTask(
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane)); 456 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane));
456 *v_plane_data = 457 *v_plane_data =
457 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane)); 458 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane));
458 return buffer; 459 return buffer;
459 } 460 }
460 NOTREACHED(); 461 NOTREACHED();
461 return scoped_ptr<Buffer>(); 462 return scoped_ptr<Buffer>();
462 } 463 }
463 464
464 } // namespace content 465 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698