mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-23 14:18:07 +00:00
use new API to set output bitrate of codecs.
This commit is contained in:
parent
b88f1f1aec
commit
1650e930f1
5 changed files with 29 additions and 14 deletions
|
|
@ -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"]);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit fd8d52069e00261b99f6bb03b78342418ddb6da4
|
||||
Subproject commit dd24b7b4556e8de04b3c4785bea27f129025e9f4
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 1d7d5f47ebdee02616854d52979739cfa075e635
|
||||
Subproject commit 4296c3945c47602e9a3e9daea6b35a85cb2513a8
|
||||
Loading…
Add table
Reference in a new issue