zaheer zuhrab

Greenhorn
+ Follow
since May 09, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by zaheer zuhrab

HI Every one

I am working in JMF and i am faceing a problem in voice conversation that there is delay of almost one or two seconds in conversation but i am not able where i can set buffer length and threshold amount to reduce this delay in conversation followin code of transmiter(RTPServer) and receiver(RTPClient) Please guid me regarding this problem in code so i can reduce the delay


i already pasted a query but no reply to me i am waiting for reply i have another problem that when i execute this program the voice conversation is started but when i stop this conversation and starts it again then there is error which is given below i am really waiting for reply please reply me and who understand this problem

Thanks
Regards



javax.media.NotConfiguredError: setContentDescriptor cannot be called before configured
at com.sun.media.ProcessEngine.setContentDescriptor(ProcessEngine.java:342)
at com.sun.media.MediaProcessor.setContentDescriptor(MediaProcessor.java:123)
at RTPServer.RTPServerTranmsimter(RTPServer.java:66)
at SignalingServer.Receive(SignalingServer.java:44)
at SignalingServer.run(SignalingServer.java:142)
at java.lang.Thread.run(Thread.java:619)
Exception in thread "Thread-2" javax.media.NotConfiguredError: setContentDescriptor cannot be called before configured
at com.sun.media.ProcessEngine.setContentDescriptor(ProcessEngine.java:342)
at com.sun.media.MediaProcessor.setContentDescriptor(MediaProcessor.java:123)
at RTPServer.RTPServerTranmsimter(RTPServer.java:66)
at SignalingServer.Receive(SignalingServer.java:44)
at SignalingServer.run(SignalingServer.java:142)
at java.lang.Thread.run(Thread.java:619)



and code for Receiver is

14 years ago
Hi every one
i am zaheer and i am new to JMF i created a program in JMF that capture voice from mic and send it to other pc using rtp manager by using sendStream method i am also running an other program on another pc that receive that audio which is send and this start voice conversation by using ip and ports

but i want make it a call when i send stream then there will be alert at other side that some one want to talk to you if it accecpts then voice will be started but i am not able to do so can anyone guide me regarding this with code example that how i can establish a call type i am very thank full to every one who guide me
Regards
14 years ago
I took this code from same forum I am trying to capture and then play the audio on other Computer but it is not working can any one help me i tried different methods of format but there is no out put please help me or any one can give me any other code related to JMF of voice chat I shall be thank full
// Capture and Send Audio

import java.io.*;
import java.util.Vector;
import javax.media.protocol.*;
import javax.media.*;
import javax.media.rtp.*;
import java.net.*;
import javax.media.format.AudioFormat;


public class CaptureNSend {

CaptureDeviceInfo di;
Processor process;
DataSource DSource;
SendStream sStream;
SessionManager sesManager;
SessionAddress sessionAdd;
RTPManager rtpMgr;
Processor p=null;
String IP;
MediaLocator Locate;
public CaptureNSend(String ip) {
IP = ip;
//AudioFormat format = new AudioFormat("LINEAR", 8000, 8, 1);

//Vector deviceList = CaptureDeviceManager.getDeviceList(new AudioFormat(AudioFormat.MPEG_RTP, 44100, 16, 2));
//Vector deviceList = CaptureDeviceManager.getDeviceList(new AudioFormat(AudioFormat.GSM_RTP,44100,16,2));
//Vector deviceList = CaptureDeviceManager.getDeviceList(new Format(AudioFormat.MPEG_RTP,44100,16,2));
Vector deviceList = CaptureDeviceManager.getDeviceList(new AudioFormat("linear", 44100, 16, 2));
//List list = CaptureDeviceManager.getDeviceList(new AudioFormat("linear", 44100, 16, 2));
System.out.println(deviceList.size());
if (deviceList.size() > 0) {
di = (CaptureDeviceInfo)deviceList.get(1);
System.out.println(di.getName());
di = (CaptureDeviceInfo)deviceList.get(deviceList.size() - 1);
System.out.println(di.getName());
}
else
System.exit(-1);

MediaLocator locate = di.getLocator();

Locate = locate;
try{
p = Manager.createProcessor(Locate);
p.addControllerListener(new ProcessorEventHandler());

p.configure();
}catch(Exception e){
e.printStackTrace();
}

}


public void setOutputFormat(){

p.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW_RTP));

System.out.println("Audio Format Set");
// transmitMedia();
}


public void setupSession () {
DSource = p.getDataOutput();
rtpMgr = RTPManager.newInstance();
System.out.println("source checked");
int port = 5000;

try {
InetAddress local=InetAddress.getLocalHost();
System.out.println("inetaddress checked");
sessionAdd = new SessionAddress(local,port);
InetAddress remote =InetAddress.getByName(IP);
SessionAddress tarAdd = new SessionAddress(remote,6638);
System.out.println(port);
System.out.println("Session address checked");

rtpMgr.initialize(sessionAdd);
rtpMgr.addTarget(tarAdd);
System.out.println("session add peer checked");
sStream = rtpMgr.createSendStream(DSource,0);
System.out.println("sending media");
sStream.start();
p.start();
} catch (Exception e) {
e.printStackTrace();
}
}


private class ProcessorEventHandler extends ControllerAdapter{

public void configureComplete(ConfigureCompleteEvent configureCompleteEvent) {

setOutputFormat();

System.out.println(" Configured");
p.realize();
}

public void realizeComplete (RealizeCompleteEvent realizeCompleteEvent) {

setupSession();
}

public void endOfMedia ( EndOfMediaEvent mediaEndEvent) {
stopTransmission();
System.out.println("Transmission completed.");
}
}

public void stopTransmission() {

}

public static void main(String[] args) {
CaptureNSend sCapture = new CaptureNSend("192.168.1.51");
}

}
-------------------------------------------------------------------

// Receive and Playback Audio

import javax.media.*;
import java.util.*;

public class ReceiveMedia{
String ip = "10.10.50.171";
int port = 5000;
Player player;

public ReceiveMedia(){
String location = "rtp://"; + ip + ":" + port + "/" + "audio" + "/1";
System.out.println("Setting up MediaLocator");
MediaLocator media = new MediaLocator(location);

try{
player = Manager.createPlayer(media);
player.addControllerListener(new PlayerHandlerEvent());
player.realize();
System.out.println("Player Realized");

} catch(Exception e){
e.printStackTrace();
}
}


public class PlayerHandlerEvent extends ControllerAdapter{

public void realizeComplete(RealizeCompleteEvent realizeDoneEvent){
player.prefetch();
}

public void prefetchComplete(PrefetchCompleteEvent prefetchDoneEvent){
player.start();
System.out.println("Start Playback");
} //end prefetchComplete method

public void endOfMedia(EndOfMediaEvent mediaEndEvent) {
player.setMediaTime(new Time(0));
player.stop();
}
}
}
14 years ago