java - JMF and Incoming tcp audio -
java - JMF and Incoming tcp audio -
i'm on project of voip. i've sound stream on tcp mobile computer. need stream , send rtp (with sip) device.
i can talk device in sip jain-sip, can't send audio, don't know how this. i'm using jmf, define custom datasource can't create processor it...
any ideas ?
thanks helping :)
code :
inside rtplayer constructor :
datasrc = new datasource(is, contenttype); datasrc.connect(); format[] format = { new audioformat(audioformat.linear, samplerate, samplesizeinbits, channel) }; processormodel pm = new processormodel(datasrc, format, new contentdescriptor(contenttype)); p = manager.createrealizedprocessor(pm);
custom datasource :
import java.io.ioexception; import java.io.inputstream; import javax.media.duration; import javax.media.time; import javax.media.protocol.contentdescriptor; import javax.media.protocol.inputsourcestream; import javax.media.protocol.pulldatasource; import javax.media.protocol.pullsourcestream; public class datasource extends pulldatasource { private inputsourcestream[] m_sources; private contentdescriptor m_cd; private boolean m_connected; private inputstream m_is; public datasource(inputstream is, string contenttype) { super(); m_connected = false; m_cd = new contentdescriptor(contenttype); m_is = is; } @override public pullsourcestream[] getstreams() { if (!m_connected) { throw new java.lang.error("source unconnected."); } homecoming m_sources; } @override public void connect() throws ioexception { m_sources = new inputsourcestream[1]; m_sources[0] = new inputsourcestream(m_is, m_cd); m_connected = true; } @override public void disconnect() { if (m_connected) m_connected = false; } @override public string getcontenttype() { if (!m_connected) throw new error("source unconnected."); homecoming m_cd.getcontenttype(); } @override public object getcontrol(string arg0) { homecoming null; } @override public object[] getcontrols() { homecoming null; } @override public time getduration() { homecoming duration.duration_unknown; } @override public void start() throws ioexception { } @override public void stop() throws ioexception { } }
inputstream :
socket = server.accept(); inputstream = socket.getinputstream(); rtplayer = new rtplayer(gethost(), remoteadress, is, send_rcv_rtp_port, remoteport, contentdescriptor.raw_rtp, samplerate, buffersize, 1);
java audio tcp rtp jmf
Comments
Post a Comment