Skip to content

Commit

Permalink
enable scp
Browse files Browse the repository at this point in the history
  • Loading branch information
rogurotus committed Feb 6, 2024
1 parent 055972d commit ae3c671
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build/ios/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ package:
.PHONY: patch
patch: common-patch
cd $(SRC_DIR) && \
patch -p2 < $(PATCH_DIR)/enable_ios_scalability_mode.patch
patch -p2 < $(PATCH_DIR)/enable_ios_scalability_mode.patch && \
patch -p2 < $(PATCH_DIR)/set_codec_preferences_ios.patch

.PHONY: build
build: patch
Expand Down
61 changes: 61 additions & 0 deletions patch/set_codec_preferences_ios.patch
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}",

0 comments on commit ae3c671

Please sign in to comment.