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

Unified Diff: trunk/src/content/browser/renderer_host/media/web_contents_video_capture_device.cc

Issue 84393002: Revert 236927 "Reorganize media::VideoCapture* types" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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: trunk/src/content/browser/renderer_host/media/web_contents_video_capture_device.cc
===================================================================
--- trunk/src/content/browser/renderer_host/media/web_contents_video_capture_device.cc (revision 236934)
+++ trunk/src/content/browser/renderer_host/media/web_contents_video_capture_device.cc (working copy)
@@ -411,6 +411,7 @@
capture_size_(capture_size),
frame_rate_(frame_rate) {}
+
bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
VideoCaptureOracle::Event event,
base::Time event_time,
@@ -960,7 +961,9 @@
virtual ~Impl();
// Asynchronous requests to change WebContentsVideoCaptureDevice::Impl state.
- void AllocateAndStart(const media::VideoCaptureParams& params,
+ void AllocateAndStart(int width,
+ int height,
+ int frame_rate,
scoped_ptr<media::VideoCaptureDevice::Client> client);
void StopAndDeAllocate();
@@ -1022,7 +1025,9 @@
render_thread_("WebContentsVideo_RenderThread") {}
void WebContentsVideoCaptureDevice::Impl::AllocateAndStart(
- const media::VideoCaptureParams& params,
+ int width,
+ int height,
+ int frame_rate,
scoped_ptr<VideoCaptureDevice::Client> client) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -1031,8 +1036,8 @@
return;
}
- if (params.requested_format.frame_rate <= 0) {
- DVLOG(1) << "invalid frame_rate: " << params.requested_format.frame_rate;
+ if (frame_rate <= 0) {
+ DVLOG(1) << "invalid frame_rate: " << frame_rate;
client->OnError();
return;
}
@@ -1045,26 +1050,23 @@
// Frame dimensions must each be a positive, even integer, since the client
// wants (or will convert to) YUV420.
- gfx::Size frame_size(MakeEven(params.requested_format.frame_size.width()),
- MakeEven(params.requested_format.frame_size.height()));
- if (frame_size.width() < kMinFrameWidth ||
- frame_size.height() < kMinFrameHeight) {
- DVLOG(1) << "invalid frame size: " << frame_size.ToString();
+ width = MakeEven(width);
+ height = MakeEven(height);
+ if (width < kMinFrameWidth || height < kMinFrameHeight) {
+ DVLOG(1) << "invalid width (" << width << ") and/or height ("
+ << height << ")";
client->OnError();
return;
}
base::TimeDelta capture_period = base::TimeDelta::FromMicroseconds(
- 1000000.0 / params.requested_format.frame_rate + 0.5);
+ 1000000.0 / frame_rate + 0.5);
scoped_ptr<VideoCaptureOracle> oracle(
new VideoCaptureOracle(capture_period,
kAcceleratedSubscriberIsSupported));
- oracle_proxy_ =
- new ThreadSafeCaptureOracle(client.Pass(),
- oracle.Pass(),
- frame_size,
- params.requested_format.frame_rate);
+ oracle_proxy_ = new ThreadSafeCaptureOracle(
+ client.Pass(), oracle.Pass(), gfx::Size(width, height), frame_rate);
// Allocates the CaptureMachine. The CaptureMachine will be tracking render
// view swapping over its lifetime, and we don't want to lose our reference to
@@ -1187,10 +1189,14 @@
}
void WebContentsVideoCaptureDevice::AllocateAndStart(
- const media::VideoCaptureParams& params,
+ const media::VideoCaptureCapability& capture_format,
scoped_ptr<Client> client) {
- DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
- impl_->AllocateAndStart(params, client.Pass());
+ DVLOG(1) << "Allocating " << capture_format.width << "x"
+ << capture_format.height;
+ impl_->AllocateAndStart(capture_format.width,
+ capture_format.height,
+ capture_format.frame_rate,
+ client.Pass());
}
void WebContentsVideoCaptureDevice::StopAndDeAllocate() {

Powered by Google App Engine
This is Rietveld 408576698