-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ObjC] Expose properties / methods required for AV1 codec support (#60)
* expose scalabilityMode * expose AV1 codec name * sender / receiver capabilities * setCodecPreferences * ref * RTCRtpCapabilities * kind * fix compile warnings * clean up * lk header * clockRate * preferredPayloadType * numChannels * parameters * Update RTCRtpCodecCapability.h * format * format * always include kDependencyDescriptorUri * clean up * don't throw when setCodecPreferences fails * unused variable
- Loading branch information
1 parent
8670af4
commit d79d77e
Showing
16 changed files
with
451 additions
and
10 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
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,33 @@ | ||
/* | ||
* Copyright 2023 LiveKit | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#import "RTCRtpCapabilities.h" | ||
|
||
#include "api/rtp_parameters.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface RTC_OBJC_TYPE (RTCRtpCapabilities) | ||
() | ||
|
||
@property(nonatomic, readonly) webrtc::RtpCapabilities nativeCapabilities; | ||
|
||
- (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,40 @@ | ||
/* | ||
* Copyright 2023 LiveKit | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "RTCMacros.h" | ||
|
||
@class RTC_OBJC_TYPE(RTCRtpCodecCapability); | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
RTC_OBJC_EXPORT | ||
@interface RTC_OBJC_TYPE (RTCRtpCapabilities) : NSObject | ||
|
||
- (instancetype)init NS_UNAVAILABLE; | ||
|
||
@property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCRtpCodecCapability) *> *codecs; | ||
|
||
// Not implemented. | ||
// std::vector<RtpHeaderExtensionCapability> header_extensions; | ||
|
||
// Not implemented. | ||
// std::vector<FecMechanism> fec; | ||
|
||
@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,50 @@ | ||
/* | ||
* Copyright 2023 LiveKit | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#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 |
33 changes: 33 additions & 0 deletions
33
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,33 @@ | ||
/* | ||
* Copyright 2023 LiveKit | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#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,63 @@ | ||
/* | ||
* Copyright 2023 LiveKit | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "RTCMacros.h" | ||
|
||
typedef NS_ENUM(NSInteger, RTCRtpMediaType); | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
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". | ||
// std::map<std::string, std::string> parameters; | ||
@property(nonatomic, copy) NSDictionary<NSString *, NSString *> *parameters; | ||
|
||
// Feedback mechanisms supported for this codec. | ||
// std::vector<RtcpFeedback> rtcp_feedback; | ||
// Not implemented. | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.