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

Side by Side Diff: talk/app/webrtc/objc/RTCAVFoundationVideoSource.mm

Issue 1416303003: Handle iOS devices with no rear-facing camera (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changes based on feedback Created 4 years, 9 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
« no previous file with comments | « no previous file | talk/app/webrtc/objc/avfoundationvideocapturer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 - (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory 39 - (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory
40 constraints:(RTCMediaConstraints*)constraints { 40 constraints:(RTCMediaConstraints*)constraints {
41 NSParameterAssert(factory); 41 NSParameterAssert(factory);
42 std::unique_ptr<webrtc::AVFoundationVideoCapturer> capturer; 42 std::unique_ptr<webrtc::AVFoundationVideoCapturer> capturer;
43 capturer.reset(new webrtc::AVFoundationVideoCapturer()); 43 capturer.reset(new webrtc::AVFoundationVideoCapturer());
44 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source = 44 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> source =
45 factory.nativeFactory->CreateVideoSource(capturer.release(), constraints.c onstraints); 45 factory.nativeFactory->CreateVideoSource(capturer.release(), constraints.c onstraints);
46 return [super initWithMediaSource:source]; 46 return [super initWithMediaSource:source];
47 } 47 }
48 48
49 - (BOOL)canUseBackCamera {
50 return self.capturer->CanUseBackCamera();
51 }
52
49 - (BOOL)useBackCamera { 53 - (BOOL)useBackCamera {
50 return self.capturer->GetUseBackCamera(); 54 return self.capturer->GetUseBackCamera();
51 } 55 }
52 56
53 - (void)setUseBackCamera:(BOOL)useBackCamera { 57 - (void)setUseBackCamera:(BOOL)useBackCamera {
54 self.capturer->SetUseBackCamera(useBackCamera); 58 self.capturer->SetUseBackCamera(useBackCamera);
55 } 59 }
56 60
57 - (AVCaptureSession*)captureSession { 61 - (AVCaptureSession*)captureSession {
58 return self.capturer->GetCaptureSession(); 62 return self.capturer->GetCaptureSession();
59 } 63 }
60 64
61 - (webrtc::AVFoundationVideoCapturer*)capturer { 65 - (webrtc::AVFoundationVideoCapturer*)capturer {
62 cricket::VideoCapturer* capturer = self.videoSource->GetVideoCapturer(); 66 cricket::VideoCapturer* capturer = self.videoSource->GetVideoCapturer();
63 // This should be safe because no one should have changed the underlying video 67 // This should be safe because no one should have changed the underlying video
64 // source. 68 // source.
65 webrtc::AVFoundationVideoCapturer* foundationCapturer = 69 webrtc::AVFoundationVideoCapturer* foundationCapturer =
66 static_cast<webrtc::AVFoundationVideoCapturer*>(capturer); 70 static_cast<webrtc::AVFoundationVideoCapturer*>(capturer);
67 return foundationCapturer; 71 return foundationCapturer;
68 } 72 }
69 73
70 @end 74 @end
OLDNEW
« no previous file with comments | « no previous file | talk/app/webrtc/objc/avfoundationvideocapturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698