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

Unified Diff: media/capture/video/linux/video_capture_device_linux.cc

Issue 1685713003: Remove V4L2CaptureDelegate{Single,Multi}Plane, VCD::Client::OnIncomingCapturedYuvData() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase -- hubbe@ added more VideoPixelFormats Created 4 years, 10 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: media/capture/video/linux/video_capture_device_linux.cc
diff --git a/media/capture/video/linux/video_capture_device_linux.cc b/media/capture/video/linux/video_capture_device_linux.cc
index 32f30e049ce376e45fe486bc1575696dc26eb9db..128f62fe9d306f0d38adf658093147ca6dda8f37 100644
--- a/media/capture/video/linux/video_capture_device_linux.cc
+++ b/media/capture/video/linux/video_capture_device_linux.cc
@@ -81,8 +81,9 @@ const std::string VideoCaptureDevice::Name::GetModel() const {
}
VideoCaptureDeviceLinux::VideoCaptureDeviceLinux(const Name& device_name)
- : v4l2_thread_("V4L2CaptureThread"), device_name_(device_name) {
-}
+ : capture_impl_(nullptr),
+ v4l2_thread_("V4L2CaptureThread"),
+ device_name_(device_name) {}
VideoCaptureDeviceLinux::~VideoCaptureDeviceLinux() {
// Check if the thread is running.
@@ -101,7 +102,7 @@ void VideoCaptureDeviceLinux::AllocateAndStart(
const int line_frequency =
TranslatePowerLineFrequencyToV4L2(GetPowerLineFrequency(params));
- capture_impl_ = V4L2CaptureDelegate::CreateV4L2CaptureDelegate(
+ capture_impl_ = new V4L2CaptureDelegate(
device_name_, v4l2_thread_.task_runner(), line_frequency);
if (!capture_impl_) {
client->OnError(FROM_HERE, "Failed to create VideoCaptureDelegate");
@@ -109,7 +110,8 @@ void VideoCaptureDeviceLinux::AllocateAndStart(
}
v4l2_thread_.message_loop()->PostTask(
FROM_HERE,
- base::Bind(&V4L2CaptureDelegate::AllocateAndStart, capture_impl_,
+ base::Bind(&V4L2CaptureDelegate::AllocateAndStart,
+ capture_impl_->AsWeakPtr(),
params.requested_format.frame_size.width(),
params.requested_format.frame_size.height(),
params.requested_format.frame_rate, base::Passed(&client)));
@@ -119,8 +121,8 @@ void VideoCaptureDeviceLinux::StopAndDeAllocate() {
if (!v4l2_thread_.IsRunning())
return; // Wrong state.
v4l2_thread_.message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&V4L2CaptureDelegate::StopAndDeAllocate, capture_impl_));
+ FROM_HERE, base::Bind(&V4L2CaptureDelegate::StopAndDeAllocate,
+ capture_impl_->AsWeakPtr()));
v4l2_thread_.Stop();
perkj_chrome 2016/02/12 11:01:40 actually - since this own the thread where delegat
mcasas 2016/02/12 21:32:43 Acknowledged.
capture_impl_ = NULL;
@@ -129,8 +131,8 @@ void VideoCaptureDeviceLinux::StopAndDeAllocate() {
void VideoCaptureDeviceLinux::SetRotation(int rotation) {
if (v4l2_thread_.IsRunning()) {
v4l2_thread_.message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&V4L2CaptureDelegate::SetRotation, capture_impl_, rotation));
+ FROM_HERE, base::Bind(&V4L2CaptureDelegate::SetRotation,
+ capture_impl_->AsWeakPtr(), rotation));
}
}

Powered by Google App Engine
This is Rietveld 408576698