<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/7633">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Corey Farrell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">rtp_engine.c: Eliminate rtcp_report_to_json() RAII_VAR usage.<br><br>Change-Id: I58a22c2ca82e91d7537409b7b3af2d735827a54d<br>---<br>M main/rtp_engine.c<br>1 file changed, 31 insertions(+), 29 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/rtp_engine.c b/main/rtp_engine.c<br>index 68c53e7..a2c0770 100644<br>--- a/main/rtp_engine.c<br>+++ b/main/rtp_engine.c<br>@@ -3092,10 +3092,10 @@<br> const struct stasis_message_sanitizer *sanitize)<br> {<br> struct rtcp_message_payload *payload = stasis_message_data(msg);<br>- RAII_VAR(struct ast_json *, json_rtcp_report, NULL, ast_json_unref);<br>- RAII_VAR(struct ast_json *, json_rtcp_report_blocks, NULL, ast_json_unref);<br>- RAII_VAR(struct ast_json *, json_rtcp_sender_info, NULL, ast_json_unref);<br>- RAII_VAR(struct ast_json *, json_channel, NULL, ast_json_unref);<br>+ struct ast_json *json_rtcp_report = NULL;<br>+ struct ast_json *json_rtcp_report_blocks;<br>+ struct ast_json *json_rtcp_sender_info = NULL;<br>+ struct ast_json *json_channel = NULL;<br> int i;<br> <br> json_rtcp_report_blocks = ast_json_array_create();<br>@@ -3106,20 +3106,19 @@<br> for (i = 0; i < payload->report->reception_report_count && payload->report->report_block[i]; i++) {<br> struct ast_json *json_report_block;<br> char str_lsr[32];<br>+<br> snprintf(str_lsr, sizeof(str_lsr), "%u", payload->report->report_block[i]->lsr);<br> json_report_block = ast_json_pack("{s: i, s: i, s: i, s: i, s: i, s: s, s: i}",<br>- "source_ssrc", payload->report->report_block[i]->source_ssrc,<br>- "fraction_lost", payload->report->report_block[i]->lost_count.fraction,<br>- "packets_lost", payload->report->report_block[i]->lost_count.packets,<br>- "highest_seq_no", payload->report->report_block[i]->highest_seq_no,<br>- "ia_jitter", payload->report->report_block[i]->ia_jitter,<br>- "lsr", str_lsr,<br>- "dlsr", payload->report->report_block[i]->dlsr);<br>- if (!json_report_block) {<br>- return NULL;<br>- }<br>-<br>- if (ast_json_array_append(json_rtcp_report_blocks, json_report_block)) {<br>+ "source_ssrc", payload->report->report_block[i]->source_ssrc,<br>+ "fraction_lost", payload->report->report_block[i]->lost_count.fraction,<br>+ "packets_lost", payload->report->report_block[i]->lost_count.packets,<br>+ "highest_seq_no", payload->report->report_block[i]->highest_seq_no,<br>+ "ia_jitter", payload->report->report_block[i]->ia_jitter,<br>+ "lsr", str_lsr,<br>+ "dlsr", payload->report->report_block[i]->dlsr);<br>+ if (!json_report_block<br>+ || ast_json_array_append(json_rtcp_report_blocks, json_report_block)) {<br>+ ast_json_unref(json_rtcp_report_blocks);<br> return NULL;<br> }<br> }<br>@@ -3127,25 +3126,27 @@<br> if (payload->report->type == AST_RTP_RTCP_SR) {<br> char sec[32];<br> char usec[32];<br>+<br> snprintf(sec, sizeof(sec), "%lu", (unsigned long)payload->report->sender_information.ntp_timestamp.tv_sec);<br> snprintf(usec, sizeof(usec), "%lu", (unsigned long)payload->report->sender_information.ntp_timestamp.tv_usec);<br> json_rtcp_sender_info = ast_json_pack("{s: s, s: s, s: i, s: i, s: i}",<br>- "ntp_timestamp_sec", sec,<br>- "ntp_timestamp_usec", usec,<br>- "rtp_timestamp", payload->report->sender_information.rtp_timestamp,<br>- "packets", payload->report->sender_information.packet_count,<br>- "octets", payload->report->sender_information.octet_count);<br>+ "ntp_timestamp_sec", sec,<br>+ "ntp_timestamp_usec", usec,<br>+ "rtp_timestamp", payload->report->sender_information.rtp_timestamp,<br>+ "packets", payload->report->sender_information.packet_count,<br>+ "octets", payload->report->sender_information.octet_count);<br> if (!json_rtcp_sender_info) {<br>+ ast_json_unref(json_rtcp_report_blocks);<br> return NULL;<br> }<br> }<br> <br> json_rtcp_report = ast_json_pack("{s: i, s: i, s: i, s: o, s: o}",<br>- "ssrc", payload->report->ssrc,<br>- "type", payload->report->type,<br>- "report_count", payload->report->reception_report_count,<br>- "sender_information", json_rtcp_sender_info ? ast_json_ref(json_rtcp_sender_info) : ast_json_ref(ast_json_null()),<br>- "report_blocks", ast_json_ref(json_rtcp_report_blocks));<br>+ "ssrc", payload->report->ssrc,<br>+ "type", payload->report->type,<br>+ "report_count", payload->report->reception_report_count,<br>+ "sender_information", json_rtcp_sender_info ?: ast_json_null(),<br>+ "report_blocks", json_rtcp_report_blocks);<br> if (!json_rtcp_report) {<br> return NULL;<br> }<br>@@ -3153,14 +3154,15 @@<br> if (payload->snapshot) {<br> json_channel = ast_channel_snapshot_to_json(payload->snapshot, sanitize);<br> if (!json_channel) {<br>+ ast_json_unref(json_rtcp_report);<br> return NULL;<br> }<br> }<br> <br> return ast_json_pack("{s: o, s: o, s: o}",<br>- "channel", payload->snapshot ? ast_json_ref(json_channel) : ast_json_ref(ast_json_null()),<br>- "rtcp_report", ast_json_ref(json_rtcp_report),<br>- "blob", ast_json_deep_copy(payload->blob));<br>+ "channel", payload->snapshot ? json_channel : ast_json_null(),<br>+ "rtcp_report", json_rtcp_report,<br>+ "blob", ast_json_deep_copy(payload->blob) ?: ast_json_null());<br> }<br> <br> static void rtp_rtcp_report_dtor(void *obj)<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7633">change 7633</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/7633"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I58a22c2ca82e91d7537409b7b3af2d735827a54d </div>
<div style="display:none"> Gerrit-Change-Number: 7633 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>