[Bug 27542] New: [MSE] Clarify that 'Initialization Segment Received' is the first place that changes ready state to HAVE_METADATA

https://www.w3.org/Bugs/Public/show_bug.cgi?id=27542

            Bug ID: 27542
           Summary: [MSE] Clarify that 'Initialization Segment Received'
                    is the first place that changes ready state to
                    HAVE_METADATA
           Product: HTML WG
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Media Source Extensions
          Assignee: adrianba@microsoft.com
          Reporter: b.gajda@samsung.com
        QA Contact: public-html-bugzilla@w3.org
                CC: mike@w3.org, public-html-media@w3.org

Currently we have: 

3.5.7 Initialization Segment Received
" 6. If the HTMLMediaElement.readyState attribute is HAVE_NOTHING, then run the
following steps:
1  If one or more objects in sourceBuffers have first initialization segment
flag set to false, then abort these steps.
2. Set the HTMLMediaElement.readyState attribute to HAVE_METADATA."

but also in 2.4.4 SourceBuffer Monitoring

"If buffered for all objects in activeSourceBuffers do not contain TimeRanges
for the current playback position:

1.  Set the HTMLMediaElement.readyState attribute to HAVE_METADATA.
2. If this is the first transition to HAVE_METADATA, then queue a task to fire
a simple event named loadedmetadata at the media element.
3. Abort these steps.
"

also SourceBuffer Monitoring states:
" The following steps are periodically run during *playback*"
but also :
"appending new segments and changes to activeSourceBuffers also cause these
steps to run because they affect the conditions that trigger state
transitions."

which could be interpreted as : run monitoring algorithm after any append.

Now what can happen is following:

Scenario 1:

1. create SB with audio
2. create SB with video
active sourcebuffers : none
3. append init segment to SB with audio
active sourcebuffers : SB with audio
4. monitoring algorithm can fire (according to spec) and changes ready state to
HAVE_METADATA, as active SB (with audio) has 0 buffered.

5. monitoring algorithm schedules event `loadedmetadata` 
6. javascript receives and asks for HTMLMediaElement width/height, 
=> Error : there is no yet, as there was no init segment for video
7. append init segment to SB with video

Scenario 2:
it could be also written as:

add event listener on `loadedmetadata`: append media segments to video
add event listener on `updateend` : append init segment to SB with video
append init segment to audio.

which would make following order : append init to SB1, loadedmetadata, append
media sample to SB2, End of stream.

so efectively media segments for video would be discarded and End of stream
shall be called according to :
"3.5.1  If the append state equals PARSING_MEDIA_SEGMENT, then run the
following steps:
6.1 If the first initialization segment flag is false, then run the end of
stream algorithm with the error parameter set to "decode" and abort this
algorithm."

--

What I believe is expected to happen is that `loadedmetadata` is fired after
both SB with audio and SB with video have received initialization segments. (so
complete metadata was loaded)

Proposed changed is to add at beggining of monitoring algorithm:

" If one or more objects in sourceBuffers have first initialization segment
flag set to false, then abort these steps."

exactly the same as in 3.5.7 6.1, which would make it crystal clear.

Or You can state at then end of 3.5.7 6.3 that this is the place when You can
start monitoring.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 9 December 2014 05:28:10 UTC