From d2ffec9dcf86a65e1725a088eea430978bf0e8e6 Mon Sep 17 00:00:00 2001 From: csoutheren Date: Mon, 3 May 2004 00:59:18 +0000 Subject: [PATCH] Fixed problem with OpalMediaFormat::GetMediaFormatsList Added new version of OpalMediaFormat::GetMediaFormatsList that minimses copying --- include/opal/mediafmt.h | 6 +++++- src/opal/mediafmt.cxx | 16 +++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/include/opal/mediafmt.h b/include/opal/mediafmt.h index 98f1f90d..d9fed1e2 100644 --- a/include/opal/mediafmt.h +++ b/include/opal/mediafmt.h @@ -25,6 +25,10 @@ * Contributor(s): ______________________________________. * * $Log$ + * Revision 2.21 2004/05/03 00:59:18 csoutheren + * Fixed problem with OpalMediaFormat::GetMediaFormatsList + * Added new version of OpalMediaFormat::GetMediaFormatsList that minimses copying + * * Revision 2.20 2004/03/22 11:32:41 rjongbloed * Added new codec type for 16 bit Linear PCM as must distinguish between the internal * format used by such things as the sound card and the RTP payload format which @@ -426,7 +430,7 @@ class OpalMediaFormat : public PCaselessString /**Get a copy of the list of media formats that have been registered. */ static OpalMediaFormatList GetAllRegisteredMediaFormats(); - + static void GetAllRegisteredMediaFormats(OpalMediaFormatList & copy); protected: RTP_DataFrame::PayloadTypes rtpPayloadType; diff --git a/src/opal/mediafmt.cxx b/src/opal/mediafmt.cxx index 0e0e70b5..c166637e 100644 --- a/src/opal/mediafmt.cxx +++ b/src/opal/mediafmt.cxx @@ -24,6 +24,10 @@ * Contributor(s): ______________________________________. * * $Log$ + * Revision 2.22 2004/05/03 00:59:19 csoutheren + * Fixed problem with OpalMediaFormat::GetMediaFormatsList + * Added new version of OpalMediaFormat::GetMediaFormatsList that minimses copying + * * Revision 2.21 2004/03/25 11:48:48 rjongbloed * Changed PCM-16 from IllegalPayloadType to MaxPayloadType to avoid problems * in other parts of the code. @@ -481,20 +485,22 @@ OpalMediaFormat & OpalMediaFormat::operator=(const PString & wildcard) } -OpalMediaFormatList OpalMediaFormat::GetAllRegisteredMediaFormats() +void OpalMediaFormat::GetAllRegisteredMediaFormats(OpalMediaFormatList & copy) { - OpalMediaFormatList copy; - PWaitAndSignal mutex(GetMediaFormatsListMutex()); const OpalMediaFormatList & registeredFormats = GetMediaFormatsList(); for (PINDEX i = 0; i < registeredFormats.GetSize(); i++) - copy.OpalMediaFormatBaseList::Append(®isteredFormats[i]); + copy.OpalMediaFormatBaseList::Append(registeredFormats[i].Clone()); +} +OpalMediaFormatList OpalMediaFormat::GetAllRegisteredMediaFormats() +{ + OpalMediaFormatList copy; + GetAllRegisteredMediaFormats(copy); return copy; } - OpalMediaFormatList & OpalMediaFormat::GetMediaFormatsList() { static OpalMediaFormatList registeredFormats; -- 2.11.4.GIT