Bug 190143

Summary: [MSE][GStreamer] Add h264parse to accept MP4 without stss
Product: WebKit Reporter: Alicia Boya García <aboya>
Component: WebKitGTKAssignee: Alicia Boya García <aboya>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, calvaris, commit-queue, pnormand
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 190394    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Alicia Boya García 2018-10-01 10:34:50 PDT
The MP4 file used in this URL does not contain a stss (Sync Sample
Box). In consequence, in acordance with the ISO BMFF spec, all samples
are assumed to be sync frames... But in this case that is not true,
it's just that the file is wrong (e.g. created with a buggy muxer).

http://orange-opensource.github.io/hasplayer.js/1.2.0/player.html?url=http://playready.directtaps.net/smoothstreaming/SSWSS720H264/SuperSpeedway_720.ism/Manifest

The way it works in other browsers is because instead of trusting the
MP4 stss table, they rely on parsing the h264 frames. We can do that
too, using h264parse.
Comment 1 Alicia Boya García 2018-10-01 10:37:38 PDT
Created attachment 351262 [details]
Patch
Comment 2 Xabier Rodríguez Calvar 2018-10-02 00:13:00 PDT
Comment on attachment 351262 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=351262&action=review

> Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:872
> +        RELEASE_ASSERT(h264parse);

Please, add a GST_ERROR, ASSERT_NOT_REACHED and return nullptr in case there is no parser. Better a not playing element than a web process crass.

And we should do the same for vorbisparse.
Comment 3 Xabier Rodríguez Calvar 2018-10-02 00:14:14 PDT
(In reply to Xabier Rodríguez Calvar from comment #2)
> And we should do the same for vorbisparse.

I don't mean we need to do it in this bug, it can be another. If you decide to do it in this bug, which I won't oppose, make it explicit in the changelog.
Comment 4 Philippe Normand 2018-10-02 00:39:15 PDT
A long-term and generic solution could be to use parsebin.
Comment 5 Alicia Boya García 2018-10-02 02:18:25 PDT
Created attachment 351361 [details]
Patch
Comment 6 Xabier Rodríguez Calvar 2018-10-02 02:37:45 PDT
Comment on attachment 351361 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=351361&action=review

> Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:872
> +        GstElement* h264parse = gst_element_factory_make("h264parse", parserName.get());
> +        g_return_val_if_fail(h264parse, nullptr);

ASSERT on the element as well to get a crash in debug.
Comment 7 Alicia Boya García 2018-10-02 02:55:16 PDT
(In reply to Xabier Rodríguez Calvar from comment #6)
> Comment on attachment 351361 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=351361&action=review
> 
> > Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:872
> > +        GstElement* h264parse = gst_element_factory_make("h264parse", parserName.get());
> > +        g_return_val_if_fail(h264parse, nullptr);
> 
> ASSERT on the element as well to get a crash in debug.

You can use G_DEBUG=fatal-criticals for that.
Comment 8 Alicia Boya García 2018-10-02 03:53:42 PDT
Created attachment 351367 [details]
Patch
Comment 9 WebKit Commit Bot 2018-10-02 04:57:13 PDT
Comment on attachment 351367 [details]
Patch

Clearing flags on attachment: 351367

Committed r236735: <https://trac.webkit.org/changeset/236735>
Comment 10 WebKit Commit Bot 2018-10-02 04:57:15 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Alicia Boya García 2018-10-08 10:43:49 PDT
Minor correction: it's not actually about a stss box because fragmented files use the `sample_is_difference_sample` flag of `trun` instead; but otherwise the problem is the same.