RTPManager problem with closing - please help
I have a program where the user can do either a video call or an audio call. Basically if the user is doing a video call there will be 4 RTPManager used- one for each port (2 sends, 2 receives). If the user decides to call audio and he is using video I will just close the video RTPManagers (send and receive) and continue with audio. If the user needs to do video I make 2 new RTPmanagers(video send and video receive).
My problem is that when I close the video section of the program when switching from video to audio, sometimes the audio hangs forever and i hear this repetitive skipping noise. I am pretty sure the RTPManager closing is involved. Below are how I close the RTPManager receive:
if (rtpmgr != null) {
rtpmgr.removeTarget(name,"The client has quit. Connection removed");
mgrs.dispose();
}
and here is for the send side:
rtpMngr.removeTarget(name,"The client has removed you from session");
rtpMngr.dispose();
I am pretty sure I have to call dispose() since when i take it out I get "port already in use" error when I switch back from audio to video using the same ports. It could be other things that might have cause my problem - Processor, datasource, player, sendstream.
if (sendStream != null) {
try {
sendStream.stop();
} catch (IOException e) {
e.printStackTrace();
}
sendStream.close();
}
if (proc!=null) {
proc.stop();
proc.close();
}
if (player != null) {
player.stop();
player.close();
}
dataSource.disconnect();
cloneSource.disconnect();
I am kinda lost on how or why this is happening. Please help!Thank you

