webrtc_m130/webrtc/sdk/objc/Framework/Classes/objcvideotracksource.mm

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

72 lines
2.6 KiB
Plaintext
Raw Normal View History

/*
* Copyright (c) 2017 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.
*/
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}
2017-05-29 09:57:37 -07:00
#include "webrtc/sdk/objc/Framework/Classes/objcvideotracksource.h"
#import "RTCVideoFrame+Private.h"
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
#include "webrtc/api/video/i420_buffer.h"
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}
2017-05-29 09:57:37 -07:00
#include "webrtc/sdk/objc/Framework/Classes/corevideo_frame_buffer.h"
namespace webrtc {
ObjcVideoTrackSource::ObjcVideoTrackSource() {}
void ObjcVideoTrackSource::OnOutputFormatRequest(int width, int height, int fps) {
cricket::VideoFormat format(width, height, cricket::VideoFormat::FpsToInterval(fps), 0);
video_adapter()->OnOutputFormatRequest(format);
}
void ObjcVideoTrackSource::OnCapturedFrame(RTCVideoFrame* frame) {
const int64_t timestamp_us = frame.timeStampNs / rtc::kNumNanosecsPerMicrosec;
const int64_t translated_timestamp_us =
timestamp_aligner_.TranslateTimestamp(timestamp_us, rtc::TimeMicros());
int adapted_width;
int adapted_height;
int crop_width;
int crop_height;
int crop_x;
int crop_y;
if (!AdaptFrame(frame.width, frame.height, timestamp_us, &adapted_width, &adapted_height,
&crop_width, &crop_height, &crop_x, &crop_y)) {
return;
}
rtc::scoped_refptr<VideoFrameBuffer> buffer;
if (adapted_width == frame.width && adapted_height == frame.height) {
// No adaption - optimized path.
buffer = frame.videoBuffer;
} else if (frame.nativeHandle) {
// Adapted CVPixelBuffer frame.
buffer = new rtc::RefCountedObject<CoreVideoFrameBuffer>(
static_cast<CVPixelBufferRef>(frame.nativeHandle), adapted_width, adapted_height,
crop_width, crop_height, crop_x, crop_y);
} else {
// Adapted I420 frame.
// TODO(magjed): Optimize this I420 path.
rtc::scoped_refptr<I420Buffer> i420_buffer = I420Buffer::Create(adapted_width, adapted_height);
i420_buffer->CropAndScaleFrom(*frame.videoBuffer, crop_x, crop_y, crop_width, crop_height);
buffer = i420_buffer;
}
// Applying rotation is only supported for legacy reasons and performance is
// not critical here.
webrtc::VideoRotation rotation = static_cast<webrtc::VideoRotation>(frame.rotation);
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(), rotation);
rotation = kVideoRotation_0;
}
OnFrame(webrtc::VideoFrame(buffer, rotation, translated_timestamp_us));
}
} // namespace webrtc