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

Side by Side Diff: media/video/capture/mac/video_capture_device_mac.mm

Issue 1116683002: [media] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased patch Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/video/capture/mac/video_capture_device_mac.h" 5 #include "media/video/capture/mac/video_capture_device_mac.h"
6 6
7 #include <IOKit/IOCFPlugIn.h> 7 #include <IOKit/IOCFPlugIn.h>
8 #include <IOKit/usb/IOUSBLib.h> 8 #include <IOKit/usb/IOUSBLib.h>
9 #include <IOKit/usb/USBSpec.h> 9 #include <IOKit/usb/USBSpec.h>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/mac/scoped_ioobject.h" 14 #include "base/mac/scoped_ioobject.h"
15 #include "base/mac/scoped_ioplugininterface.h" 15 #include "base/mac/scoped_ioplugininterface.h"
16 #include "base/message_loop/message_loop_proxy.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/thread_task_runner_handle.h"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
19 #import "media/base/mac/avfoundation_glue.h" 20 #import "media/base/mac/avfoundation_glue.h"
20 #import "media/video/capture/mac/platform_video_capturing_mac.h" 21 #import "media/video/capture/mac/platform_video_capturing_mac.h"
21 #import "media/video/capture/mac/video_capture_device_avfoundation_mac.h" 22 #import "media/video/capture/mac/video_capture_device_avfoundation_mac.h"
22 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h" 23 #import "media/video/capture/mac/video_capture_device_qtkit_mac.h"
23 #include "ui/gfx/geometry/size.h" 24 #include "ui/gfx/geometry/size.h"
24 25
25 @implementation DeviceNameAndTransportType 26 @implementation DeviceNameAndTransportType
26 27
27 - (id)initWithName:(NSString*)deviceName transportType:(int32_t)transportType { 28 - (id)initWithName:(NSString*)deviceName transportType:(int32_t)transportType {
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 std::string id_vendor = unique_id_.substr(vid_location, kVidPidSize); 339 std::string id_vendor = unique_id_.substr(vid_location, kVidPidSize);
339 const size_t pid_location = unique_id_.size() - kVidPidSize; 340 const size_t pid_location = unique_id_.size() - kVidPidSize;
340 std::string id_product = unique_id_.substr(pid_location, kVidPidSize); 341 std::string id_product = unique_id_.substr(pid_location, kVidPidSize);
341 342
342 return id_vendor + ":" + id_product; 343 return id_vendor + ":" + id_product;
343 } 344 }
344 345
345 VideoCaptureDeviceMac::VideoCaptureDeviceMac(const Name& device_name) 346 VideoCaptureDeviceMac::VideoCaptureDeviceMac(const Name& device_name)
346 : device_name_(device_name), 347 : device_name_(device_name),
347 tried_to_square_pixels_(false), 348 tried_to_square_pixels_(false),
348 task_runner_(base::MessageLoopProxy::current()), 349 task_runner_(base::ThreadTaskRunnerHandle::Get()),
349 state_(kNotInitialized), 350 state_(kNotInitialized),
350 capture_device_(nil), 351 capture_device_(nil),
351 weak_factory_(this) { 352 weak_factory_(this) {
352 // Avoid reconfiguring AVFoundation or blacklisted devices. 353 // Avoid reconfiguring AVFoundation or blacklisted devices.
353 final_resolution_selected_ = AVFoundationGlue::IsAVFoundationSupported() || 354 final_resolution_selected_ = AVFoundationGlue::IsAVFoundationSupported() ||
354 device_name.is_blacklisted(); 355 device_name.is_blacklisted();
355 } 356 }
356 357
357 VideoCaptureDeviceMac::~VideoCaptureDeviceMac() { 358 VideoCaptureDeviceMac::~VideoCaptureDeviceMac() {
358 DCHECK(task_runner_->BelongsToCurrentThread()); 359 DCHECK(task_runner_->BelongsToCurrentThread());
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() 570 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height()
570 width:capture_format_.frame_size.width() 571 width:capture_format_.frame_size.width()
571 frameRate:capture_format_.frame_rate]) { 572 frameRate:capture_format_.frame_rate]) {
572 ReceiveError("Could not configure capture device."); 573 ReceiveError("Could not configure capture device.");
573 return false; 574 return false;
574 } 575 }
575 return true; 576 return true;
576 } 577 }
577 578
578 } // namespace media 579 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698