<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/29 Duncan Palmer <span dir="ltr"><<a href="mailto:dpalmer@digisoft.tv" target="_blank">dpalmer@digisoft.tv</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


Hi all,<br>
<br>
I'd like to make use of the hlsdemux work described in<br>
<a href="https://bugzilla.gnome.org/show_bug.cgi?id=698155" target="_blank">https://bugzilla.gnome.org/show_bug.cgi?id=698155</a> , and I'm running<br>
gstreamer 1.x. So, I've spent some time nosing around the changes<br>
introduced by 698155 with a view to figuring out what would be<br>
required to get this stuff rebased onto the 1.x HEAD. I'm hoping<br>
Andoni (the author), and maybe a few other people who may be familiar<br>
with this can comment on what I think needs to be done, as I'd say<br>
there's a good chance I may have missed a few things.<br>
<br>
>From what I can see, the hlsdemux work was branched from the<br>
sdk-0.10.23-hls branch in Andoni's github repository about a year ago.<br>
After work on the hlsdemux branch finished, it was rebased onto some<br>
other branch. Since this time, much (but not all) of the hlsdemux work<br>
has been merged into the sdk-0.10.23-hls branch, and there have been<br>
additional bug fixes applied to this branch.<br>
<br>
Andoni, could you tell me what the story with the sdk-0.10.23-hls<br>
branch is, and whether it would be sensible to pull any bug fixes from<br>
this branch?<br></blockquote><div><div>Hi Duncan,<br><br></div>The latest work is in the following 
branch: <a href="https://github.com/fluendo/gst-plugins-bad/tree/sdk-0.10.23-hls" target="_blank">https://github.com/fluendo/gst-plugins-bad/tree/sdk-0.10.23-hls</a>,
 which is just a rebase of the patches submitted submitted in the bug report on top of the sdk branch plus more patches fixing issues we have found on the way.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<br>
I think as a starting point, Andoni's hlsdemux branch would need to be ported<br>
to 1.x, and all 1.x changes then merged in (if they still make sense), perhaps<br>
along with bug fixes from Andoni's sdk-0.10.23-hls branch. This would be quite<br>
a manual process. There are some complications;<br>
- Andoni's hlsdemux branch and the 1.x hlsdemux implementation both support<br>
  decryption, but the implementations are conflicting. Also, the 1.x<br>
  implementation relies on gnutls whilst the hlsdemux branch relies on openssl.<br>
  I'd probably be inclined to stick with gnutls, to avoid the openssl license<br>
  complications.<br>
- I think there are conflicting changes in m3u8.c<br>
- Refactoring of uridownloader into it's own library on 1.x. Should be<br>
  straightforward to deal with.<br>
<br>
The hlsdemux branch creates hlsdemux as a bin, encapsulating a<br>
typefind element and a tsdemux, plus some elements for subtitle<br>
handling (haven't looked into it). I gather from the bug report that<br>
there is some disagreement over whether this is the right way to go.<br>
Could anyone enlighten me on the details?<br>
<br>
>From what I can see, these are the reasons for the hlsdemux being a bin. Have I<br>
missed any?<br>
- To fiddle with the timestamps on SEGMENT events after a 'catch-up' seek to<br>
  the head of a live window.<br>
- To ensure that no SEGMENT events produced by tsdemux make it downstream (does<br>
  tsdemux actually produce it's own SEGMENT events - I haven't looked<br>
  properly).<br>
- To facilitate the implementation of gst_hls_demux_drain_streams(); on a<br>
  discontinuity, hlsdemux waits for the tsdemux to drain (and filters out the<br>
  EOS event it sends), before sending a SEGMENT event.<br></blockquote><div><br></div><div>You are missing here the most important point which is allowing to filter out the audio stream from the main muxed video/audio and use the audio from the alternative rendition when  it's being activated.<br>


<br></div><div>Honestly, I don't think you can try to rebase this branch on top of the current master, it has diverged so much that it would be impossible to apply those patches separately. Also, the design of the element is completely different and even though it's an element in -bad where you can change its API there should probably be an hlsemux2. This would make things much simpler, as you could  directly port this element to 1.x instead of trying to rebase the patches, which I think it's not currently a viable option.<br>


<br></div><div>If I had to port everything to 1.x I would also change a few things too that were more hard to handle in 0.10. There is one thing specially  that complicates the design *a lot*, which is the fact that you have to create a new decoding chain for decodebin when the stream topology changes (when you go from Vidieo/Audio to Audio only or when you activate the subtitles track). This means that each time a pad is deactivated or activated you have to flush everything, remove all the pads, create new pads and signal no-more-pads so that decodebin knows about the new decoding chain with the new topology. An that's specially complicated with this element because you have cached fragments, which means that when you activate the subtitles pad  or you move to an audio-only stream, the topology does not change straight away, but when downstream has consumed the cached fragments and it starts processing the one that changes everything. This also forces you to treat fragments sequentially, and right now the streaming has to create up to 3 more threads to push the audio/video fragment, the alternative audio if present and the subtitles fragment if present.<br>

<br></div><div>I think 1.x can help a lot in improving this situation with the support for sparse streams.<br><br></div><div>Cheers,<br></div><div>Andoni<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">


<br>
Any comments much appreciated.<br></blockquote><div><br></div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Regards,<br>
Dunk.<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Andoni Morales Alastruey<br><br>LongoMatch:The Digital Coach<br><a href="http://www.longomatch.ylatuya.es" target="_blank">http://www.longomatch.ylatuya.es</a>
</div></div>