Boolean LiveAMRAudioRTPSink::sourceIsCompatibleWithUs( MediaSource& source )
{
  // Our source must be an AMR audio source:
  if (!source.isAMRAudioSource()) return False;

  // Also, the source must be wideband iff we asked for this:
  LiveAMRAudioDeviceSource& amrSource = (LiveAMRAudioDeviceSource&)source;
  if ((amrSource.isWideband()^sourceIsWideband()) != 0) return False;

  // Also, the source must have the same number of channels that we
  // specified.  (It could, in principle, have more, but we don't
  // support that.)
  if (amrSource.numChannels() != numChannels()) return False;

  // Also, because in our current implementation we output only one
  // frame in each RTP packet, this means that for multi-channel audio,
  // each 'frame-block' will be split over multiple RTP packets, which
  // may violate the spec.  Warn about this:
  if (amrSource.numChannels() > 1) {
    envir() << "AMRAudioRTPSink: Warning: Input source has " << amrSource.numChannels()
      << " audio channels.  In the current implementation, the multi-frame frame-block will be split over multiple RTP packets\n";
  }

  return True;
}
Пример #2
0
Boolean AMRAudioFileSink::sourceIsCompatibleWithUs(MediaSource& source) {
  // The input source must be a AMR Audio source:
  return source.isAMRAudioSource();
}