w3c / media-source

Media Source Extensions
https://w3c.github.io/media-source/
Other
268 stars 58 forks source link

append appendBuffer with negative timestampOffset give no result #224

Closed szymon-wesolowski closed 5 years ago

szymon-wesolowski commented 5 years ago

If timestampOffset property of sourceBuffer is set less then about -7.5, after appendBuffer sourceBuffer.buffered is still empty.

This code does not append sourceBuffer.

let timestampOffset = -7.6 this.sourceBuffer.timestampOffset = timestampOffset; this.sourceBuffer.appendBuffer(arrayBytes);

jyavenard commented 5 years ago

this should be closed as invalid.

https://w3c.github.io/media-source/index.html#sourcebuffer-coded-frame-processing

Step 8. "If presentation timestamp is less than appendWindowStart, then set the need random access point flag to true, drop the coded frame, and jump to the top of the loop to start processing the next coded frame. "

appendWindowStart by default is 0.

szymon-wesolowski commented 5 years ago

i have not specify duration of appending segment. appending segment has about 10s in my scenario, so i would expect 2.5s should be placed in the sourcebuffer and available to play. actually there are not any frames in sourcebuffer, it is empty

jernoble commented 5 years ago

It's likely empty because all the samples from the last 2.5s depend upon timestamps whose shifted PTS is negative, and were dropped. If your segment had an I-frame at (unshifted) 7.5s, the buffered range would be 2.5s as you'd expect.

szymon-wesolowski commented 5 years ago

thank you for explenation, @jernoble you are right, my video files contains 50 frames in GOP with 20fps, which are exactly 2.5s.