One liner fix update for a potential segfault when a client connects and the header is not yet received from the source.<div><br></div><div>Updated full patch attached.</div><div><br></div><div><br><br><div class="gmail_quote">
On Thu, Feb 9, 2012 at 5:37 AM, Dennis Heerema <span dir="ltr">&lt;<a href="mailto:dennis@heerema.net">dennis@heerema.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="font-size:16px;font-style:normal;font-family:arial,helvetica,sans-serif;font-weight:400">
        Hi David,</div>
<div style="font-size:16px;font-style:normal;font-family:arial,helvetica,sans-serif;font-weight:400">
         </div>
<div style="font-size:16px;font-style:normal;font-family:arial,helvetica,sans-serif;font-weight:400">
        Streaming live WebM would also give a boost to this open format.</div>
<div style="font-size:16px;font-style:normal;font-family:arial,helvetica,sans-serif;font-weight:400">
        Whitch Client do you use to stream the webm format to icecast with?</div></div></blockquote><div><br></div><div>I&#39;m using Krad Cam, which is in a very early alpha form. More information is here:</div><div><br></div>
<div><a href="https://gist.github.com/1773943">https://gist.github.com/1773943</a></div><div><br></div><div>There is also a &quot;Test Signal&quot; client that sends a video only stream for testing purposes.</div><div><br>
</div><div>-David</div><div> </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<div style="font-size:16px;font-style:normal;font-family:arial,helvetica,sans-serif;font-weight:400">
        Regards,<br>
        <br>
        Dennis</div><div><div class="h5">
<div style="font-size:16px;font-style:normal;font-family:arial,helvetica,sans-serif;font-weight:400">
         </div>
<div style="font-size:16px;font-style:normal;font-family:arial,helvetica,sans-serif;font-weight:400">
         </div>
<div style="font-size:16px;font-style:normal;font-family:arial,helvetica,sans-serif;font-weight:400">
        -----Original Message-----<br>
        From: Krad Radio &lt;<a href="mailto:kradradio@gmail.com" target="_blank">kradradio@gmail.com</a>&gt;<br>
        To: <a href="mailto:icecast-dev@xiph.org" target="_blank">icecast-dev@xiph.org</a>, <a href="mailto:icecast@xiph.org" target="_blank">icecast@xiph.org</a><br>
        Date: Wed, 8 Feb 2012 23:53:05 -0500<br>
        Subject: [Icecast] Icecast WebM Support Patch Second Edition<br>
        <br>
        Howdy,</div>
<div style="font-size:13px;font-style:normal;font-family:arial,helvetica,sans-serif;font-weight:400">
        <blockquote style="border-left:#000000 2px solid;padding-left:5px;padding-right:0px;margin-left:5px;margin-right:0px">
                <div>
                         </div>
                <div>
                        tl;dr:  Nothing new or interesting to non-developers</div>
                <div>
                         </div>
                <div>
                        Attached is a newer Icecast WebM support patch for Icecast SVN, there is 
simply aesthetic changes. Whitespace has been altered to match Icecast 
project style, </div>
                <div>
                        some functions have been renamed and moved around.</div>
                <div>
                         </div>
                <div>
                        Some discussion. </div>
                <div>
                         </div>
                <div>
                        The format_ebml.c file lines 0-296 operates much the same as the 
format_ogg.c file does. It uses a parsing library api to feed in and pull 
out bytes via </div>
                <div>
                        the _get_buffer function. In the case of Ogg this is of course 
libogg, in the case of ebml, the &quot;parsing library&quot; consists of the 
functions below line 296.</div>
                <div>
                        This mini-included library comes from some debugging code that 
I wrote during my work on a much more robust EBML muxing library, originally 
I had thought</div>
                <div>
                        icecast would need to do some manipulation of the EBML segment header in 
all cases, but it turns out in most cases this is better done by the source 
client. </div>
                <div>
                        This mini-included library implements the same function calls that 
Icecast would need to use if it was using this EBML muxing library, but 
&quot;parse&quot; is a very </div>
                <div>
                        generous descriptor of whats actually happening. If you are familiar 
with the internals of Ogg streaming, you know that the stream starts out 
with a few header pages</div>
                <div>
                        that are then followed by pages containing the acutual video and audio 
packets. EBML doctype WebM and MKV (The only currently known) work in 
a similar way. </div>
                <div>
                        There is a &quot;Segment Header&quot; followed by &quot;Clusters&quot; 
(Its actually more nuanced than this, but this oversimplification will 
suffice for the moment). Clusters are comparable to</div>
                <div>
                        Ogg pages. The connecting client needs to be sent the header, and then it 
can start on any cluster as long as it starts exactly on a cluster. (This is 
actually not a format requirement per se but all media players I am aware of 
lack the ability to re-sync themselves if started on a random byte, 
something I intend not to be a limitation of my own work). So, in a live 
WebM stream, everything before the first cluster is the &quot;Header&quot; 
and then the rest is the clusters, of which the boundary between them is 
marked with 4 specific bytes. So at every cluster the refbuf is marked as a 
sync point. The size of clusters could vary significantly during a 
stream or from stream to stream, but on a properly constructed one would 
indicate a keyframe in the case of a stream with video. The 
&#39;mini-library&#39; doesn&#39;t actually &#39;parse&#39; the stream at 
all, all it does is look for the four byte sequence indicating a cluster 
boundary and informs the format functions appropriately. I am a fraudulent 
mathematician at best, but I calculate that there is a 1 in 4.2 billion 
chance of this happening for any given 4 bytes, and 1 in 4294 per megabyte, 
and likely once per 4.2 gigabytes. This is not a problem once the stream has 
started for the client however, it only matters when the source connects and 
the header is stored, and when a client connects and needs a proper starting 
point. I suppose that makes it very unlikely to cause a problem, even though 
its technically wrong. It also means that each byte is being compared, 
whilst when properly parsing most would be skipped, but computers are so 
damn fast that its moot. At any rate proper parsing could be added this this 
mini-library or provided by the external library as it matures.</div>
                <div>
                         </div>
                <div>
                        Enjoy,</div>
                <div>
                         </div>
                <div>
                        David</div>
                <div>
                         </div>
                <div>
                         </div>
                <div>
                         </div>
                <div>
                         </div>
                <div>
                         </div>
        </blockquote>
</div>
</div></div></div>
</blockquote></div><br></div>