<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14740">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">stream.c: Added 2 more debugging utils and added pos to stream string<br><br> * Added ast_stream_to_stra and ast_stream_topology_to_stra() macros<br> which are shortcuts for<br> ast_str_tmp(256, ast_stream_to_str(stream, &STR_TMP))<br><br> * Added the stream position to the string representation of the<br> stream.<br><br> * Fixed some formatting in ast_stream_to_str().<br><br>Change-Id: Idaf4cb0affa46d4dce58a73a111f35435331cc4b<br>---<br>M include/asterisk/stream.h<br>M main/stream.c<br>2 files changed, 28 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/asterisk/stream.h b/include/asterisk/stream.h</span><br><span>index ca637be..205feeb 100644</span><br><span>--- a/include/asterisk/stream.h</span><br><span>+++ b/include/asterisk/stream.h</span><br><span>@@ -474,6 +474,19 @@</span><br><span> const char *ast_stream_to_str(const struct ast_stream *stream, struct ast_str **buf);</span><br><span> </span><br><span> /*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Get a stack allocated string representing the stream for debugging/display purposes</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param stream A stream</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \returns a stack allocated pointer to a string representing the stream.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \warning No attempt should ever be made to free the returned</span><br><span style="color: hsl(120, 100%, 40%);">+ * char* as it is allocated from the stack.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#define ast_stream_to_stra(__stream) ast_str_tmp(128, ast_stream_to_str(__stream, &STR_TMP))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span> * \brief Get the count of the current negotiated formats of a stream</span><br><span> *</span><br><span> * \param stream The media stream</span><br><span>@@ -954,4 +967,17 @@</span><br><span> struct ast_stream_codec_negotiation_prefs *prefs,</span><br><span> struct ast_str **error_message);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Get a stack allocated string representing the topology for debugging/display purposes</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param topology A topology</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \returns a stack allocated pointer to a string representing the topology.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \warning No attempt should ever be made to free the returned</span><br><span style="color: hsl(120, 100%, 40%);">+ * char* as it is allocated from the stack.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+#define ast_stream_topology_to_stra(__topology) ast_str_tmp(256, ast_stream_topology_to_str(__topology, &STR_TMP))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #endif /* _AST_STREAM_H */</span><br><span>diff --git a/main/stream.c b/main/stream.c</span><br><span>index 01b07ca..c97ae48 100644</span><br><span>--- a/main/stream.c</span><br><span>+++ b/main/stream.c</span><br><span>@@ -343,7 +343,8 @@</span><br><span> return ast_str_buffer(*buf);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_str_append(buf, 0, "%s:%s:%s ",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_str_append(buf, 0, "%d:%s:%s:%s ",</span><br><span style="color: hsl(120, 100%, 40%);">+ stream->position,</span><br><span> S_OR(stream->name, "noname"),</span><br><span> ast_codec_media_type2str(stream->type),</span><br><span> ast_stream_state_map[stream->state]);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14740">change 14740</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/14740"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: Idaf4cb0affa46d4dce58a73a111f35435331cc4b </div>
<div style="display:none"> Gerrit-Change-Number: 14740 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>