<html><body><span class="xfm_50909489">
  <span>Hi Simon,</span>
  <div>
    <span class="xfm_50909489">
      <br/></span>
  </div>
  <div>
    <span class="xfm_50909489">Ok, I will describe my point of view with details...</span>
  </div>
  <div>
    <span class="xfm_50909489">
      <br/></span>
  </div>
  <div>For now we have this implementation (from the CVS):</div>
  <div>
    <br/></div>
  <div>
    <table cellspacing="0" cellpadding="0" style="width: 1209px; margin: 0px; border: none; font-family: sans-serif; font-size: medium;"><tbody><tr class="vc_row_odd" id="l1642" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1642</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;"><span class="pygments-kt" style="color: rgb(176, 0, 64);">void</span> <span class="pygments-n">H323ExtendedVideoCapability</span><span class="pygments-o" style="color: rgb(102, 102, 102);">::</span><span class="pygments-n">AddAllCapabilities</span><span class="pygments-p">(</span>
</td>
        </tr><tr class="vc_row_odd" id="l1643" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1643</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">      <span class="pygments-n">H323Capabilities</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">&</span> <span class="pygments-n">basecapabilities</span><span class="pygments-p">,</span> <span class="pygments-n">PINDEX</span> <span class="pygments-n">descriptorNum</span><span class="pygments-p">,</span><span class="pygments-n">PINDEX</span> <span class="pygments-n">simultaneous</span><span class="pygments-p">)</span>
</td>
        </tr><tr class="vc_row_odd" id="l1644" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1644</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;"><span class="pygments-p">{</span>
</td>
        </tr><tr class="vc_row_odd" id="l1645" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1645</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">  <span class="pygments-n">H323ExtendedVideoFactory</span><span class="pygments-o" style="color: rgb(102, 102, 102);">::</span><span class="pygments-n">KeyList_T</span> <span class="pygments-n">extCaps</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">=</span> <span class="pygments-n">H323ExtendedVideoFactory</span><span class="pygments-o" style="color: rgb(102, 102, 102);">::</span><span class="pygments-n">GetKeyList</span><span class="pygments-p">();</span>
</td>
        </tr><tr class="vc_row_odd" id="l1646" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1646</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">  <span class="pygments-k" style="color: rgb(0, 128, 0); font-weight: bold;">if</span> <span class="pygments-p">(</span><span class="pygments-n">extCaps</span><span class="pygments-p">.</span><span class="pygments-n">size</span><span class="pygments-p">()</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">></span> <span class="pygments-mi" style="color: rgb(102, 102, 102);">0</span><span class="pygments-p">)</span> <span class="pygments-p">{</span>
</td>
        </tr><tr class="vc_row_odd" id="l1647" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1647</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">    <span class="pygments-n">H323CodecExtendedVideoCapability</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">*</span> <span class="pygments-n">capability</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">=</span> <span class="pygments-k" style="color: rgb(0, 128, 0); font-weight: bold;">new</span> <span class="pygments-n">H323CodecExtendedVideoCapability</span><span class="pygments-p">();</span>
</td>
        </tr><tr class="vc_row_odd" id="l1648" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1648</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">    <span class="pygments-n">H323ExtendedVideoFactory</span><span class="pygments-o" style="color: rgb(102, 102, 102);">::</span><span class="pygments-n">KeyList_T</span><span class="pygments-o" style="color: rgb(102, 102, 102);">::</span><span class="pygments-n">const_iterator</span> <span class="pygments-n">r</span><span class="pygments-p">;</span>
</td>
        </tr><tr class="vc_row_odd" id="l1649" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1649</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">        <span class="pygments-n">PINDEX</span> <span class="pygments-n">num</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">=</span> <span class="pygments-n">P_MAX_INDEX</span><span class="pygments-p">;</span>
</td>
        </tr><tr class="vc_row_odd" id="l1650" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1650</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">        <span class="pygments-k" style="color: rgb(0, 128, 0); font-weight: bold;">for</span> <span class="pygments-p">(</span><span class="pygments-n">r</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">=</span> <span class="pygments-n">extCaps</span><span class="pygments-p">.</span><span class="pygments-n">begin</span><span class="pygments-p">();</span> <span class="pygments-n">r</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">!=</span> <span class="pygments-n">extCaps</span><span class="pygments-p">.</span><span class="pygments-n">end</span><span class="pygments-p">();</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">++</span><span class="pygments-n">r</span><span class="pygments-p">)</span> <span class="pygments-p">{</span>
</td>
        </tr><tr class="vc_row_odd" id="l1651" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1651</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">           <span class="pygments-n">H323Capability</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">*</span> <span class="pygments-n">childCap</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">=</span> <span class="pygments-n">H323ExtendedVideoFactory</span><span class="pygments-o" style="color: rgb(102, 102, 102);">::</span><span class="pygments-n">CreateInstance</span><span class="pygments-p">(</span><span class="pygments-o" style="color: rgb(102, 102, 102);">*</span><span class="pygments-n">r</span><span class="pygments-p">);</span>
</td>
        </tr><tr class="vc_row_odd" id="l1652" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1652</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">           <span class="pygments-k" style="color: rgb(0, 128, 0); font-weight: bold;">if</span> <span class="pygments-p">(</span><span class="pygments-n">childCap</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">!=</span> <span class="pygments-nb" style="color: rgb(0, 128, 0);">NULL</span><span class="pygments-p">)</span> <span class="pygments-p">{</span>
</td>
        </tr><tr class="vc_row_odd" id="l1653" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1653</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">               <span class="pygments-n">H323CodecExtendedVideoCapability</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">*</span> <span class="pygments-n">extCapability</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">=</span> <span class="pygments-p">(</span><span class="pygments-n">H323CodecExtendedVideoCapability</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">*</span><span class="pygments-p">)</span><span class="pygments-n">capability</span><span class="pygments-o" style="color: rgb(102, 102, 102);">-></span><span class="pygments-n">Clone</span><span class="pygments-p">();</span>
</td>
        </tr><tr class="vc_row_odd" id="l1654" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1654</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">               <span class="pygments-n">extCapability</span><span class="pygments-o" style="color: rgb(102, 102, 102);">-></span><span class="pygments-n">AddCapability</span><span class="pygments-p">(</span><span class="pygments-n">childCap</span><span class="pygments-p">);</span>
</td>
        </tr><tr class="vc_row_odd" id="l1655" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1655</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">               <span class="pygments-n">num</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">=</span> <span class="pygments-n">basecapabilities</span><span class="pygments-p">.</span><span class="pygments-n">SetCapability</span><span class="pygments-p">(</span><span class="pygments-n">descriptorNum</span><span class="pygments-p">,</span> <span class="pygments-n">simultaneous</span><span class="pygments-p">,</span> <span class="pygments-n">extCapability</span><span class="pygments-p">);</span>
</td>
        </tr><tr class="vc_row_odd" id="l1656" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1656</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">               <span class="pygments-n">simultaneous</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">=</span> <span class="pygments-n">num</span><span class="pygments-p">;</span>
</td>
        </tr><tr class="vc_row_odd" id="l1657" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1657</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">               <span class="pygments-k" style="color: rgb(0, 128, 0); font-weight: bold;">delete</span> <span class="pygments-n">childCap</span><span class="pygments-p">;</span>
</td>
        </tr><tr class="vc_row_odd" id="l1658" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1658</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">           <span class="pygments-p">}</span>
</td>
        </tr><tr class="vc_row_odd" id="l1659" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1659</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">        <span class="pygments-p">}</span>
</td>
        </tr><tr class="vc_row_odd" id="l1660" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1660</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">    <span class="pygments-n">simultaneous</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">=</span> <span class="pygments-n">P_MAX_INDEX</span><span class="pygments-p">;</span>
</td>
        </tr><tr class="vc_row_odd" id="l1661" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1661</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">    <span class="pygments-n">basecapabilities</span><span class="pygments-p">.</span><span class="pygments-n">SetCapability</span><span class="pygments-p">(</span><span class="pygments-n">descriptorNum</span><span class="pygments-p">,</span> <span class="pygments-n">simultaneous</span><span class="pygments-p">,</span><span class="pygments-k" style="color: rgb(0, 128, 0); font-weight: bold;">new</span> <span class="pygments-n">H323ControlExtendedVideoCapability</span><span class="pygments-p">());</span>
</td>
        </tr><tr class="vc_row_odd" id="l1662" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1662</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">    <span class="pygments-k" style="color: rgb(0, 128, 0); font-weight: bold;">delete</span> <span class="pygments-n">capability</span><span class="pygments-p">;</span>
</td>
        </tr><tr class="vc_row_odd" id="l1663" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1663</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">  <span class="pygments-p">}</span> 
</td>
        </tr><tr class="vc_row_odd" id="l1664" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">1664</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">
            <span class="pygments-p">}


</span>
          </td>
        </tr></tbody></table></div>
  <div>
    <table cellspacing="0" cellpadding="0" style="width: 1209px; margin: 0px; border: none; font-family: sans-serif; font-size: medium;"><tbody><tr class="vc_row_odd" id="l2023" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">2023</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;"><span class="pygments-kt" style="color: rgb(176, 0, 64);">void</span> <span class="pygments-n">H323CodecExtendedVideoCapability</span><span class="pygments-o" style="color: rgb(102, 102, 102);">::</span><span class="pygments-n">AddCapability</span><span class="pygments-p">(</span><span class="pygments-k" style="color: rgb(0, 128, 0); font-weight: bold;">const</span> <span class="pygments-n">PString</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">&</span> <span class="pygments-n">cap</span><span class="pygments-p">)</span>
</td>
        </tr><tr class="vc_row_odd" id="l2024" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">2024</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;"><span class="pygments-p">{</span>
</td>
        </tr><tr class="vc_row_odd" id="l2025" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">2025</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">    <span class="pygments-n">extCapabilities</span><span class="pygments-p">.</span><span class="pygments-n">Add</span><span class="pygments-p">(</span><span class="pygments-n">H323ExtendedVideoFactory</span><span class="pygments-o" style="color: rgb(102, 102, 102);">::</span><span class="pygments-n">CreateInstance</span><span class="pygments-p">(</span><span class="pygments-n">cap</span><span class="pygments-p">));</span>
</td>
        </tr><tr class="vc_row_odd" id="l2026" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">2026</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;"><span class="pygments-p">}</span>
</td>
        </tr><tr class="vc_row_odd" id="l2027" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">2027</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">
</td>
        </tr><tr class="vc_row_odd" id="l2028" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">2028</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;"><span class="pygments-kt" style="color: rgb(176, 0, 64);">void</span> <span class="pygments-n">H323CodecExtendedVideoCapability</span><span class="pygments-o" style="color: rgb(102, 102, 102);">::</span><span class="pygments-n">AddCapability</span><span class="pygments-p">(</span><span class="pygments-n">H323Capability</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">*</span> <span class="pygments-n">capability</span><span class="pygments-p">)</span>
</td>
        </tr><tr class="vc_row_odd" id="l2029" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">2029</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;"><span class="pygments-p">{</span>
</td>
        </tr><tr class="vc_row_odd" id="l2030" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">2030</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">    <span class="pygments-n">extCapabilities</span><span class="pygments-p">.</span><span class="pygments-n">Add</span><span class="pygments-p">((</span><span class="pygments-n">H323Capability</span> <span class="pygments-o" style="color: rgb(102, 102, 102);">*</span><span class="pygments-p">)</span><span class="pygments-n">capability</span><span class="pygments-o" style="color: rgb(102, 102, 102);">-></span><span class="pygments-n">Clone</span><span class="pygments-p">());</span>
</td>
        </tr><tr class="vc_row_odd" id="l2031" style="vertical-align: top; background-color: rgb(240, 240, 240);"><td class="vc_file_line_number" style="vertical-align: top; border-right-width: 1px; color: rgb(80, 80, 80); text-align: right; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: rgb(238, 238, 238);">2031</td>
          <td class="vc_file_line_text" style="vertical-align: top; border-right-width: 0px; font-family: monospace; white-space: pre; width: 1152px; border-right-style: solid; border-right-color: rgb(80, 80, 80); padding: 1px 5px; background-color: white;">
            <span class="pygments-p">}</span>
          </td>
        </tr></tbody></table></div>
  <div>
    <span class="xfm_50909489">
      <br/></span>
  </div>
  <div>
    <span class="xfm_50909489">
      <br/></span>
  </div>
  <div>
    <span class="xfm_50909489">I see some issues for current implementation:</span>
  </div>
  <div>
    <span class="xfm_50909489">
      <br/></span>
  </div>
  <div><span class="xfm_50909489">1.If someone just calls </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323CodecExtendedVideoCapability</span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">::</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">AddCapability</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">(</span><span class="pygments-k" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(0, 128, 0); font-weight: bold;">const</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">PString</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">&</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">cap</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">)</span> manually - we will have the crash in result because of "double delete" for same pointer. The is absolutelly same issue from my first email. And that issue still not solved.</div>
  <div><span class="xfm_50909489">2.We have new AddCapability(H323Capability*) finction which has potential (and real) memory leak because it's behaviour a bit strange and not transparent as for me. This function confused me. For example, we have </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323Capability</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-o" style="color: rgb(102, 102, 102); font-family: monospace; font-size: medium; white-space: pre;">*</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323Capability</span><span class="pygments-o" style="color: rgb(102, 102, 102); font-family: monospace; font-size: medium; white-space: pre;">::</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">Create</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">(</span><span class="pygments-k" style="color: rgb(0, 128, 0); font-weight: bold; font-family: monospace; font-size: medium; white-space: pre;">const</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">PString</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-o" style="color: rgb(102, 102, 102); font-family: monospace; font-size: medium; white-space: pre;">&</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">name</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">)</span> function and this function doing that that it should.</div>
  <div>3.Fix for <span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323ExtendedVideoCapability</span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">::</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">AddAllCapabilities</span> function doing some redundant work - basically all that new work it is deal of AddCapability(const PString&) function that we have had before the fix. Also, checking to !NULL has no sense, because it works with internal KeyList that returns the Factory, that factory has real pairs <keyname,pointer_to_object> and it is impossible to get a Key without an Object... We have no memory leak but it is simplest to use AddCapability(const PString&) with simplest fix for same goal.</div>
  <div>
    <span class="xfm_50909489">
      <br/></span>
  </div>
  <div>
    <span class="xfm_50909489">My proposition the same I have had from the beginning:</span>
  </div>
  <div>1.Remove <span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323CodecExtendedVideoCapability</span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">::</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">AddCapability</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">(</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323Capability</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">*</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">capability</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">) </span>function - we don't need it at all. If someone need to have this function - don't need to clone the pointer like we have now. It is only confuse us, plus  we have a potential memory leak in result.</div>
  <div>2.Revert <span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323ExtendedVideoCapability</span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">::</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">AddAllCapabilities</span> back as we have had before the fix - first version of that function is absolutelly clear and has no any problem.</div>
  <div>3.Modify <span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323CodecExtendedVideoCapability</span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">::</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">AddCapability</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">(</span><span class="pygments-k" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(0, 128, 0); font-weight: bold;">const</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">PString</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">&</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">cap</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">) </span>function to "clone" the object that returns by <span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323ExtendedVideoFactory</span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">::</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">CreateInstance</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">(</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">cap</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">) </span>code - in resul H323CodecExtendedVideoCapability object will work with copy object only and will delete copy object too. No any memory leak or other undefined behavior.</div>
  <div>
    <br/></div>
  <div>Also possible to modify a bit <span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">H323CodecExtendedVideoCapability</span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">::</span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">AddCapability</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">(</span><span class="pygments-k" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(0, 128, 0); font-weight: bold;">const</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">PString</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-o" style="font-family: monospace; font-size: medium; white-space: pre; color: rgb(102, 102, 102);">&</span><span style="font-family: monospace; font-size: medium; white-space: pre;"> </span><span class="pygments-n" style="font-family: monospace; font-size: medium; white-space: pre;">cap</span><span class="pygments-p" style="font-family: monospace; font-size: medium; white-space: pre;">) </span>function, but it is not mandatory... I'm talking about a case when someone puts wrong parameter, for example a string which has no related Capability - for this case the Factory returns NULL and we will have a crash during attempt to clone the NULL-capability.</div>
  <div>I can propose to replace that func to something like this (in result we able to control wrong parameters):</div>
  <div>
    <br/></div>
  <div>H323Capability* H323CodecExtendedVideoCapability::AddCapability(const PString & cap)</div>
  <div>
    <div>{</div>
    <div>    H323Capability* p = H323ExtendedVideoFactory::CreateInstance(cap);</div>
    <div>    if (!p)</div>
    <div>      return p;</div>
    <div>
      <br/></div>
    <div>    p = (H323Capability*)p->clone();</div>
    <div>    extCapabilities.Add(p);</div>
    <div>
      <br/></div>
    <div>    return p;</div>
    <div>}</div>
  </div>
  <div>
    <br/></div>
  <div>
    <span class="xfm_50909489">
      <br/></span>
  </div>
  <div>
    <span class="xfm_50909489">Thank's and good luck</span>
  </div>
  <div>
    <span class="xfm_50909489">--</span>
  </div>
  <div>
    <span class="xfm_50909489">Iurii Gordiienko<br/><br/><div style="font-size:14px;font-style:italic;">
24 January 2016, 23:22:24, by "Simon Horne" <<a href="mailto:s.horne@packetizer.com" target="_self">s.horne@packetizer.com</a>>:<br/></div>
<br/><blockquote style="border-left:1px solid rgb(204, 204, 204);margin:0px 0px 0px 0.8ex;padding-left:1ex;">
<span>
  <span>
    <style>.xfm_50909489 <!-- @font-face{font-family:Calibri;}
.xfm_50909489 p.xfmc1,.xfm_50909489 li.xfmc1,.xfm_50909489 div.xfmc1{margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New Roman",serif;}
.xfm_50909489 a:link,.xfm_50909489 span.xfmc2{color:blue;text-decoration:underline;}
.xfm_50909489 a:visited,.xfm_50909489 span.xfmc3{color:purple;text-decoration:underline;}
.xfm_50909489 pre{margin:0in;margin-bottom:.0001pt;font-size:10.0pt;font-family:"Courier New";}
.xfm_50909489 span.xfmc4{font-family:"Consolas",serif;}
.xfm_50909489 span.xfmc5{font-family:"Calibri",sans-serif;color:#1F497D;}
.xfm_50909489 .xfmc6{font-size:10.0pt;}</style></span>
  <span lang="EN-US">
    <div class="xfmc7">
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">Iurii</span></p><p></p>
      <p></p>
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">
          </span></p><p> </p>
        
      <p></p>
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">I’m confused. There is no difference in the functionality except to resolve the memory leak. H323ExtendedVideoFactory::CreateInstance may return a NULL (unlikely tho’) which also needs to be checked. The change simply separates the CreateInstance, checks for NULL then clone() in basically the same place (another function) as the old implementation.</span></p><p></p>
      <p></p>
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">
          </span></p><p> </p>
        
      <p></p>
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">You are correct in that VLD like Valgrind detects a leak with the codec factory system with plugin codecs because the codecs are loaded as pointers to the singleton. The singleton is only created at startup and destroyed at shutdown so do not grow on a call-by-call basis. </span></p><p></p>
      <p></p>
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">
          </span></p><p> </p>
        
      <p></p>
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">There is also a small leak per call with some MediaOptions not being cleaned up. This is an issue as this is on a call-by-call basis. Fixes for that are welcome.</span></p><p></p>
      <p></p>
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">
          </span></p><p> </p>
        
      <p></p>
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">Simon</span></p><p></p>
      <p></p>
      <p class="xfmc1">
        <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;">
          </span></p><p> </p>
        
      <p></p>
      <div>
        <div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in;">
          <p class="xfmc1">
            <b>
              <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;">From:</span>
            </b>
            <span style="font-size:11.0pt;font-family:"Calibri",sans-serif;"> Iurii Gordiienko [mailto:hordi@ukr.net] <br/><b>Sent:</b> Monday, January 25, 2016 4:27 AM<br/><b>To:</b> Simon Horne <<a href="mailto:s.horne@packetizer.com" target="_blank">s.horne@packetizer.com</a>><br/><b>Cc:</b> 'Jan Willamowius' <<a href="mailto:jan@willamowius.de" target="_blank">jan@willamowius.de</a>>; <a href="mailto:h323plus@lists.packetizer.com" target="_blank">h323plus@lists.packetizer.com</a><br/><b>Subject:</b> Re[2]: [h323plus] Double-delete Capability bug</span></p><p></p>
          <p></p>
        </div>
      </div>
      <p class="xfmc1">
        </p><p> </p>
      
      <div>
        <p class="xfmc1">I'm sure - current implementations ::AddCapability are wrong - we should't clone the pointer for <span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">H323CodecExtendedVideoCapability</span></span><span class="xfmc9"><span style="font-size:13.5pt;font-family:"Courier New";color:#666666;">::</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">AddCapability</span></span><span class="xfmc10"><span style="font-size:13.5pt;font-family:"Courier New";">(</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">H323Capability</span></span><span style="font-size:13.5pt;font-family:"Courier New";"> <span class="xfmc9"><span style="color:#666666;">*</span></span> <span class="xfmc8">capability</span><span class="xfmc10">)</span></span> function and should clone for <span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">H323CodecExtendedVideoCapability</span></span><span class="xfmc9"><span style="font-size:13.5pt;font-family:"Courier New";color:#666666;">::</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">AddCapability</span></span><span class="xfmc10"><span style="font-size:13.5pt;font-family:"Courier New";">(</span></span><span class="xfmc11"><b><span style="font-size:13.5pt;font-family:"Courier New";color:green;">const</span></b></span><span style="font-size:13.5pt;font-family:"Courier New";"> <span class="xfmc8">PString</span> <span class="xfmc9"><span style="color:#666666;">&</span></span> <span class="xfmc8">cap</span><span class="xfmc10">) </span></span>function. I think, Valgrind shows memory leak for case when we are using <span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">extCapabilities</span></span><span class="xfmc10"><span style="font-size:13.5pt;font-family:"Courier New";">.</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">Add</span></span><span class="xfmc10"><span style="font-size:13.5pt;font-family:"Courier New";">(</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">H323ExtendedVideoFactory</span></span><span class="xfmc9"><span style="font-size:13.5pt;font-family:"Courier New";color:#666666;">::</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">CreateInstance</span></span><span class="xfmc10"><span style="font-size:13.5pt;font-family:"Courier New";">(</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">cap</span></span><span class="xfmc10"><span style="font-size:13.5pt;font-family:"Courier New";">)->clone()) (forr </span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">H323CodecExtendedVideoCapability</span></span><span class="xfmc9"><span style="font-size:13.5pt;font-family:"Courier New";color:#666666;">::</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">AddCapability</span></span><span class="xfmc10"><span style="font-size:13.5pt;font-family:"Courier New";">(</span></span><span class="xfmc11"><b><span style="font-size:13.5pt;font-family:"Courier New";color:green;">const</span></b></span><span style="font-size:13.5pt;font-family:"Courier New";"> <span class="xfmc8">PString</span> <span class="xfmc9"><span style="color:#666666;">&</span></span> <span class="xfmc8">cap</span><span class="xfmc10">))</span></span> because we have no any default mechanism to clear (delete all capabilities) capabilities factory - we have static factory objects as I remember and Valgrind don't see any desctructor execution. I will write (tomorrow ) simple app and show you proper behavior and destructors execution.</p><p></p>
      </div>
      <div>
        <p class="xfmc1">We can't use current version (with clone()) of <span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">H323CodecExtendedVideoCapability</span></span><span class="xfmc9"><span style="font-size:13.5pt;font-family:"Courier New";color:#666666;">::</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">AddCapability</span></span><span class="xfmc10"><span style="font-size:13.5pt;font-family:"Courier New";">(</span></span><span class="xfmc8"><span style="font-size:13.5pt;font-family:"Courier New";">H323Capability</span></span><span style="font-size:13.5pt;font-family:"Courier New";"> <span class="xfmc9"><span style="color:#666666;">*</span></span> <span class="xfmc8">capability</span><span class="xfmc10">) </span></span>fuction because that function has been declared as owner of pointer to H323Capability and any user expects that <span style="font-size:13.5pt;font-family:"Courier New";">H323CodecExtendedVideoCapability </span>object will delete that pointer in own destructor. Whis current modiification we have 100% memory leak because it has not declared behaviour.</p><p></p>
      </div>
      <div>
        <p class="xfmc1">
          </p><p> </p>
        
      </div>
      <div>
        <p class="xfmc1">
          </p><p> </p>
        
      </div>
      <div>
        <table class="xfmc12" border="0" cellspacing="0" cellpadding="0" width="1209" style="width:906.75pt;"><tbody><tr id="xfmi1"><td valign="top" style="border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1" align="right" style="text-align:right;">
                <span style="font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050;">2023</span></p><p></p>
              <p></p>
            </td>
            <td width="1152" valign="top" style="width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1">
                <span class="xfmc13">
                  <span style="font-size:13.5pt;font-family:"Courier New";color:#B00040;">void</span>
                </span>
                <span style="font-size:13.5pt;font-family:"Courier New";"> <span class="xfmc8">H323CodecExtendedVideoCapability</span><span class="xfmc9"><span style="color:#666666;">::</span></span><span class="xfmc8">AddCapability</span><span class="xfmc10">(</span><span class="xfmc11"><b><span style="color:green;">const</span></b></span> <span class="xfmc8">PString</span> <span class="xfmc9"><span style="color:#666666;">&</span></span> <span class="xfmc8">cap</span><span class="xfmc10">)</span></span></p><p></p>
              <p></p>
            </td>
          </tr><tr id="xfmi2"><td valign="top" style="border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1" align="right" style="text-align:right;">
                <span style="font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050;">2024</span></p><p></p>
              <p></p>
            </td>
            <td width="1152" valign="top" style="width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1">
                <span class="xfmc10">
                  <span style="font-size:13.5pt;font-family:"Courier New";">{</span>
                </span>
                <span style="font-size:13.5pt;font-family:"Courier New";">
                  </span></p><p></p>
                
              <p></p>
            </td>
          </tr><tr id="xfmi3"><td valign="top" style="border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1" align="right" style="text-align:right;">
                <span style="font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050;">2025</span></p><p></p>
              <p></p>
            </td>
            <td width="1152" valign="top" style="width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1">
                <span style="font-size:13.5pt;font-family:"Courier New";">    <span class="xfmc8">extCapabilities</span><span class="xfmc10">.</span><span class="xfmc8">Add</span><span class="xfmc10">(</span><span class="xfmc8">H323ExtendedVideoFactory</span><span class="xfmc9"><span style="color:#666666;">::</span></span><span class="xfmc8">CreateInstance</span><span class="xfmc10">(</span><span class="xfmc8">cap</span><span class="xfmc10">));</span></span></p><p></p>
              <p></p>
            </td>
          </tr><tr id="xfmi4"><td valign="top" style="border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1" align="right" style="text-align:right;">
                <span style="font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050;">2026</span></p><p></p>
              <p></p>
            </td>
            <td width="1152" valign="top" style="width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1">
                <span class="xfmc10">
                  <span style="font-size:13.5pt;font-family:"Courier New";">}</span>
                </span>
                <span style="font-size:13.5pt;font-family:"Courier New";">
                  </span></p><p></p>
                
              <p></p>
            </td>
          </tr><tr id="xfmi5"><td valign="top" style="border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1" align="right" style="text-align:right;">
                <span style="font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050;">2027</span></p><p></p>
              <p></p>
            </td>
            <td width="1152" valign="top" style="width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1">
                <span style="font-size:13.5pt;font-family:"Courier New";">
                  </span></p><p> </p>
                
              <p></p>
            </td>
          </tr><tr id="xfmi6"><td valign="top" style="border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1" align="right" style="text-align:right;">
                <span style="font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050;">2028</span></p><p></p>
              <p></p>
            </td>
            <td width="1152" valign="top" style="width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1">
                <span class="xfmc13">
                  <span style="font-size:13.5pt;font-family:"Courier New";color:#B00040;">void</span>
                </span>
                <span style="font-size:13.5pt;font-family:"Courier New";"> <span class="xfmc8">H323CodecExtendedVideoCapability</span><span class="xfmc9"><span style="color:#666666;">::</span></span><span class="xfmc8">AddCapability</span><span class="xfmc10">(</span><span class="xfmc8">H323Capability</span> <span class="xfmc9"><span style="color:#666666;">*</span></span> <span class="xfmc8">capability</span><span class="xfmc10">)</span></span></p><p></p>
              <p></p>
            </td>
          </tr><tr id="xfmi7"><td valign="top" style="border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1" align="right" style="text-align:right;">
                <span style="font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050;">2029</span></p><p></p>
              <p></p>
            </td>
            <td width="1152" valign="top" style="width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1">
                <span class="xfmc10">
                  <span style="font-size:13.5pt;font-family:"Courier New";">{</span>
                </span>
                <span style="font-size:13.5pt;font-family:"Courier New";">
                  </span></p><p></p>
                
              <p></p>
            </td>
          </tr><tr id="xfmi8"><td valign="top" style="border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1" align="right" style="text-align:right;">
                <span style="font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050;">2030</span></p><p></p>
              <p></p>
            </td>
            <td width="1152" valign="top" style="width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1">
                <span style="font-size:13.5pt;font-family:"Courier New";">    <span class="xfmc8">extCapabilities</span><span class="xfmc10">.</span><span class="xfmc8">Add</span><span class="xfmc10">((</span><span class="xfmc8">H323Capability</span> <span class="xfmc9"><span style="color:#666666;">*</span></span><span class="xfmc10">)</span><span class="xfmc8">capability</span><span class="xfmc9"><span style="color:#666666;">-></span></span><span class="xfmc8">Clone</span><span class="xfmc10">());</span></span></p><p></p>
              <p></p>
            </td>
          </tr><tr id="xfmi9"><td valign="top" style="border:none;border-right:solid #505050 1.0pt;background:#EEEEEE;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1" align="right" style="text-align:right;">
                <span style="font-size:13.5pt;font-family:"Arial",sans-serif;color:#505050;">2031</span></p><p></p>
              <p></p>
            </td>
            <td width="1152" valign="top" style="width:12.0in;border:none;border-right:solid #505050 1.0pt;background:white;padding:.75pt 3.75pt .75pt 3.75pt;">
              <p class="xfmc1">
                <span class="xfmc10">
                  <span style="font-size:13.5pt;font-family:"Courier New";">}</span>
                </span>
                <span style="font-size:13.5pt;font-family:"Courier New";">
                  </span></p><p></p>
                
              <p></p>
            </td>
          </tr></tbody></table></div>
      <p class="xfmc1" style="margin-bottom:12.0pt;">
        <span class="xfmc14">
          </span></p><p> </p>
        
      <p></p>
      <div>
        <p class="xfmc1">
          <i>
            <span style="font-size:11.0pt;">--- Original message ---<br/>From: "Simon Horne" <<a href="mailto:s.horne@packetizer.com" target="_blank">s.horne@packetizer.com</a>><br/>Date: 24 January 2016, 07:23:27</span>
          </i>
          <i>
            <span style="font-size:11.0pt;">
              </span></i></p><p></p><i>
            
          </i>
        <p></p>
      </div>
      <p class="xfmc1">
        <span class="xfmc14">
          </span></p><p> </p>
        
      <p></p>
      <blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in;">
        <pre>Fix checked in. <p></p></pre>
        <pre>The first instance is created in<p></p></pre>
        <pre>H323ExtendedVideoCapability::AddAllCapabilities and a new function<p></p></pre>
        <pre>H323CodecExtendedVideoCapability::AddCapability(H323Capability *) then<p></p></pre>
        <pre>clones the first instance. The first instance is then deleted. This will<p></p></pre>
        <pre>ensure every subsequent call to H323ExtendedVideoFactory::CreateInstance()<p></p></pre>
        <pre>will create a new unique instance and there is no memory leak.<p></p></pre>
        <pre>          <p> </p>
        </pre>
        <pre>Simon<p></p></pre>
        <pre>          <p> </p>
        </pre>
        <pre>-----Original Message-----<p></p></pre>
        <pre>From: h323plus [<a href="mailto:h323plus-bounces@lists.packetizer.com" target="_blank">mailto:h323plus-bounces@lists.packetizer.com</a>] On Behalf Of<p></p></pre>
        <pre>Jan Willamowius<p></p></pre>
        <pre>Sent: Sunday, January 24, 2016 2:35 AM<p></p></pre>
        <pre>To: <a href="mailto:h323plus@lists.packetizer.com" target="_blank">h323plus@lists.packetizer.com</a><p></p></pre>
        <pre>Subject: Re: [h323plus] Double-delete Capability bug<p></p></pre>
        <pre>          <p> </p>
        </pre>
        <pre>Hi Simon,<p></p></pre>
        <pre>          <p> </p>
        </pre>
        <pre>it does need a better fix. But a leak is still better than a crash.<p></p></pre>
        <pre>          <p> </p>
        </pre>
        <pre>The proper fix is probably to have CreateInstance() always allocate new<p></p></pre>
        <pre>memory. But until thats fixed I would leave the Clone() in.<p></p></pre>
        <pre>          <p> </p>
        </pre>
        <pre>Regards,<p></p></pre>
        <pre>Jan<p></p></pre>
        <pre>          <p> </p>
        </pre>
        <pre>Simon Horne wrote:<p></p></pre>
        <pre>> Jan<p></p></pre>
        <pre>> <p></p></pre>
        <pre>> As I suspected, I just check with VLD on windows and the change causes <p></p></pre>
        <pre>> a 9kB/call memory leak (as the capability gets cloned 3 times per <p></p></pre>
        <pre>> call). Needs to be reverted out.<p></p></pre>
        <pre>> <p></p></pre>
        <pre>> Simon<p></p></pre>
        <pre>> <p></p></pre>
        <pre>> -----Original Message-----<p></p></pre>
        <pre>> From: h323plus [<a href="mailto:h323plus-bounces@lists.packetizer.com" target="_blank">mailto:h323plus-bounces@lists.packetizer.com</a>] On <p></p></pre>
        <pre>> Behalf Of Jan Willamowius<p></p></pre>
        <pre>> Sent: Saturday, January 23, 2016 4:49 AM<p></p></pre>
        <pre>> To: <a href="mailto:h323plus@lists.packetizer.com" target="_blank">h323plus@lists.packetizer.com</a><p></p></pre>
        <pre>> Subject: Re: [h323plus] Double-delete Capability bug<p></p></pre>
        <pre>> <p></p></pre>
        <pre>> Hi Iurii,<p></p></pre>
        <pre>> <p></p></pre>
        <pre>> I have added the Clone() in the CVS, but could you please check (wg.<p></p></pre>
        <pre>> with Valgrind) if we now have a memory leak in some cases instead of a <p></p></pre>
        <pre>> crash ?<p></p></pre>
        <pre>> <p></p></pre>
        <pre>> Regards,<p></p></pre>
        <pre>> Jan<p></p></pre>
        <pre>> <p></p></pre>
        <pre>> --<p></p></pre>
        <pre>> Jan Willamowius, Founder of the GNU Gatekeeper Project EMail  :<p></p></pre>
        <pre>> <a href="mailto:jan@willamowius.de" target="_blank">jan@willamowius.de</a><p></p></pre>
        <pre>> Website: <a href="http://www.gnugk.org" target="_blank">http://www.gnugk.org</a><p></p></pre>
        <pre>> Support: <a href="http://www.willamowius.com/gnugk-support.html" target="_blank">http://www.willamowius.com/gnugk-support.html</a><p></p></pre>
        <pre>> <p></p></pre>
        <pre>> Relaxed Communications GmbH<p></p></pre>
        <pre>> Frahmredder 91<p></p></pre>
        <pre>> 22393 Hamburg<p></p></pre>
        <pre>> Geschäftsführer: Jan Willamowius<p></p></pre>
        <pre>> HRB 125261 (Amtsgericht Hamburg)<p></p></pre>
        <pre>> USt-IdNr: DE286003584<p></p></pre>
        <pre>> <p></p></pre>
        <pre>> Iurii Gordiienko wrote:<p></p></pre>
        <pre>> > Hi,<p></p></pre>
        <pre>> > I have found something... For<p></p></pre>
        <pre>> H323ExtendedVideoCapability::AddAllCapabilities function we are using <p></p></pre>
        <pre>> H323CodecExtendedVideoCapability::AddCapability function for<p></p></pre>
        <pre>> extCapability->AddCapability(*r).<p></p></pre>
        <pre>> H323CodecExtendedVideoCapability::AddCapability function uses<p></p></pre>
        <pre>> extCapabilities.Add(H323ExtendedVideoFactory::CreateInstance(cap))<p></p></pre>
        <pre>function.<p></p></pre>
        <pre>> The function H323ExtendedVideoFactory::CreateInstance(cap) will call "new"<p></p></pre>
        <pre>> if any same "cap" does not is exists for now< for other case it will <p></p></pre>
        <pre>> return the pointer to current actual Capability. But <p></p></pre>
        <pre>> H323CodecExtendedVideoCapability::extCapabilities will delete all <p></p></pre>
        <pre>> items in time of execution  extCapabilities.RemoveAll() function from <p></p></pre>
        <pre>> H323CodecExtendedVideoCapability::~H323CodecExtendedVideoCapability().<p></p></pre>
        <pre>> In result we have "double delete" and undefined behavior (crash for <p></p></pre>
        <pre>> worst case).<p></p></pre>
        <pre>> > <p></p></pre>
        <pre>> > --------------------------------<p></p></pre>
        <pre>> > void H323ExtendedVideoCapability::AddAllCapabilities(<p></p></pre>
        <pre>> H323Capabilities & basecapabilities, PINDEX descriptorNum,PINDEX<p></p></pre>
        <pre>> simultaneous) {   H323ExtendedVideoFactory::KeyList_T extCaps = <p></p></pre>
        <pre>> H323ExtendedVideoFactory::GetKeyList();   if (extCaps.size() > 0) { <p></p></pre>
        <pre>> H323CodecExtendedVideoCapability * capability = new <p></p></pre>
        <pre>> H323CodecExtendedVideoCapability();<p></p></pre>
        <pre>> H323ExtendedVideoFactory::KeyList_T::const_iterator r;         PINDEX <p></p></pre>
        <pre>> num = P_MAX_INDEX;         for (r = extCaps.begin(); r != <p></p></pre>
        <pre>> extCaps.end(); ++r) {<p></p></pre>
        <pre>>          H323CodecExtendedVideoCapability * extCapability = <p></p></pre>
        <pre>> (H323CodecExtendedVideoCapability *)capability->Clone();<p></p></pre>
        <pre>>  extCapability->AddCapability(*r);            num = <p></p></pre>
        <pre>> basecapabilities.SetCapability(descriptorNum, <p></p></pre>
        <pre>> simultaneous,extCapability);<p></p></pre>
        <pre>>          simultaneous = num;         }     simultaneous = P_MAX_INDEX; <p></p></pre>
        <pre>> basecapabilities.SetCapability(descriptorNum, simultaneous,new <p></p></pre>
        <pre>> H323ControlExtendedVideoCapability());  !<p></p></pre>
        <pre>> >     delete capability;   }  }<p></p></pre>
        <pre>> > void H323CodecExtendedVideoCapability::AddCapability(const PString &<p></p></pre>
        <pre>> > cap) {<p></p></pre>
        <pre>> > extCapabilities.Add(H323ExtendedVideoFactory::CreateInstance(cap)); <p></p></pre>
        <pre>> > }<p></p></pre>
        <pre>> > <p></p></pre>
        <pre>> > -------------------------------------------------<p></p></pre>
        <pre>> > I propose to replace the "void<p></p></pre>
        <pre>> H323CodecExtendedVideoCapability::AddCapability(const PString & cap)" <p></p></pre>
        <pre>> to this one:<p></p></pre>
        <pre>> > void H323CodecExtendedVideoCapability::AddCapability(const PString &<p></p></pre>
        <pre>> > cap) {<p></p></pre>
        <pre>> > extCapabilities.Add(H323ExtendedVideoFactory::CreateInstance(cap)->c<p></p></pre>
        <pre>> > lo<p></p></pre>
        <pre>> > ne()); }<p></p></pre>
        <pre>> > <p></p></pre>
        <pre>> > <p></p></pre>
        <pre>> > <p></p></pre>
        <pre>> > Thanks -- Iurii Gordiienko<p></p></pre>
        <pre>          <p> </p>
        </pre>
        <pre>          <p> </p>
        </pre>
      </blockquote>
      <p class="xfmc1">
        </p><p></p>
      
    </div>
  </span>
</span>
</blockquote>

</span>
  </div>
</span><img src="https://mail.ukr.net/api/public/message_read?a=nKmgvdFnKHmsk7uvZLEpXibnDdI_H8jqU1JOfr3AIBCleEcS2srd_e9yhYiMfmjk2T54SqWV9K_Bl-5oL7JgA17iDWlab8vuet10zjLENO4=" alt="" width="1" height="1" style="visibility: hidden; width: 1px; height: 1px;"/>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       </body></html>