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

Unified Diff: content/browser/renderer_host/media/video_capture_host.cc

Issue 23551011: From Video Capture, abolish OnFrameInfo and enable resolution changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add assert to vcbp unittest Created 7 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 side-by-side diff with in-line comments
Download patch
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..ae883128339932e4463681d04f751ffcede6bc6a 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,
@@ -225,7 +192,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);

Powered by Google App Engine
This is Rietveld 408576698