From f6e388c4b2d08cb25abb8c6c22792063fac33a81 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 8 Sep 2014 16:23:11 +0200 Subject: [PATCH] Add possibility to change adaptive rate algorithm at runtime --- coreapi/linphonecall.c | 4 + coreapi/linphonecore.c | 36 +- coreapi/linphonecore.h | 3 + coreapi/linphonecore_jni.cc | 14 + .../org/linphone/core/LinphoneCore.java | 388 ++++++++++-------- .../org/linphone/core/LinphoneCoreImpl.java | 199 ++++----- mediastreamer2 | 2 +- 7 files changed, 369 insertions(+), 277 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7ceafdae7..b02e04fcb 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1960,6 +1960,8 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna if (playcard && stream->max_rate>0) ms_snd_card_set_preferred_sample_rate(playcard, stream->max_rate); if (captcard && stream->max_rate>0) ms_snd_card_set_preferred_sample_rate(captcard, stream->max_rate); audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc); + media_stream_set_adaptive_bitrate_algorithm(&call->audiostream->ms, + linphone_core_get_adaptive_rate_algorithm(lc)); audio_stream_enable_adaptive_jittcomp(call->audiostream, linphone_core_audio_adaptive_jittcomp_enabled(lc)); if (!call->params->in_conference && call->params->record_file){ audio_stream_mixed_record_open(call->audiostream,call->params->record_file); @@ -2050,6 +2052,8 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna video_stream_enable_adaptive_bitrate_control(call->videostream, linphone_core_adaptive_rate_control_enabled(lc)); + media_stream_set_adaptive_bitrate_algorithm(&call->videostream->ms, + linphone_core_get_adaptive_rate_algorithm(lc)); video_stream_enable_adaptive_jittcomp(call->videostream, linphone_core_video_adaptive_jittcomp_enabled(lc)); if (lc->video_conf.preview_vsize.width!=0) video_stream_set_preview_size(call->videostream,lc->video_conf.preview_vsize); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 03d148402..ca1d20c0c 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -785,6 +785,36 @@ bool_t linphone_core_adaptive_rate_control_enabled(const LinphoneCore *lc){ return lp_config_get_int(lc->config,"net","adaptive_rate_control",TRUE); } +/** + * Sets adaptive rate algorithm. It will be used for each new calls starting from + * now. Calls already started will not be updated. + * + * @ingroup media_parameters + * +**/ +void linphone_core_set_adaptive_rate_algorithm(LinphoneCore *lc, MSQosAnalyzerAlgorithm algorithm){ + lp_config_set_string(lc->config,"net","adaptive_rate_algorithm",ms_qos_analyzer_algorithm_to_string(algorithm)); +} + +/** + * Returns which adaptive rate algorithm is currently configured for future calls. + * + * @ingroup media_parameters + * + * See linphone_core_set_adaptive_rate_algorithm(). +**/ +MSQosAnalyzerAlgorithm linphone_core_get_adaptive_rate_algorithm(const LinphoneCore *lc){ + const char* alg = lp_config_get_string(lc->config, "net", "adaptive_rate_algorithm", NULL); + + if (alg == NULL || strcmp(alg, "Simple")==0) + return MSQosAnalyzerAlgorithmSimple; + else if (strcmp(alg, "Stateful")==0) + return MSQosAnalyzerAlgorithmStateful; + + ms_error("Invalid value for key net/adaptive_rate_control: %s", alg); + return MSQosAnalyzerAlgorithmSimple; +} + bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc){ return lp_config_get_int(lc->config,"rtp","rtcp_enabled",TRUE); } @@ -5031,13 +5061,13 @@ static void update_preview_size(LinphoneCore *lc, MSVideoSize oldvsize, MSVideoS void linphone_core_set_preferred_video_size(LinphoneCore *lc, MSVideoSize vsize){ if (video_size_supported(vsize)){ MSVideoSize oldvsize=lc->video_conf.preview_vsize; - + if (oldvsize.width==0){ oldvsize=lc->video_conf.vsize; } lc->video_conf.vsize=vsize; update_preview_size(lc,oldvsize,vsize); - + if (linphone_core_ready(lc)) lp_config_set_string(lc->config,"video","size",video_size_get_name(vsize)); } @@ -5951,7 +5981,7 @@ LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *l } /** - * Create a LinphoneCallParams suitable for linphone_core_invite_with_params(), linphone_core_accept_call_with_params(), linphone_core_accept_early_media_with_params(), + * Create a LinphoneCallParams suitable for linphone_core_invite_with_params(), linphone_core_accept_call_with_params(), linphone_core_accept_early_media_with_params(), * linphone_core_accept_call_update(). * The parameters are initialized according to the current LinphoneCore configuration and the current state of the LinphoneCall. * @param lc the LinphoneCore diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index bd9386ae7..65cce6847 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1877,6 +1877,9 @@ LINPHONE_PUBLIC int linphone_core_get_upload_bandwidth(const LinphoneCore *lc); LINPHONE_PUBLIC void linphone_core_enable_adaptive_rate_control(LinphoneCore *lc, bool_t enabled); LINPHONE_PUBLIC bool_t linphone_core_adaptive_rate_control_enabled(const LinphoneCore *lc); +LINPHONE_PUBLIC void linphone_core_set_adaptive_rate_algorithm(LinphoneCore *lc, MSQosAnalyzerAlgorithm algorithm); +LINPHONE_PUBLIC MSQosAnalyzerAlgorithm linphone_core_get_adaptive_rate_algorithm(const LinphoneCore *lc); + LINPHONE_PUBLIC void linphone_core_set_download_ptime(LinphoneCore *lc, int ptime); LINPHONE_PUBLIC int linphone_core_get_download_ptime(LinphoneCore *lc); diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index ff2095151..1f6caf683 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1333,6 +1333,20 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isAdaptiveRateContro ) { return (jboolean)linphone_core_adaptive_rate_control_enabled((LinphoneCore*)lc); } +extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getAdaptiveRateAlgorithm(JNIEnv* env + ,jobject thiz + ,jlong lc + ) { + return (jint)linphone_core_get_adaptive_rate_algorithm((LinphoneCore*)lc); +} + +extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setAdaptiveRateAlgorithm(JNIEnv* env + ,jobject thiz + ,jlong lc + ,jint alg) { + linphone_core_set_adaptive_rate_algorithm((LinphoneCore*)lc,(MSQosAnalyzerAlgorithm)alg); +} + extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableEchoCancellation(JNIEnv* env ,jobject thiz diff --git a/java/common/org/linphone/core/LinphoneCore.java b/java/common/org/linphone/core/LinphoneCore.java index 4bf740b43..1df06e56d 100644 --- a/java/common/org/linphone/core/LinphoneCore.java +++ b/java/common/org/linphone/core/LinphoneCore.java @@ -27,7 +27,7 @@ import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration; import android.view.SurfaceView; /** - * Linphone core main object created by method {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)}. + * Linphone core main object created by method {@link LinphoneCoreFactory#createLinphoneCore(LinphoneCoreListener, String, String, Object)}. * */ @@ -36,12 +36,12 @@ public interface LinphoneCore { * linphone core states */ static public class GlobalState { - + static private Vector values = new Vector(); /** * Off */ - static public GlobalState GlobalOff = new GlobalState(0,"GlobalOff"); + static public GlobalState GlobalOff = new GlobalState(0,"GlobalOff"); /** * Startup */ @@ -62,7 +62,7 @@ public interface LinphoneCore { private final int mValue; private final String mStringValue; - + private GlobalState(int value,String stringValue) { mValue = value; values.addElement(this); @@ -84,12 +84,12 @@ public interface LinphoneCore { * linphone remote provisioning states */ static public class RemoteProvisioningState { - + static private Vector values = new Vector(); /** * Off */ - static public RemoteProvisioningState ConfiguringSuccessful = new RemoteProvisioningState(0,"ConfiguringSuccessful"); + static public RemoteProvisioningState ConfiguringSuccessful = new RemoteProvisioningState(0,"ConfiguringSuccessful"); /** * Startup */ @@ -102,7 +102,7 @@ public interface LinphoneCore { private final int mValue; private final String mStringValue; - + private RemoteProvisioningState(int value,String stringValue) { mValue = value; values.addElement(this); @@ -125,12 +125,12 @@ public interface LinphoneCore { * */ static public class RegistrationState { - + private static Vector values = new Vector(); /** * None */ - public static RegistrationState RegistrationNone = new RegistrationState(0,"RegistrationNone"); + public static RegistrationState RegistrationNone = new RegistrationState(0,"RegistrationNone"); /** * In Progress */ @@ -150,7 +150,7 @@ public interface LinphoneCore { private final int mValue; private final String mStringValue; - + private RegistrationState(int value,String stringValue) { mValue = value; values.addElement(this); @@ -173,12 +173,12 @@ public interface LinphoneCore { * */ static public class FirewallPolicy { - + static private Vector values = new Vector(); /** * No firewall is assumed. */ - static public FirewallPolicy NoFirewall = new FirewallPolicy(0,"NoFirewall"); + static public FirewallPolicy NoFirewall = new FirewallPolicy(0,"NoFirewall"); /** * Use NAT address (discouraged) */ @@ -195,11 +195,11 @@ public interface LinphoneCore { * Use uPnP. */ static public FirewallPolicy UseUpnp = new FirewallPolicy(4,"UseUpnp"); - + private final int mValue; private final String mStringValue; - + private FirewallPolicy(int value,String stringValue) { mValue = value; values.addElement(this); @@ -220,7 +220,7 @@ public interface LinphoneCore { return mValue; } } - + /** * Linphone core SIP transport ports. * Use with {@link LinphoneCore#setSignalingTransportPorts(Transports)} @@ -239,7 +239,7 @@ public interface LinphoneCore { * tls port to listening on, negative value if not set * */ public int tls; - + public Transports() {}; public Transports(Transports t) { this.udp = t.udp; @@ -255,12 +255,12 @@ public interface LinphoneCore { * */ static public final class MediaEncryption { - + static private Vector values = new Vector(); /** * None */ - static public final MediaEncryption None = new MediaEncryption(0,"None"); + static public final MediaEncryption None = new MediaEncryption(0,"None"); /** * SRTP */ @@ -272,7 +272,7 @@ public interface LinphoneCore { protected final int mValue; private final String mStringValue; - + private MediaEncryption(int value,String stringValue) { mValue = value; values.addElement(this); @@ -290,11 +290,43 @@ public interface LinphoneCore { return mStringValue; } } + static public final class AdaptiveRateAlgorithm { + + static private Vector values = new Vector(); + /** + * Simple + */ + static public final AdaptiveRateAlgorithm Simple = new AdaptiveRateAlgorithm(0,"Simple"); + /** + * Stateful + */ + static public final AdaptiveRateAlgorithm Stateful = new AdaptiveRateAlgorithm(1,"Stateful"); + protected final int mValue; + private final String mStringValue; + + + private AdaptiveRateAlgorithm(int value,String stringValue) { + mValue = value; + values.addElement(this); + mStringValue=stringValue; + } + public static AdaptiveRateAlgorithm fromInt(int value) { + + for (int i=0; i values = new Vector(); /* Do not change the values of these constants or the strings associated with them to prevent breaking the collection of echo canceller calibration results during the wizard! */ @@ -322,7 +354,7 @@ public interface LinphoneCore { private final int mValue; private final String mStringValue; - + private EcCalibratorStatus(int value,String stringValue) { mValue = value; values.addElement(this); @@ -343,11 +375,11 @@ public interface LinphoneCore { return mValue; } } - + static public class UpnpState { static private Vector values = new Vector(); /** - * Idle + * Idle */ static public UpnpState Idle = new UpnpState(0, "Idle"); /** @@ -371,11 +403,11 @@ public interface LinphoneCore { */ static public UpnpState Ok = new UpnpState(5, "Ok"); /** - * Ko + * Ko */ static public UpnpState Ko = new UpnpState(6, "Ko"); /** - * Blacklisted + * Blacklisted */ static public UpnpState Blacklisted = new UpnpState(7, "Blacklisted"); @@ -414,34 +446,34 @@ public interface LinphoneCore { * @throws LinphoneCoreException */ public void addProxyConfig(LinphoneProxyConfig proxyCfg) throws LinphoneCoreException; - + /** * Removes a proxy configuration. * @param proxyCfg */ public void removeProxyConfig(LinphoneProxyConfig proxyCfg); - + /** * Sets the default proxy. *
- * This default proxy must be part of the list of already entered {@link LinphoneProxyConfig}. + * This default proxy must be part of the list of already entered {@link LinphoneProxyConfig}. * Toggling it as default will make LinphoneCore favor the identity associated with the proxy configuration in all incoming and outgoing calls. * Better proxy configuration match may override this choice. Pass null to unset the default proxy. - * @param proxyCfg + * @param proxyCfg */ public void setDefaultProxyConfig(LinphoneProxyConfig proxyCfg); - + /** * get he default proxy configuration, that is the one used to determine the current identity. - * @return null if no default proxy config + * @return null if no default proxy config */ public LinphoneProxyConfig getDefaultProxyConfig() ; - + /** * Returns an array with all the auth infos stored in LinphoneCore */ LinphoneAuthInfo[] getAuthInfosList(); - + /** * Returns a matching auth info or null if no match found */ @@ -451,7 +483,7 @@ public interface LinphoneCore { * @param authInfo */ public void removeAuthInfo(LinphoneAuthInfo authInfo); - + /** * clear all the added auth info */ @@ -462,7 +494,7 @@ public interface LinphoneCore { * @param info */ void addAuthInfo(LinphoneAuthInfo info); - + /** * Build an address according to the current proxy config. In case destination is not a sip address, the default proxy domain is automatically appended * @param destination @@ -470,7 +502,7 @@ public interface LinphoneCore { * @throws If no LinphoneAddress can be built from destination */ public LinphoneAddress interpretUrl(String destination) throws LinphoneCoreException; - + /** * Starts a call given a destination. Internally calls {@link #interpretUrl(String)} then {@link #invite(LinphoneAddress)}. * @param uri @@ -499,20 +531,20 @@ public interface LinphoneCore { * Returns The LinphoneCall the current call if one is in call * **/ - public LinphoneCall getCurrentCall(); - + public LinphoneCall getCurrentCall(); + /** * get current call remote address in case of in/out call * @return null if no call engaged yet */ public LinphoneAddress getRemoteAddress(); /** - * + * * @return true if there is a call running or pending. */ public boolean isIncall(); /** - * + * * @return Returns true if in incoming call is pending, ie waiting for being answered or declined. */ public boolean isInComingInvitePending(); @@ -523,7 +555,7 @@ public interface LinphoneCore { *
  • receiving of SIP messages *
  • handles timers and timeout *
  • performs registration to proxies - *
  • authentication retries The application MUST call this function from periodically, in its main loop. + *
  • authentication retries The application MUST call this function from periodically, in its main loop. *
    Be careful that this function must be call from the same thread as other liblinphone methods. In not the case make sure all liblinphone calls are serialized with a mutex. */ @@ -535,10 +567,10 @@ public interface LinphoneCore { * {@link LinphoneCoreListener#callState} listener method. * The application can later respond positively to the call using * this method. - * @throws LinphoneCoreException + * @throws LinphoneCoreException */ public void acceptCall(LinphoneCall aCall) throws LinphoneCoreException; - + /** * Accept an incoming call. * @@ -546,10 +578,10 @@ public interface LinphoneCore { * {@link LinphoneCoreListener#callState} listener method. * The application can later respond positively to the call using * this method. - * @throws LinphoneCoreException + * @throws LinphoneCoreException */ public void acceptCallWithParams(LinphoneCall aCall, LinphoneCallParams params) throws LinphoneCoreException; - + /** * Accept call modifications initiated by other end. * @@ -557,11 +589,11 @@ public interface LinphoneCore { * {@link LinphoneCoreListener#callState} listener method. * The application can later respond positively to the call using * this method. - * @throws LinphoneCoreException + * @throws LinphoneCoreException */ public void acceptCallUpdate(LinphoneCall aCall, LinphoneCallParams params) throws LinphoneCoreException; - - + + /** * Prevent LinphoneCore from performing an automatic answer * @@ -569,21 +601,21 @@ public interface LinphoneCore { * {@link LinphoneCoreListener#callState} listener method. * The application can later respond positively to the call using * this method. - * @throws LinphoneCoreException + * @throws LinphoneCoreException */ public void deferCallUpdate(LinphoneCall aCall) throws LinphoneCoreException; /** - * @return a list of LinphoneCallLog + * @return a list of LinphoneCallLog */ public LinphoneCallLog[] getCallLogs(); - + /** * This method is called by the application to notify the Linphone core library when network is reachable. * Calling this method with true trigger Linphone to initiate a registration process for all proxy * configuration with parameter register set to enable. * This method disable the automatic registration mode. It means you must call this method after each network state changes - * @param network state + * @param network state * */ public void setNetworkReachable(boolean isReachable); @@ -597,12 +629,12 @@ public interface LinphoneCore { */ public void destroy(); /** - * Allow to control play level before entering sound card: + * Allow to control play level before entering sound card: * @param level in db */ public void setPlaybackGain(float gain); /** - * get play level before entering sound card: + * get play level before entering sound card: * @return level in db */ public float getPlaybackGain(); @@ -623,7 +655,7 @@ public interface LinphoneCore { */ void muteMic(boolean isMuted); /** - * + * * @return true is mic is muted */ boolean isMicMuted(); @@ -644,42 +676,42 @@ public interface LinphoneCore { * stop current dtmf */ void stopDtmf(); - + /** * remove all call logs */ void clearCallLogs(); - - - - + + + + /** * Get payload type from mime type and clock rate * * This function searches in audio and video codecs for the given payload type name and clockrate. * @param mime payload mime type (I.E SPEEX, PCMU, VP8) - * @param clockRate (I.E 8000, 16000, 90000, ...) + * @param clockRate (I.E 8000, 16000, 90000, ...) * @param channels number of channels * @return Returns null if not found. - */ - PayloadType findPayloadType(String mime, int clockRate, int channels); + */ + PayloadType findPayloadType(String mime, int clockRate, int channels); /*** * get payload type from mime type and clock rate.. * Same as @{link {@link #findPayloadType(String, int, int)} but ignoring channels params * @param mime payload mime type (I.E SPEEX, PCMU, VP8) - * @param clockRate (I.E 8000, 16000, 90000, ...) + * @param clockRate (I.E 8000, 16000, 90000, ...) * @return null if not found */ - PayloadType findPayloadType(String mime, int clockRate); - + PayloadType findPayloadType(String mime, int clockRate); + /*** - * get payload type from mime type + * get payload type from mime type * Same as @{link {@link #findPayloadType(String, int, int)} but ignoring channels and clock rate params * @param mime payload mime type (I.E SPEEX, PCMU, VP8) * @return null if not found */ - PayloadType findPayloadType(String mime); - + PayloadType findPayloadType(String mime); + /** * Enable payload type * @param pt payload type to enable, can be retrieve from {@link #findPayloadType} @@ -688,52 +720,52 @@ public interface LinphoneCore { * */ void enablePayloadType(PayloadType pt, boolean enable) throws LinphoneCoreException; - + /** * @param pt the payload type * @return whether or not the payload is enabled in linphonecore. */ boolean isPayloadTypeEnabled(PayloadType pt); - + /** * @param pt the payload type * @return whether or not the payload epresents a VBR codec */ boolean payloadTypeIsVbr(PayloadType pt); - + /** * Set an explicit bitrate (IP bitrate, not codec bitrate) for a given codec, in kbit/s. * @param pt the payload type * @param bitrate target IP bitrate in kbit/s */ void setPayloadTypeBitrate(PayloadType pt, int bitrate); - + /** * Get target bitrate previously set by setPayloadTypeBitrate(). * @param pt * @return IP bitrate in kbit/s */ int getPayloadTypeBitrate(PayloadType pt); - + /** * Enable adaptive rate control. * @param enable */ void enableAdaptiveRateControl(boolean enable); - + /** * Enables or disable adaptive rate control. * @return true if adaptive rate control is enabled. */ boolean isAdaptiveRateControlEnabled(); - + /** * Enables or disable echo cancellation. * @param enable */ void enableEchoCancellation(boolean enable); /** - * get EC status + * get EC status * @return true if echo cancellation is enabled. */ boolean isEchoCancellationEnabled(); @@ -747,24 +779,24 @@ public interface LinphoneCore { * @param local transports ports used for signaling (TCP, UDP and TLS) */ void setSignalingTransportPorts(Transports transports); - /**Get + /**Get * @return transports used for signaling (TCP, UDP, TLS) */ Transports getSignalingTransportPorts(); - + /** * Assign a dscp value for the SIP socket. * DSCP is an IP packet field used to indicate the type of routing service to routers. * @param dscp */ void setSipDscp(int dscp); - + /** * Get DSCP used for SIP socket. * @return the DSCP value used for the SIP socket. */ int getSipDscp(); - + /** * Activates or deactivates the speaker. * @param value @@ -808,7 +840,7 @@ public interface LinphoneCore { PresenceModel getPresenceModel(); /** * Create a new chat room for messaging from a sip uri like sip:joe@sip.linphone.org - * @param to destination address for messages + * @param to destination address for messages * * @return {@link LinphoneChatRoom} where messaging can take place. */ @@ -844,18 +876,18 @@ public interface LinphoneCore { * Returns the id of the currently active video device as found in {@link AndroidCameraConfiguration#retrieveCameras}. **/ int getVideoDevice(); - - + + /** * Teturns true if the underlying sdk support video - * + * * */ boolean isVideoSupported(); - + /** * Enables video globally. * - * + * * This function does not have any effect during calls. It just indicates #LinphoneCore to * initiate future calls with video or not. The two boolean parameters indicate in which * direction video is enabled. Setting both to false disables video entirely. @@ -867,10 +899,10 @@ public interface LinphoneCore { void enableVideo(boolean vcap_enabled, boolean display_enabled); /** * Returns TRUE if video is enabled, FALSE otherwise. - * + * ***/ boolean isVideoEnabled(); - + /** * Specify a STUN server to help firewall traversal. * @param stun_server Stun server address and port, such as stun.linphone.org or stun.linphone.org:3478 @@ -881,7 +913,7 @@ public interface LinphoneCore { * @return stun server address if previously set. */ String getStunServer(); - + /** * Sets policy regarding workarounding NATs * @param pol one of the FirewallPolicy members. @@ -899,7 +931,7 @@ public interface LinphoneCore { * *
    The LinphoneAddress can be constructed directly using {@link LinphoneCoreFactory#createLinphoneAddress} , or created {@link LinphoneCore#interpretUrl(String)}. . * - * @return a {@link #LinphoneCall LinphoneCall} object + * @return a {@link #LinphoneCall LinphoneCall} object * @throws LinphoneCoreException in case of failure **/ LinphoneCall inviteAddressWithParams(LinphoneAddress destination, LinphoneCallParams params) throws LinphoneCoreException ; @@ -934,14 +966,14 @@ public interface LinphoneCore { * @return null if not set */ String getRing(); - + /** * Sets file or folder containing trusted root CAs * * @param path path to file with multiple PEM certif or to folder with multiple PEM files - */ + */ void setRootCA(String path); - + void setUploadBandwidth(int bw); /** * Sets maximum available download bandwidth @@ -956,13 +988,13 @@ public interface LinphoneCore { * @param bw the bandwidth in kbits/s, 0 for infinite */ void setDownloadBandwidth(int bw); - + /** * Sets audio packetization interval suggested for remote end. * @param ptime packetization interval in milliseconds */ void setDownloadPtime(int ptime); - + /** * Sets audio packetization interval sent to remote end. * @param ptime packetization interval in milliseconds @@ -974,7 +1006,7 @@ public interface LinphoneCore { * This applies only to the stream that is captured and sent to the remote party, * since we accept all standard video size on the receive path. * @param vSize - * + * **/ void setPreferredVideoSize(VideoSize vSize); /** @@ -991,7 +1023,7 @@ public interface LinphoneCore { * **/ VideoSize getPreferredVideoSize(); - + /** * Returns the currently supported audio codecs, as PayloadType elements * @return @@ -1024,17 +1056,17 @@ public interface LinphoneCore { * If the device has a builtin echo canceller or calibration value is already known, it will return false. */ boolean needsEchoCalibration(); - + void enableIpv6(boolean enable); - + boolean isIpv6Enabled(); - + /** * @deprecated * @param i */ void adjustSoftwareVolume(int i); - + /** * Pauses a call. If a music file has been setup using {@link LinphoneCore#setPlayFile(String)}, * this file will be played to the remote user. @@ -1049,7 +1081,7 @@ public interface LinphoneCore { * Pause all currently running calls. **/ boolean pauseAllCalls(); - + void setZrtpSecretsCache(String file); void enableEchoLimiter(boolean val); @@ -1059,12 +1091,12 @@ public interface LinphoneCore { boolean isInConference(); /** * Moves the local participant inside the conference. - * - * Makes the local participant to join the conference. + * + * Makes the local participant to join the conference. * Typically, the local participant is by default always part of the conference when joining an active call into a conference. * However, by calling {@link #leaveConference()} and {@link #enterConference()} the application can decide to temporarily * move out and in the local participant from the conference. - * + * * @returns true if successful **/ boolean enterConference(); @@ -1076,49 +1108,49 @@ public interface LinphoneCore { /** * Merge a call into a conference. - * + * * If this is the first call that enters the conference, the virtual conference will be created automatically. * If the local user was actively part of the call (ie not in paused state), then the local user is automatically entered into the conference. * If the call was in paused state, then it is automatically resumed when entering into the conference. * @param call an established call, either in {@link LinphoneCall.State#StreamsRunning} or {@link LinphoneCall.State#Paused} state. - * + * **/ void addToConference(LinphoneCall call); /** * Remove a call from the conference. * @param call a call that has been previously merged into the conference. - * + * * After removing the remote participant belonging to the supplied call, the call becomes a normal call in paused state. * If one single remote participant is left alone together with the local user in the conference after the removal, then the conference is * automatically transformed into a simple call in StreamsRunning state. * The conference's resources are then automatically destroyed. - * + * * In other words, unless {@link #leaveConference()} is explicitely called, the last remote participant of a conference is automatically * put in a simple call in running state. - * + * **/ void removeFromConference(LinphoneCall call); /** * Add all calls into a conference. - * + * * Merge all established calls (either in {@link LinphoneCall.State#StreamsRunning} or {@link LinphoneCall.State#Paused}) into a conference. - * + * **/ void addAllToConference(); - + /** * Terminates the conference and the calls associated with it. - * + * * All the calls that were merged to the conference are terminated, and the conference resources are destroyed. - * + * **/ void terminateConference(); /** * Returns the number of participants to the conference, including the local participant. - * + * * Typically, after merging two calls into the conference, there is total of 3 participants: * the local participant (or local user), and two remote participants that were the destinations of the two previously establised calls. - * + * * @returns the number of participants to the conference **/ int getConferenceSize(); @@ -1129,7 +1161,7 @@ public interface LinphoneCore { * @param path where to write recording file **/ void startConferenceRecording(String path); - + /** * Stop recording of the conference. **/ @@ -1167,7 +1199,7 @@ public interface LinphoneCore { * @param dest a running call whose remote person will receive the transfer **/ void transferCallToAnother(LinphoneCall callToTransfer, LinphoneCall destination); - + /** * Start a new call as a consequence of a transfer request received from a call. * This function is for advanced usage: the execution of transfers is automatically managed by the LinphoneCore. However if an application @@ -1205,7 +1237,7 @@ public interface LinphoneCore { * which could result in an active call. * Eg: don't start a new call if one is in outgoing ringing. * Eg: don't merge to conference either as it could result - * in two active calls (conference and accepted call). + * in two active calls (conference and accepted call). * @return */ boolean soundResourcesLocked(); @@ -1271,18 +1303,18 @@ public interface LinphoneCore { * @param autoAccept video shall be accepter by default for incoming calls **/ void setVideoPolicy(boolean autoInitiate, boolean autoAccept); - + /** * Gets the policy for the autoInitiate video */ boolean getVideoAutoInitiatePolicy(); - + /** * Gets the policy for the autoAccept video */ boolean getVideoAutoAcceptPolicy(); - - /** Set static picture to be used when "Static picture" is the video device + + /** Set static picture to be used when "Static picture" is the video device * @param path to the static picture file * */ void setStaticPicture(String path); @@ -1296,17 +1328,17 @@ public interface LinphoneCore { * Set the number of cores used for media processing * */ void setCpuCount(int count); - + /** * remove a call log */ public void removeCallLog(LinphoneCallLog log); - + /** * @return count of missed calls */ public int getMissedCallsCount(); - + /** * Set missed calls count to zero */ @@ -1320,111 +1352,111 @@ public interface LinphoneCore { * return the version code of linphone core */ public String getVersion(); - + /** * remove a linphone friend from linphone core and linphonerc */ void removeFriend(LinphoneFriend lf); - + /** * return a linphone friend (if exists) that matches the sip address */ LinphoneFriend findFriendByAddress(String sipUri); - + /** * Sets the UDP port used for audio streaming. **/ void setAudioPort(int port); - + /** * Sets the UDP port range from which to randomly select the port used for audio streaming. */ void setAudioPortRange(int minPort, int maxPort); - + /** * Assign a DSCP value to the audio RTP sockets. * @param dscp the DSCP value. * DSCP is an IP header field used to indicate a type of service to routers. */ void setAudioDscp(int dscp); - + /** * Return DSCP value used for the audio RTP sockets. * @return the DSCP value used for the audio RTP sockets. */ int getAudioDscp(); - + /** * Sets the UDP port used for video streaming. **/ void setVideoPort(int port); - + /** * Sets the UDP port range from which to randomly select the port used for video streaming. */ void setVideoPortRange(int minPort, int maxPort); - + /** * Assign a DSCP value to the video RTP sockets. * @param dscp the DSCP value. * DSCP is an IP header field used to indicate a type of service to routers. */ void setVideoDscp(int dscp); - + /** * Return DSCP value used for the video RTP sockets. * @return the DSCP value used for the video RTP sockets. */ int getVideoDscp(); - + /** * Set the incoming call timeout in seconds. * If an incoming call isn't answered for this timeout period, it is * automatically declined. **/ void setIncomingTimeout(int timeout); - + /** * Set the call timeout in seconds. * Once this time is elapsed (ringing included), the call is automatically hung up. **/ void setInCallTimeout(int timeout); /** - * Allow to control microphone level: + * Allow to control microphone level: * @param gain in db **/ void setMicrophoneGain(float gain); - + /** * Set username and display name to use if no LinphoneProxyConfig configured */ void setPrimaryContact(String displayName, String username); - + /** * Returns the username used if no LinphoneProxyConfig configured */ String getPrimaryContactUsername(); - + /** * Returns the display name used if no LinphoneProxyConfig configured */ String getPrimaryContactDisplayName(); - + /** * Enable/Disable the use of SIP INFO for DTMFs */ void setUseSipInfoForDtmfs(boolean use); - + /** * Returns the state of use of SIP INFO for DTMFs */ boolean getUseSipInfoForDtmfs(); - + /** * Enable/Disable the use of inband DTMFs */ void setUseRfc2833ForDtmfs(boolean use); - + /** * Returns the state of use of inband DTMFs */ @@ -1440,34 +1472,34 @@ public interface LinphoneCore { /** * Return the availability of uPnP. * - * @return true if uPnP is available otherwise return false. + * @return true if uPnP is available otherwise return false. */ public boolean upnpAvailable(); /** - * Return the internal state of uPnP. + * Return the internal state of uPnP. * - * @return an UpnpState. + * @return an UpnpState. */ public UpnpState getUpnpState(); /** - * Return the external ip address of router. + * Return the external ip address of router. * In some cases the uPnP can have an external ip address but not a usable uPnP - * (state different of Ok). + * (state different of Ok). * * @return a null terminated string containing the external ip address. If the - * the external ip address is not available return null. + * the external ip address is not available return null. */ public String getUpnpExternalIpaddress(); - + /** * Create an empty INFO message. * It can later be sent using {@link LinphoneCall.sendInfoMessage() }. * @return the new info message. */ public LinphoneInfoMessage createInfoMessage(); - + /** * Sends an outgoing subscription for a resource with given event, expiration period, and content. * The state changes of the new subscriptions can be followed thanks to { @link LinphoneCoreListener.subscriptionStateChanged() } and @@ -1479,7 +1511,7 @@ public interface LinphoneCore { * @return a LinphoneEvent representing the subscription context. */ public LinphoneEvent subscribe(LinphoneAddress resource, String event, int expires, LinphoneContent content); - + /** * Create an outgoing subscription, specifying the destination resource, the event name, and an optional content body. * If accepted, the subscription runs for a finite period, but is automatically renewed if not terminated before. @@ -1491,7 +1523,7 @@ public interface LinphoneCore { * @return a LinphoneEvent holding the context of the created subcription. */ public LinphoneEvent createSubscribe(LinphoneAddress resource, String event, int expires); - + /** * Create a publish context for an event state. * After being created, the publish must be sent using linphone_event_send_publish(). @@ -1502,7 +1534,7 @@ public interface LinphoneCore { * @return the LinphoneEvent holding the context of the publish. */ public LinphoneEvent createPublish(LinphoneAddress resource, String event, int expires); - + /** * Publish an event. * After the initial publication, updates can be done with { @link LinphoneEvent.updatePublish() } @@ -1513,25 +1545,25 @@ public interface LinphoneCore { * @return a LinphoneEvent representing the publish context. */ public LinphoneEvent publish(LinphoneAddress resource, String event, int expires, LinphoneContent content); - + /** * Sets the path to the database where the chat messages will be stored (if enabled) * @param path the database where the chat messages will be stored. */ public void setChatDatabasePath(String path); - + /** * Gets the chat rooms * @return an array of LinphoneChatRoom */ public LinphoneChatRoom[] getChatRooms(); - + /** * Gets the linphonecore supported resolutions for video * @return an array of String */ public String[] getSupportedVideoSizes(); - + /** * Migrate configuration so that all SIP transports are enabled. * Versions of linphone < 3.7 did not support using multiple SIP transport simultaneously. @@ -1541,7 +1573,7 @@ public interface LinphoneCore { * @returns 1 if migration was done, 0 if not done because unnecessary or already done, -1 in case of error. */ public int migrateToMultiTransport(); - + /** * When receiving an incoming, accept to start a media session as early-media. * This means the call is not accepted but audio & video streams can be established if the remote party supports early media. @@ -1553,7 +1585,7 @@ public interface LinphoneCore { * @return true if successful, false otherwise. */ public boolean acceptEarlyMedia(LinphoneCall call); - + /** * Accept an early media session for an incoming call. * This is identical as calling linphone_core_accept_early_media_with_params() with NULL call parameters. @@ -1563,29 +1595,29 @@ public interface LinphoneCore { * @return true if successful, false otherwise. */ public boolean acceptEarlyMediaWithParams(LinphoneCall call, LinphoneCallParams params); - + /** * Creates a proxy config using the default values if they exists * @return a default proxy config */ public LinphoneProxyConfig createProxyConfig(); public LinphoneProxyConfig createProxyConfig(String identity,String proxy,String route, boolean enableRegister) throws LinphoneCoreException; - + /** * Assign an audio file to played locally upon call failure, for a given reason. * @param reason the #LinphoneReason representing the failure error code. * @param path a wav file to be played when such call failure happens. */ public void setCallErrorTone(Reason reason, String path); - + /** * Assign an audio file to be played locally in replacement of common telephony tone. * This is typically used to internationalize tones. * @param id a tone id - * @param wav a path to a 16 bit PCM linear wav file. + * @param wav a path to a 16 bit PCM linear wav file. */ public void setTone(ToneID id, String wavfile); - + /** * Inform the core about the maximum transmission unit of the network. * This is used for fragmenting video RTP packets to a size compatible with the network. @@ -1594,7 +1626,7 @@ public interface LinphoneCore { public void setMtu(int mtu); /** * Returns the mtu value previously set by setMtu(). - * + * * @return the MTU in bytes. */ public int getMtu(); @@ -1608,34 +1640,34 @@ public interface LinphoneCore { * @return true if INVITE has to be sent whitout SDP. */ public boolean isSdp200AckEnabled(); - + /** * Inconditionnaly disable incoming chat messages. * @param lc the core * @param deny_reason the deny reason (using ReasonNone has no effect). **/ public void disableChat(Reason denycode); - + /** * Enable reception of incoming chat messages. * By default it is enabled but it can be disabled with linphone_core_disable_chat(). * @param lc the core **/ public void enableChat(); - + /** * Returns whether chat is enabled. * @return true if chat is enabled, false otherwise. **/ public boolean chatEnabled(); - + /** - * Whenever the liblinphone is playing a ring to advertise an incoming call or ringback of an outgoing call, this function stops the ringing. + * Whenever the liblinphone is playing a ring to advertise an incoming call or ringback of an outgoing call, this function stops the ringing. * Typical use is to stop ringing when the user requests to ignore the call. **/ public void stopRinging(); - + /** * Set audio jitter buffer size in milliseconds. * A value of zero disables the jitter buffer. @@ -1643,7 +1675,7 @@ public interface LinphoneCore { * @param value the jitter buffer size in milliseconds. */ public void setAudioJittcomp(int value); - + /** * Set video jitter buffer size in milliseconds. * A value of zero disables the jitter buffer. diff --git a/java/impl/org/linphone/core/LinphoneCoreImpl.java b/java/impl/org/linphone/core/LinphoneCoreImpl.java index 61bfb4e23..8d95d9399 100644 --- a/java/impl/org/linphone/core/LinphoneCoreImpl.java +++ b/java/impl/org/linphone/core/LinphoneCoreImpl.java @@ -47,7 +47,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native int addProxyConfig(LinphoneProxyConfig jprtoxyCfg,long nativePtr,long proxyCfgNativePtr); private native void removeProxyConfig(long nativePtr, long proxyCfg); private native void clearAuthInfos(long nativePtr); - + private native void clearProxyConfigs(long nativePtr); private native void addAuthInfo(long nativePtr,long authInfoNativePtr); private native void removeAuthInfo(long nativePtr, long authInfoNativePtr); @@ -77,6 +77,8 @@ class LinphoneCoreImpl implements LinphoneCore { private native boolean payloadTypeIsVbr(long nativePtr, long payloadType); private native void enableAdaptiveRateControl(long nativePtr,boolean enable); private native boolean isAdaptiveRateControlEnabled(long nativePtr); + private native int getAdaptiveRateAlgorithm(long nativePtr); + private native void setAdaptiveRateAlgorithm(long nativePtr, int alg); private native void enableEchoCancellation(long nativePtr,boolean enable); private native boolean isEchoCancellationEnabled(long nativePtr); private native Object getCurrentCall(long nativePtr) ; @@ -154,7 +156,7 @@ class LinphoneCoreImpl implements LinphoneCore { private native boolean isSdp200AckEnabled(long nativePtr); private native void stopRinging(long nativePtr); private native static void setAndroidPowerManager(Object pm); - + LinphoneCoreImpl(LinphoneCoreListener listener, File userConfig, File factoryConfig, Object userdata) throws IOException { mListener = listener; String user = userConfig == null ? null : userConfig.getCanonicalPath(); @@ -165,9 +167,9 @@ class LinphoneCoreImpl implements LinphoneCore { mListener = listener; nativePtr = newLinphoneCore(listener,null,null,null); } - + protected void finalize() throws Throwable { - + } private boolean contextInitialized() { @@ -195,7 +197,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized LinphoneProxyConfig getDefaultProxyConfig() { isValid(); - return getDefaultProxyConfig(nativePtr); + return getDefaultProxyConfig(nativePtr); } public synchronized LinphoneCall invite(String uri) { @@ -259,7 +261,7 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized LinphoneCallLog[] getCallLogs() { isValid(); - LinphoneCallLog[] logs = new LinphoneCallLog[getNumberOfCallLogs(nativePtr)]; + LinphoneCallLog[] logs = new LinphoneCallLog[getNumberOfCallLogs(nativePtr)]; for (int i=0;i < getNumberOfCallLogs(nativePtr);i++) { logs[i] = new LinphoneCallLogImpl(getCallLog(nativePtr, i)); } @@ -267,7 +269,7 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized void destroy() { } - + private void isValid() { if (nativePtr == 0) { throw new RuntimeException("object already destroyed"); @@ -278,7 +280,7 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized void setPlaybackGain(float gain) { setPlaybackGain(nativePtr,gain); - + } public synchronized float getPlaybackGain() { return getPlaybackGain(nativePtr); @@ -295,7 +297,7 @@ class LinphoneCoreImpl implements LinphoneCore { throw new LinphoneCoreException("Cannot interpret ["+destination+"]"); } } - public synchronized LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException { + public synchronized LinphoneCall invite(LinphoneAddress to) throws LinphoneCoreException { LinphoneCall call = (LinphoneCall)inviteAddress(nativePtr,((LinphoneAddressImpl)to).nativePtr); if (call!=null) { return call; @@ -328,18 +330,18 @@ class LinphoneCoreImpl implements LinphoneCore { if (enablePayloadType(nativePtr,((PayloadTypeImpl)pt).nativePtr,enable) != 0) { throw new LinphoneCoreException("cannot enable payload type ["+pt+"]"); } - + } public synchronized boolean isPayloadTypeEnabled(PayloadType pt) { isValid(); return isPayloadTypeEnabled(nativePtr, ((PayloadTypeImpl)pt).nativePtr); } - + public synchronized boolean payloadTypeIsVbr(PayloadType pt) { isValid(); return payloadTypeIsVbr(nativePtr, ((PayloadTypeImpl)pt).nativePtr); } - + public synchronized void enableEchoCancellation(boolean enable) { isValid(); enableEchoCancellation(nativePtr, enable); @@ -347,21 +349,21 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean isEchoCancellationEnabled() { isValid(); return isEchoCancellationEnabled(nativePtr); - + } public synchronized LinphoneCall getCurrentCall() { isValid(); return (LinphoneCall)getCurrentCall(nativePtr); } - + public int getPlayLevel() { // TODO Auto-generated method stub return 0; } public void setPlayLevel(int level) { // TODO Auto-generated method stub - + } private void applyAudioHacks() { @@ -397,20 +399,20 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized void playDtmf(char number, int duration) { playDtmf(nativePtr,number, duration); - + } public synchronized void stopDtmf() { stopDtmf(nativePtr); } - + public synchronized void addFriend(LinphoneFriend lf) throws LinphoneCoreException { addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr); - + } @SuppressWarnings("deprecation") public synchronized void setPresenceInfo(int minutes_away, String alternative_contact, OnlineStatus status) { setPresenceInfo(nativePtr,minutes_away,alternative_contact,status.mValue); - + } @SuppressWarnings("deprecation") public synchronized OnlineStatus getPresenceInfo() { @@ -434,7 +436,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void setDeviceRotation(int rotation) { setDeviceRotation(nativePtr, rotation); } - + public synchronized void enableVideo(boolean vcap_enabled, boolean display_enabled) { enableVideo(nativePtr,vcap_enabled, display_enabled); } @@ -456,15 +458,15 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void setStunServer(String stunServer) { setStunServer(nativePtr,stunServer); } - + public synchronized LinphoneCallParams createDefaultCallParameters() { return new LinphoneCallParamsImpl(createDefaultCallParams(nativePtr)); } - + public synchronized LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException { long ptrDestination = ((LinphoneAddressImpl)to).nativePtr; long ptrParams =((LinphoneCallParamsImpl)params).nativePtr; - + LinphoneCall call = (LinphoneCall)inviteAddressWithParams(nativePtr, ptrDestination, ptrParams); if (call!=null) { return call; @@ -509,19 +511,19 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized String getRing() { return getRing(nativePtr); } - + public synchronized void setRootCA(String path) { setRootCA(nativePtr, path); } - - public synchronized LinphoneProxyConfig[] getProxyConfigList() { + + public synchronized LinphoneProxyConfig[] getProxyConfigList() { return getProxyConfigList(nativePtr); } - + public synchronized PayloadType[] getVideoCodecs() { long[] typesPtr = listVideoPayloadTypes(nativePtr); if (typesPtr == null) return null; - + PayloadType[] codecs = new PayloadType[typesPtr.length]; for (int i=0; i < codecs.length; i++) { @@ -533,7 +535,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized PayloadType[] getAudioCodecs() { long[] typesPtr = listAudioPayloadTypes(nativePtr); if (typesPtr == null) return null; - + PayloadType[] codecs = new PayloadType[typesPtr.length]; for (int i=0; i < codecs.length; i++) { @@ -545,10 +547,10 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean isNetworkReachable() { return isNetworkStateReachable(nativePtr); } - + public synchronized void enableKeepAlive(boolean enable) { enableKeepAlive(nativePtr,enable); - + } public synchronized boolean isKeepAliveEnabled() { return isKeepAliveEnabled(nativePtr); @@ -556,7 +558,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void startEchoCalibration(Object data) throws LinphoneCoreException { startEchoCalibration(nativePtr, data); } - + public synchronized Transports getSignalingTransportPorts() { Transports transports = new Transports(); transports.udp = getSignalingTransportPort(nativePtr, 0); @@ -591,7 +593,7 @@ class LinphoneCoreImpl implements LinphoneCore { } public synchronized void setDownloadPtime(int ptime) { setDownloadPtime(nativePtr,ptime); - + } public synchronized void setUploadPtime(int ptime) { setUploadPtime(nativePtr,ptime); @@ -614,12 +616,12 @@ class LinphoneCoreImpl implements LinphoneCore { } - private native void leaveConference(long nativePtr); + private native void leaveConference(long nativePtr); public synchronized void leaveConference() { leaveConference(nativePtr); } - private native boolean enterConference(long nativePtr); + private native boolean enterConference(long nativePtr); public synchronized boolean enterConference() { return enterConference(nativePtr); } @@ -657,12 +659,12 @@ class LinphoneCoreImpl implements LinphoneCore { private native void addAllToConference(long nativePtr); public synchronized void addAllToConference() { addAllToConference(nativePtr); - + } private native void addToConference(long nativePtr, long nativePtrLcall); public synchronized void addToConference(LinphoneCall call) { addToConference(nativePtr, getCallPtr(call)); - + } private native void removeFromConference(long nativePtr, long nativeCallPtr); public synchronized void removeFromConference(LinphoneCall call) { @@ -672,7 +674,7 @@ class LinphoneCoreImpl implements LinphoneCore { private long getCallPtr(LinphoneCall call) { return ((LinphoneCallImpl)call).nativePtr; } - + private long getCallParamsPtr(LinphoneCallParams callParams) { return ((LinphoneCallParamsImpl)callParams).nativePtr; } @@ -700,7 +702,7 @@ class LinphoneCoreImpl implements LinphoneCore { return isMediaEncryptionMandatory(nativePtr); } public synchronized void setMediaEncryption(MediaEncryption menc) { - setMediaEncryption(nativePtr, menc.mValue); + setMediaEncryption(nativePtr, menc.mValue); } public synchronized void setMediaEncryptionMandatory(boolean yesno) { setMediaEncryptionMandatory(nativePtr, yesno); @@ -751,13 +753,13 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void tunnelAddServerAndMirror(String host, int port, int mirror, int ms) { tunnelAddServerAndMirror(nativePtr, host, port, mirror, ms); } - + private native void tunnelAddServer(long nativePtr, TunnelConfig config); @Override public synchronized void tunnelAddServer(TunnelConfig config) { tunnelAddServer(nativePtr, config); } - + private native final TunnelConfig[] tunnelGetServers(long nativePtr); @Override public synchronized final TunnelConfig[] tunnelGetServers() { @@ -784,7 +786,7 @@ class LinphoneCoreImpl implements LinphoneCore { @Override public native boolean isTunnelAvailable(); - + private native void acceptCallWithParams(long nativePtr, long aCall, long params); @Override @@ -792,14 +794,14 @@ class LinphoneCoreImpl implements LinphoneCore { LinphoneCallParams params) throws LinphoneCoreException { acceptCallWithParams(nativePtr, getCallPtr(aCall), getCallParamsPtr(params)); } - + private native void acceptCallUpdate(long nativePtr, long aCall, long params); @Override public synchronized void acceptCallUpdate(LinphoneCall aCall, LinphoneCallParams params) throws LinphoneCoreException { - acceptCallUpdate(nativePtr, getCallPtr(aCall), getCallParamsPtr(params)); + acceptCallUpdate(nativePtr, getCallPtr(aCall), getCallParamsPtr(params)); } - + private native void deferCallUpdate(long nativePtr, long aCall); @Override public synchronized void deferCallUpdate(LinphoneCall aCall) @@ -807,7 +809,7 @@ class LinphoneCoreImpl implements LinphoneCore { deferCallUpdate(nativePtr, getCallPtr(aCall)); } - + private native void setVideoPolicy(long nativePtr, boolean autoInitiate, boolean autoAccept); public synchronized void setVideoPolicy(boolean autoInitiate, boolean autoAccept) { setVideoPolicy(nativePtr, autoInitiate, autoAccept); @@ -820,7 +822,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean getVideoAutoAcceptPolicy() { return getVideoAutoAcceptPolicy(nativePtr); } - + private native void setStaticPicture(long nativePtr, String path); public synchronized void setStaticPicture(String path) { setStaticPicture(nativePtr, path); @@ -836,11 +838,11 @@ class LinphoneCoreImpl implements LinphoneCore { { setCpuCountNative(count); } - + public synchronized int getMissedCallsCount() { return getMissedCallsCount(nativePtr); } - + public synchronized void removeCallLog(LinphoneCallLog log) { removeCallLog(nativePtr, ((LinphoneCallLogImpl) log).getNativePtr()); } @@ -848,7 +850,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void resetMissedCallsCount() { resetMissedCallsCount(nativePtr); } - + private native void tunnelSetHttpProxy(long nativePtr, String proxy_host, int port, String username, String password); @Override @@ -856,12 +858,12 @@ class LinphoneCoreImpl implements LinphoneCore { String username, String password) { tunnelSetHttpProxy(nativePtr, proxy_host, port, username, password); } - + private native void refreshRegisters(long nativePtr); public synchronized void refreshRegisters() { refreshRegisters(nativePtr); } - + @Override public String getVersion() { return getVersion(nativePtr); @@ -878,13 +880,13 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized PayloadType findPayloadType(String mime, int clockRate) { return findPayloadType(mime, clockRate, FIND_PAYLOAD_IGNORE_CHANNELS); } - + private native void removeFriend(long ptr, long lf); @Override public synchronized void removeFriend(LinphoneFriend lf) { removeFriend(nativePtr, lf.getNativePtr()); } - + private native long getFriendByAddress(long ptr, String sipUri); @Override public synchronized LinphoneFriend findFriendByAddress(String sipUri) { @@ -894,64 +896,64 @@ class LinphoneCoreImpl implements LinphoneCore { } return new LinphoneFriendImpl(ptr); } - + public synchronized void setAudioPort(int port) { setAudioPort(nativePtr, port); } - + public synchronized void setVideoPort(int port) { setVideoPort(nativePtr, port); } - + public synchronized void setAudioPortRange(int minPort, int maxPort) { setAudioPortRange(nativePtr, minPort, maxPort); } - + public synchronized void setVideoPortRange(int minPort, int maxPort) { setVideoPortRange(nativePtr, minPort, maxPort); } - + public synchronized void setIncomingTimeout(int timeout) { setIncomingTimeout(nativePtr, timeout); } - + public synchronized void setInCallTimeout(int timeout) { setInCallTimeout(nativePtr, timeout); } - + private native void setMicrophoneGain(long ptr, float gain); public synchronized void setMicrophoneGain(float gain) { setMicrophoneGain(nativePtr, gain); } - + public synchronized void setPrimaryContact(String displayName, String username) { setPrimaryContact(nativePtr, displayName, username); } - + public synchronized String getPrimaryContactUsername() { return getPrimaryContactUsername(nativePtr); } - + public synchronized String getPrimaryContactDisplayName() { return getPrimaryContactDisplayName(nativePtr); } - + private native void setUseSipInfoForDtmfs(long ptr, boolean use); public synchronized void setUseSipInfoForDtmfs(boolean use) { setUseSipInfoForDtmfs(nativePtr, use); } - + private native boolean getUseSipInfoForDtmfs(long ptr); public synchronized boolean getUseSipInfoForDtmfs() { return getUseSipInfoForDtmfs(nativePtr); } - + private native void setUseRfc2833ForDtmfs(long ptr, boolean use); public synchronized void setUseRfc2833ForDtmfs(boolean use) { setUseRfc2833ForDtmfs(nativePtr, use); } - + private native boolean getUseRfc2833ForDtmfs(long ptr); public synchronized boolean getUseRfc2833ForDtmfs() { return getUseRfc2833ForDtmfs(nativePtr); @@ -972,17 +974,17 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void declineCall(LinphoneCall aCall, Reason reason) { declineCall(nativePtr,((LinphoneCallImpl)aCall).nativePtr,reason.mValue); } - + private native boolean upnpAvailable(long ptr); public synchronized boolean upnpAvailable() { return upnpAvailable(nativePtr); - } + } private native int getUpnpState(long ptr); public synchronized UpnpState getUpnpState() { - return UpnpState.fromInt(getUpnpState(nativePtr)); + return UpnpState.fromInt(getUpnpState(nativePtr)); } - + private native String getUpnpExternalIpaddress(long ptr); public synchronized String getUpnpExternalIpaddress() { return getUpnpExternalIpaddress(nativePtr); @@ -992,7 +994,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void startConferenceRecording(String path) { startConferenceRecording(nativePtr,path); } - + private native int stopConferenceRecording(long nativePtr); @Override public synchronized void stopConferenceRecording() { @@ -1002,13 +1004,13 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized PayloadType findPayloadType(String mime) { return findPayloadType(mime, FIND_PAYLOAD_IGNORE_RATE); } - + private native void setSipDscp(long nativePtr, int dscp); @Override public synchronized void setSipDscp(int dscp) { setSipDscp(nativePtr,dscp); } - + private native int getSipDscp(long nativePtr); @Override public synchronized int getSipDscp() { @@ -1019,36 +1021,36 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void setAudioDscp(int dscp) { setAudioDscp(nativePtr, dscp); } - + private native int getAudioDscp(long nativePtr); @Override public synchronized int getAudioDscp() { return getAudioDscp(nativePtr); } - + private native void setVideoDscp(long nativePtr, int dscp); @Override public synchronized void setVideoDscp(int dscp) { setVideoDscp(nativePtr,dscp); } - + private native int getVideoDscp(long nativePtr); @Override public synchronized int getVideoDscp() { return getVideoDscp(nativePtr); } - + private native long createInfoMessage(long nativeptr); @Override public synchronized LinphoneInfoMessage createInfoMessage() { return new LinphoneInfoMessageImpl(createInfoMessage(nativePtr)); } - + private native Object subscribe(long coreptr, long addrptr, String eventname, int expires, String type, String subtype, byte data [], String encoding); @Override public synchronized LinphoneEvent subscribe(LinphoneAddress resource, String eventname, int expires, LinphoneContent content) { - return (LinphoneEvent)subscribe(nativePtr, ((LinphoneAddressImpl)resource).nativePtr, eventname, expires, + return (LinphoneEvent)subscribe(nativePtr, ((LinphoneAddressImpl)resource).nativePtr, eventname, expires, content!=null ? content.getType() : null, content!=null ? content.getSubtype() : null, content!=null ? content.getData() : null, content!=null ? content.getEncoding() : null); } @@ -1056,7 +1058,7 @@ class LinphoneCoreImpl implements LinphoneCore { @Override public synchronized LinphoneEvent publish(LinphoneAddress resource, String eventname, int expires, LinphoneContent content) { - return (LinphoneEvent)publish(nativePtr, ((LinphoneAddressImpl)resource).nativePtr, eventname, expires, + return (LinphoneEvent)publish(nativePtr, ((LinphoneAddressImpl)resource).nativePtr, eventname, expires, content!=null ? content.getType() : null, content!=null ? content.getSubtype() : null, content!=null ? content.getData() : null, content!=null ? content.getEncoding() : null); } @@ -1073,15 +1075,15 @@ class LinphoneCoreImpl implements LinphoneCore { String event, int expires) { return (LinphoneEvent)createPublish(nativePtr, ((LinphoneAddressImpl)resource).nativePtr, event, expires); } - + public synchronized void setChatDatabasePath(String path) { setChatDatabasePath(nativePtr, path); } - + public synchronized LinphoneChatRoom[] getChatRooms() { long[] typesPtr = getChatRooms(nativePtr); if (typesPtr == null) return null; - + LinphoneChatRoom[] proxies = new LinphoneChatRoom[typesPtr.length]; for (int i=0; i < proxies.length; i++) { @@ -1093,7 +1095,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized LinphoneAuthInfo[] getAuthInfosList() { long[] typesPtr = getAuthInfosList(nativePtr); if (typesPtr == null) return null; - + LinphoneAuthInfo[] authInfos = new LinphoneAuthInfo[typesPtr.length]; for (int i=0; i < authInfos.length; i++) { @@ -1102,12 +1104,12 @@ class LinphoneCoreImpl implements LinphoneCore { return authInfos; } - + public synchronized LinphoneAuthInfo findAuthInfo(String username, String realm, String domain) { long ptr = findAuthInfos(nativePtr, username, realm, domain); if (ptr == 0) return null; - + return new LinphoneAuthInfoImpl(ptr); } private native LinphoneCall startReferedCall(long corePtr, long callptr, long paramsPtr); @@ -1117,7 +1119,7 @@ class LinphoneCoreImpl implements LinphoneCore { long ptrParams =((LinphoneCallParamsImpl)params).nativePtr; return startReferedCall(nativePtr, getCallPtr(call), ptrParams); } - + private native String[] listSupportedVideoResolutions(long ptr); @Override public synchronized String[] getSupportedVideoSizes() { @@ -1128,13 +1130,13 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized int migrateToMultiTransport() { return migrateToMultiTransport(nativePtr); } - + private native boolean acceptEarlyMedia(long lc, long call); @Override public synchronized boolean acceptEarlyMedia(LinphoneCall call) { return acceptEarlyMedia(nativePtr, getCallPtr(call)); } - + private native boolean acceptEarlyMediaWithParams(long lc, long call, long params); @Override public synchronized boolean acceptEarlyMediaWithParams(LinphoneCall call, @@ -1197,7 +1199,7 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized boolean chatEnabled() { return chatEnabled(nativePtr); } - + @Override public synchronized void stopRinging() { stopRinging(nativePtr); @@ -1215,13 +1217,20 @@ class LinphoneCoreImpl implements LinphoneCore { @Override public synchronized void enableAdaptiveRateControl(boolean enable) { enableAdaptiveRateControl(nativePtr,enable); - + } @Override public synchronized boolean isAdaptiveRateControlEnabled() { return isAdaptiveRateControlEnabled(nativePtr); } - + public synchronized getAdaptiveRateAlgorithm() { + return AdaptiveRateAlgorithm.fromInt(getAdaptiveRateAlgorithm(nativePtr)); + } + public synchronized void setAdaptiveRateAlgorithm(AdaptiveRateAlgorithm alg) { + setAdaptiveRateAlgorithm(nativePtr, alg.mValue); + } + + private native void setAudioJittcomp(long ptr, int value); @Override public synchronized void setAudioJittcomp(int value) { @@ -1232,5 +1241,5 @@ class LinphoneCoreImpl implements LinphoneCore { public synchronized void setVideoJittcomp(int value) { setVideoJittcomp(nativePtr,value); } - + } diff --git a/mediastreamer2 b/mediastreamer2 index b3578c1cc..322600a86 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b3578c1cc5861e137bf058584f2bc715d19ca405 +Subproject commit 322600a869cc9b82927238a2d2fb87c11a73c5cc