Hi,<br><br>Currently, in gst-plugins-good/gst/rtpmanager/rtpsource.c, bitrate is estimated on the sender side. Would it be possible to estimate this on the receiver side? It would be delta &quot;octets-received&quot; over a given running time. I&#39;ve tried to do it in my application but I have a health discrepancy between my estimation and that on the sender side (about 90000 bits less in mine). I get the stats every two seconds with the &quot;get-internal-session&quot; signal. Here&#39;s my code, which parses a source&#39;s rtp stats and tries to estimate the bitrate:<br>
 <br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">    const GValue *val = gst_structure_get_value(stats, &quot;internal&quot;);<br>    if (g_value_get_boolean(val))   // is-internal<br>
        return;<br></blockquote><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote"><div> </div></blockquote><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
    GTimeVal currentTime;<br>    g_get_current_time (&amp;currentTime);<br>    static GTimeVal previousTime = currentTime;<br>    guint64 elapsed = currentTime.tv_sec - previousTime.tv_sec;<br><br>    if (elapsed &gt; 0)<br>
    {<br>        // in case we&#39;re not getting this in our receiver reports for a while (i.e. sender died)<br>        if (G_VALUE_HOLDS_UINT64(gst_structure_get_value(stats, &quot;octets-received&quot;)))<br>        {<br>
            guint octets = g_value_get_uint64(gst_structure_get_value(stats, &quot;octets-received&quot;));<br>            static guint previousOctets = octets;<br>            guint diffOctets = octets - previousOctets;<br>
            //LOG_INFO(&quot;Diff octets &quot; &lt;&lt; diffOctets);<br><br>            enum {BITS_PER_BYTE = 8};<br>            guint64 bitrate = BITS_PER_BYTE * (diffOctets / elapsed);<br><br>            LOG_INFO(sessionName_ &lt;&lt; &quot;:BITRATE:&quot; &lt;&lt; bitrate);<br>
            previousOctets = octets;<br>        }<br>    }<br>    previousTime = currentTime;<br></blockquote><br>One difference I noticed is that in the rtpsource.c code, the clocktime is determined from the running time passed to the function, not with g_get_current_time. Should i be calculating the time from my pipeline instead? Any other tips?<br>
<br>-- <br>Tristan Matthews<br>email: <a href="mailto:tristan@sat.qc.ca">tristan@sat.qc.ca</a><br>web: <a href="http://tristanswork.blogspot.com">http://tristanswork.blogspot.com</a><br>