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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/avfoundationvideocapturer.mm

Issue 2528493004: Add method on AVFoundation capturer to adapt output format. (Closed)
Patch Set: align colons in method name Created 4 years 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 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 107
108 void AVFoundationVideoCapturer::SetUseBackCamera(bool useBackCamera) { 108 void AVFoundationVideoCapturer::SetUseBackCamera(bool useBackCamera) {
109 _capturer.useBackCamera = useBackCamera; 109 _capturer.useBackCamera = useBackCamera;
110 } 110 }
111 111
112 bool AVFoundationVideoCapturer::GetUseBackCamera() const { 112 bool AVFoundationVideoCapturer::GetUseBackCamera() const {
113 return _capturer.useBackCamera; 113 return _capturer.useBackCamera;
114 } 114 }
115 115
116 void AVFoundationVideoCapturer::AdaptOutputFormat(int width, int height, int fps ) {
117 cricket::VideoFormat format(width, height, cricket::VideoFormat::FpsToInterval (fps), 0);
118 video_adapter()->OnOutputFormatRequest(format);
119 }
120
116 void AVFoundationVideoCapturer::CaptureSampleBuffer( 121 void AVFoundationVideoCapturer::CaptureSampleBuffer(
117 CMSampleBufferRef sample_buffer, VideoRotation rotation) { 122 CMSampleBufferRef sample_buffer, VideoRotation rotation) {
118 if (CMSampleBufferGetNumSamples(sample_buffer) != 1 || 123 if (CMSampleBufferGetNumSamples(sample_buffer) != 1 ||
119 !CMSampleBufferIsValid(sample_buffer) || 124 !CMSampleBufferIsValid(sample_buffer) ||
120 !CMSampleBufferDataIsReady(sample_buffer)) { 125 !CMSampleBufferDataIsReady(sample_buffer)) {
121 return; 126 return;
122 } 127 }
123 128
124 CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sample_buffer); 129 CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sample_buffer);
125 if (image_buffer == NULL) { 130 if (image_buffer == NULL) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 buffer->width(), buffer->height(), 175 buffer->width(), buffer->height(),
171 static_cast<libyuv::RotationMode>(rotation)); 176 static_cast<libyuv::RotationMode>(rotation));
172 buffer = rotated_buffer; 177 buffer = rotated_buffer;
173 } 178 }
174 179
175 OnFrame(webrtc::VideoFrame(buffer, rotation, translated_camera_time_us), 180 OnFrame(webrtc::VideoFrame(buffer, rotation, translated_camera_time_us),
176 captured_width, captured_height); 181 captured_width, captured_height);
177 } 182 }
178 183
179 } // namespace webrtc 184 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698