-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose getCapabilities/setCodecPreferences for objc
Bug: None Change-Id: I31cf22bae595cf2b995ff648523d25485106fcd5 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/305200 Reviewed-by: Magnus Jedvert <[email protected]> Reviewed-by: Peter Hanspers <[email protected]> Commit-Queue: Peter Hanspers <[email protected]> Cr-Commit-Position: refs/heads/main@{#40841}
- Loading branch information
Showing
11 changed files
with
402 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2023 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. | ||
*/ | ||
|
||
#import "RTCRtpCapabilities.h" | ||
|
||
#include "api/rtp_parameters.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface RTC_OBJC_TYPE (RTCRtpCapabilities) | ||
() | ||
|
||
/** Returns the equivalent native RtpCapabilities structure. */ | ||
@property(nonatomic, readonly) webrtc::RtpCapabilities nativeCapabilities; | ||
|
||
/** Initialize the object with a native RtpCapabilities structure. */ | ||
- (instancetype)initWithNativeCapabilities:(const webrtc::RtpCapabilities &)nativeCapabilities | ||
NS_DESIGNATED_INITIALIZER; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2023 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. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "RTCMacros.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@class RTC_OBJC_TYPE(RTCRtpCodecCapability); | ||
|
||
RTC_OBJC_EXPORT | ||
@interface RTC_OBJC_TYPE (RTCRtpCapabilities) : NSObject | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
@property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCRtpCodecCapability) *> *codecs; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2023 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. | ||
*/ | ||
|
||
#import "RTCRtpCapabilities+Private.h" | ||
#import "RTCRtpCodecCapability+Private.h" | ||
|
||
#import "RTCMediaStreamTrack.h" | ||
#import "helpers/NSString+StdString.h" | ||
|
||
#include "media/base/media_constants.h" | ||
#include "rtc_base/checks.h" | ||
|
||
@implementation RTC_OBJC_TYPE (RTCRtpCapabilities) | ||
|
||
@synthesize nativeCapabilities = _nativeCapabilities; | ||
|
||
- (instancetype)initWithNativeCapabilities:(const webrtc::RtpCapabilities &)nativeCapabilities { | ||
if (self = [super init]) { | ||
_nativeCapabilities = nativeCapabilities; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (NSArray<RTC_OBJC_TYPE(RTCRtpCodecCapability) *> *)codecs { | ||
NSMutableArray *result = [NSMutableArray array]; | ||
|
||
for (auto &element : _nativeCapabilities.codecs) { | ||
RTCRtpCodecCapability *object = | ||
[[RTCRtpCodecCapability alloc] initWithNativeCodecCapability:element]; | ||
[result addObject:object]; | ||
} | ||
|
||
return result; | ||
} | ||
|
||
@end |
27 changes: 27 additions & 0 deletions
27
sdk/objc/api/peerconnection/RTCRtpCodecCapability+Private.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright 2023 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. | ||
*/ | ||
|
||
#import "RTCRtpCodecCapability.h" | ||
|
||
#include "api/rtp_parameters.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface RTC_OBJC_TYPE (RTCRtpCodecCapability) | ||
() | ||
|
||
@property(nonatomic, readonly) webrtc::RtpCodecCapability nativeCodecCapability; | ||
|
||
- (instancetype)initWithNativeCodecCapability: | ||
(const webrtc::RtpCodecCapability &)nativeCodecCapability NS_DESIGNATED_INITIALIZER; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2023 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. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "RTCMacros.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
typedef NS_ENUM(NSInteger, RTCRtpMediaType); | ||
|
||
RTC_OBJC_EXPORT | ||
@interface RTC_OBJC_TYPE (RTCRtpCodecCapability) : NSObject | ||
|
||
/** Build MIME "type/subtype" string from name and kind. */ | ||
@property(nonatomic, readonly) NSString *mimeType; | ||
|
||
/** Used to identify the codec. Equivalent to MIME subtype. */ | ||
@property(nonatomic, copy) NSString *name; | ||
|
||
/** The media type of this codec. Equivalent to MIME top-level type. */ | ||
@property(nonatomic, assign) RTCRtpMediaType kind; | ||
|
||
/** Clock rate in Hertz. If unset, the codec is applicable to any clock rate. */ | ||
@property(nonatomic, copy, nullable) NSNumber *clockRate; | ||
|
||
/** Default payload type for this codec. Mainly needed for codecs that use | ||
* that have statically assigned payload types. | ||
*/ | ||
@property(nonatomic, copy, nullable) NSNumber *preferredPayloadType; | ||
|
||
/** The number of audio channels supported. Unused for video codecs. */ | ||
@property(nonatomic, copy, nullable) NSNumber *numChannels; | ||
|
||
/**Codec-specific parameters that must be signaled to the remote party. | ||
* | ||
* Corresponds to "a=fmtp" parameters in SDP. | ||
* | ||
* Contrary to ORTC, these parameters are named using all lowercase strings. | ||
* This helps make the mapping to SDP simpler, if an application is using SDP. | ||
* Boolean values are represented by the string "1". | ||
*/ | ||
@property(nonatomic, copy) NSDictionary<NSString *, NSString *> *parameters; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.