/**
  * Sends a specific <tt>RawPacket</tt> through this <tt>OutputDataStream</tt> to a specific
  * <tt>InetSocketAddress</tt>.
  *
  * @param packet the <tt>RawPacket</tt> to send through this <tt>OutputDataStream</tt> to the
  *     specified <tt>target</tt>
  * @param target the <tt>InetSocketAddress</tt> to which the specified <tt>packet</tt> is to be
  *     sent through this <tt>OutputDataStream</tt>
  * @throws IOException if anything goes wrong while sending the specified <tt>packet</tt> through
  *     this <tt>OutputDataStream</tt> to the specified <tt>target</tt>
  */
 @Override
 protected void sendToTarget(RawPacket packet, InetSocketAddress target) throws IOException {
   socket.send(
       new DatagramPacket(
           packet.getBuffer(),
           packet.getOffset(),
           packet.getLength(),
           target.getAddress(),
           target.getPort()));
 }
  /**
   * Log the packet.
   *
   * @param packet packet to log
   */
  @Override
  protected void doLogPacket(RawPacket packet, InetSocketAddress target) {
    if (socket == null || packet == null || target == null) return;

    // Do not log the packet if it has been processed (and already
    // logged) by the ice4j stack.
    if (socket instanceof MultiplexingDatagramSocket) return;

    PacketLoggingService pktLogging = getPacketLoggingService();

    if (pktLogging != null) {
      pktLogging.logPacket(
          PacketLoggingService.ProtocolName.RTP,
          socket.getLocalAddress().getAddress(),
          socket.getLocalPort(),
          target.getAddress().getAddress(),
          target.getPort(),
          PacketLoggingService.TransportName.UDP,
          true,
          packet.getBuffer(),
          packet.getOffset(),
          packet.getLength());
    }
  }