[sip-comm-dev] how to stop the right Transmitter


#1

I am extending the Sipcommunicator to enable multi videoconference capabilities. At the moment every think work fine but i also want to stop each stream (Audio and video). that mean i want to stop any Transmitter separatelly and i use RTPManager.reomvetarget() to do it. But this also stop sending stream to other participant,despite the fact that the transmitter of other participant is still working.

here is a part of my code:

Kinds Regards and thanks in advance.

Lyly

     // Diese Method is declared in a Class extended from MediaManager
     // stop a specify transmitter
      protected void stopTransmitter(String ipAddress)
    {
        
        // stop the Transmitter with the giving IP address
        try {
            console.logEntry();
            for (int i = avTransmitters.size() - 1; i >= 0; i--) {
                try {
                    
                   AVTransmitter avt = ( (AVTransmitter) avTransmitters.elementAt(i));
                   ArrayList Address = avt.ipAddresses;
                   
                     if(Address.contains(ipAddress))//
                       {
                           if(Participantscount == 0) // if the last Transmitter
                            super.stopTransmitters();
                           else
                           {
                              // avt.stop();
                               avTransmitters.removeElementAt(i);
                              
                               // DestinationSessionAddr is a vector with all destinations SessionAddress
                              if(DestinationSessionAddr.size() != 0)
                              {
                                  for(int k=0;k<DestinationSessionAddr.size();k++)
                                  {
                                     SessionAddress item = (SessionAddress)DestinationSessionAddr.get(k);
                                     if(item.getDataHostAddress().equals(ipAddress))
                                        {
                                        avt.stop(item);
                                        System.out.println("stopaTransmitter = "+avt + "address = " +Address.get(0));
                                        break;
                                        }
                                  }
                              }
                            }
                          }
                   }
                       
                 //Catch everything that comes out as we wouldn't want
                //Some null pointer prevent us from closing a device and thus
                //render it unusable
                catch (Exception exc) {
                    console.error("Could not close transmitter " + i, exc);
                }
               
            }
        }
        finally {
            console.logExit();
        }
    }

// This Method is defined in AVtransmitter and remove the specify Target from the RTPManager List
   void stop(SessionAddress address)
    {
        try {
            console.logEntry();
            synchronized (this) {
                if (processor != null) {
                    processor.stop();
                    if (rtpMgrs != null) {
                        for (int i = 0; i < rtpMgrs.length; i++) {
                                 rtpMgrs[i].removeTarget(address,"Session ended.");
                                                                                 
                        }
                    }
                }
            }
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
        finally
        {
            console.logExit();
        }
    }


#2

Hello Lyly

Sorry not to have been able to reply earlier. Glad to hear u r working on this.

Your code seems fine to me but I didn't have time to experiment with it. Are u still having the specified problem?

Cheers
Emil
Lyly Yonkwa wrote:

···

I am extending the Sipcommunicator to enable multi videoconference capabilities. At the moment every think work fine but i also want to stop each stream (Audio and video). that mean i want to stop any Transmitter separatelly and i use RTPManager.reomvetarget() to do it. But this also stop sending stream to other participant,despite the fact that the transmitter of other participant is still working.
here is a part of my code:
Kinds Regards and thanks in advance.
Lyly

     // stop a specify transmitter
      protected void stopTransmitter(String ipAddress)
    {
               // stop the Transmitter with the giving IP address
        try {
            console.logEntry();
            for (int i = avTransmitters.size() - 1; i >= 0; i--) {
                try {
                                      AVTransmitter avt = ( (AVTransmitter) avTransmitters.elementAt(i));
                   ArrayList Address = avt.ipAddresses;
                                       if(Address.contains(ipAddress))//
                       {
                           if(Participantscount == 0) // if the last Transmitter super.stopTransmitters();
                           else
                           {
                              // avt.stop();
                               avTransmitters.removeElementAt(i);
                                                            // DestinationSessionAddr is a vector with all destinations SessionAddress
                              if(DestinationSessionAddr.size() != 0) {
                                  for(int k=0;k<DestinationSessionAddr.size();k++)
                                  {
                                     SessionAddress item = (SessionAddress)DestinationSessionAddr.get(k);
                                     if(item.getDataHostAddress().equals(ipAddress))
                                        {
                                        avt.stop(item);
                                        System.out.println("stopaTransmitter = "+avt + "address = " +Address.get(0));
                                        break;
                                        }
                                  }
                              }
                            }
                          }
                   }
                                       //Catch everything that comes out as we wouldn't want
                //Some null pointer prevent us from closing a device and thus
                //render it unusable
                catch (Exception exc) {
                    console.error("Could not close transmitter " + i, exc);
                }
                          }
        }
        finally {
            console.logExit();
        }
    }

   void stop(SessionAddress address)
    {
        try {
            console.logEntry();
            synchronized (this) {
                if (processor != null) {
                    processor.stop();
                    if (rtpMgrs != null) {
                        for (int i = 0; i < rtpMgrs.length; i++) {
                                 rtpMgrs[i].removeTarget(address,"Session ended.");
                                                                                                         }
                    }
                }
            }
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
        finally
        {
            console.logExit();
        }
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net