<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK][GStreamer][MSE] Crash on youtube when MSE is enabled but gstreamer cant find the decoder element."
   href="https://bugs.webkit.org/show_bug.cgi?id=167120#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK][GStreamer][MSE] Crash on youtube when MSE is enabled but gstreamer cant find the decoder element."
   href="https://bugs.webkit.org/show_bug.cgi?id=167120">bug 167120</a>
              from <span class="vcard"><a class="email" href="mailto:zan&#64;falconsigh.net" title="Zan Dobersek &lt;zan&#64;falconsigh.net&gt;"> <span class="fn">Zan Dobersek</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=304937&amp;action=diff" name="attach_304937" title="Patch">attachment 304937</a> <a href="attachment.cgi?id=304937&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=304937&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=304937&amp;action=review</a>

<span class="quote">&gt;&gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:113
&gt;&gt; +bool doInitializeGStreamerAndRegisterWebKitElements()
&gt; 
&gt; I'd thank feedback from some reviewer about if this is the best way to expose the original initializeGStreamerAndRegisterWebKitElements() internal function to be called from another internal function in MediaPlayerPrivateGStreamer.cpp.
&gt; 
&gt; If resorting to declare a friend function is too cumbersome, maybe a more direct approach would be to just declare the original initializeGStreamerAndRegisterWebKitElements() publicly in the header file. I'm still not sure.</span >

IMO this should be a public static function in the MediaPlayerPrivateGStreamerBase class. That way there's no need to declare friendship in the MediaPlayerPrivateGStreamerMSE class.

<span class="quote">&gt; Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:755
&gt; +static HashSet&lt;String, ASCIICaseInsensitiveHash&gt;&amp; codecSet()</span >

Should return a const reference.

<span class="quote">&gt; Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:759
&gt; +        callInitializeGStreamerAndRegisterWebKitElements();</span >

This would be a direct call to MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements().

<span class="quote">&gt; Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:780
&gt; +        Vector&lt;GstCapsWebKitMapping&gt; mapping = {
&gt; +            {VideoDecoder, &quot;video/x-h264,  profile=(string){ constrained-baseline, baseline }&quot;, {&quot;x-h264&quot;}},
&gt; +            {VideoDecoder, &quot;video/x-h264, stream-format=avc&quot;, {&quot;avc*&quot;}},
&gt; +            {VideoDecoder, &quot;video/mpeg, mpegversion=(int){1,2}, systemstream=(boolean)false&quot;, {&quot;mpeg&quot;}},
&gt; +        };</span >

This should be a std::array&lt;&gt;.

The brace-initialization should have spaces at after the opening and before the closing brace: { VideoDecoder, ..., { &quot;x-h264&quot; } },

Why AtomicStrings? Regardless whether you use AtomicStrings or ordinary Strings, you should intialize them with AtomicString(&quot;...&quot;, AtomicString::ConstructFromLiteral) or ASCIILiteral(&quot;...&quot;).

<span class="quote">&gt; Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:787
&gt; +            GList* factories = nullptr;
&gt; +            if (current.elementType == AudioDecoder)
&gt; +                factories = audioDecoderFactories;
&gt; +            else if (current.elementType == VideoDecoder)
&gt; +                factories = videoDecoderFactories;</span >

This doesn't handle the Demuxer value, which would leave the factories GList null and cause problems in gstRegistryHasElementForMediaType(). But as it stands the Demuxer value isn't used in the mapping array.

If it's not needed, it should be removed from the enum. If it's needed, it should be handled here. Either way, this if-elseif block should be a switch statement that handles all the values in the enum.

<span class="quote">&gt; Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:811
&gt; +            set.add(AtomicString(&quot;audio/mpeg&quot;));
&gt; +            set.add(AtomicString(&quot;audio/x-mpeg&quot;));</span >

Again regarding using AtomicStrings -- you should use Strings all the way if the target HashSet has String values. But don't forget to use ASCIILiteral directly.

<span class="quote">&gt; Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:814
&gt; +
&gt; +</span >

Nit: one extraneous newline.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>