forked from crow-misia/libwebrtc-bin
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
diff --git a/src/sdk/objc/api/peerconnection/RTCRtpTransceiver.h b/src/sdk/objc/api/peerconnection/RTCRtpTransceiver.h | ||
index fd59013..1701f68 100644 | ||
--- a/src/sdk/objc/api/peerconnection/RTCRtpTransceiver.h | ||
+++ b/src/sdk/objc/api/peerconnection/RTCRtpTransceiver.h | ||
@@ -46,6 +46,7 @@ RTC_OBJC_EXPORT | ||
@end | ||
|
||
@class RTC_OBJC_TYPE(RTCRtpTransceiver); | ||
+@class RTC_OBJC_TYPE(RTCRtpCodecCapability); | ||
|
||
/** The RTCRtpTransceiver maps to the RTCRtpTransceiver defined by the | ||
* WebRTC specification. A transceiver represents a combination of an RTCRtpSender | ||
@@ -118,6 +119,12 @@ RTC_OBJC_EXPORT | ||
*/ | ||
- (void)stopInternal; | ||
|
||
+/** The setCodecPreferences method overrides the default codec preferences used | ||
+ * by WebRTC for this transceiver. | ||
+ * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-setcodecpreferences | ||
+ */ | ||
+- (void)setCodecPreferences:(NSArray<RTC_OBJC_TYPE(RTCRtpCodecCapability) *> *)codecs; | ||
+ | ||
/** An update of directionality does not take effect immediately. Instead, | ||
* future calls to createOffer and createAnswer mark the corresponding media | ||
* descriptions as sendrecv, sendonly, recvonly, or inactive. | ||
diff --git a/src/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm b/src/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm | ||
index ae1cf79..eb0ad96 100644 | ||
--- a/src/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm | ||
+++ b/src/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm | ||
@@ -10,6 +10,7 @@ | ||
|
||
#import "RTCRtpTransceiver+Private.h" | ||
|
||
+#import "RTCRtpCodecCapability+Private.h" | ||
#import "RTCRtpEncodingParameters+Private.h" | ||
#import "RTCRtpParameters+Private.h" | ||
#import "RTCRtpReceiver+Private.h" | ||
@@ -17,6 +18,8 @@ | ||
#import "base/RTCLogging.h" | ||
#import "helpers/NSString+StdString.h" | ||
|
||
+#include "api/rtp_parameters.h" | ||
+ | ||
NSString *const kRTCRtpTransceiverErrorDomain = @"org.webrtc.RTCRtpTranceiver"; | ||
|
||
@implementation RTC_OBJC_TYPE (RTCRtpTransceiverInit) | ||
@@ -105,6 +108,14 @@ NSString *const kRTCRtpTransceiverErrorDomain = @"org.webrtc.RTCRtpTranceiver"; | ||
_nativeRtpTransceiver->StopInternal(); | ||
} | ||
|
||
+- (void)setCodecPreferences:(NSArray<RTC_OBJC_TYPE(RTCRtpCodecCapability) *> *)codecs { | ||
+ std::vector<webrtc::RtpCodecCapability> codecCapabilities; | ||
+ for (RTC_OBJC_TYPE(RTCRtpCodecCapability) * rtpCodecCapability in codecs) { | ||
+ codecCapabilities.push_back(rtpCodecCapability.nativeRtpCodecCapability); | ||
+ } | ||
+ _nativeRtpTransceiver->SetCodecPreferences(codecCapabilities); | ||
+} | ||
+ | ||
- (NSString *)description { | ||
return [NSString | ||
stringWithFormat:@"RTC_OBJC_TYPE(RTCRtpTransceiver) {\n sender: %@\n receiver: %@\n}", |