| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * libjingle | 2  * libjingle | 
| 3  * Copyright 2015 Google Inc. | 3  * Copyright 2015 Google Inc. | 
| 4  * | 4  * | 
| 5  * Redistribution and use in source and binary forms, with or without | 5  * Redistribution and use in source and binary forms, with or without | 
| 6  * modification, are permitted provided that the following conditions are met: | 6  * modification, are permitted provided that the following conditions are met: | 
| 7  * | 7  * | 
| 8  *  1. Redistributions of source code must retain the above copyright notice, | 8  *  1. Redistributions of source code must retain the above copyright notice, | 
| 9  *     this list of conditions and the following disclaimer. | 9  *     this list of conditions and the following disclaimer. | 
| 10  *  2. Redistributions in binary form must reproduce the above copyright notice, | 10  *  2. Redistributions in binary form must reproduce the above copyright notice, | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 32 #import "RTCPeerConnectionFactory+Internal.h" | 32 #import "RTCPeerConnectionFactory+Internal.h" | 
| 33 #import "RTCVideoSource+Internal.h" | 33 #import "RTCVideoSource+Internal.h" | 
| 34 | 34 | 
| 35 @implementation RTCAVFoundationVideoSource | 35 @implementation RTCAVFoundationVideoSource | 
| 36 | 36 | 
| 37 - (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory | 37 - (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory | 
| 38                     constraints:(RTCMediaConstraints*)constraints { | 38                     constraints:(RTCMediaConstraints*)constraints { | 
| 39   NSParameterAssert(factory); | 39   NSParameterAssert(factory); | 
| 40   rtc::scoped_ptr<webrtc::AVFoundationVideoCapturer> capturer; | 40   rtc::scoped_ptr<webrtc::AVFoundationVideoCapturer> capturer; | 
| 41   capturer.reset(new webrtc::AVFoundationVideoCapturer()); | 41   capturer.reset(new webrtc::AVFoundationVideoCapturer()); | 
| 42   rtc::scoped_refptr<webrtc::VideoSourceInterface> source = | 42   rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source = | 
| 43       factory.nativeFactory->CreateVideoSource(capturer.release(), | 43       factory.nativeFactory->CreateVideoSource(capturer.release(), constraints.c
    onstraints); | 
| 44                                                constraints.constraints); |  | 
| 45   return [super initWithMediaSource:source]; | 44   return [super initWithMediaSource:source]; | 
| 46 } | 45 } | 
| 47 | 46 | 
| 48 - (BOOL)useBackCamera { | 47 - (BOOL)useBackCamera { | 
| 49   return self.capturer->GetUseBackCamera(); | 48   return self.capturer->GetUseBackCamera(); | 
| 50 } | 49 } | 
| 51 | 50 | 
| 52 - (void)setUseBackCamera:(BOOL)useBackCamera { | 51 - (void)setUseBackCamera:(BOOL)useBackCamera { | 
| 53   self.capturer->SetUseBackCamera(useBackCamera); | 52   self.capturer->SetUseBackCamera(useBackCamera); | 
| 54 } | 53 } | 
| 55 | 54 | 
| 56 - (AVCaptureSession*)captureSession { | 55 - (AVCaptureSession*)captureSession { | 
| 57   return self.capturer->GetCaptureSession(); | 56   return self.capturer->GetCaptureSession(); | 
| 58 } | 57 } | 
| 59 | 58 | 
| 60 - (webrtc::AVFoundationVideoCapturer*)capturer { | 59 - (webrtc::AVFoundationVideoCapturer*)capturer { | 
| 61   cricket::VideoCapturer* capturer = self.videoSource->GetVideoCapturer(); | 60   cricket::VideoCapturer* capturer = self.videoSource->GetVideoCapturer(); | 
| 62   // This should be safe because no one should have changed the underlying video | 61   // This should be safe because no one should have changed the underlying video | 
| 63   // source. | 62   // source. | 
| 64   webrtc::AVFoundationVideoCapturer* foundationCapturer = | 63   webrtc::AVFoundationVideoCapturer* foundationCapturer = | 
| 65       static_cast<webrtc::AVFoundationVideoCapturer*>(capturer); | 64       static_cast<webrtc::AVFoundationVideoCapturer*>(capturer); | 
| 66   return foundationCapturer; | 65   return foundationCapturer; | 
| 67 } | 66 } | 
| 68 | 67 | 
| 69 @end | 68 @end | 
| OLD | NEW | 
|---|