소프트 폰을 만들 때 Mjsip을 사용하고 있습니다. 코드에는 오디오 스트래밍을위한 3 가지 유형의 옵션이 있습니다. 나는 RAT를 사용하고 있지 않다 JMF가 Mjsip을 사용한 오디오 스트리밍에서 작동하지 않는 이유는 무엇입니까?
RAT (강력한 오디오 도구)를 사용하여 자바 오디오
- . 그 가치는 혼자 가짜입니다. 다음은 JMF를 호출하는 코드입니다.
public JMFAudioLauncher(int local_port, String remote_addr, int remote_port, int direction, Log logger) { log=logger; localport=local_port; remoteport=remote_port; remoteaddr=remote_addr; // Patch for working with JMF with local streams if (remote_addr.startsWith("127.")) { printLog("Patch for JMF: replaced local destination address "+remote_addr+" with 255.255.255.255"); remote_addr="255.255.255.255"; } dir=direction; if (dir>=0) sender=new JMediaSender("audio",null,remote_addr,remote_port); if (dir<=0) receiver=new JMediaReceiver("audio",local_port,null); } /** Starts media application */ public boolean startMedia() { printLog("launching JMF-Audio..."); String err1=null, err2=null; if (sender!=null) err1=sender.start(); if (err1!=null) printLog("Error trying to send audio stream: "+err1); if (receiver!=null) err2=receiver.start(); if (err2!=null) printLog("Error trying to receive audio stream: "+err2); return (err1==null && err2==null); } /** Stops media application */ public boolean stopMedia() { String err1=null, err2=null; if (sender!=null) err1=sender.stop(); if (err1!=null) printLog("Error stopping audio sender: "+err1); if (receiver!=null) err2=receiver.stop(); if (err2!=null) printLog("Error stopping audio receiver: "+err2); return (err1==null && err2==null); }
그러나 실행 중이 아닙니다. 나는 아직도 내 소프트 폰과 이야기 할 수있다. 하지만 로그는 ... 보여
UA: REGISTRATION UA: Registration success: 200 OK UA: INCOMING UA: CONFIRMED/CALL UA: Error trying to create the JMFAudioLauncher AudioInput: TargetDataLine: [email protected] AudioOutput: SourceDataLine: [email protected] AudioLauncher: starting java audio..
그러나 JMF 값을 사용하면 user_agent_profile 마찬가지입니다 및 오류가이 코드에서 생성합니다.
if (user_profile.audio && local_audio_port!=0 && remote_audio_port!=0) { if (user_profile.use_rat) // create an audio_app and start it { audio_app=new RATLauncher(user_profile.bin_rat,local_audio_port,remote_media_address,remote_audio_port,log); } else if (user_profile.use_jmf) { // check if JMF is supported try { Class myclass=Class.forName("local.ua.JMFAudioLauncher"); Class[] parameter_types={ Class.forName("int"), Class.forName("java.lang.String"),Class.forName("int"), Class.forName("int"), Class.forName("org.zoolu.tools.Log") }; Object[] parameters={ new Integer(local_audio_port), remote_media_address, new Integer(remote_audio_port), new Integer(dir), log }; java.lang.reflect.Constructor constructor=myclass.getConstructor(parameter_types); audio_app=(MediaLauncher)constructor.newInstance(parameters); } catch (Exception e) { printException(e,LogLevel.HIGH); printLog("Error trying to create the JMFAudioLauncher",LogLevel.HIGH); } } // else if (audio_app==null) { // for testing.. String audio_in=null; if (user_profile.send_tone) audio_in=JAudioLauncher.TONE; else if (user_profile.send_file!=null) audio_in=user_profile.send_file; String audio_out=null; if (user_profile.recv_file!=null) audio_out=user_profile.recv_file; //audio_app=new JAudioLauncher(local_audio_port,remote_media_address,remote_audio_port,dir,log); audio_app=new JAudioLauncher(local_audio_port,remote_media_address,remote_audio_port,dir,audio_in,audio_out,user_profile.audio_sample_rate,user_profile.audio_sample_size,user_profile.audio_frame_size,log); } audio_app.startMedia(); }
JMF를 사용하려면 어떻게해야합니까?
코드의 들여 쓰기를 수정해야 할 수 있습니다. 어떻게 생겼는지 알 수 있습니다. 그것을 고정하면 적어도 더 쉽게 읽을 수 있습니다. – Bart
@ 바트 : 나는 약간의 formtting을 향상 시켰는데, 실제로 왜 내 코드를 읽을 수 없다고 말하고 있는가? 향상된 서식에 대해 구체적으로 설명해주십시오. 감사합니다 –
@ Alvi_1987 당신은 지금 더 운이 있는지 보자. – Aristos