Compare commits

...

1 Commits

Author SHA1 Message Date
Michael Kirk
b6097fdff4 Update WebRTC to 59 + signal patches 2017-07-07 10:29:10 -05:00
18 changed files with 212 additions and 44 deletions

View File

@ -29,6 +29,16 @@ RTC_EXPORT
- (instancetype)init NS_UNAVAILABLE;
/**
* Calling this function will cause frames to be scaled down to the
* requested resolution. Also, frames will be cropped to match the
* requested aspect ratio, and frames will be dropped to match the
* requested fps. The requested aspect ratio is orientation agnostic and
* will be adjusted to maintain the input orientation, so it doesn't
* matter if e.g. 1280x720 or 720x1280 is requested.
*/
- (void)adaptOutputFormatToWidth:(int)width height:(int)height fps:(int)fps;
/** Returns whether rear-facing camera is available for use. */
@property(nonatomic, readonly) BOOL canUseBackCamera;

View File

@ -20,6 +20,13 @@ RTC_EXPORT
- (instancetype)init NS_UNAVAILABLE;
// Sets the volume for the RTCMediaSource. |volume| is a gain value in the range
// [0, 10].
// Temporary fix to be able to modify volume of remote audio tracks.
// TODO(kthelgason): Property stays here temporarily until a proper volume-api
// is available on the surface exposed by webrtc.
@property(nonatomic, assign) double volume;
@end
NS_ASSUME_NONNULL_END

View File

@ -84,6 +84,7 @@ RTC_EXPORT
@property(nonatomic, assign)
RTCContinualGatheringPolicy continualGatheringPolicy;
@property(nonatomic, assign) int audioJitterBufferMaxPackets;
@property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
@property(nonatomic, assign) int iceConnectionReceivingTimeout;
@property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
@ -103,7 +104,12 @@ RTC_EXPORT
*/
@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
/** If set to non-nil, controls the minimal interval between consecutive ICE
* check packets.
*/
@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
- (instancetype)init;
@end

View File

@ -12,12 +12,31 @@
#import <WebRTC/RTCMacros.h>
typedef NS_OPTIONS(NSUInteger, RTCFieldTrialOptions) {
RTCFieldTrialOptionsNone = 0,
RTCFieldTrialOptionsImprovedBitrateEstimate = 1 << 0,
};
/** The only valid value for the following if set is kRTCFieldTrialEnabledValue. */
RTC_EXTERN NSString * const kRTCFieldTrialAudioSendSideBweKey;
RTC_EXTERN NSString * const kRTCFieldTrialSendSideBweWithOverheadKey;
RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03AdvertisedKey;
RTC_EXTERN NSString * const kRTCFieldTrialFlexFec03Key;
RTC_EXTERN NSString * const kRTCFieldTrialImprovedBitrateEstimateKey;
RTC_EXTERN NSString * const kRTCFieldTrialH264HighProfileKey;
/** Must be called before any other call into WebRTC. See:
/** The valid value for field trials above. */
RTC_EXTERN NSString * const kRTCFieldTrialEnabledValue;
/** Use a string returned by RTCFieldTrialMedianSlopeFilterValue as the value. */
RTC_EXTERN NSString * const kRTCFieldTrialMedianSlopeFilterKey;
RTC_EXTERN NSString *RTCFieldTrialMedianSlopeFilterValue(
size_t windowSize, double thresholdGain);
/** Use a string returned by RTCFieldTrialTrendlineFilterValue as the value. */
RTC_EXTERN NSString * const kRTCFieldTrialTrendlineFilterKey;
/** Returns a valid value for kRTCFieldTrialTrendlineFilterKey. */
RTC_EXTERN NSString *RTCFieldTrialTrendlineFilterValue(
size_t windowSize, double smoothingCoeff, double thresholdGain);
/** Initialize field trials using a dictionary mapping field trial keys to their values. See above
* for valid keys and values.
* Must be called before any other call into WebRTC. See:
* webrtc/system_wrappers/include/field_trial_default.h
*/
RTC_EXTERN void RTCInitFieldTrials(RTCFieldTrialOptions options);
RTC_EXTERN void RTCInitFieldTrialDictionary(NSDictionary<NSString *, NSString *> *fieldTrials);

View File

@ -32,6 +32,9 @@ RTC_EXPORT
/** The SDP string for this candidate. */
@property(nonatomic, readonly) NSString *sdp;
/** The URL of the ICE server which this candidate is gathered from. */
@property(nonatomic, readonly, nullable) NSString *serverUrl;
- (instancetype)init NS_UNAVAILABLE;
/**

View File

@ -12,6 +12,11 @@
#import <WebRTC/RTCMacros.h>
typedef NS_ENUM(NSUInteger, RTCTlsCertPolicy) {
RTCTlsCertPolicySecure,
RTCTlsCertPolicyInsecureNoCheck
};
NS_ASSUME_NONNULL_BEGIN
RTC_EXPORT
@ -26,6 +31,11 @@ RTC_EXPORT
/** Credential to use if this RTCIceServer object is a TURN server. */
@property(nonatomic, readonly, nullable) NSString *credential;
/**
* TLS certificate policy to use if this RTCIceServer object is a TURN server.
*/
@property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy;
- (nonnull instancetype)init NS_UNAVAILABLE;
/** Convenience initializer for a server with no authentication (e.g. STUN). */
@ -35,9 +45,18 @@ RTC_EXPORT
* Initialize an RTCIceServer with its associated URLs, optional username,
* optional credential, and credentialType.
*/
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
username:(nullable NSString *)username
credential:(nullable NSString *)credential;
/**
* Initialize an RTCIceServer with its associated URLs, optional username,
* optional credential, and TLS cert policy.
*/
- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
username:(nullable NSString *)username
credential:(nullable NSString *)credential
tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
NS_DESIGNATED_INITIALIZER;
@end

View File

@ -23,6 +23,10 @@ RTC_EXTERN NSString * const kRTCMediaConstraintsMinHeight;
RTC_EXTERN NSString * const kRTCMediaConstraintsMaxFrameRate;
RTC_EXTERN NSString * const kRTCMediaConstraintsMinFrameRate;
RTC_EXTERN NSString * const kRTCMediaConstraintsLevelControl;
/** The value for this key should be a base64 encoded string containing
* the data from the serialized configuration proto.
*/
RTC_EXTERN NSString * const kRTCMediaConstraintsAudioNetworkAdaptorConfig;
RTC_EXTERN NSString * const kRTCMediaConstraintsValueTrue;
RTC_EXTERN NSString * const kRTCMediaConstraintsValueFalse;

View File

@ -123,6 +123,7 @@ RTC_EXPORT
@property(nonatomic, readonly) RTCSignalingState signalingState;
@property(nonatomic, readonly) RTCIceConnectionState iceConnectionState;
@property(nonatomic, readonly) RTCIceGatheringState iceGatheringState;
@property(nonatomic, readonly, copy) RTCConfiguration *configuration;
/** Gets all RTCRtpSenders associated with this peer connection.
* Note: reading this property returns different instances of RTCRtpSender.

View File

@ -46,6 +46,11 @@ RTC_EXPORT
- (RTCAVFoundationVideoSource *)avFoundationVideoSourceWithConstraints:
(nullable RTCMediaConstraints *)constraints;
/** Initialize a generic RTCVideoSource. The RTCVideoSource should be passed to a RTCVideoCapturer
* implementation, e.g. RTCCameraVideoCapturer, in order to produce frames.
*/
- (RTCVideoSource *)videoSource;
/** Initialize an RTCVideoTrack with a source and an id. */
- (RTCVideoTrack *)videoTrackWithSource:(RTCVideoSource *)source
trackId:(NSString *)trackId;

View File

@ -14,22 +14,22 @@
NS_ASSUME_NONNULL_BEGIN
RTC_EXTERN const NSString * const kRTCRtxCodecMimeType;
RTC_EXTERN const NSString * const kRTCRedCodecMimeType;
RTC_EXTERN const NSString * const kRTCUlpfecCodecMimeType;
RTC_EXTERN const NSString * const kRTCFlexfecCodecMimeType;
RTC_EXTERN const NSString * const kRTCOpusCodecMimeType;
RTC_EXTERN const NSString * const kRTCIsacCodecMimeType;
RTC_EXTERN const NSString * const kRTCL16CodecMimeType;
RTC_EXTERN const NSString * const kRTCG722CodecMimeType;
RTC_EXTERN const NSString * const kRTCIlbcCodecMimeType;
RTC_EXTERN const NSString * const kRTCPcmuCodecMimeType;
RTC_EXTERN const NSString * const kRTCPcmaCodecMimeType;
RTC_EXTERN const NSString * const kRTCDtmfCodecMimeType;
RTC_EXTERN const NSString * const kRTCComfortNoiseCodecMimeType;
RTC_EXTERN const NSString * const kRTCVp8CodecMimeType;
RTC_EXTERN const NSString * const kRTCVp9CodecMimeType;
RTC_EXTERN const NSString * const kRTCH264CodecMimeType;
RTC_EXTERN const NSString * const kRTCRtxCodecName;
RTC_EXTERN const NSString * const kRTCRedCodecName;
RTC_EXTERN const NSString * const kRTCUlpfecCodecName;
RTC_EXTERN const NSString * const kRTCFlexfecCodecName;
RTC_EXTERN const NSString * const kRTCOpusCodecName;
RTC_EXTERN const NSString * const kRTCIsacCodecName;
RTC_EXTERN const NSString * const kRTCL16CodecName;
RTC_EXTERN const NSString * const kRTCG722CodecName;
RTC_EXTERN const NSString * const kRTCIlbcCodecName;
RTC_EXTERN const NSString * const kRTCPcmuCodecName;
RTC_EXTERN const NSString * const kRTCPcmaCodecName;
RTC_EXTERN const NSString * const kRTCDtmfCodecName;
RTC_EXTERN const NSString * const kRTCComfortNoiseCodecName;
RTC_EXTERN const NSString * const kRTCVp8CodecName;
RTC_EXTERN const NSString * const kRTCVp9CodecName;
RTC_EXTERN const NSString * const kRTCH264CodecName;
/** Defined in http://w3c.github.io/webrtc-pc/#idl-def-RTCRtpCodecParameters */
RTC_EXPORT
@ -39,18 +39,29 @@ RTC_EXPORT
@property(nonatomic, assign) int payloadType;
/**
* The codec MIME type. Valid types are listed in:
* The codec MIME subtype. Valid types are listed in:
* http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-2
*
* Several supported types are represented by the constants above.
*/
@property(nonatomic, nonnull) NSString *mimeType;
@property(nonatomic, readonly, nonnull) NSString *name;
/**
* The media type of this codec. Equivalent to MIME top-level type.
*
* Valid values are kRTCMediaStreamTrackKindAudio and
* kRTCMediaStreamTrackKindVideo.
*/
@property(nonatomic, readonly, nonnull) NSString *kind;
/** The codec clock rate expressed in Hertz. */
@property(nonatomic, assign) int clockRate;
@property(nonatomic, readonly, nullable) NSNumber *clockRate;
/** The number of channels (mono=1, stereo=2). */
@property(nonatomic, assign) int channels;
/**
* The number of channels (mono=1, stereo=2).
* Set to null for video codecs.
**/
@property(nonatomic, readonly, nullable) NSNumber *numChannels;
- (instancetype)init NS_DESIGNATED_INITIALIZER;

View File

@ -25,6 +25,9 @@ RTC_EXPORT
*/
@property(nonatomic, copy, nullable) NSNumber *maxBitrateBps;
/** The SSRC being used by this encoding. */
@property(nonatomic, readonly, nullable) NSNumber *ssrc;
- (instancetype)init NS_DESIGNATED_INITIALIZER;
@end

View File

@ -16,6 +16,35 @@
NS_ASSUME_NONNULL_BEGIN
/** Represents the media type of the RtpReceiver. */
typedef NS_ENUM(NSInteger, RTCRtpMediaType) {
RTCRtpMediaTypeAudio,
RTCRtpMediaTypeVideo,
RTCRtpMediaTypeData,
};
@class RTCRtpReceiver;
RTC_EXPORT
@protocol RTCRtpReceiverDelegate <NSObject>
/** Called when the first RTP packet is received.
*
* Note: Currently if there are multiple RtpReceivers of the same media type,
* they will all call OnFirstPacketReceived at once.
*
* For example, if we create three audio receivers, A/B/C, they will listen to
* the same signal from the underneath network layer. Whenever the first audio packet
* is received, the underneath signal will be fired. All the receivers A/B/C will be
* notified and the callback of the receiver's delegate will be called.
*
* The process is the same for video receivers.
*/
- (void)rtpReceiver:(RTCRtpReceiver *)rtpReceiver
didReceiveFirstPacketForMediaType:(RTCRtpMediaType)mediaType;
@end
RTC_EXPORT
@protocol RTCRtpReceiver <NSObject>
@ -38,6 +67,9 @@ RTC_EXPORT
*/
@property(nonatomic, readonly) RTCMediaStreamTrack *track;
/** The delegate for this RtpReceiver. */
@property(nonatomic, weak) id<RTCRtpReceiverDelegate> delegate;
@end
RTC_EXPORT

View File

@ -15,25 +15,33 @@
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, RTCVideoRotation) {
RTCVideoRotation_0 = 0,
RTCVideoRotation_90 = 90,
RTCVideoRotation_180 = 180,
RTCVideoRotation_270 = 270,
};
// RTCVideoFrame is an ObjectiveC version of webrtc::VideoFrame.
RTC_EXPORT
@interface RTCVideoFrame : NSObject
/** Width without rotation applied. */
@property(nonatomic, readonly) size_t width;
@property(nonatomic, readonly) int width;
/** Height without rotation applied. */
@property(nonatomic, readonly) size_t height;
@property(nonatomic, readonly) int rotation;
@property(nonatomic, readonly) size_t chromaWidth;
@property(nonatomic, readonly) size_t chromaHeight;
// These can return NULL if the object is not backed by a buffer.
@property(nonatomic, readonly, nullable) const uint8_t *yPlane;
@property(nonatomic, readonly, nullable) const uint8_t *uPlane;
@property(nonatomic, readonly, nullable) const uint8_t *vPlane;
@property(nonatomic, readonly) int32_t yPitch;
@property(nonatomic, readonly) int32_t uPitch;
@property(nonatomic, readonly) int32_t vPitch;
@property(nonatomic, readonly) int height;
@property(nonatomic, readonly) RTCVideoRotation rotation;
/** Accessing YUV data should only be done for I420 frames, i.e. if nativeHandle
* is null. It is always possible to get such a frame by calling
* newI420VideoFrame.
*/
@property(nonatomic, readonly, nullable) const uint8_t *dataY;
@property(nonatomic, readonly, nullable) const uint8_t *dataU;
@property(nonatomic, readonly, nullable) const uint8_t *dataV;
@property(nonatomic, readonly) int strideY;
@property(nonatomic, readonly) int strideU;
@property(nonatomic, readonly) int strideV;
/** Timestamp in nanoseconds. */
@property(nonatomic, readonly) int64_t timeStampNs;
@ -42,11 +50,32 @@ RTC_EXPORT
@property(nonatomic, readonly) CVPixelBufferRef nativeHandle;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)new NS_UNAVAILABLE;
/** If the frame is backed by a CVPixelBuffer, creates a backing i420 frame.
* Calling the yuv plane properties will call this method if needed.
/** Initialize an RTCVideoFrame from a pixel buffer, rotation, and timestamp.
*/
- (void)convertBufferIfNeeded;
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
rotation:(RTCVideoRotation)rotation
timeStampNs:(int64_t)timeStampNs;
/** Initialize an RTCVideoFrame from a pixel buffer combined with cropping and
* scaling. Cropping will be applied first on the pixel buffer, followed by
* scaling to the final resolution of scaledWidth x scaledHeight.
*/
- (instancetype)initWithPixelBuffer:(CVPixelBufferRef)pixelBuffer
scaledWidth:(int)scaledWidth
scaledHeight:(int)scaledHeight
cropWidth:(int)cropWidth
cropHeight:(int)cropHeight
cropX:(int)cropX
cropY:(int)cropY
rotation:(RTCVideoRotation)rotation
timeStampNs:(int64_t)timeStampNs;
/** Return a frame that is guaranteed to be I420, i.e. it is possible to access
* the YUV data on it.
*/
- (RTCVideoFrame *)newI420VideoFrame;
@end

View File

@ -12,14 +12,26 @@
#import <WebRTC/RTCMacros.h>
#import <WebRTC/RTCMediaSource.h>
#import <WebRTC/RTCVideoCapturer.h>
NS_ASSUME_NONNULL_BEGIN
RTC_EXPORT
@interface RTCVideoSource : RTCMediaSource
@interface RTCVideoSource : RTCMediaSource <RTCVideoCapturerDelegate>
- (instancetype)init NS_UNAVAILABLE;
/**
* Calling this function will cause frames to be scaled down to the
* requested resolution. Also, frames will be cropped to match the
* requested aspect ratio, and frames will be dropped to match the
* requested fps. The requested aspect ratio is orientation agnostic and
* will be adjusted to maintain the input orientation, so it doesn't
* matter if e.g. 1280x720 or 720x1280 is requested.
*/
- (void)adaptOutputFormatToWidth:(int)width height:(int)height fps:(int)fps;
@end
NS_ASSUME_NONNULL_END

View File

@ -59,5 +59,6 @@ typedef NS_ENUM(NSInteger, RTCDeviceType) {
+ (RTCDeviceType)deviceType;
+ (NSString *)stringForDeviceType:(RTCDeviceType)deviceType;
+ (BOOL)isIOS9OrLater;
@end

View File

@ -11,12 +11,16 @@
#import <WebRTC/RTCAVFoundationVideoSource.h>
#import <WebRTC/RTCAudioSource.h>
#import <WebRTC/RTCAudioTrack.h>
#if TARGET_OS_IPHONE
#import <WebRTC/RTCCameraPreviewView.h>
#endif
#import <WebRTC/RTCConfiguration.h>
#import <WebRTC/RTCDataChannel.h>
#import <WebRTC/RTCDataChannelConfiguration.h>
#import <WebRTC/RTCDispatcher.h>
#if TARGET_OS_IPHONE
#import <WebRTC/RTCEAGLVideoView.h>
#endif
#import <WebRTC/RTCFieldTrials.h>
#import <WebRTC/RTCFileLogger.h>
#import <WebRTC/RTCIceCandidate.h>
@ -44,4 +48,6 @@
#import <WebRTC/RTCVideoRenderer.h>
#import <WebRTC/RTCVideoSource.h>
#import <WebRTC/RTCVideoTrack.h>
#if TARGET_OS_IPHONE
#import <WebRTC/UIDevice+RTCDevice.h>
#endif

Binary file not shown.