<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=koi8-r"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=RU link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hello.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>As far as I understand live555 keep track the created ‘objects’ in internal containers so my guess was it is possible to iterate over that containers.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>What I need is to enumerate all rtspclients. According to this comment <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>// A data structure for looking up a Medium by its string name.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>// (It is used only to implement "Medium", but we make it visible here, in case developers want to use it to iterate over<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>//š the whole set of "Medium" objects that we've created.)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I used MediaLookupTable and my ‘environment’ pointer:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>ššššššššššššššš MediaLookupTable* ptable = MediaLookupTable::ourMedia(*pliveenvironment);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>ššššššššššššššš HashTable const& objects = ptable->getTable();<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>ššššššššššššššš HashTable::Iterator* piterator = HashTable::Iterator::create(objects);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>ššššššššššššššš MediaSession* pmediasession;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>ššššššššššššššš vector<MediaSession*> clients; // put here all found clients<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>ššššššššššššššš char</span><span lang=EN-US> </span><span lang=EN-US>const</span>* <span lang=EN-US>key</span>;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>ššššššššššššššš <span lang=EN-US>while ( (pmediasession = (MediaSession*)piterator->next(key)) != NULL )<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>šššššššššššššššššššššššššššššš if (pmediasession->isRTSPClient())<o:p></o:p></span></p><p class=MsoNormal style='margin-left:70.8pt;text-indent:35.4pt'><span lang=EN-US>clients.push_back(pmediasession); // if it is RTSPClient put it to vector<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>ššššššššššššššš delete piterator;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>This works, but later I noticed a memory leak in MediaLookupTable::ourMedia:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>MediaLookupTable* MediaLookupTable::ourMedia(UsageEnvironment& env) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>š _Tables* ourTables = _Tables::getOurTables(env);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>š if (ourTables->mediaTable == NULL) {<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>ššš // Create a new table to record the media that are to be created in<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>ššš // this environment:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>ššš ourTables->mediaTable = new MediaLookupTable(env);<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>š }<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>š return ourTables->mediaTable;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>}<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>My ptable pointer allocated in MediaLookupTable::ourMedia but never deleted, and I can’t delete it myself – the destructor is protected.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>So, I think I am doing something wrong. Maybe another way exists to enumerate all specific objects?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>WBR<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>