Exposing rtcp report interval setting in objc api

Bug: webrtc:8789
Change-Id: I75d8cac70de00b067cbbcbe7faa3d3ccb0318453
Reviewed-on: https://webrtc-review.googlesource.com/c/110846
Reviewed-by: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Jiawei Ou <ouj@fb.com>
Cr-Commit-Position: refs/heads/master@{#25643}
This commit is contained in:
Jiawei Ou 2018-11-13 23:48:19 -08:00 committed by Commit Bot
parent 83aa5ace99
commit b1e477518a
3 changed files with 24 additions and 1 deletions

View file

@ -201,6 +201,16 @@ RTC_OBJC_EXPORT
*/ */
@property(nonatomic, nullable) RTCCryptoOptions *cryptoOptions; @property(nonatomic, nullable) RTCCryptoOptions *cryptoOptions;
/**
* Time interval between audio RTCP reports.
*/
@property(nonatomic, assign) int rtcpAudioReportIntervalMs;
/**
* Time interval between video RTCP reports.
*/
@property(nonatomic, assign) int rtcpVideoReportIntervalMs;
- (instancetype)init; - (instancetype)init;
@end @end

View file

@ -53,6 +53,8 @@
@synthesize useMediaTransport = _useMediaTransport; @synthesize useMediaTransport = _useMediaTransport;
@synthesize useMediaTransportForDataChannels = _useMediaTransportForDataChannels; @synthesize useMediaTransportForDataChannels = _useMediaTransportForDataChannels;
@synthesize cryptoOptions = _cryptoOptions; @synthesize cryptoOptions = _cryptoOptions;
@synthesize rtcpAudioReportIntervalMs = _rtcpAudioReportIntervalMs;
@synthesize rtcpVideoReportIntervalMs = _rtcpVideoReportIntervalMs;
- (instancetype)init { - (instancetype)init {
// Copy defaults. // Copy defaults.
@ -130,6 +132,8 @@
sframeRequireFrameEncryption:config.crypto_options->sframe sframeRequireFrameEncryption:config.crypto_options->sframe
.require_frame_encryption]; .require_frame_encryption];
} }
_rtcpAudioReportIntervalMs = config.audio_rtcp_report_interval_ms();
_rtcpVideoReportIntervalMs = config.video_rtcp_report_interval_ms();
} }
return self; return self;
} }
@ -261,7 +265,8 @@
_cryptoOptions.sframeRequireFrameEncryption ? true : false; _cryptoOptions.sframeRequireFrameEncryption ? true : false;
nativeConfig->crypto_options = absl::optional<webrtc::CryptoOptions>(nativeCryptoOptions); nativeConfig->crypto_options = absl::optional<webrtc::CryptoOptions>(nativeCryptoOptions);
} }
nativeConfig->set_audio_rtcp_report_interval_ms(_rtcpAudioReportIntervalMs);
nativeConfig->set_video_rtcp_report_interval_ms(_rtcpVideoReportIntervalMs);
return nativeConfig.release(); return nativeConfig.release();
} }

View file

@ -54,6 +54,8 @@
srtpEnableAes128Sha1_32CryptoCipher:YES srtpEnableAes128Sha1_32CryptoCipher:YES
srtpEnableEncryptedRtpHeaderExtensions:YES srtpEnableEncryptedRtpHeaderExtensions:YES
sframeRequireFrameEncryption:YES]; sframeRequireFrameEncryption:YES];
config.rtcpAudioReportIntervalMs = 2500;
config.rtcpVideoReportIntervalMs = 3750;
std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration> std::unique_ptr<webrtc::PeerConnectionInterface::RTCConfiguration>
nativeConfig([config createNativeConfiguration]); nativeConfig([config createNativeConfiguration]);
@ -86,6 +88,8 @@
EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_aes128_sha1_32_crypto_cipher); EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_aes128_sha1_32_crypto_cipher);
EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_encrypted_rtp_header_extensions); EXPECT_EQ(true, nativeConfig->crypto_options->srtp.enable_encrypted_rtp_header_extensions);
EXPECT_EQ(true, nativeConfig->crypto_options->sframe.require_frame_encryption); EXPECT_EQ(true, nativeConfig->crypto_options->sframe.require_frame_encryption);
EXPECT_EQ(2500, nativeConfig->audio_rtcp_report_interval_ms());
EXPECT_EQ(3750, nativeConfig->video_rtcp_report_interval_ms());
} }
- (void)testNativeConversionToConfiguration { - (void)testNativeConversionToConfiguration {
@ -115,6 +119,8 @@
srtpEnableAes128Sha1_32CryptoCipher:NO srtpEnableAes128Sha1_32CryptoCipher:NO
srtpEnableEncryptedRtpHeaderExtensions:NO srtpEnableEncryptedRtpHeaderExtensions:NO
sframeRequireFrameEncryption:NO]; sframeRequireFrameEncryption:NO];
config.rtcpAudioReportIntervalMs = 1500;
config.rtcpVideoReportIntervalMs = 2150;
webrtc::PeerConnectionInterface::RTCConfiguration *nativeConfig = webrtc::PeerConnectionInterface::RTCConfiguration *nativeConfig =
[config createNativeConfiguration]; [config createNativeConfiguration];
@ -150,6 +156,8 @@
newConfig.cryptoOptions.srtpEnableEncryptedRtpHeaderExtensions); newConfig.cryptoOptions.srtpEnableEncryptedRtpHeaderExtensions);
EXPECT_EQ(config.cryptoOptions.sframeRequireFrameEncryption, EXPECT_EQ(config.cryptoOptions.sframeRequireFrameEncryption,
newConfig.cryptoOptions.sframeRequireFrameEncryption); newConfig.cryptoOptions.sframeRequireFrameEncryption);
EXPECT_EQ(config.rtcpAudioReportIntervalMs, newConfig.rtcpAudioReportIntervalMs);
EXPECT_EQ(config.rtcpVideoReportIntervalMs, newConfig.rtcpVideoReportIntervalMs);
} }
- (void)testDefaultValues { - (void)testDefaultValues {