Hey...
I'm having a similar problem, because i'm developing an application that its serving RTP audio context streams. So the application would transmit a playlist of files over RTP, and it works fine for one file, but when i try to give it a new file, i always get the exception "Can´t open door: ...". This error occurs on the line that is marked with *****.
I'm creating a processor for each file i want to transmit, for the same port and same IP address, so when the first file ends i close the processor and create a new one with the same properties, but with a diferent file...
I really nead this to work, so if someone could help me on this it would be really appreciated... Thanks in advance...
My code for creating the transmitter is like this:
private String createProcessor(){
if (locator == null) return My_Dictionary.TRANSMIT_LOCATOR;
try{
ds = javax.media.Manager.createDataSource(locator);
}catch (Exception e){
return My_Dictionary.TRANSMIT_DATASOURCE;
}
try{
processor = javax.media.Manager.createProcessor(ds);
}catch (NoProcessorException npe){
return My_Dictionary.TRANSMIT_PROCESSOR;
}catch (IOException ioe){
return My_Dictionary.TRANSMIT_IO_PROCESSOR;
}
boolean result = waitForState(processor,Processor.Configured);
if (result == false) return My_Dictionary.TRANSMIT_PROCESSOR_CONFIG;
TrackControl [ ] tracks = processor.getTrackControls();
if (tracks == null || tracks.length < 1) return My_Dictionary.TRANSMIT_TRACKS;
ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
processor.setContentDescriptor(cd);
Format supported[];
Format chosen;
boolean atLeastOneTrack = false;
for (int i = 0; i < tracks.length; i++){
if (tracks.isEnabled()){
supported = tracks.getSupportedFormats();
if (supported.length > 0){
for (int j = 0; j < supported.length; j++){
if (supported[j] instanceof AudioFormat){
if (supported[j].matches(Transmit.audioformat)){
chosen = supported[j];
tracks.setFormat(chosen);
atLeastOneTrack = true;
System.out.println("Track " + i + " is set to transmit as: " + chosen);
}
}
}
}else tracks.setEnabled(false);
}else tracks.setEnabled(false);
}
if (!atLeastOneTrack) return My_Dictionary.TRANSMIT_ANY_TRACKS;
result = waitForState(processor,Controller.Realized);
if (result == false) return My_Dictionary.TRANSMIT_PROCESSOR_REALIZE;
dataOutput = processor.getDataOutput();
return null;
}
private static String createTransmitter(){
PushBufferDataSource pbds = (PushBufferDataSource)dataOutput;
PushBufferStream pbss[] = pbds.getStreams();
rtpMgrs = new RTPManager[pbss.length];
SessionAddress localAddr, destAddr;
InetAddress ipAddr;
SendStream sendStream;
int port;
for (int i = 0; i < pbss.length; i++){
try{
rtpMgrs = RTPManager.newInstance();
port = portBase + 2*i;
ipAddr = InetAddress.getByName(ipAddress);
localAddr = new SessionAddress(InetAddress.getLocalHost(),port);
destAddr = new SessionAddress(ipAddr,port);
rtpMgrs.initialize(localAddr); *****
rtpMgrs.addTarget(destAddr);
System.out.println("Created RTP session: " + ipAddress + "/" + port);
sendStream = rtpMgrs.createSendStream(dataOutput,i);
sendStream.start();
}catch (Exception e){
return e.getMessage();
}
}
return null;
}
I'm having a similar problem, because i'm developing an application that its serving RTP audio context streams. So the application would transmit a playlist of files over RTP, and it works fine for one file, but when i try to give it a new file, i always get the exception "Can´t open door: ...". This error occurs on the line that is marked with *****.
I'm creating a processor for each file i want to transmit, for the same port and same IP address, so when the first file ends i close the processor and create a new one with the same properties, but with a diferent file...
I really nead this to work, so if someone could help me on this it would be really appreciated... Thanks in advance...
My code for creating the transmitter is like this:
private String createProcessor(){
if (locator == null) return My_Dictionary.TRANSMIT_LOCATOR;
try{
ds = javax.media.Manager.createDataSource(locator);
}catch (Exception e){
return My_Dictionary.TRANSMIT_DATASOURCE;
}
try{
processor = javax.media.Manager.createProcessor(ds);
}catch (NoProcessorException npe){
return My_Dictionary.TRANSMIT_PROCESSOR;
}catch (IOException ioe){
return My_Dictionary.TRANSMIT_IO_PROCESSOR;
}
boolean result = waitForState(processor,Processor.Configured);
if (result == false) return My_Dictionary.TRANSMIT_PROCESSOR_CONFIG;
TrackControl [ ] tracks = processor.getTrackControls();
if (tracks == null || tracks.length < 1) return My_Dictionary.TRANSMIT_TRACKS;
ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
processor.setContentDescriptor(cd);
Format supported[];
Format chosen;
boolean atLeastOneTrack = false;
for (int i = 0; i < tracks.length; i++){
if (tracks.isEnabled()){
supported = tracks.getSupportedFormats();
if (supported.length > 0){
for (int j = 0; j < supported.length; j++){
if (supported[j] instanceof AudioFormat){
if (supported[j].matches(Transmit.audioformat)){
chosen = supported[j];
tracks.setFormat(chosen);
atLeastOneTrack = true;
System.out.println("Track " + i + " is set to transmit as: " + chosen);
}
}
}
}else tracks.setEnabled(false);
}else tracks.setEnabled(false);
}
if (!atLeastOneTrack) return My_Dictionary.TRANSMIT_ANY_TRACKS;
result = waitForState(processor,Controller.Realized);
if (result == false) return My_Dictionary.TRANSMIT_PROCESSOR_REALIZE;
dataOutput = processor.getDataOutput();
return null;
}
private static String createTransmitter(){
PushBufferDataSource pbds = (PushBufferDataSource)dataOutput;
PushBufferStream pbss[] = pbds.getStreams();
rtpMgrs = new RTPManager[pbss.length];
SessionAddress localAddr, destAddr;
InetAddress ipAddr;
SendStream sendStream;
int port;
for (int i = 0; i < pbss.length; i++){
try{
rtpMgrs = RTPManager.newInstance();
port = portBase + 2*i;
ipAddr = InetAddress.getByName(ipAddress);
localAddr = new SessionAddress(InetAddress.getLocalHost(),port);
destAddr = new SessionAddress(ipAddr,port);
rtpMgrs.initialize(localAddr); *****
rtpMgrs.addTarget(destAddr);
System.out.println("Created RTP session: " + ipAddress + "/" + port);
sendStream = rtpMgrs.createSendStream(dataOutput,i);
sendStream.start();
}catch (Exception e){
return e.getMessage();
}
}
return null;
}