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

Side by Side Diff: content/renderer/media/video_capture_impl.cc

Issue 22876027: Consolidate duplicated frame / capability structures in video_capture_types.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased: changed media::VideoCaptureCapability::kI420 -> media::PIXEL_FORMAT_I420 etc. Created 7 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/media/video_capture_impl.h" 5 #include "content/renderer/media/video_capture_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/child/child_process.h" 9 #include "content/child/child_process.h"
10 #include "content/common/media/video_capture_messages.h" 10 #include "content/common/media/video_capture_messages.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 VideoCaptureImpl::VideoCaptureImpl( 49 VideoCaptureImpl::VideoCaptureImpl(
50 const media::VideoCaptureSessionId id, 50 const media::VideoCaptureSessionId id,
51 base::MessageLoopProxy* capture_message_loop_proxy, 51 base::MessageLoopProxy* capture_message_loop_proxy,
52 VideoCaptureMessageFilter* filter) 52 VideoCaptureMessageFilter* filter)
53 : VideoCapture(), 53 : VideoCapture(),
54 message_filter_(filter), 54 message_filter_(filter),
55 capture_message_loop_proxy_(capture_message_loop_proxy), 55 capture_message_loop_proxy_(capture_message_loop_proxy),
56 io_message_loop_proxy_(ChildProcess::current()->io_message_loop_proxy()), 56 io_message_loop_proxy_(ChildProcess::current()->io_message_loop_proxy()),
57 device_id_(0), 57 device_id_(0),
58 video_type_(media::VideoCaptureCapability::kI420), 58 video_type_(media::PIXEL_FORMAT_I420),
59 device_info_available_(false), 59 device_info_available_(false),
60 suspended_(false), 60 suspended_(false),
61 state_(VIDEO_CAPTURE_STATE_STOPPED) { 61 state_(VIDEO_CAPTURE_STATE_STOPPED) {
62 DCHECK(filter); 62 DCHECK(filter);
63 capture_format_.session_id = id; 63 capture_format_.session_id = id;
64 } 64 }
65 65
66 VideoCaptureImpl::~VideoCaptureImpl() { 66 VideoCaptureImpl::~VideoCaptureImpl() {
67 STLDeleteValues(&cached_dibs_); 67 STLDeleteValues(&cached_dibs_);
68 } 68 }
(...skipping 10 matching lines...) Expand all
79 79
80 void VideoCaptureImpl::DeInit(base::Closure task) { 80 void VideoCaptureImpl::DeInit(base::Closure task) {
81 capture_message_loop_proxy_->PostTask(FROM_HERE, 81 capture_message_loop_proxy_->PostTask(FROM_HERE,
82 base::Bind(&VideoCaptureImpl::DoDeInitOnCaptureThread, 82 base::Bind(&VideoCaptureImpl::DoDeInitOnCaptureThread,
83 base::Unretained(this), task)); 83 base::Unretained(this), task));
84 } 84 }
85 85
86 void VideoCaptureImpl::StartCapture( 86 void VideoCaptureImpl::StartCapture(
87 media::VideoCapture::EventHandler* handler, 87 media::VideoCapture::EventHandler* handler,
88 const media::VideoCaptureCapability& capability) { 88 const media::VideoCaptureCapability& capability) {
89 DCHECK_EQ(capability.color, media::VideoCaptureCapability::kI420); 89 DCHECK_EQ(capability.color, media::PIXEL_FORMAT_I420);
90 90
91 capture_message_loop_proxy_->PostTask(FROM_HERE, 91 capture_message_loop_proxy_->PostTask(FROM_HERE,
92 base::Bind(&VideoCaptureImpl::DoStartCaptureOnCaptureThread, 92 base::Bind(&VideoCaptureImpl::DoStartCaptureOnCaptureThread,
93 base::Unretained(this), handler, capability)); 93 base::Unretained(this), handler, capability));
94 } 94 }
95 95
96 void VideoCaptureImpl::StopCapture(media::VideoCapture::EventHandler* handler) { 96 void VideoCaptureImpl::StopCapture(media::VideoCapture::EventHandler* handler) {
97 capture_message_loop_proxy_->PostTask(FROM_HERE, 97 capture_message_loop_proxy_->PostTask(FROM_HERE,
98 base::Bind(&VideoCaptureImpl::DoStopCaptureOnCaptureThread, 98 base::Bind(&VideoCaptureImpl::DoStopCaptureOnCaptureThread,
99 base::Unretained(this), handler)); 99 base::Unretained(this), handler));
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 StartCaptureInternal(); 431 StartCaptureInternal();
432 } 432 }
433 433
434 void VideoCaptureImpl::StartCaptureInternal() { 434 void VideoCaptureImpl::StartCaptureInternal() {
435 DCHECK(capture_message_loop_proxy_->BelongsToCurrentThread()); 435 DCHECK(capture_message_loop_proxy_->BelongsToCurrentThread());
436 DCHECK(device_id_); 436 DCHECK(device_id_);
437 437
438 media::VideoCaptureParams capability_as_params_copy; 438 media::VideoCaptureParams capability_as_params_copy;
439 capability_as_params_copy.width = capture_format_.width; 439 capability_as_params_copy.width = capture_format_.width;
440 capability_as_params_copy.height = capture_format_.height; 440 capability_as_params_copy.height = capture_format_.height;
441 capability_as_params_copy.frame_per_second = capture_format_.frame_rate; 441 capability_as_params_copy.frame_rate = capture_format_.frame_rate;
442 capability_as_params_copy.session_id = capture_format_.session_id; 442 capability_as_params_copy.session_id = capture_format_.session_id;
443 capability_as_params_copy.frame_size_type = capture_format_.frame_size_type; 443 capability_as_params_copy.frame_size_type = capture_format_.frame_size_type;
444 Send(new VideoCaptureHostMsg_Start(device_id_, capability_as_params_copy)); 444 Send(new VideoCaptureHostMsg_Start(device_id_, capability_as_params_copy));
445 state_ = VIDEO_CAPTURE_STATE_STARTED; 445 state_ = VIDEO_CAPTURE_STATE_STARTED;
446 } 446 }
447 447
448 void VideoCaptureImpl::AddDelegateOnIOThread() { 448 void VideoCaptureImpl::AddDelegateOnIOThread() {
449 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread()); 449 DCHECK(io_message_loop_proxy_->BelongsToCurrentThread());
450 message_filter_->AddDelegate(this); 450 message_filter_->AddDelegate(this);
451 } 451 }
(...skipping 30 matching lines...) Expand all
482 if (it != clients->end()) { 482 if (it != clients->end()) {
483 handler->OnStopped(this); 483 handler->OnStopped(this);
484 handler->OnRemoved(this); 484 handler->OnRemoved(this);
485 clients->erase(it); 485 clients->erase(it);
486 found = true; 486 found = true;
487 } 487 }
488 return found; 488 return found;
489 } 489 }
490 490
491 } // namespace content 491 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/video_capture_impl.h ('k') | content/renderer/media/video_capture_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698