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

Unified Diff: trunk/src/content/browser/renderer_host/media/desktop_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/desktop_capture_device.cc
===================================================================
--- trunk/src/content/browser/renderer_host/media/desktop_capture_device.cc (revision 236934)
+++ trunk/src/content/browser/renderer_host/media/desktop_capture_device.cc (working copy)
@@ -53,7 +53,7 @@
scoped_ptr<webrtc::DesktopCapturer> capturer);
// Implementation of VideoCaptureDevice methods.
- void AllocateAndStart(const media::VideoCaptureParams& params,
+ void AllocateAndStart(const media::VideoCaptureCapability& capture_format,
scoped_ptr<Client> client);
void StopAndDeAllocate();
@@ -67,7 +67,7 @@
// Helper methods that run on the |task_runner_|. Posted from the
// corresponding public methods.
- void DoAllocateAndStart(const media::VideoCaptureParams& params,
+ void DoAllocateAndStart(const media::VideoCaptureCapability& capture_format,
scoped_ptr<Client> client);
void DoStopAndDeAllocate();
@@ -97,10 +97,10 @@
scoped_ptr<Client> client_;
// Requested video capture format (width, height, frame rate, etc).
- media::VideoCaptureParams requested_params_;
+ media::VideoCaptureCapability requested_format_;
// Actual video capture format being generated.
- media::VideoCaptureFormat capture_format_;
+ media::VideoCaptureCapability capture_format_;
// Size of frame most recently captured from the source.
webrtc::DesktopSize previous_frame_size_;
@@ -136,15 +136,18 @@
}
void DesktopCaptureDevice::Core::AllocateAndStart(
- const media::VideoCaptureParams& params,
+ const media::VideoCaptureCapability& capture_format,
scoped_ptr<Client> client) {
- DCHECK_GT(params.requested_format.frame_size.GetArea(), 0);
- DCHECK_GT(params.requested_format.frame_rate, 0);
+ DCHECK_GT(capture_format.width, 0);
+ DCHECK_GT(capture_format.height, 0);
+ DCHECK_GT(capture_format.frame_rate, 0);
task_runner_->PostTask(
FROM_HERE,
- base::Bind(
- &Core::DoAllocateAndStart, this, params, base::Passed(&client)));
+ base::Bind(&Core::DoAllocateAndStart,
+ this,
+ capture_format,
+ base::Passed(&client)));
}
void DesktopCaptureDevice::Core::StopAndDeAllocate() {
@@ -178,8 +181,8 @@
// Handle initial frame size and size changes.
RefreshCaptureFormat(frame->size());
- webrtc::DesktopSize output_size(capture_format_.frame_size.width(),
- capture_format_.frame_size.height());
+ webrtc::DesktopSize output_size(capture_format_.width,
+ capture_format_.height);
size_t output_bytes = output_size.width() * output_size.height() *
webrtc::DesktopFrame::kBytesPerPixel;
const uint8_t* output_data = NULL;
@@ -225,7 +228,7 @@
}
void DesktopCaptureDevice::Core::DoAllocateAndStart(
- const media::VideoCaptureParams& params,
+ const media::VideoCaptureCapability& capture_format,
scoped_ptr<Client> client) {
DCHECK(task_runner_->RunsTasksOnCurrentThread());
DCHECK(desktop_capturer_);
@@ -233,12 +236,19 @@
DCHECK(!client_.get());
client_ = client.Pass();
- requested_params_ = params;
+ requested_format_ = capture_format;
- capture_format_ = requested_params_.requested_format;
+ capture_format_.frame_rate = requested_format_.frame_rate;
+ // Support dynamic changes in resolution only if requester also does.
+ if (requested_format_.frame_size_type ==
+ media::VariableResolutionVideoCaptureDevice) {
+ capture_format_.frame_size_type =
+ media::VariableResolutionVideoCaptureDevice;
+ }
+
// This capturer always outputs ARGB, non-interlaced.
- capture_format_.pixel_format = media::PIXEL_FORMAT_ARGB;
+ capture_format_.color = media::PIXEL_FORMAT_ARGB;
desktop_capturer_->Start(this);
@@ -263,31 +273,28 @@
output_frame_.reset();
if (previous_frame_size_.is_empty() ||
- requested_params_.allow_resolution_change) {
+ requested_format_.frame_size_type ==
+ media::VariableResolutionVideoCaptureDevice) {
// If this is the first frame, or the receiver supports variable resolution
// then determine the output size by treating the requested width & height
// as maxima.
- if (frame_size.width() >
- requested_params_.requested_format.frame_size.width() ||
- frame_size.height() >
- requested_params_.requested_format.frame_size.height()) {
+ if (frame_size.width() > requested_format_.width ||
+ frame_size.height() > requested_format_.height) {
output_rect_ = ComputeLetterboxRect(
- webrtc::DesktopSize(
- requested_params_.requested_format.frame_size.width(),
- requested_params_.requested_format.frame_size.height()),
+ webrtc::DesktopSize(requested_format_.width,
+ requested_format_.height),
frame_size);
output_rect_.Translate(-output_rect_.left(), -output_rect_.top());
} else {
output_rect_ = webrtc::DesktopRect::MakeSize(frame_size);
}
- capture_format_.frame_size.SetSize(output_rect_.width(),
- output_rect_.height());
+ capture_format_.width = output_rect_.width();
+ capture_format_.height = output_rect_.height();
} else {
// Otherwise the output frame size cannot change, so just scale and
// letterbox.
output_rect_ = ComputeLetterboxRect(
- webrtc::DesktopSize(capture_format_.frame_size.width(),
- capture_format_.frame_size.height()),
+ webrtc::DesktopSize(capture_format_.width, capture_format_.height),
frame_size);
}
@@ -404,9 +411,9 @@
}
void DesktopCaptureDevice::AllocateAndStart(
- const media::VideoCaptureParams& params,
+ const media::VideoCaptureCapability& capture_format,
scoped_ptr<Client> client) {
- core_->AllocateAndStart(params, client.Pass());
+ core_->AllocateAndStart(capture_format, client.Pass());
}
void DesktopCaptureDevice::StopAndDeAllocate() {

Powered by Google App Engine
This is Rietveld 408576698