From 10e57bd34a572a405eeba07912c1a6e98b36f1c8 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 16 Apr 2010 17:35:54 +0200 Subject: [PATCH] fix bug with speex codecs never disabled add ilbc --- Classes/CallHistoryTableViewController.m | 4 +-- Classes/linphoneAppDelegate.m | 16 +++++++++++- Settings.bundle/Root.plist | 32 ++++++++---------------- linphone.xcodeproj/project.pbxproj | 26 ++++++++++++++++--- 4 files changed, 50 insertions(+), 28 deletions(-) diff --git a/Classes/CallHistoryTableViewController.m b/Classes/CallHistoryTableViewController.m index 70fe667bc..f814128f5 100644 --- a/Classes/CallHistoryTableViewController.m +++ b/Classes/CallHistoryTableViewController.m @@ -120,7 +120,7 @@ // Set up the cell... LinphoneAddress* partyToDisplay; const MSList * logs = linphone_core_get_call_logs(myLinphoneCore); - LinphoneCallLog* callLogs = ms_list_nth_data(logs, ms_list_size(logs)-indexPath.row-1) ; + LinphoneCallLog* callLogs = ms_list_nth_data(logs, indexPath.row) ; NSString *path; if (callLogs->dir == LinphoneCallIncoming) { @@ -160,7 +160,7 @@ [tableView deselectRowAtIndexPath:indexPath animated:NO]; const MSList * logs = linphone_core_get_call_logs(myLinphoneCore); - LinphoneCallLog* callLogs = ms_list_nth_data(logs, ms_list_size(logs)-indexPath.row-1) ; + LinphoneCallLog* callLogs = ms_list_nth_data(logs, indexPath.row) ; LinphoneAddress* partyToCall; if (callLogs->dir == LinphoneCallIncoming) { partyToCall=callLogs->from; diff --git a/Classes/linphoneAppDelegate.m b/Classes/linphoneAppDelegate.m index a43ff5b37..7c0989ee6 100644 --- a/Classes/linphoneAppDelegate.m +++ b/Classes/linphoneAppDelegate.m @@ -187,6 +187,8 @@ LinphoneCoreVTable linphonec_vtable = { [super dealloc]; } +extern void libmsilbc_init(); + /************* *lib linphone init method */ @@ -226,6 +228,7 @@ LinphoneCoreVTable linphonec_vtable = { //register audio queue sound card ms_au_register_card(); + libmsilbc_init(); /* * Initialize linphone core @@ -319,8 +322,14 @@ LinphoneCoreVTable linphonec_vtable = { PayloadType *pt; //get codecs from linphonerc const MSList *audioCodecs=linphone_core_get_audio_codecs(myLinphoneCore); + const MSList *elem; + //disable all codecs + for (elem=audioCodecs;elem!=NULL;elem=elem->next){ + pt=(PayloadType*)elem->data; + linphone_core_enable_payload_type(myLinphoneCore,pt,FALSE); + } - //read from setting bundle + //read codecs from setting bundle and enable them one by one if ([[NSUserDefaults standardUserDefaults] boolForKey:@"speex_32k_preference"]) { if(pt = [self findPayload:@"speex"withRate:32000 from:audioCodecs]) { linphone_core_enable_payload_type(myLinphoneCore,pt, TRUE); @@ -351,6 +360,11 @@ LinphoneCoreVTable linphonec_vtable = { linphone_core_enable_payload_type(myLinphoneCore,pt, TRUE); } } + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"ilbc_preference"]) { + if(pt = [self findPayload:@"iLBC"withRate:8000 from:audioCodecs]) { + linphone_core_enable_payload_type(myLinphoneCore,pt, TRUE); + } + } if ([[NSUserDefaults standardUserDefaults] boolForKey:@"pcmu_preference"]) { if(pt = [self findPayload:@"PCMU"withRate:8000 from:audioCodecs]) { linphone_core_enable_payload_type(myLinphoneCore,pt, TRUE); diff --git a/Settings.bundle/Root.plist b/Settings.bundle/Root.plist index 3349b60fa..8e7538bb1 100644 --- a/Settings.bundle/Root.plist +++ b/Settings.bundle/Root.plist @@ -91,17 +91,6 @@ Codecs - TrueValue - - Type - PSToggleSwitchSpecifier - Title - Speex 8Khz - Key - speex_8k_preference - DefaultValue - - Type PSToggleSwitchSpecifier Title @@ -112,17 +101,6 @@ - TrueValue - - Type - PSToggleSwitchSpecifier - Title - Speex 8Khz - Key - speex_8k_preference - DefaultValue - - Type PSToggleSwitchSpecifier Title @@ -142,6 +120,16 @@ DefaultValue + + Type + PSToggleSwitchSpecifier + Title + ILBC + Key + ilbc_preference + DefaultValue + + Type PSToggleSwitchSpecifier diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 27623377c..0585d9eb2 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -22,6 +22,8 @@ 220FAD3810765B400068D98F /* libspeex.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 220FAD2F10765B400068D98F /* libspeex.a */; }; 220FAD3910765B400068D98F /* libspeexdsp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 220FAD3010765B400068D98F /* libspeexdsp.a */; }; 220FAE4B10767A6A0068D98F /* PhoneMainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 220FAE4A10767A6A0068D98F /* PhoneMainView.xib */; }; + 223148E41178A08200637D6A /* libilbc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 223148E31178A08200637D6A /* libilbc.a */; }; + 223148E61178A09900637D6A /* libmsilbc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 223148E51178A09900637D6A /* libmsilbc.a */; }; 2237D4091084D7A9001383EE /* oldphone-mono.wav in Resources */ = {isa = PBXBuildFile; fileRef = 2237D4081084D7A9001383EE /* oldphone-mono.wav */; }; 2242D91610D66BF300E9963F /* in_call.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91410D66BF300E9963F /* in_call.png */; }; 2242D91710D66BF300E9963F /* out_call.png in Resources */ = {isa = PBXBuildFile; fileRef = 2242D91510D66BF300E9963F /* out_call.png */; }; @@ -180,6 +182,8 @@ 220FAD2F10765B400068D98F /* libspeex.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libspeex.a; path = "../liblinphone-sdk/apple-darwin/lib/libspeex.a"; sourceTree = SOURCE_ROOT; }; 220FAD3010765B400068D98F /* libspeexdsp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libspeexdsp.a; path = "../liblinphone-sdk/apple-darwin/lib/libspeexdsp.a"; sourceTree = SOURCE_ROOT; }; 220FAE4A10767A6A0068D98F /* PhoneMainView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PhoneMainView.xib; sourceTree = ""; }; + 223148E31178A08200637D6A /* libilbc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libilbc.a; path = "../liblinphone-sdk/apple-darwin/lib/libilbc.a"; sourceTree = SOURCE_ROOT; }; + 223148E51178A09900637D6A /* libmsilbc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmsilbc.a; path = "../liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins/libmsilbc.a"; sourceTree = SOURCE_ROOT; }; 2237D4081084D7A9001383EE /* oldphone-mono.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "oldphone-mono.wav"; path = "../liblinphone-sdk/apple-darwin/share/sounds/linphone/rings/oldphone-mono.wav"; sourceTree = ""; }; 2242D91410D66BF300E9963F /* in_call.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = in_call.png; path = Resources/in_call.png; sourceTree = ""; }; 2242D91510D66BF300E9963F /* out_call.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = out_call.png; path = Resources/out_call.png; sourceTree = ""; }; @@ -250,6 +254,8 @@ 22B5EFA310CE50BD00777D97 /* AddressBookUI.framework in Frameworks */, 22B5F03510CE6B2F00777D97 /* AddressBook.framework in Frameworks */, 2264B6D211200342002C2C53 /* SystemConfiguration.framework in Frameworks */, + 223148E41178A08200637D6A /* libilbc.a in Frameworks */, + 223148E61178A09900637D6A /* libmsilbc.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -479,6 +485,8 @@ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { isa = PBXGroup; children = ( + 223148E51178A09900637D6A /* libmsilbc.a */, + 223148E31178A08200637D6A /* libilbc.a */, 2273785D10A3703300526073 /* libmsiounit.a */, 220FAD2810765B400068D98F /* libeXosip2.a */, 220FAD2910765B400068D98F /* libgsm.a */, @@ -649,7 +657,11 @@ GCC_PREFIX_HEADER = linphone_Prefix.pch; HEADER_SEARCH_PATHS = "../liblinphone-sdk/apple-darwin/include/**"; INFOPLIST_FILE = "linphone-Info.plist"; - LIBRARY_SEARCH_PATHS = "../liblinphone-sdk/apple-darwin/lib/**"; + LIBRARY_SEARCH_PATHS = ( + "../liblinphone-sdk/apple-darwin/lib/**", + "\"$(SRCROOT)/../liblinphone-sdk/apple-darwin/lib\"", + "\"$(SRCROOT)/../liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins\"", + ); PRODUCT_NAME = linphone; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SDKROOT = iphoneos3.0; @@ -666,7 +678,11 @@ GCC_PREFIX_HEADER = linphone_Prefix.pch; HEADER_SEARCH_PATHS = "../liblinphone-sdk/apple-darwin/include/**"; INFOPLIST_FILE = "linphone-Info.plist"; - LIBRARY_SEARCH_PATHS = "../liblinphone-sdk/apple-darwin/lib/**"; + LIBRARY_SEARCH_PATHS = ( + "../liblinphone-sdk/apple-darwin/lib/**", + "\"$(SRCROOT)/../liblinphone-sdk/apple-darwin/lib\"", + "\"$(SRCROOT)/../liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins\"", + ); PRODUCT_NAME = linphone; }; name = Release; @@ -701,7 +717,11 @@ GCC_PREFIX_HEADER = linphone_Prefix.pch; HEADER_SEARCH_PATHS = "../liblinphone-sdk/apple-darwin/include/**"; INFOPLIST_FILE = "linphone-Info.plist"; - LIBRARY_SEARCH_PATHS = "../liblinphone-sdk/apple-darwin/lib/**"; + LIBRARY_SEARCH_PATHS = ( + "../liblinphone-sdk/apple-darwin/lib/**", + "\"$(SRCROOT)/../liblinphone-sdk/apple-darwin/lib\"", + "\"$(SRCROOT)/../liblinphone-sdk/apple-darwin/lib/mediastreamer/plugins\"", + ); PRODUCT_NAME = linphone; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SDKROOT = iphoneos3.0;