Google
  Web www.spinics.net

Re: [Openh323-devel] OpalMediaFormats registration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi John,

Thank you for your help.
I've found a (rather tricky) solution : I just call
BufferEndPoint::GetMediaFormats() before a call to instanciate all medias
statically.

Now I'm trying to send WAV samples into a media stream. My code looks like this
:

OpalMediaStream * BufferConnection::CreateMediaStream(
      const OpalMediaFormat & mediaFormat, /// Media format for stream
      unsigned sessionID,                  /// Session number for stream
      BOOL isSource                        /// Is a source stream
                                                        )
{
  if (sessionID != OpalMediaFormat::DefaultAudioSessionID)
    return OpalConnection::CreateMediaStream(mediaFormat, sessionID, isSource);

	srand((int)time(NULL));

	PString str(rand());
	PString filename;

	if (!isSource)
	{
	        filename = "out " + str + ".wav";
	}
	else
	{
		filename = "test8k.wav";
	}

	if (!PFile::Exists(filename))
	 return NULL;

	OpalWAVFile * file = new OpalWAVFile(filename);

	file->Open();

	return new OpalFileMediaStream(mediaFormat, sessionID, isSource, file);
}

I use a "PCMU" media format.
How could I convert 8kHz WAV samples into PCMU samples ??

Damien

> Hi Damien,
>
> That code chunk looks fine to me, I'm doing something very similar to
> statically add a known, custom media format and it works for me.
>
> MediaFormats can be tricky, it's possible that you may need to call
> OpalMediaFormat::SetRegisteredMediaFormat(format) on them as well at
> some point in time.  I don't know if that's exactly the problem, but I
> remember having some issues related to that with similar errors as
> yourself.  Generally you only call that function after you instantate a
> new format and set media options, but it might be worth a shot.  As
> well, take a look at sipcon.cxx (if using SIP) or h323neg.cxx (H323) and
> take a look at what conditions are triggering the
> EndedByCapabilityExchange error, you might find some info there.
>
> Josh
>
> damd@xxxxxxx wrote:
> > hello,
> >
> > does anybody know how and when opal media formats are statically registered
> ?
> >
> > I'd like to create an endpoint that handles audio memory buffers. The media
> > decription function looks like this:
> >
> > OpalMediaFormatList BufferEndPoint::GetMediaFormats() const
> > {
> >   OpalMediaFormatList formats;
> >
> >   formats+=OpalPCM16;
> >   formats+=OpalL16_MONO_8KHZ;
> >   formats+=OpalL16_MONO_16KHZ;
> >   ...
> >   formats+= OpalG7231A_5k3;
> >   formats+= OpalRFC2833;
> >
> >   formats+= OpalG711ALaw;
> >
> >   AddVideoMediaFormats(formats);
> >   return formats;
> > }
> >
> > It appears that the media formats are registred after a first call, leading
> to a
> >  "EndedByCapabilityExchange" error message during the first call.
> >
> > Any help would be appreciated,
> >
> > Damien
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc.
> > Still grepping through log files to find problems?  Stop.
> > Now Search log events and configuration files using AJAX and a browser.
> > Download your FREE copy of Splunk now >>  http://get.splunk.com/
> > _______________________________________________
> > Openh323-devel mailing list
> > Openh323-devel@xxxxxxxxxxxxxxxxxxxxx
> > https://lists.sourceforge.net/lists/listinfo/openh323-devel
> >
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Openh323-devel mailing list
> Openh323-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/openh323-devel
>



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Openh323-devel mailing list
Openh323-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/openh323-devel

[Open H.323]     [IETF SIP]     [Gnu Gatekeeper]     [Asterisk PBX]     [Fedora Linux]     [Gimp]     [Yosemite News]     [Yosemite Photos]     [Yosemite Campsites]     [ISDN Cause Codes]

Add to Google Powered by Linux