Index: content/browser/renderer_host/media/video_capture_host.cc |
diff --git a/content/browser/renderer_host/media/video_capture_host.cc b/content/browser/renderer_host/media/video_capture_host.cc |
index 1c2219908048b8cf695276a4dd6d9d2c4214209a..eb51246e7ef5121dd043d65d64b286d2bd54b8b7 100644 |
--- a/content/browser/renderer_host/media/video_capture_host.cc |
+++ b/content/browser/renderer_host/media/video_capture_host.cc |
@@ -57,35 +57,25 @@ void VideoCaptureHost::OnBufferCreated( |
this, controller_id, handle, length, buffer_id)); |
} |
-void VideoCaptureHost::OnBufferReady( |
+void VideoCaptureHost::OnBufferDestroyed( |
const VideoCaptureControllerID& controller_id, |
- int buffer_id, |
- base::Time timestamp) { |
+ int buffer_id) { |
BrowserThread::PostTask( |
BrowserThread::IO, FROM_HERE, |
- base::Bind(&VideoCaptureHost::DoSendFilledBufferOnIOThread, |
- this, controller_id, buffer_id, timestamp)); |
-} |
- |
-void VideoCaptureHost::OnFrameInfo( |
- const VideoCaptureControllerID& controller_id, |
- const media::VideoCaptureCapability& format) { |
- BrowserThread::PostTask( |
- BrowserThread::IO, |
- FROM_HERE, |
- base::Bind(&VideoCaptureHost::DoSendFrameInfoOnIOThread, |
- this, controller_id, format)); |
+ base::Bind(&VideoCaptureHost::DoSendFreeBufferOnIOThread, |
+ this, controller_id, buffer_id)); |
} |
-void VideoCaptureHost::OnFrameInfoChanged( |
+void VideoCaptureHost::OnBufferReady( |
const VideoCaptureControllerID& controller_id, |
- int width, |
- int height, |
- int frame_rate) { |
+ int buffer_id, |
+ base::Time timestamp, |
+ const media::VideoCaptureFormat& frame_format) { |
BrowserThread::PostTask( |
BrowserThread::IO, FROM_HERE, |
- base::Bind(&VideoCaptureHost::DoSendFrameInfoChangedOnIOThread, |
- this, controller_id, width, height, frame_rate)); |
+ base::Bind(&VideoCaptureHost::DoSendFilledBufferOnIOThread, |
+ this, controller_id, buffer_id, timestamp, |
+ frame_format)); |
} |
void VideoCaptureHost::OnEnded(const VideoCaptureControllerID& controller_id) { |
@@ -109,16 +99,28 @@ void VideoCaptureHost::DoSendNewBufferOnIOThread( |
length, buffer_id)); |
} |
+void VideoCaptureHost::DoSendFreeBufferOnIOThread( |
+ const VideoCaptureControllerID& controller_id, |
+ int buffer_id) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ |
+ if (entries_.find(controller_id) == entries_.end()) |
+ return; |
+ |
+ Send(new VideoCaptureMsg_FreeBuffer(controller_id.device_id, buffer_id)); |
+} |
+ |
void VideoCaptureHost::DoSendFilledBufferOnIOThread( |
const VideoCaptureControllerID& controller_id, |
- int buffer_id, base::Time timestamp) { |
+ int buffer_id, base::Time timestamp, |
+ const media::VideoCaptureFormat& format) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
if (entries_.find(controller_id) == entries_.end()) |
return; |
Send(new VideoCaptureMsg_BufferReady(controller_id.device_id, buffer_id, |
- timestamp)); |
+ timestamp, format)); |
} |
void VideoCaptureHost::DoHandleErrorOnIOThread( |
@@ -145,41 +147,6 @@ void VideoCaptureHost::DoEndedOnIOThread( |
DeleteVideoCaptureControllerOnIOThread(controller_id); |
} |
-void VideoCaptureHost::DoSendFrameInfoOnIOThread( |
- const VideoCaptureControllerID& controller_id, |
- const media::VideoCaptureCapability& format) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- |
- if (entries_.find(controller_id) == entries_.end()) |
- return; |
- |
- media::VideoCaptureParams params; |
- params.width = format.width; |
- params.height = format.height; |
- params.frame_rate = format.frame_rate; |
- params.frame_size_type = format.frame_size_type; |
- Send(new VideoCaptureMsg_DeviceInfo(controller_id.device_id, params)); |
- Send(new VideoCaptureMsg_StateChanged(controller_id.device_id, |
- VIDEO_CAPTURE_STATE_STARTED)); |
-} |
- |
-void VideoCaptureHost::DoSendFrameInfoChangedOnIOThread( |
- const VideoCaptureControllerID& controller_id, |
- int width, |
- int height, |
- int frame_rate) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- |
- if (entries_.find(controller_id) == entries_.end()) |
- return; |
- |
- media::VideoCaptureParams params; |
- params.width = width; |
- params.height = height; |
- params.frame_rate = frame_rate; |
- Send(new VideoCaptureMsg_DeviceInfoChanged(controller_id.device_id, params)); |
-} |
- |
/////////////////////////////////////////////////////////////////////////////// |
// IPC Messages handler. |
bool VideoCaptureHost::OnMessageReceived(const IPC::Message& message, |
@@ -200,12 +167,13 @@ void VideoCaptureHost::OnStartCapture(int device_id, |
const media::VideoCaptureParams& params) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
DVLOG(1) << "VideoCaptureHost::OnStartCapture, device_id " << device_id |
- << ", (" << params.width << ", " << params.height << ", " |
- << params.frame_rate << ", " << params.session_id |
- << ", variable resolution device:" |
- << ((params.frame_size_type == |
+ << ", (" << params.requested_format.width |
+ << ", " << params.requested_format.height |
+ << ", " << params.requested_format.frame_rate |
+ << ", " << params.session_id << ", variable resolution device:" |
+ << ((params.requested_format.frame_size_type == |
media::VariableResolutionVideoCaptureDevice) ? "yes" : "no") |
- << ")"; |
+ << ")"; |
VideoCaptureControllerID controller_id(device_id); |
DCHECK(entries_.find(controller_id) == entries_.end()); |
@@ -225,7 +193,7 @@ void VideoCaptureHost::OnControllerAdded( |
} |
void VideoCaptureHost::DoControllerAddedOnIOThread( |
- int device_id, const media::VideoCaptureParams params, |
+ int device_id, const media::VideoCaptureParams& params, |
const base::WeakPtr<VideoCaptureController>& controller) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
VideoCaptureControllerID controller_id(device_id); |