RTP 형식의 JMF 2.1.1e를 사용하여 오디오를 캡처하고 스트리밍하고 싶습니다. 나는 간단한 송신기를 썼다. 나는 오디오를 송수신 할 수있다. 그러나 Wireshark에서 보았을 때 패킷을 UDP로 보았습니다. 누구든지 저에게 문제를 지적 해주십시오.jmf를 사용하여 스트리밍 할 때 Wireshark의 RTP가 아닌 UDP 인 이유는 무엇입니까?
그리고 오디오 캡처 및 전송을 담당하는 기능은 다음과 같습니다.
public void captureAudio(){
// Get the device list for ULAW
Vector devices = captureDevices();
CaptureDeviceInfo captureDeviceInfo = null;
if (devices.size() > 0) {
//get the first device from the list and cast it as CaptureDeviceInfo
captureDeviceInfo = (CaptureDeviceInfo) devices.firstElement();
}
else {
// exit if we could not find the relevant capturedevice.
System.out.println("No such device found");
System.exit(-1);
}
Processor processor = null;
try {
//Create a Processor for the specified media.
processor = Manager.createProcessor(captureDeviceInfo.getLocator());
} catch (IOException ex) {
System.err.println(ex);
} catch (NoProcessorException ex) {
System.err.println(ex);
}
//Prepares the Processor to be programmed.
//puts the Processor into the Configuring state.
processor.configure();
//Wait till the Processor configured.
while (processor.getState() != Processor.Configured){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
//Sets the output content-type for this Processor
processor.setContentDescriptor(CONTENT_DESCRIPTOR);
/**
ContentDescriptor CONTENT_DESCRIPTOR
= new ContentDescriptor(ContentDescriptor.RAW_RTP);
*/
//Gets a TrackControl for each track in the media stream.
TrackControl track[] = processor.getTrackControls();
boolean encodingOk = false;
//searching through tracks to get a supported audio format track.
for (int i = 0; i < track.length; i++) {
if (!encodingOk && track[i] instanceof FormatControl) {
if (((FormatControl)
track[i]).setFormat(new AudioFormat(AudioFormat.ULAW_RTP, 8000, 8, 1)) == null)
{
track[i].setEnabled(false);
}
else {
encodingOk = true;
track[i].setEnabled(encodingOk);
System.out.println("enc: " + i);
}
} else {
// we could not set this track to ULAW, so disable it
track[i].setEnabled(false);
}
}
//If we could set this track to ULAW we proceed
if (encodingOk){
processor.realize();
while (processor.getState() != Processor.Realized){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
DataSource dataSource = null;
try {
dataSource = processor.getDataOutput();
} catch (NotRealizedError e) {
e.printStackTrace();
}
try {
String url= "rtp://192.168.1.99:49150/audio/1";
MediaLocator m = new MediaLocator(url);
DataSink d = Manager.createDataSink(dataSource, m);
d.open();
d.start();
System.out.println("transmitting...");
processor.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
부적절하거나 불분명 한 것이 있으면 부탁드립니다. 미리 감사드립니다. :)
명확한 설명 : 나는 RTP 스트리밍 C# 코드의 peice 있습니다. 그리고 내가 Wireshark를를 사용하여 데이터를 캡처 할 때, 나는 RTP로 볼 수 있습니다,하지만 난 UDP로 보여 JMF 와이어 샤크에서 데이터 스트림을 캡처 할 때 문제입니다. 제 질문은, 왜죠?
나는 UDP와 RTP의 차이점을 안다.
문제는 CONTENT_DESCRIPTOR에 있다고 생각합니다. raw-rtp입니다. – shibli049
현재 직면 한 문제를 제외하고 코드가 실행 중임을 이해합니다. JMF 소스 코드에서 JMF가 Osbcure와 같은 CONTENT_DESCRIPTOR를 사용할 때 Processor 클래스를 구현하는 방법을 살펴볼 필요가 있습니다. 이것은 C# 코드와 Java JMF 코드의 차이 일 수 있습니다. C# 버전에 어떤 스트리밍 라이브러리를 사용하고 있는지 알려면주의하십시오. – ecle
@eee : C# 프로젝트는 pjsipDll을 사용하고 있습니다. wireshark에서 패킷을 테스트하기 위해 친구로부터 가져 왔습니다. C#으로 작업하지 않았습니다. C#에 대한 자세한 내용을 알려 드릴 수 없습니다. – shibli049