(Auto)update libjingle 75390072-> 75428737

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7174 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
buildbot@webrtc.org 2014-09-13 01:09:18 +00:00
parent 7e31197cb2
commit a42a3ade54
3 changed files with 56 additions and 2 deletions

View File

@ -588,6 +588,7 @@
'link_settings': {
'xcode_settings': {
'OTHER_LDFLAGS': [
'-weak_framework AVFoundation',
'-framework Cocoa',
'-framework CoreAudio',
'-framework CoreVideo',

View File

@ -71,7 +71,7 @@ static const UInt32 kAudioDeviceNameLength = 64;
extern DeviceWatcherImpl* CreateDeviceWatcherCallback(
DeviceManagerInterface* dm);
extern void ReleaseDeviceWatcherCallback(DeviceWatcherImpl* impl);
extern bool GetQTKitVideoDevices(std::vector<Device>* out);
extern bool GetAVFoundationVideoDevices(std::vector<Device>* out);
static bool GetAudioDeviceIDs(bool inputs, std::vector<AudioDeviceID>* out);
static bool GetAudioDeviceName(AudioDeviceID id, bool input, std::string* out);
@ -84,7 +84,7 @@ MacDeviceManager::~MacDeviceManager() {
bool MacDeviceManager::GetVideoCaptureDevices(std::vector<Device>* devices) {
devices->clear();
if (!GetQTKitVideoDevices(devices)) {
if (!GetAVFoundationVideoDevices(devices)) {
return false;
}
return FilterDevices(devices, kFilteredVideoDevicesName);

View File

@ -33,6 +33,11 @@
#include "talk/media/devices/devicemanager.h"
#import <assert.h>
#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
#import <AVFoundation/AVFoundation.h>
#endif
#endif
#import <QTKit/QTKit.h>
#include "webrtc/base/logging.h"
@ -136,4 +141,52 @@ bool GetQTKitVideoDevices(std::vector<Device>* devices) {
return true;
}
bool GetAVFoundationVideoDevices(std::vector<Device>* devices) {
#ifdef __MAC_OS_X_VERSION_MAX_ALLOWED
#if __MAC_OS_X_VERSION_MAX_ALLOWED >=1070
if (![AVCaptureDevice class]) {
// Fallback to using QTKit if AVFoundation is not available
return GetQTKitVideoDevices(devices);
}
#if !__has_feature(objc_arc)
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
#else
@autoreleasepool
#endif
{
NSArray* capture_devices = [AVCaptureDevice devices];
LOG(LS_INFO) << [capture_devices count] << " capture device(s) found:";
for (AVCaptureDevice* capture_device in capture_devices) {
if ([capture_device hasMediaType:AVMediaTypeVideo] ||
[capture_device hasMediaType:AVMediaTypeMuxed]) {
static NSString* const kFormat = @"localizedName: \"%@\", "
@"modelID: \"%@\", uniqueID \"%@\", isConnected: %d, "
@"isInUseByAnotherApplication: %d";
NSString* info = [NSString
stringWithFormat:kFormat,
[capture_device localizedName],
[capture_device modelID],
[capture_device uniqueID],
[capture_device isConnected],
[capture_device isInUseByAnotherApplication]];
LOG(LS_INFO) << [info UTF8String];
std::string name([[capture_device localizedName] UTF8String]);
devices->push_back(
Device(name, [[capture_device uniqueID] UTF8String]));
}
}
}
#if !__has_feature(objc_arc)
[pool drain];
#endif
return true;
#else // __MAC_OS_X_VERSION_MAX_ALLOWED >=1070
return GetQTKitVideoDevices(devices);
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >=1070
#else // __MAC_OS_X_VERSION_MAX_ALLOWED
return GetQTKitVideoDevices(devices);
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED
}
} // namespace cricket