2016-01-21 11:44:55 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-04-27 01:54:20 -07:00
|
|
|
#include "avfoundationvideocapturer.h"
|
2016-01-21 11:44:55 -08:00
|
|
|
|
|
|
|
|
#import <AVFoundation/AVFoundation.h>
|
|
|
|
|
|
2016-11-23 00:41:57 -08:00
|
|
|
#import "RTCAVFoundationVideoCapturerInternal.h"
|
2016-04-27 01:54:20 -07:00
|
|
|
#import "RTCDispatcher+Private.h"
|
|
|
|
|
#import "WebRTC/RTCLogging.h"
|
|
|
|
|
|
2016-11-23 00:41:57 -08:00
|
|
|
#include "avfoundationformatmapper.h"
|
2017-01-10 07:44:26 -08:00
|
|
|
|
|
|
|
|
#include "webrtc/api/video/video_rotation.h"
|
2016-04-27 01:54:20 -07:00
|
|
|
#include "webrtc/base/bind.h"
|
|
|
|
|
#include "webrtc/base/checks.h"
|
Reland of Make cricket::VideoFrame inherit webrtc::VideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2402853002/ )
This cl now makes cricket::VideoFrame and cricket::WebRtcVideoFrame aliases for webrtc::VideoFrame.
Reason for revert:
Fixing backwards compatibility issues.
Original issue's description:
> Revert of Make cricket::VideoFrame inherit webrtc::VideoFrame. (patchset #9 id:160001 of https://codereview.webrtc.org/2315663002/ )
>
> Reason for revert:
> Breaks compile for Chromium builds:
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/10761
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/18142
>
> FAILED: obj/remoting/protocol/protocol/webrtc_video_renderer_adapter.o
> ../../remoting/protocol/webrtc_video_renderer_adapter.cc:110:52: error: no member named 'transport_frame_id' in 'cricket::VideoFrame'
> weak_factory_.GetWeakPtr(), frame.transport_frame_id(),
> ~~~~~ ^
> 1 error generated.
>
> Please run chromium trybots as described at https://webrtc.org/contributing/#tryjobs-on-chromium-trybots before relanding.
>
> Original issue's description:
> > Make cricket::VideoFrame inherit webrtc::VideoFrame. Delete
> > all methods but a few constructors. And similarly for the
> > subclass cricket::WebRtcVideoFrame.
> >
> > TBR=tkchin@webrtc.org # Added an include line
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/dda6ec008a0fc8d52e118814fb779032e8931968
> > Cr-Commit-Position: refs/heads/master@{#14576}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,pthatcher@chromium.org,tkchin@webrtc.org,nisse@webrtc.org
> NOTRY=True
> NOPRESUBMIT=True
> BUG=webrtc:5682
>
> Committed: https://crrev.com/d36dd499c8f253cbcf37364c2a070c2e8c7100e9
> Cr-Commit-Position: refs/heads/master@{#14583}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,pthatcher@chromium.org,tkchin@webrtc.org,kjellander@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2411953002
Cr-Commit-Position: refs/heads/master@{#14678}
2016-10-19 00:30:30 -07:00
|
|
|
#include "webrtc/base/logging.h"
|
2016-04-27 01:54:20 -07:00
|
|
|
#include "webrtc/base/thread.h"
|
Reland of Split iOS sdk in to separate targets (patchset #1 id:1 of https://codereview.webrtc.org/2911053002/ )
Reason for revert:
Take three of relanding this after all internal issues have been resolved.
Original issue's description:
> Revert of Split iOS sdk in to separate targets (patchset #3 id:320001 of https://codereview.webrtc.org/2893843003/ )
>
> Reason for revert:
> Breaks downstream project.
>
> Original issue's description:
> > Reland of Split iOS sdk in to separate targets (patchset #1 id:1 of https://codereview.webrtc.org/2893593002/ )
> >
> > Reason for revert:
> > Take two of fixing downstream issues?
> >
> > Original issue's description:
> > > Revert of Split iOS sdk in to separate targets (patchset #1 id:1 of https://codereview.webrtc.org/2890733003/ )
> > >
> > > Reason for revert:
> > > Still problems with downstream projects
> > >
> > > Original issue's description:
> > > > Reland of Split iOS sdk in to separate targets (patchset #1 id:1 of https://codereview.webrtc.org/2890513002/ )
> > > >
> > > > Reason for revert:
> > > > Fixing downstream breakages
> > > >
> > > > Original issue's description:
> > > > > Revert of Split iOS sdk in to separate targets (patchset #13 id:280001 of https://codereview.webrtc.org/2862543002/ )
> > > > >
> > > > > Reason for revert:
> > > > > Breaking downstream projects.
> > > > >
> > > > > Original issue's description:
> > > > > > Split iOS sdk in to separate targets
> > > > > >
> > > > > > This CL splits the iOS sdk into separate static libraries for video,
> > > > > > audio, ui, common, and peerconnection-related code. This will in the
> > > > > > future make it easier to compile WebRTC without unneeded components.
> > > > > >
> > > > > > BUG=webrtc:4867
> > > > > >
> > > > > > Review-Url: https://codereview.webrtc.org/2862543002
> > > > > > Cr-Commit-Position: refs/heads/master@{#18166}
> > > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/52c83fe7102f566cf35a7533092873d58b38f426
> > > > >
> > > > > TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,kthelgason@webrtc.org
> > > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > > NOPRESUBMIT=true
> > > > > NOTREECHECKS=true
> > > > > NOTRY=true
> > > > > BUG=webrtc:4867
> > > > >
> > > > > Review-Url: https://codereview.webrtc.org/2890513002
> > > > > Cr-Commit-Position: refs/heads/master@{#18170}
> > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/9756238084707787f735e1294e896e462e459717
> > > >
> > > > TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org
> > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > NOPRESUBMIT=true
> > > > NOTREECHECKS=true
> > > > NOTRY=true
> > > > BUG=webrtc:4867
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2890733003
> > > > Cr-Commit-Position: refs/heads/master@{#18174}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/d51e042492bedd057bc0cac7828979d5c7369cea
> > >
> > > TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:4867
> > >
> > > Review-Url: https://codereview.webrtc.org/2893593002
> > > Cr-Commit-Position: refs/heads/master@{#18182}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/37144b214e2baf62ecb262ab878dde8c59cdd6a3
> >
> > TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=webrtc:4867
> >
> > Review-Url: https://codereview.webrtc.org/2893843003
> > Cr-Commit-Position: refs/heads/master@{#18303}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/580c3522d294c877adfe555048c675bd8d166657
>
> TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org,kthelgason@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:4867
>
> Review-Url: https://codereview.webrtc.org/2911053002
> Cr-Commit-Position: refs/heads/master@{#18309}
> Committed: https://chromium.googlesource.com/external/webrtc/+/af5c05540cc8208f682cafe88c5c16a505479196
TBR=magjed@webrtc.org,denicija@webrtc.org,tkchin@webrtc.org,henrika@webrtc.org,charujain@webrtc.org,mbonadei@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:4867
Review-Url: https://codereview.webrtc.org/2913753003
Cr-Commit-Position: refs/heads/master@{#18319}
2017-05-30 01:48:47 -07:00
|
|
|
#include "webrtc/sdk/objc/Framework/Classes/Video/corevideo_frame_buffer.h"
|
2016-01-21 11:44:55 -08:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2016-03-31 17:14:04 -07:00
|
|
|
enum AVFoundationVideoCapturerMessageType : uint32_t {
|
|
|
|
|
kMessageTypeFrame,
|
|
|
|
|
};
|
|
|
|
|
|
2016-09-01 15:15:00 +02:00
|
|
|
AVFoundationVideoCapturer::AVFoundationVideoCapturer() : _capturer(nil) {
|
2016-08-19 01:24:46 -07:00
|
|
|
_capturer =
|
|
|
|
|
[[RTCAVFoundationVideoCapturerInternal alloc] initWithCapturer:this];
|
|
|
|
|
|
2016-10-06 02:32:02 -07:00
|
|
|
std::set<cricket::VideoFormat> front_camera_video_formats =
|
|
|
|
|
GetSupportedVideoFormatsForDevice([_capturer frontCaptureDevice]);
|
|
|
|
|
std::set<cricket::VideoFormat> back_camera_video_formats =
|
|
|
|
|
GetSupportedVideoFormatsForDevice([_capturer backCaptureDevice]);
|
|
|
|
|
std::vector<cricket::VideoFormat> intersection_video_formats;
|
|
|
|
|
if (back_camera_video_formats.empty()) {
|
|
|
|
|
intersection_video_formats.assign(front_camera_video_formats.begin(),
|
|
|
|
|
front_camera_video_formats.end());
|
|
|
|
|
|
|
|
|
|
} else if (front_camera_video_formats.empty()) {
|
|
|
|
|
intersection_video_formats.assign(back_camera_video_formats.begin(),
|
|
|
|
|
back_camera_video_formats.end());
|
|
|
|
|
} else {
|
|
|
|
|
std::set_intersection(
|
|
|
|
|
front_camera_video_formats.begin(), front_camera_video_formats.end(),
|
|
|
|
|
back_camera_video_formats.begin(), back_camera_video_formats.end(),
|
|
|
|
|
std::back_inserter(intersection_video_formats));
|
2016-08-19 01:24:46 -07:00
|
|
|
}
|
2016-10-06 02:32:02 -07:00
|
|
|
SetSupportedFormats(intersection_video_formats);
|
2016-01-21 11:44:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AVFoundationVideoCapturer::~AVFoundationVideoCapturer() {
|
|
|
|
|
_capturer = nil;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cricket::CaptureState AVFoundationVideoCapturer::Start(
|
|
|
|
|
const cricket::VideoFormat& format) {
|
|
|
|
|
if (!_capturer) {
|
|
|
|
|
LOG(LS_ERROR) << "Failed to create AVFoundation capturer.";
|
|
|
|
|
return cricket::CaptureState::CS_FAILED;
|
|
|
|
|
}
|
|
|
|
|
if (_capturer.isRunning) {
|
|
|
|
|
LOG(LS_ERROR) << "The capturer is already running.";
|
|
|
|
|
return cricket::CaptureState::CS_FAILED;
|
|
|
|
|
}
|
2016-08-19 01:24:46 -07:00
|
|
|
|
2016-10-06 02:32:02 -07:00
|
|
|
AVCaptureDevice* device = [_capturer getActiveCaptureDevice];
|
|
|
|
|
AVCaptureSession* session = _capturer.captureSession;
|
2016-08-19 01:24:46 -07:00
|
|
|
|
2016-10-06 02:32:02 -07:00
|
|
|
if (!SetFormatForCaptureDevice(device, session, format)) {
|
2016-01-21 11:44:55 -08:00
|
|
|
return cricket::CaptureState::CS_FAILED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetCaptureFormat(&format);
|
|
|
|
|
// This isn't super accurate because it takes a while for the AVCaptureSession
|
|
|
|
|
// to spin up, and this call returns async.
|
|
|
|
|
// TODO(tkchin): make this better.
|
2016-03-31 17:14:04 -07:00
|
|
|
[_capturer start];
|
2016-01-21 11:44:55 -08:00
|
|
|
SetCaptureState(cricket::CaptureState::CS_RUNNING);
|
|
|
|
|
|
|
|
|
|
return cricket::CaptureState::CS_STARTING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AVFoundationVideoCapturer::Stop() {
|
2016-03-31 17:14:04 -07:00
|
|
|
[_capturer stop];
|
2016-01-21 11:44:55 -08:00
|
|
|
SetCaptureFormat(NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AVFoundationVideoCapturer::IsRunning() {
|
|
|
|
|
return _capturer.isRunning;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AVCaptureSession* AVFoundationVideoCapturer::GetCaptureSession() {
|
|
|
|
|
return _capturer.captureSession;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-14 20:55:22 -07:00
|
|
|
bool AVFoundationVideoCapturer::CanUseBackCamera() const {
|
|
|
|
|
return _capturer.canUseBackCamera;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-21 11:44:55 -08:00
|
|
|
void AVFoundationVideoCapturer::SetUseBackCamera(bool useBackCamera) {
|
|
|
|
|
_capturer.useBackCamera = useBackCamera;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool AVFoundationVideoCapturer::GetUseBackCamera() const {
|
|
|
|
|
return _capturer.useBackCamera;
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-01 01:36:16 -08:00
|
|
|
void AVFoundationVideoCapturer::AdaptOutputFormat(int width, int height, int fps) {
|
|
|
|
|
cricket::VideoFormat format(width, height, cricket::VideoFormat::FpsToInterval(fps), 0);
|
|
|
|
|
video_adapter()->OnOutputFormatRequest(format);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-21 11:44:55 -08:00
|
|
|
void AVFoundationVideoCapturer::CaptureSampleBuffer(
|
2016-10-20 03:34:29 -07:00
|
|
|
CMSampleBufferRef sample_buffer, VideoRotation rotation) {
|
2016-08-25 03:25:04 -07:00
|
|
|
if (CMSampleBufferGetNumSamples(sample_buffer) != 1 ||
|
|
|
|
|
!CMSampleBufferIsValid(sample_buffer) ||
|
|
|
|
|
!CMSampleBufferDataIsReady(sample_buffer)) {
|
2016-01-21 11:44:55 -08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-25 03:25:04 -07:00
|
|
|
CVImageBufferRef image_buffer = CMSampleBufferGetImageBuffer(sample_buffer);
|
2016-03-31 17:14:04 -07:00
|
|
|
if (image_buffer == NULL) {
|
2016-01-21 11:44:55 -08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-09 07:09:23 -08:00
|
|
|
int captured_width = CVPixelBufferGetWidth(image_buffer);
|
|
|
|
|
int captured_height = CVPixelBufferGetHeight(image_buffer);
|
2016-07-14 08:12:17 -07:00
|
|
|
|
|
|
|
|
int adapted_width;
|
|
|
|
|
int adapted_height;
|
|
|
|
|
int crop_width;
|
|
|
|
|
int crop_height;
|
|
|
|
|
int crop_x;
|
|
|
|
|
int crop_y;
|
|
|
|
|
int64_t translated_camera_time_us;
|
|
|
|
|
|
|
|
|
|
if (!AdaptFrame(captured_width, captured_height,
|
2016-09-01 15:15:00 +02:00
|
|
|
rtc::TimeNanos() / rtc::kNumNanosecsPerMicrosec,
|
2016-07-14 08:12:17 -07:00
|
|
|
rtc::TimeMicros(), &adapted_width, &adapted_height,
|
|
|
|
|
&crop_width, &crop_height, &crop_x, &crop_y,
|
|
|
|
|
&translated_camera_time_us)) {
|
2016-01-21 11:44:55 -08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-20 03:34:29 -07:00
|
|
|
rtc::scoped_refptr<VideoFrameBuffer> buffer =
|
|
|
|
|
new rtc::RefCountedObject<CoreVideoFrameBuffer>(
|
|
|
|
|
image_buffer,
|
|
|
|
|
adapted_width, adapted_height,
|
2016-09-15 07:20:40 -07:00
|
|
|
crop_width, crop_height,
|
2016-10-20 03:34:29 -07:00
|
|
|
crop_x, crop_y);
|
|
|
|
|
|
|
|
|
|
// Applying rotation is only supported for legacy reasons and performance is
|
|
|
|
|
// not critical here.
|
|
|
|
|
if (apply_rotation() && rotation != kVideoRotation_0) {
|
Reland of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2853383005/ )
Reason for revert:
Downstream projects have been fixed.
Original issue's description:
> Revert of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2854873003/ )
>
> Reason for revert:
> More downstream breakage discovered.
>
> Original issue's description:
> > Reland of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2854883002/ )
> >
> > Reason for revert:
> > Will make another attempt to track down and fix downstream projects.
> >
> > Original issue's description:
> > > Revert of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2852303002/ )
> > >
> > > Reason for revert:
> > > Unfortunately, more downstream updates needed.
> > >
> > > Original issue's description:
> > > > Reland of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #1 id:1 of https://codereview.webrtc.org/2845333002/ )
> > > >
> > > > Reason for revert:
> > > > Downstream projects being updated.
> > > >
> > > > For Chrome, relanding depends on cl
> > > > https://codereview.chromium.org/2855783003/
> > > >
> > > > Original issue's description:
> > > > > Revert of Delete deprecated and transitional stuff related to video frame refactoring. (patchset #17 id:320001 of https://codereview.webrtc.org/2622263002/ )
> > > > >
> > > > > Reason for revert:
> > > > > Broke Chrome build, see, e.g.,
> > > > > http://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/16237
> > > > >
> > > > > Original issue's description:
> > > > > > Delete deprecated and transitional stuff related to video frame refactoring.
> > > > > >
> > > > > > BUG=webrtc:5880
> > > > > >
> > > > > > Review-Url: https://codereview.webrtc.org/2622263002
> > > > > > Cr-Commit-Position: refs/heads/master@{#17928}
> > > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/713a3bbcc74a4c1a1f54d6dbd0bdaa715f5c1ae1
> > > > >
> > > > > TBR=mflodman@webrtc.org,perkj@webrtc.org
> > > > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > > > NOPRESUBMIT=true
> > > > > NOTREECHECKS=true
> > > > > NOTRY=true
> > > > > BUG=webrtc:5880
> > > > >
> > > > > Review-Url: https://codereview.webrtc.org/2845333002
> > > > > Cr-Commit-Position: refs/heads/master@{#17929}
> > > > > Committed: https://chromium.googlesource.com/external/webrtc/+/aec49d2b49e1beceb286cbb29ad220aefd0ac648
> > > >
> > > > TBR=mflodman@webrtc.org,perkj@webrtc.org
> > > > # Not skipping CQ checks because original CL landed more than 1 days ago.
> > > > BUG=webrtc:5880
> > > >
> > > > Review-Url: https://codereview.webrtc.org/2852303002
> > > > Cr-Commit-Position: refs/heads/master@{#17974}
> > > > Committed: https://chromium.googlesource.com/external/webrtc/+/d71ebd70f6c40a37559a7ee2930002a804ad3f13
> > >
> > > TBR=mflodman@webrtc.org,perkj@webrtc.org
> > > # Skipping CQ checks because original CL landed less than 1 days ago.
> > > NOPRESUBMIT=true
> > > NOTREECHECKS=true
> > > NOTRY=true
> > > BUG=webrtc:5880
> > >
> > > Review-Url: https://codereview.webrtc.org/2854883002
> > > Cr-Commit-Position: refs/heads/master@{#17978}
> > > Committed: https://chromium.googlesource.com/external/webrtc/+/6e6a485a028799501ea4753ceefc811dd826f52f
> >
> > TBR=mflodman@webrtc.org,perkj@webrtc.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> >
> > BUG=webrtc:5880
> >
> > Review-Url: https://codereview.webrtc.org/2854873003
> > Cr-Commit-Position: refs/heads/master@{#18006}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/3870a071c452dc2e782196bc5bba0375d019b653
>
> TBR=mflodman@webrtc.org,perkj@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5880
>
> Review-Url: https://codereview.webrtc.org/2853383005
> Cr-Commit-Position: refs/heads/master@{#18008}
> Committed: https://chromium.googlesource.com/external/webrtc/+/61b22dde133aff91a0db6a628d87b2ea9134fa15
TBR=mflodman@webrtc.org,perkj@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5880
Review-Url: https://codereview.webrtc.org/2867703002
Cr-Commit-Position: refs/heads/master@{#18081}
2017-05-10 05:25:59 -07:00
|
|
|
buffer = I420Buffer::Rotate(*buffer->NativeToI420Buffer(),
|
2017-01-10 07:44:26 -08:00
|
|
|
rotation);
|
|
|
|
|
if (rotation == kVideoRotation_90 || rotation == kVideoRotation_270) {
|
2017-01-09 07:09:23 -08:00
|
|
|
std::swap(captured_width, captured_height);
|
|
|
|
|
}
|
2017-01-10 07:44:26 -08:00
|
|
|
|
2017-01-09 07:09:23 -08:00
|
|
|
rotation = kVideoRotation_0;
|
2016-07-14 08:12:17 -07:00
|
|
|
}
|
|
|
|
|
|
Reland of Make cricket::VideoFrame inherit webrtc::VideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2402853002/ )
This cl now makes cricket::VideoFrame and cricket::WebRtcVideoFrame aliases for webrtc::VideoFrame.
Reason for revert:
Fixing backwards compatibility issues.
Original issue's description:
> Revert of Make cricket::VideoFrame inherit webrtc::VideoFrame. (patchset #9 id:160001 of https://codereview.webrtc.org/2315663002/ )
>
> Reason for revert:
> Breaks compile for Chromium builds:
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/10761
> https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/18142
>
> FAILED: obj/remoting/protocol/protocol/webrtc_video_renderer_adapter.o
> ../../remoting/protocol/webrtc_video_renderer_adapter.cc:110:52: error: no member named 'transport_frame_id' in 'cricket::VideoFrame'
> weak_factory_.GetWeakPtr(), frame.transport_frame_id(),
> ~~~~~ ^
> 1 error generated.
>
> Please run chromium trybots as described at https://webrtc.org/contributing/#tryjobs-on-chromium-trybots before relanding.
>
> Original issue's description:
> > Make cricket::VideoFrame inherit webrtc::VideoFrame. Delete
> > all methods but a few constructors. And similarly for the
> > subclass cricket::WebRtcVideoFrame.
> >
> > TBR=tkchin@webrtc.org # Added an include line
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/dda6ec008a0fc8d52e118814fb779032e8931968
> > Cr-Commit-Position: refs/heads/master@{#14576}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,pthatcher@chromium.org,tkchin@webrtc.org,nisse@webrtc.org
> NOTRY=True
> NOPRESUBMIT=True
> BUG=webrtc:5682
>
> Committed: https://crrev.com/d36dd499c8f253cbcf37364c2a070c2e8c7100e9
> Cr-Commit-Position: refs/heads/master@{#14583}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,pthatcher@chromium.org,tkchin@webrtc.org,kjellander@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2411953002
Cr-Commit-Position: refs/heads/master@{#14678}
2016-10-19 00:30:30 -07:00
|
|
|
OnFrame(webrtc::VideoFrame(buffer, rotation, translated_camera_time_us),
|
2016-07-14 08:12:17 -07:00
|
|
|
captured_width, captured_height);
|
2016-01-21 11:44:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|