我成功了但是文档当中的传递媒体流的程序实现不了我刚开始学习jmf不知道怎么改动
错误在于 Processor 的p.configure()执行以后不能够被正确配置,下一句程序说没有配置好所以不能够执行。
public void dosend()
{
Processor p=null;
// First find a capture device that will capture linear audio
// data at 8bit 8Khz
AudioFormat format= new AudioFormat(AudioFormat.LINEAR,
8000,
8,
1);
Vector devices= CaptureDeviceManager.getDeviceList( format);
CaptureDeviceInfo di= null;
if (devices.size() > 0) {
di = (CaptureDeviceInfo) devices.elementAt(0);
System.out.print(di.getName());
}
else {
// exit if we could not find the relevant capturedevice.
System.exit(-1);
}
// Create a processor for this capturedevice & exit if we
// cannot create it
try {
System.out.print(p.getState());
System.out.print(p.Configuring);
// System.out.print(p.getContentDescriptor().toString());
// block until it has been configured
// Go through the tracks and try to program one of them to
// output gsm data.
for (int i = 0; i < track.length; i++) {
if (!encodingOk && track[i] instanceof FormatControl) {
if (((FormatControl)track[i]).
setFormat( new AudioFormat(AudioFormat.GSM_RTP,
8000,
8,
1)) == null) {
track[i].setEnabled(false);
}
else {
encodingOk = true;
}
} else {
// we could not set this track to gsm, so disable it
track[i].setEnabled(false);
}
}
// At this point, we have determined where we can send out
// gsm data or not.
// realize the processor
if (encodingOk) {
p.realize();
// block until realized.
// get the output datasource of the processor and exit
// if we fail
DataSource ds = null;
// hand this datasource to manager for creating an RTP
// datasink our RTP datasimnk will multicast the audio
try {
String url= "rtp://224.144.251.104:49150/audio/1";