On Apr 16, 2012, at 10:01 PM, Chris Pearce wrote:
> On 14/04/2012 9:54 a.m., Steve Workman wrote:
>
> > 1. from the WebMDASH spec, there is one Segment per media period, i.e. one URL, i.e. the media files are non-chunked, although they are separated into audio and video.
>
> Just so we're clear, there's a manifest file, and one video file per video stream, and one file for the audio stream?
Yup. Manifest file is .mpd = Media Presentation Description. It's in XML.
And yup, one audio file, non-chunked, so just one big file. And one video file per video stream, i.e. one file for each bitrate. These are also non-chunked.
>
> > Note, I also think that a proxy element object would be useful at the DASH level of things, so that the sub-decoders can have their notifications aggregated before sending to the real nsHTMLMediaElement.
>
> This sounds reasonable.
Good :)
>
>
> > You'll notice that ALL the video decoders are Loaded after the MPD is parsed.
>
> So you load up one decoder for each stream in the resource? So if a resource contains 1 high quality stream, 1 low quality stream, and 1 audio stream, you'd create 3 separate WebMDecoders for each one?
>
Right, that is the current way of thinking. Do you foresee any problems with this approach? The reason I chose this way to start is because this connection of one file and one decoder already exists in the code; downloading, seeking, playing etc. are already controlled on a per file basis, so it seemed logical to pursue this avenue and reuse as much of the current code/design as possible.
>
> > Currently, this is to get around errors in my working code at switching time (the 2nd video's state machine complains because I called a Seek immediately after a Load - it looks like it needs a little time to get metadata first).
>
> Yes, as you allude to, the decoder needs enough time to read the Cues (seek index) before it can seek. If the Cues are stored at the start of the stream like they're supposed to be, this shouldn't be too bad…
The order within the file should be as follows, according to the spec:
EBML header, Segment header, Segment Information and Tracks.
Cues,
Clusters.
However, there is this line at the end of the description:
"If the Cues is placed after the Clusters then a SeekHead shall be contained in the Initialization Segment with a reference to the Cues." [1]
Note: the Initialization Segment is at the start of the file.
>
> > So, I need some help with hacking the state machine, so that it loads metadata only and then stops. Only for the alternative streams, of course. If this early metadata loading doesn't make sense, or you see another way, please let me know.
>
> So normally when a media element is loaded with the preload="metadata" attribute, we stop the download after metadata is loaded by calling nsMediaDecoder::Suspend() when the decoder notifies us that it's loaded metadata (by calling nsHTMLMediaElement::FirstFrameLoaded()). So in your proxy which intercepts the nsBuiltinDecoders' calls to nsHTMLMediaElement, can you call Suspend() on the decoder when you intercept the alternative decoder's call to FirstFrameLoaded()?
Cool. I'll play around with the proxy element to see how I can control all of this. I want to explore how much control of network downloading we have through this, since it's separate threads etc. But, that's a second or later stage. First is getting Suspend working correctly to enable switching.
>
> Cheers,
> Chris P.
Thanks!
Steve.
[1]
http://wiki.webmproject.org/adaptive-streaming/webm-dash-specification