diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m index a83129c80..41378d2ee 100644 --- a/Classes/LinphoneCoreSettingsStore.m +++ b/Classes/LinphoneCoreSettingsStore.m @@ -182,16 +182,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); [self transformCodecsToKeys: linphone_core_get_audio_codecs(lc)]; [self transformCodecsToKeys: linphone_core_get_video_codecs(lc)]; [self setBool:linphone_core_adaptive_rate_control_enabled(lc) forKey:@"adaptive_rate_control_preference"]; - [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", 36) forKey:@"audio_codec_bitrate_limit_preference"]; + [self setInteger:lp_config_get_int(conf, "audio", "codec_bitrate_limit", kLinphoneAudioVbrCodecDefaultBitrate) forKey:@"audio_codec_bitrate_limit_preference"]; - PayloadType *pt; - const MSList *elem; - for (elem=linphone_core_get_audio_codecs(lc);elem!=NULL;elem=elem->next){ - pt=(PayloadType*)elem->data; - if ((strcmp(pt->mime_type, "opus") == 0) || (strcmp(pt->mime_type, "mpeg4-generic") == 0)) { - pt->normal_bitrate = [self integerForKey:@"audio_codec_bitrate_limit_preference"] * 1000; - } - } } { @@ -505,10 +497,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); pt=(PayloadType*)elem->data; NSString *pref=[LinphoneManager getPreferenceForCodec:pt->mime_type withRate:pt->clock_rate]; linphone_core_enable_payload_type(lc,pt,[self boolForKey: pref]); - if ((strcmp(pt->mime_type, "opus") == 0) || (strcmp(pt->mime_type, "mpeg4-generic") == 0)) { - pt->normal_bitrate = [self integerForKey:@"audio_codec_bitrate_limit_preference"] * 1000; - } } + for (elem=linphone_core_get_video_codecs(lc);elem!=NULL;elem=elem->next){ pt=(PayloadType*)elem->data; NSString *pref=[LinphoneManager getPreferenceForCodec:pt->mime_type withRate:pt->clock_rate]; @@ -517,6 +507,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args); LpConfig *config = linphone_core_get_config(lc); lp_config_set_int(config, "audio", "codec_bitrate_limit", [self integerForKey:@"audio_codec_bitrate_limit_preference"]); + [[LinphoneManager instance] configureVbrCodecs]; linphone_core_enable_adaptive_rate_control(lc, [self boolForKey:@"adaptive_rate_control_preference"]); linphone_core_set_use_info_for_dtmf(lc, [self boolForKey:@"sipinfo_dtmf_preference"]); diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index fb6806f23..1f243617c 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -73,6 +73,8 @@ typedef enum _Connectivity { none } Connectivity; +extern const int kLinphoneAudioVbrCodecDefaultBitrate; + /* Application specific call context */ typedef struct _CallContext { LinphoneCall* call; @@ -148,6 +150,8 @@ typedef struct _LinphoneManagerSounds { - (bool)allowSpeaker; +- (void)configureVbrCodecs; + + (BOOL)copyFile:(NSString*)src destination:(NSString*)dst override:(BOOL)override; + (NSString*)bundleFile:(NSString*)file; + (NSString*)documentFile:(NSString*)file; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 191087fd8..c61947f95 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -63,6 +63,8 @@ NSString *const kLinphoneConfiguringStateUpdate = @"LinphoneConfiguringStateUpda NSString *const kLinphoneGlobalStateUpdate = @"LinphoneGlobalStateUpdate"; +const int kLinphoneAudioVbrCodecDefaultBitrate=36; /*you can override this from linphonerc or linphonerc-factory*/ + extern void libmsilbc_init(void); extern void libmsamr_init(void); extern void libmsx264_init(void); @@ -1706,6 +1708,23 @@ static void audioRouteChangeListenerCallback ( return TRUE; } +- (void)configureVbrCodecs{ + PayloadType *pt; + int bitrate=lp_config_get_int(configDb,"audio","codec_bitrate_limit",kLinphoneAudioVbrCodecDefaultBitrate);/*default value is in linphonerc or linphonerc-factory*/ + pt=linphone_core_find_payload_type(theLinphoneCore, "opus", 48000, -1); + if (pt){ + linphone_core_set_payload_type_bitrate(theLinphoneCore,pt,bitrate); + } + pt=linphone_core_find_payload_type(theLinphoneCore, "mpeg4-generic", 44100, -1); + if (pt){ + linphone_core_set_payload_type_bitrate(theLinphoneCore,pt,bitrate); + } + pt=linphone_core_find_payload_type(theLinphoneCore, "mpeg4-generic", 22050, -1); + if (pt){ + linphone_core_set_payload_type_bitrate(theLinphoneCore,pt,bitrate); + } +} + #pragma mark - LPConfig Functions @@ -1859,4 +1878,5 @@ static void audioRouteChangeListenerCallback ( } } + @end diff --git a/submodules/belle-sip b/submodules/belle-sip index fd8d52069..dd24b7b45 160000 --- a/submodules/belle-sip +++ b/submodules/belle-sip @@ -1 +1 @@ -Subproject commit fd8d52069e00261b99f6bb03b78342418ddb6da4 +Subproject commit dd24b7b4556e8de04b3c4785bea27f129025e9f4 diff --git a/submodules/linphone b/submodules/linphone index 1d7d5f47e..4296c3945 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 1d7d5f47ebdee02616854d52979739cfa075e635 +Subproject commit 4296c3945c47602e9a3e9daea6b35a85cb2513a8