Re: [Opalvoip-user] Trable with adjisting media formats in OpenSourceMediaStreams
Brought to you by:
csoutheren,
rjongbloed
From: Robert J. <ro...@vo...> - 2009-10-27 22:24:05
|
Looks like correct behaviour to me, even if different to before. If you set the media format mask at the manager level to exclude G.711 then G.711 is excluded for ALL endpoints. That makes perfect sense to me. How can the system know which endpoints to apply the mask and which not? However, I can see your difficulty, even if you override the AdjustMediaFormats() functions to control the availability on a per connection basis, it will still only give the intersection of the media format sets. To get around I have added an extra parameter to the AdjustMediaFormats() to help if it is adjusting the media formats for some other connection, that way you can override it and adjust the formats correctly for your application. Alternatively you can set the OPAL_OPT_REMOVE_CODEC string option on a connection basis which I think (at least now) would achieve the same thing. Robert Jongbloed OPAL/OpenH323/PTLib Architect and Co-founder. From: Yuriy Cherniavsky [mailto:yur...@gm...] Sent: Wednesday, 28 October 2009 8:01 AM To: opa...@li... Subject: [Opalvoip-user] Trable with adjisting media formats in OpenSourceMediaStreams Hi OPAL community. My use case is H323 -> OPAL -> MyEndPoint. My EndPoint connections may processing only G711. >From H323 I wish to receive only for example G729 and G723.1 in corresponding order. So two stage transcoding require (G729 -> PCM -> G711). I implement this by SetMediaFormatOrder to [G729, G723.1] and SetMediaFormatMask to [all except G729, G723.1]. All work perfect till commit number 23581 of rjongbloed "Added ability for connections to get in and adjust media formats during OPenSourceMediaStreams execution.", Index: call.cxx =================================================================== --- call.cxx (revision 23580) +++ call.cxx (revision 23581) @@ -477,6 +477,8 @@ order += '@' + mediaType; // And media of the same type OpalMediaFormatList sinkMediaFormats = otherConnection->GetMediaFormats(); + otherConnection->AdjustMediaFormats(sinkMediaFormats); + connection.AdjustMediaFormats(sinkMediaFormats); if (preselectedFormat.IsValid() && sinkMediaFormats.HasFormat(preselectedFormat)) sinkMediaFormats = preselectedFormat; else @@ -487,6 +489,8 @@ sourceMediaFormats = sourceFormat; // Use the source format already established else { sourceMediaFormats = connection.GetMediaFormats(); + otherConnection->AdjustMediaFormats(sourceMediaFormats); + connection.AdjustMediaFormats(sourceMediaFormats); if (preselectedFormat.IsValid() && sourceMediaFormats.HasFormat(preselectedFormat)) sourceMediaFormats = preselectedFormat; else Now I receive this message in log (and no correct media streams are opening in result): call.cxx(509) Call OpenSourceMediaStreams failed with no source formats for audio session 1 on Call[C4b6633511]-EP<voipadapt>[adaptconnection/1] because default implementation of AdjustMediaFormats gets from OpalManager: void OpalManager::AdjustMediaFormats(const OpalConnection & /*connection*/, OpalMediaFormatList & mediaFormats) const { mediaFormats.Remove(mediaFormatMask); mediaFormats.Reorder(mediaFormatOrder); } so sourceMediaFormats = connection.GetMediaFormats(); << call.cxx:505 return G711 in sourceMediaFormats variable, and after otherConnection->AdjustMediaFormats(sourceMediaFormats); connection.AdjustMediaFormats(sourceMediaFormats); G711 codec removed from sourceMediaFormats variable due to default implementation of AdjustMediaFormats method. Does something wrong with this commit or something wrong with my logic? Please explain how I need to implement such behavior, if problem in my logic. Or correct this commit, if problem in it. Truly yours, Yuriy. |