Commit b9829e15 authored by DanmeiChen's avatar DanmeiChen

correct no video error in android and set speakerphone always for special devices

parent 4f85b8a5
......@@ -1066,6 +1066,13 @@ public interface LinphoneCore {
* @return true if speaker enabled, false otherwise
*/
boolean isSpeakerEnabled();
/**
* Always Activates the speaker or not.
* @param value
*/
void setSpeakerphoneAlwaysOn(boolean value);
/**
* add a friend to the current buddy list, if subscription attribute is set, a SIP SUBSCRIBE message is sent.
* @param lf LinphoenFriend to add
......
......@@ -96,6 +96,12 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
return true;
}
private void setSpeaker(LinphoneCore lc) {
boolean value = MediastreamerAndroidContext.getSpeakerphoneAlwaysOn(lc.getMSFactory());
lc.setSpeakerphoneAlwaysOn(value);
lc.enableSpeaker(value);
}
@Override
public LinphoneCore createLinphoneCore(LinphoneCoreListener listener,
String userConfig, String factoryConfig, Object userdata, Object context)
......@@ -104,11 +110,11 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
fcontext = (Context)context;
boolean openh264DownloadEnabled = false;
if (context != null) openh264DownloadEnabled = loadingDownloadedOpenH264(fcontext);
MediastreamerAndroidContext.setContext(context);
File user = userConfig == null ? null : new File(userConfig);
File factory = factoryConfig == null ? null : new File(factoryConfig);
LinphoneCore lc = new LinphoneCoreImpl(listener, user, factory, userdata, context);
MediastreamerAndroidContext.setContext(context,lc.getMSFactory());
setSpeaker(lc);
lc.enableDownloadOpenH264(openh264DownloadEnabled);
return lc;
} catch (IOException e) {
......@@ -122,9 +128,9 @@ public class LinphoneCoreFactoryImpl extends LinphoneCoreFactory {
fcontext = (Context)context;
boolean openh264DownloadEnabled = false;
if (context != null) openh264DownloadEnabled = loadingDownloadedOpenH264(fcontext);
MediastreamerAndroidContext.setContext(context);
LinphoneCore lc = new LinphoneCoreImpl(listener, context);
MediastreamerAndroidContext.setContext(context,lc.getMSFactory());
setSpeaker(lc);
lc.enableDownloadOpenH264(openh264DownloadEnabled);
return lc;
} catch (IOException e) {
......
......@@ -47,6 +47,7 @@ class LinphoneCoreImpl implements LinphoneCore {
private AudioManager mAudioManager = null;
private boolean openh264DownloadEnabled = false;
private boolean mSpeakerEnabled = false;
private boolean mSpeakerphoneAlwaysOn = false; //Speakerphone always on for some speacial devices
private native long newLinphoneCore(LinphoneCoreListener listener,String userConfig,String factoryConfig,Object userdata, Object context);
private native void iterate(long nativePtr);
private native LinphoneProxyConfig getDefaultProxyConfig(long nativePtr);
......@@ -447,6 +448,7 @@ class LinphoneCoreImpl implements LinphoneCore {
}
private native void forceSpeakerState(long nativePtr, boolean speakerOn);
public void enableSpeaker(boolean value) {
value = value || mSpeakerphoneAlwaysOn;
final LinphoneCall call = getCurrentCall();
mSpeakerEnabled = value;
applyAudioHacks();
......@@ -460,6 +462,9 @@ class LinphoneCoreImpl implements LinphoneCore {
public boolean isSpeakerEnabled() {
return mSpeakerEnabled;
}
public void setSpeakerphoneAlwaysOn(boolean value) {
mSpeakerphoneAlwaysOn = value;
}
public synchronized void playDtmf(char number, int duration) {
playDtmf(nativePtr,number, duration);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment