Index: content/browser/renderer_host/media/video_capture_controller.cc |
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc |
index 293014174a6f3411d046003ce520b5aca8e7ea32..ea836964e56c2d72cb64453b944a247597d19709 100644 |
--- a/content/browser/renderer_host/media/video_capture_controller.cc |
+++ b/content/browser/renderer_host/media/video_capture_controller.cc |
@@ -20,7 +20,7 @@ |
#include "third_party/libyuv/include/libyuv.h" |
#endif |
-using media::VideoCaptureCapability; |
+using media::VideoCaptureFormat; |
namespace content { |
@@ -48,27 +48,28 @@ class PoolBuffer : public media::VideoCaptureDevice::Client::Buffer { |
} // anonymous namespace |
struct VideoCaptureController::ControllerClient { |
- ControllerClient( |
- const VideoCaptureControllerID& id, |
- VideoCaptureControllerEventHandler* handler, |
- base::ProcessHandle render_process, |
- const media::VideoCaptureParams& params) |
+ ControllerClient(const VideoCaptureControllerID& id, |
+ VideoCaptureControllerEventHandler* handler, |
+ base::ProcessHandle render_process, |
+ media::VideoCaptureSessionId session_id, |
+ const media::VideoCaptureParams& params) |
: controller_id(id), |
event_handler(handler), |
render_process_handle(render_process), |
+ session_id(session_id), |
parameters(params), |
- session_closed(false) { |
- } |
+ session_closed(false) {} |
~ControllerClient() {} |
// ID used for identifying this object. |
- VideoCaptureControllerID controller_id; |
- VideoCaptureControllerEventHandler* event_handler; |
+ const VideoCaptureControllerID controller_id; |
+ VideoCaptureControllerEventHandler* const event_handler; |
// Handle to the render process that will receive the capture buffers. |
- base::ProcessHandle render_process_handle; |
- media::VideoCaptureParams parameters; |
+ const base::ProcessHandle render_process_handle; |
+ const media::VideoCaptureSessionId session_id; |
+ const media::VideoCaptureParams parameters; |
// Buffers that are currently known to this client. |
std::set<int> known_buffers; |
@@ -115,7 +116,7 @@ class VideoCaptureController::VideoCaptureDeviceClient |
int rotation, |
bool flip_vert, |
bool flip_horiz, |
- const VideoCaptureCapability& frame_info) |
+ const VideoCaptureFormat& frame_format) |
OVERRIDE; |
virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, |
media::VideoFrame::Format format, |
@@ -167,13 +168,13 @@ void VideoCaptureController::AddClient( |
const VideoCaptureControllerID& id, |
VideoCaptureControllerEventHandler* event_handler, |
base::ProcessHandle render_process, |
+ media::VideoCaptureSessionId session_id, |
const media::VideoCaptureParams& params) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
DVLOG(1) << "VideoCaptureController::AddClient, id " << id.device_id |
- << ", (" << params.requested_format.width |
- << ", " << params.requested_format.height |
+ << ", " << params.requested_format.frame_size.ToString() |
<< ", " << params.requested_format.frame_rate |
- << ", " << params.session_id |
+ << ", " << session_id |
<< ")"; |
// Signal error in case device is already in error state. |
@@ -186,8 +187,8 @@ void VideoCaptureController::AddClient( |
if (FindClient(id, event_handler, controller_clients_)) |
return; |
- ControllerClient* client = new ControllerClient(id, event_handler, |
- render_process, params); |
+ ControllerClient* client = new ControllerClient( |
+ id, event_handler, render_process, session_id, params); |
// If we already have gotten frame_info from the device, repeat it to the new |
// client. |
if (state_ == VIDEO_CAPTURE_STATE_STARTED) { |
@@ -215,7 +216,7 @@ int VideoCaptureController::RemoveClient( |
} |
client->active_buffers.clear(); |
- int session_id = client->parameters.session_id; |
+ int session_id = client->session_id; |
controller_clients_.remove(client); |
delete client; |
@@ -266,24 +267,24 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedFrame( |
int rotation, |
bool flip_vert, |
bool flip_horiz, |
- const VideoCaptureCapability& frame_info) { |
+ const VideoCaptureFormat& frame_format) { |
TRACE_EVENT0("video", "VideoCaptureController::OnIncomingCapturedFrame"); |
- if (!frame_info.IsValid()) |
+ if (!frame_format.IsValid()) |
return; |
// Chopped pixels in width/height in case video capture device has odd |
// numbers for width/height. |
int chopped_width = 0; |
int chopped_height = 0; |
- int new_width = frame_info.width; |
- int new_height = frame_info.height; |
+ int new_width = frame_format.frame_size.width(); |
+ int new_height = frame_format.frame_size.height(); |
- if (frame_info.width & 1) { |
+ if (new_width & 1) { |
--new_width; |
chopped_width = 1; |
} |
- if (frame_info.height & 1) { |
+ if (new_height & 1) { |
--new_height; |
chopped_height = 1; |
} |
@@ -324,7 +325,7 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedFrame( |
else if (new_rotation_angle == 270) |
rotation_mode = libyuv::kRotate270; |
- switch (frame_info.color) { |
+ switch (frame_format.pixel_format) { |
case media::PIXEL_FORMAT_UNKNOWN: // Color format not set. |
break; |
case media::PIXEL_FORMAT_I420: |
@@ -364,7 +365,7 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedFrame( |
#if defined(OS_WIN) |
// kRGB24 on Windows start at the bottom line and has a negative stride. This |
// is not supported by libyuv, so the media API is used instead. |
- if (frame_info.color == media::PIXEL_FORMAT_RGB24) { |
+ if (frame_format.pixel_format == media::PIXEL_FORMAT_RGB24) { |
// Rotation and flipping is not supported in kRGB24 and OS_WIN case. |
DCHECK(!rotation && !flip_vert && !flip_horiz); |
need_convert_rgb24_on_win = true; |
@@ -434,7 +435,7 @@ void VideoCaptureController::VideoCaptureDeviceClient::OnIncomingCapturedFrame( |
controller_, |
buffer, |
dimensions, |
- frame_info.frame_rate, |
+ frame_format.frame_rate, |
timestamp)); |
} |
@@ -524,11 +525,8 @@ void VideoCaptureController::DoIncomingCapturedI420BufferOnIOThread( |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
DCHECK_NE(buffer->id(), VideoCaptureBufferPool::kInvalidId); |
- media::VideoCaptureFormat frame_format( |
- dimensions.width(), |
- dimensions.height(), |
- frame_rate, |
- media::VariableResolutionVideoCaptureDevice); |
+ VideoCaptureFormat frame_format( |
+ dimensions, frame_rate, media::PIXEL_FORMAT_I420); |
int count = 0; |
if (state_ == VIDEO_CAPTURE_STATE_STARTED) { |
@@ -611,7 +609,7 @@ VideoCaptureController::FindClient( |
const ControllerClients& clients) { |
for (ControllerClients::const_iterator client_it = clients.begin(); |
client_it != clients.end(); ++client_it) { |
- if ((*client_it)->parameters.session_id == session_id) { |
+ if ((*client_it)->session_id == session_id) { |
return *client_it; |
} |
} |