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

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

Issue 1418263006: Extend VideoCaptureDevice::Client::OnError() to have a tracked_objects::Location param. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 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 // MacOSX implementation of generic VideoCaptureDevice, using either QTKit or 5 // MacOSX implementation of generic VideoCaptureDevice, using either QTKit or
6 // AVFoundation as native capture API. QTKit is available in all OSX versions, 6 // AVFoundation as native capture API. QTKit is available in all OSX versions,
7 // although namely deprecated in 10.9, and AVFoundation is available in versions 7 // although namely deprecated in 10.9, and AVFoundation is available in versions
8 // 10.7 (Lion) and later. 8 // 10.7 (Lion) and later.
9 9
10 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ 10 #ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
11 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ 11 #define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
12 12
13 #import <Foundation/Foundation.h> 13 #import <Foundation/Foundation.h>
14 14
15 #include <string> 15 #include <string>
16 16
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/mac/scoped_nsobject.h" 18 #include "base/mac/scoped_nsobject.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
21 #include "media/base/video_capture_types.h" 21 #include "media/base/video_capture_types.h"
22 #include "media/capture/video/video_capture_device.h" 22 #include "media/capture/video/video_capture_device.h"
23 23
24 @protocol PlatformVideoCapturingMac; 24 @protocol PlatformVideoCapturingMac;
25 25
26 namespace base { 26 namespace base {
27 class SingleThreadTaskRunner; 27 class SingleThreadTaskRunner;
28 } 28 }
29 29
30 namespace tracked_objects {
31 class Location;
32 } // namespace tracked_objects
33
30 // Small class to bundle device name and connection type into a dictionary. 34 // Small class to bundle device name and connection type into a dictionary.
31 MEDIA_EXPORT 35 MEDIA_EXPORT
32 @interface DeviceNameAndTransportType : NSObject { 36 @interface DeviceNameAndTransportType : NSObject {
33 @private 37 @private
34 base::scoped_nsobject<NSString> deviceName_; 38 base::scoped_nsobject<NSString> deviceName_;
35 // The transport type of the device (USB, PCI, etc), values are defined in 39 // The transport type of the device (USB, PCI, etc), values are defined in
36 // <IOKit/audio/IOAudioTypes.h> as kIOAudioDeviceTransportType*. 40 // <IOKit/audio/IOAudioTypes.h> as kIOAudioDeviceTransportType*.
37 int32_t transportType_; 41 int32_t transportType_;
38 } 42 }
39 43
(...skipping 26 matching lines...) Expand all
66 bool Init(VideoCaptureDevice::Name::CaptureApiType capture_api_type); 70 bool Init(VideoCaptureDevice::Name::CaptureApiType capture_api_type);
67 71
68 // Called to deliver captured video frames. 72 // Called to deliver captured video frames.
69 void ReceiveFrame(const uint8* video_frame, 73 void ReceiveFrame(const uint8* video_frame,
70 int video_frame_length, 74 int video_frame_length,
71 const VideoCaptureFormat& frame_format, 75 const VideoCaptureFormat& frame_format,
72 int aspect_numerator, 76 int aspect_numerator,
73 int aspect_denominator); 77 int aspect_denominator);
74 78
75 // Forwarder to VideoCaptureDevice::Client::OnError(). 79 // Forwarder to VideoCaptureDevice::Client::OnError().
76 void ReceiveError(const std::string& reason); 80 void ReceiveError(const tracked_objects::Location& from_here,
81 const std::string& reason);
77 82
78 // Forwarder to VideoCaptureDevice::Client::OnLog(). 83 // Forwarder to VideoCaptureDevice::Client::OnLog().
79 void LogMessage(const std::string& message); 84 void LogMessage(const std::string& message);
80 85
81 private: 86 private:
82 void SetErrorState(const std::string& reason); 87 void SetErrorState(const tracked_objects::Location& from_here,
88 const std::string& reason);
83 bool UpdateCaptureResolution(); 89 bool UpdateCaptureResolution();
84 90
85 // Flag indicating the internal state. 91 // Flag indicating the internal state.
86 enum InternalState { kNotInitialized, kIdle, kCapturing, kError }; 92 enum InternalState { kNotInitialized, kIdle, kCapturing, kError };
87 93
88 Name device_name_; 94 Name device_name_;
89 scoped_ptr<VideoCaptureDevice::Client> client_; 95 scoped_ptr<VideoCaptureDevice::Client> client_;
90 96
91 VideoCaptureFormat capture_format_; 97 VideoCaptureFormat capture_format_;
92 // These variables control the two-step configure-start process for QTKit HD: 98 // These variables control the two-step configure-start process for QTKit HD:
(...skipping 13 matching lines...) Expand all
106 // VideoCaptureDeviceMac is destroyed. 112 // VideoCaptureDeviceMac is destroyed.
107 // NOTE: Weak pointers must be invalidated before all other member variables. 113 // NOTE: Weak pointers must be invalidated before all other member variables.
108 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_; 114 base::WeakPtrFactory<VideoCaptureDeviceMac> weak_factory_;
109 115
110 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac); 116 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceMac);
111 }; 117 };
112 118
113 } // namespace media 119 } // namespace media
114 120
115 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_ 121 #endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698