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

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

Issue 2403533002: VideoCaptureHostTest: simplify testing and remove unused code (Closed)
Patch Set: Created 4 years, 2 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/browser/renderer_host/media/video_capture_host.h" 5 #include "content/browser/renderer_host/media/video_capture_host.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 video_frame->metadata()->MergeInternalValuesInto(&params.metadata); 101 video_frame->metadata()->MergeInternalValuesInto(&params.metadata);
102 params.pixel_format = video_frame->format(); 102 params.pixel_format = video_frame->format();
103 params.storage_type = video_frame->storage_type(); 103 params.storage_type = video_frame->storage_type();
104 params.coded_size = video_frame->coded_size(); 104 params.coded_size = video_frame->coded_size();
105 params.visible_rect = video_frame->visible_rect(); 105 params.visible_rect = video_frame->visible_rect();
106 106
107 Send(new VideoCaptureMsg_BufferReady(params)); 107 Send(new VideoCaptureMsg_BufferReady(params));
108 } 108 }
109 109
110 void VideoCaptureHost::OnEnded(VideoCaptureControllerID controller_id) { 110 void VideoCaptureHost::OnEnded(VideoCaptureControllerID controller_id) {
111 DVLOG(1) << "VideoCaptureHost::OnEnded"; 111 DVLOG(1) << __func__;
112 DCHECK_CURRENTLY_ON(BrowserThread::IO); 112 DCHECK_CURRENTLY_ON(BrowserThread::IO);
113 BrowserThread::PostTask( 113 BrowserThread::PostTask(
114 BrowserThread::IO, FROM_HERE, 114 BrowserThread::IO, FROM_HERE,
115 base::Bind(&VideoCaptureHost::DoEnded, this, controller_id)); 115 base::Bind(&VideoCaptureHost::DoEnded, this, controller_id));
116 } 116 }
117 117
118 void VideoCaptureHost::DoError(VideoCaptureControllerID controller_id) { 118 void VideoCaptureHost::DoError(VideoCaptureControllerID controller_id) {
119 DVLOG(1) << "VideoCaptureHost::DoError"; 119 DVLOG(1) << __func__;
120 DCHECK_CURRENTLY_ON(BrowserThread::IO); 120 DCHECK_CURRENTLY_ON(BrowserThread::IO);
121 if (controllers_.find(controller_id) == controllers_.end()) 121 if (controllers_.find(controller_id) == controllers_.end())
122 return; 122 return;
123 123
124 Send(new VideoCaptureMsg_StateChanged(controller_id, 124 Send(new VideoCaptureMsg_StateChanged(controller_id,
125 VIDEO_CAPTURE_STATE_ERROR)); 125 VIDEO_CAPTURE_STATE_ERROR));
126 DeleteVideoCaptureController(controller_id, true); 126 DeleteVideoCaptureController(controller_id, true);
127 } 127 }
128 128
129 void VideoCaptureHost::DoEnded(VideoCaptureControllerID controller_id) { 129 void VideoCaptureHost::DoEnded(VideoCaptureControllerID controller_id) {
130 DVLOG(1) << "VideoCaptureHost::DoEnded"; 130 DVLOG(1) << __func__;
131 DCHECK_CURRENTLY_ON(BrowserThread::IO); 131 DCHECK_CURRENTLY_ON(BrowserThread::IO);
132 if (controllers_.find(controller_id) == controllers_.end()) 132 if (controllers_.find(controller_id) == controllers_.end())
133 return; 133 return;
134 134
135 Send(new VideoCaptureMsg_StateChanged(controller_id, 135 Send(new VideoCaptureMsg_StateChanged(controller_id,
136 VIDEO_CAPTURE_STATE_ENDED)); 136 VIDEO_CAPTURE_STATE_ENDED));
137 DeleteVideoCaptureController(controller_id, false); 137 DeleteVideoCaptureController(controller_id, false);
138 } 138 }
139 139
140 ///////////////////////////////////////////////////////////////////////////////
141 // IPC Messages handler.
142 bool VideoCaptureHost::OnMessageReceived(const IPC::Message& message) { 140 bool VideoCaptureHost::OnMessageReceived(const IPC::Message& message) {
143 bool handled = true; 141 bool handled = true;
144 IPC_BEGIN_MESSAGE_MAP(VideoCaptureHost, message) 142 IPC_BEGIN_MESSAGE_MAP(VideoCaptureHost, message)
145 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady, 143 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_BufferReady,
146 OnRendererFinishedWithBuffer) 144 OnRendererFinishedWithBuffer)
147 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceSupportedFormats, 145 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceSupportedFormats,
148 OnGetDeviceSupportedFormats) 146 OnGetDeviceSupportedFormats)
149 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceFormatsInUse, 147 IPC_MESSAGE_HANDLER(VideoCaptureHostMsg_GetDeviceFormatsInUse,
150 OnGetDeviceFormatsInUse) 148 OnGetDeviceFormatsInUse)
151 IPC_MESSAGE_UNHANDLED(handled = false) 149 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return; 317 return;
320 318
321 if (it->second) { 319 if (it->second) {
322 media_stream_manager_->video_capture_manager()->StopCaptureForClient( 320 media_stream_manager_->video_capture_manager()->StopCaptureForClient(
323 it->second.get(), controller_id, this, on_error); 321 it->second.get(), controller_id, this, on_error);
324 } 322 }
325 controllers_.erase(it); 323 controllers_.erase(it);
326 } 324 }
327 325
328 } // namespace content 326 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698