<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/3519/">https://reviewboard.asterisk.org/r/3519/</a>
</td>
</tr>
</table>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/3519/diff/1/?file=58191#file58191line1049" style="color: black; font-weight: bold; text-decoration: underline;">/team/group/media_formats-reviewed/channels/chan_h323.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static int __oh323_rtp_create(struct oh323_pvt *pvt)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1026</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="k">if</span> <span class="p">(</span><span class="n">pvt</span><span class="o">-></span><span class="n">peercapability</span><span class="p">)</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1049</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="c1"><span class="hl">//</span><span class="tb"> </span>if (pvt->peercapability)</span></pre></td>
</tr>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1027</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="n">ast_rtp_codecs_packetization_set</span><span class="p">(</span><span class="n">ast_rtp_instance_get_codecs</span><span class="p">(</span><span class="n">pvt</span><span class="o">-></span><span class="n">rtp</span><span class="p">),</span> <span class="n">pvt</span><span class="o">-></span><span class="n">rtp</span><span class="p">,</span> <span class="o">&</span><span class="n">pvt</span><span class="o">-></span><span class="n">peer_prefs</span><span class="p">);</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1050</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="c1"><span class="hl">//</span><span class="tb"> </span><span class="tb"> </span>ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, &pvt->peer_prefs);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">If no longer needed then delete, or did you mean to come back to this?</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/3519/diff/1/?file=58191#file58191line2615" style="color: black; font-weight: bold; text-decoration: underline;">/team/group/media_formats-reviewed/channels/chan_h323.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static void set_peer_capabilities(unsigned call_reference, const char *token, int capabilities, struct ast_codec_pref *prefs)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">2577</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="n">ast_rtp_codecs_packetization_set</span><span class="p">(</span><span class="n">ast_rtp_instance_get_codecs</span><span class="p">(</span><span class="n">pvt</span><span class="o">-></span><span class="n">rtp</span><span class="p">),</span> <span class="n">pvt</span><span class="o">-></span><span class="n">rtp</span><span class="p">,</span> <span class="o">&</span><span class="n">pvt</span><span class="o">-></span><span class="n">peer_prefs</span><span class="p">);</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2612</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="c1"><span class="hl">//</span><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span>ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, &pvt->peer_prefs);</span></pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">2578</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="p">}</span> <span class="k">else</span> <span class="p">{</span></pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2613</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="p">}</span> <span class="k">else</span> <span class="p">{</span></pre></td>
</tr>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">2579</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="n">ast_debug</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s">"Autoframing option not set, ignoring peer's packetization settings</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span></pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2614</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="n">ast_debug</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="s">"Autoframing option not set, ignoring peer's packetization settings</span><span class="se">\n</span><span class="s">"</span><span class="p">);</span></pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">2580</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="n">ast_rtp_codecs_packetization_set</span><span class="p">(</span><span class="n">ast_rtp_instance_get_codecs</span><span class="p">(</span><span class="n">pvt</span><span class="o">-></span><span class="n">rtp</span><span class="p">),</span> <span class="n">pvt</span><span class="o">-></span><span class="n">rtp</span><span class="p">,</span> <span class="o">&</span><span class="n">pvt</span><span class="o">-></span><span class="n">options</span><span class="p">.</span><span class="n">prefs</span><span class="p">);</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">2615</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="c1"><span class="hl">//</span><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span>ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(pvt->rtp), pvt->rtp, &pvt->options.prefs);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">More of the same commented code.</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/3519/diff/1/?file=58192#file58192line6282" style="color: black; font-weight: bold; text-decoration: underline;">/team/group/media_formats-reviewed/channels/chan_iax2.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">static int decode_frame(ast_aes_decrypt_key *dcx, struct ast_iax2_full_hdr *fh, struct ast_frame *f, int *datalen)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">6245</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span><span class="hl">ast_format_from_old_bitfield(&</span>f->subclass.format<span class="hl">, </span>(uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1))<span class="hl">)</span>;</pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">6279</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span>f->subclass.format<span class="hl"> = ast_format_compatibility_bitfield2format</span>(uncompress_subclass(fh->csub & ~0x40) | ((fh->csub >> 6) & 0x1));</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#f0f0f0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">6246</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span>} else if (f->frametype == AST_FRAME_VOICE) {</pre></td>
<th bgcolor="#f0f0f0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">6280</font></th>
<td bgcolor="#ffffff" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span>} else if (f->frametype == AST_FRAME_VOICE) {</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">6247</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span>ast_format_from_old_bitfield(&f->subclass.format, uncompress_subclass(fh->csub));</pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">6281</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="tb"> </span>f->subclass.format = ast_format_compatibility_bitfield2format(uncompress_subclass(fh->csub));</pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">May not be a problem, but what happens if/when these formats get unref'ed since it points to a global object? If the incoming frame is on the stack the format won't be unref'ed so should be fine, otherwise these might need a ref bump.</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/3519/diff/1/?file=58195#file58195line1923" style="color: black; font-weight: bold; text-decoration: underline;">/team/group/media_formats-reviewed/channels/h323/ast_h323.cxx</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void MyH323Connection::SetCapabilities(int caps, int dtmf_mode, void *_prefs, int pref_codec)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1920</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="n">caps</span> <span class="o">&</span> <span class="n">codec</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="n">alreadysent</span> <span class="o">&</span> <span class="n">codec</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="n"><span class="hl">AST_FORMAT_GET_TYPE</span></span><span class="p"><span class="hl">(</span></span><span class="n"><span class="hl">ast_format_id_from_old_bitfield</span></span><span class="p"><span class="hl">(</span></span><span class="n">codec</span><span class="p"><span class="hl">))</span></span> <span class="o">!=</span> <span class="n">AST_<span class="hl">FORMAT</span>_TYPE_AUDIO</span><span class="p">))</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1919</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="n">caps</span> <span class="o">&</span> <span class="n">codec</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="n">alreadysent</span> <span class="o">&</span> <span class="n">codec</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="n"><span class="hl">tmpfmt</span></span><span class="o"><span class="hl">-></span></span><span class="n">codec</span><span class="o"><span class="hl">-></span></span><span class="n"><span class="hl">type</span></span> <span class="o">!=</span> <span class="n">AST_<span class="hl">MEDIA</span>_TYPE_AUDIO</span><span class="p">))</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This should be unreachable now. Should be ast_format_get_type(tmpfmt) != AST_MEDIA_TYPE_AUDIO</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/3519/diff/1/?file=58195#file58195line1928" style="color: black; font-weight: bold; text-decoration: underline;">/team/group/media_formats-reviewed/channels/h323/ast_h323.cxx</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void MyH323Connection::SetCapabilities(int caps, int dtmf_mode, void *_prefs, int pref_codec)</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">1925</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="n">frames_per_packet</span> <span class="o">=</span> <span class="p">(</span><span class="n">f<span class="hl">ormat</span></span><span class="p"><span class="hl">.</span></span><span class="n"><span class="hl">inc_ms</span></span> <span class="o">?</span> <span class="n">f<span class="hl">ormat</span></span><span class="p"><span class="hl">.</span></span><span class="n"><span class="hl">cur_ms</span></span> <span class="o">/</span> <span class="n"><span class="hl">format</span></span><span class="p"><span class="hl">.</span></span><span class="n">inc_ms</span> <span class="o">:</span> <span class="n"><span class="hl">format</span></span><span class="p"><span class="hl">.</span></span><span class="n"><span class="hl">cur</span>_ms</span><span class="p">);</span></pre></td>
<th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">1924</font></th>
<td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="n">frames_per_packet</span> <span class="o">=</span> <span class="p">(</span><span class="n">f<span class="hl">raming</span></span> <span class="o">?</span> <span class="n">f<span class="hl">raming</span></span> <span class="o">/</span> <span class="n"><span class="hl">tmpfmt</span></span><span class="o"><span class="hl">-></span></span><span class="n"><span class="hl">codec</span></span><span class="o"><span class="hl">-></span></span><span class="n">inc<span class="hl">rement</span>_ms</span> <span class="o">:</span> <span class="n"><span class="hl">tmpfmt</span></span><span class="o"><span class="hl">-></span></span><span class="n"><span class="hl">codec</span></span><span class="o"><span class="hl">-></span></span><span class="n"><span class="hl">default</span>_ms</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Same here for codec->default_ms, but can use "ast_format_get_default_ms "</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/3519/diff/1/?file=58205#file58205line46" style="color: black; font-weight: bold; text-decoration: underline;">/team/group/media_formats-reviewed/main/format_compatibility.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">46</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="k">return</span> <span class="p">(</span><span class="mi">1ULL</span> <span class="o"><<</span> <span class="mi">0</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">What about #defining the various (1ULL << num) as I see them repeated in several spots and it might make sense to have a name to them?</pre>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="https://reviewboard.asterisk.org/r/3519/diff/1/?file=58205#file58205line308" style="color: black; font-weight: bold; text-decoration: underline;">/team/group/media_formats-reviewed/main/format_compatibility.c</a>
<span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">308</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="k">struct</span> <span class="n">ast_format</span> <span class="o">*</span><span class="n">ast_codec_pref_index</span><span class="p">(</span><span class="k">struct</span> <span class="n">ast_codec_pref</span> <span class="o">*</span><span class="n">pref</span><span class="p">,</span> <span class="kt">int</span> <span class="n">idx</span><span class="p">,</span> <span class="k">struct</span> <span class="n">ast_format</span> <span class="o">**</span><span class="n">result</span><span class="p">)</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">309</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="p">{</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">310</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="k">if</span> <span class="p">((</span><span class="n">idx</span> <span class="o">>=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">&&</span> <span class="p">(</span><span class="n">idx</span> <span class="o"><</span> <span class="k">sizeof</span><span class="p">(</span><span class="n">pref</span><span class="o">-></span><span class="n">order</span><span class="p">))</span> <span class="o">&&</span> <span class="n">pref</span><span class="o">-></span><span class="n">order</span><span class="p">[</span><span class="n">idx</span><span class="p">])</span> <span class="p">{</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">311</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="o">*</span><span class="n">result</span> <span class="o">=</span> <span class="n">ast_format_compatibility_bitfield2format</span><span class="p">(</span><span class="n">pref</span><span class="o">-></span><span class="n">order</span><span class="p">[</span><span class="n">idx</span><span class="p">]);</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">312</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="p">}</span> <span class="k">else</span> <span class="p">{</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">313</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="tb"> </span><span class="o">*</span><span class="n">result</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">314</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="p">}</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">315</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">316</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb"> </span><span class="k">return</span> <span class="o">*</span><span class="n">result</span><span class="p">;</span></pre></td>
</tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">317</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="p">}</span></pre></td>
</tr>
</tbody>
</table>
<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">It looks possible that this could return NULL. Looking through some of the code I saw a few spots where this function was called but the NULL result was not checked for and there would be a possibility of a NULL pointer being dereffed. So do those places need a NULL check, should this return some kind of empty format representing NULL, or is this something that really should never happen or are all the cases calling this know based on the passed in params that NULL won't be returned?</pre>
</div>
<br />
<p>- Kevin Harwell</p>
<br />
<p>On April 30th, 2014, 5:54 p.m. CDT, Joshua Colp wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Joshua Colp.</div>
<p style="color: grey;"><i>Updated April 30, 2014, 5:54 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This change adds a legacy legacy format compatibility API which is used by chan_iax2, chan_h323, and chan_misdn to work in new media formats land.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/team/group/media_formats-reviewed/main/format_compatibility.c <span style="color: grey">(PRE-CREATION)</span></li>
<li>/team/group/media_formats-reviewed/main/codec_builtin.c <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/include/asterisk/translate.h <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/include/asterisk/format_compatibility.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>/team/group/media_formats-reviewed/include/asterisk/format_cache.h <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/include/asterisk/codec.h <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/codecs/codec_dahdi.c <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/channels/iax2/provision.c <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/channels/iax2/parser.c <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/channels/h323/chan_h323.h <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/channels/h323/ast_h323.cxx <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/channels/chan_phone.c <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/channels/chan_misdn.c <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/channels/chan_iax2.c <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/channels/chan_h323.c <span style="color: grey">(413144)</span></li>
<li>/team/group/media_formats-reviewed/apps/app_meetme.c <span style="color: grey">(413144)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/3519/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>