Bug 179373 - [GStreamer] Builds fails with ENABLE_VIDEO=OFF due to GStreamer usage
Summary: [GStreamer] Builds fails with ENABLE_VIDEO=OFF due to GStreamer usage
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords: InRadar
Depends on: 179372
Blocks:
  Show dependency treegraph
 
Reported: 2017-11-07 06:10 PST by Adrian Perez
Modified: 2017-11-30 08:22 PST (History)
15 users (show)

See Also:


Attachments
Patch (1.26 KB, patch)
2017-11-08 07:33 PST, Adrian Perez
no flags Details | Formatted Diff | Diff
Patch (1.48 KB, patch)
2017-11-30 02:30 PST, Adrian Perez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 (2.54 MB, application/zip)
2017-11-30 03:46 PST, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 2017-11-07 06:10:28 PST
The build error is as follows:

    In file included from DerivedSources/WebCore/unified-sources/UnifiedSource287.cpp:8:0:
    ../Source/WebCore/page/DeprecatedGlobalSettings.cpp: In static member function ‘static void WebCore::DeprecatedGlobalSettings::setGStreamerEnabled(bool)’:
    ../Source/WebCore/page/DeprecatedGlobalSettings.cpp:144:23: error: incomplete type ‘WebCore::HTMLMediaElement’ used in nested name specifier
         HTMLMediaElement::resetMediaEngines();
                           ^~~~~~~~~~~~~~~~~

The part of the code referenced above is guarded with “USE(GSTREAMER)”,
but IIRC it used to be that building with “ENABLE_VIDEO=OFF” should not
be using GStreamer at all.
Comment 1 Adrian Perez 2017-11-07 06:44:19 PST
Setting both “ENABLE_VIDEO=OFF” and “ENABLE_WEB_AUDIO=OFF” effectively
makes CMake skip checking for GStreamer, and the “USE(GSTREAMER)” guard
evaluates to false.

I see the following options:

 1.) Fixing things using ENABLE_VIDEO=OFF and ENABLE_WEB_AUDIO=ON
     combination works.
 2.) Make ENABLE_WEB_AUDIO depend on ENABLE_VIDEO.
 3.) Have a new ENABLE_MULTIMEDIA on which both ENABLE_VIDEO and
     ENABLE_WEB_AUDIO depend.
 4.) ???

What should we do here?
Comment 2 Michael Catanzaro 2017-11-07 07:00:38 PST
(In reply to Adrian Perez from comment #0)
> The build error is as follows:
> 
>     In file included from
> DerivedSources/WebCore/unified-sources/UnifiedSource287.cpp:8:0:
>     ../Source/WebCore/page/DeprecatedGlobalSettings.cpp: In static member
> function ‘static void
> WebCore::DeprecatedGlobalSettings::setGStreamerEnabled(bool)’:
>     ../Source/WebCore/page/DeprecatedGlobalSettings.cpp:144:23: error:
> incomplete type ‘WebCore::HTMLMediaElement’ used in nested name specifier
>          HTMLMediaElement::resetMediaEngines();
>                            ^~~~~~~~~~~~~~~~~
> 
> The part of the code referenced above is guarded with “USE(GSTREAMER)”,
> but IIRC it used to be that building with “ENABLE_VIDEO=OFF” should not
> be using GStreamer at all.

ENABLE_WEB_AUDIO uses GStreamer too. I think the code should probably be guarded by #if ENABLE(VIDEO) || ENABLE(WEB_AUDIO). But please ask the multimedia team what they prefer.
Comment 3 Carlos Alberto Lopez Perez 2017-11-07 07:05:11 PST
> The part of the code referenced above is guarded with “USE(GSTREAMER)”,
> but IIRC it used to be that building with “ENABLE_VIDEO=OFF” should not
> be using GStreamer at all.

I think the WEB_AUDIO feature depends on GStreamer.
Comment 4 Adrian Perez 2017-11-08 06:30:45 PST
(In reply to Carlos Alberto Lopez Perez from comment #3)
> > The part of the code referenced above is guarded with “USE(GSTREAMER)”,
> > but IIRC it used to be that building with “ENABLE_VIDEO=OFF” should not
> > be using GStreamer at all.
> 
> I think the WEB_AUDIO feature depends on GStreamer.

I have been checking the source code: WebAudio also depends on ENABLE_VIDEO.
The correct solution here seems to be adding the feature dependency, which
is option (2.) of the ones I was suggesting.
Comment 5 Carlos Alberto Lopez Perez 2017-11-08 06:49:42 PST
(In reply to Adrian Perez from comment #4)
> (In reply to Carlos Alberto Lopez Perez from comment #3)
> > > The part of the code referenced above is guarded with “USE(GSTREAMER)”,
> > > but IIRC it used to be that building with “ENABLE_VIDEO=OFF” should not
> > > be using GStreamer at all.
> > 
> > I think the WEB_AUDIO feature depends on GStreamer.
> 
> I have been checking the source code: WebAudio also depends on ENABLE_VIDEO.
> The correct solution here seems to be adding the feature dependency, which
> is option (2.) of the ones I was suggesting.

mmm... isn't hat a bug? Why (or where) WebAudio needs to depend on ENABLE_VIDEO?
Comment 6 Adrian Perez 2017-11-08 07:33:20 PST
Created attachment 326326 [details]
Patch
Comment 7 Adrian Perez 2017-11-08 07:40:56 PST
(In reply to Carlos Alberto Lopez Perez from comment #5)
> (In reply to Adrian Perez from comment #4)
> > (In reply to Carlos Alberto Lopez Perez from comment #3)
> > > > The part of the code referenced above is guarded with “USE(GSTREAMER)”,
> > > > but IIRC it used to be that building with “ENABLE_VIDEO=OFF” should not
> > > > be using GStreamer at all.
> > > 
> > > I think the WEB_AUDIO feature depends on GStreamer.
> > 
> > I have been checking the source code: WebAudio also depends on ENABLE_VIDEO.
> > The correct solution here seems to be adding the feature dependency, which
> > is option (2.) of the ones I was suggesting.
> 
> mmm... isn't hat a bug? Why (or where) WebAudio needs to depend on
> ENABLE_VIDEO?

The *whole* implementation of “HTMLMediaElement” (which is used for
<video> and <audio> tags) is guarded with “ENABLE(VIDEO)”, and WebAudio
requires it.

My guess is that ENABLE_VIDEO was originally used to guard the support
for <video>, then when <audio> was implemented (and later the WebAudio
JS API) but the guard was kept. Probably the guard should be renamed to
ENABLE_MULTIMEDIA_PLAYBACK to make it better reflect what it does.
Comment 8 Michael Catanzaro 2017-11-08 07:48:42 PST
Comment on attachment 326326 [details]
Patch

OK, wow. That is a surprise to me.

I'm OK with this, assuming multimedia team agrees. (Please find a multimedia team reviewer.) But if we do it, we need to update existing code that assumes ENABLE_WEB_AUDIO does not depend on ENABLE_VIDEO. For example, in GStreamerChecks.cmake, the entire file is guarded by if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO). That doesn't make sense after this commit, since ENABLE_VIDEO now implies ENABLE_WEB_AUDIO, the ENABLE_WEB_AUDIO check should be dropped. I grepped the codebase for 'ENABLE(VIDEO) || ENABLE(WEB_AUDIO)' and found hits in PlatformMediaSession.cpp and PlatformMediaSessionManager.cpp that will need to be removed.
Comment 9 Adrian Perez 2017-11-09 02:20:21 PST
(In reply to Michael Catanzaro from comment #8)
> Comment on attachment 326326 [details]
> Patch
> 
> OK, wow. That is a surprise to me.

Same here when I found out.

Interestingly enough, in Buildroot the recipe has a “Enable multimedia
support” configuration option which ends up toggling both ENABLE_VIDEO
and ENABLE_WEB_AUDIO:

  https://git.busybox.net/buildroot/tree/package/webkitgtk/webkitgtk.mk#n37

...which from the repo history I see they do that way because setting
only ENABLE_VIDEO=OFF doesn't build :-)

> I'm OK with this, assuming multimedia team agrees. (Please find a multimedia
> team reviewer.) But if we do it, we need to update existing code that
> assumes ENABLE_WEB_AUDIO does not depend on ENABLE_VIDEO. For example, in
> GStreamerChecks.cmake, the entire file is guarded by if (ENABLE_VIDEO OR
> ENABLE_WEB_AUDIO). That doesn't make sense after this commit, since
> ENABLE_VIDEO now implies ENABLE_WEB_AUDIO, the ENABLE_WEB_AUDIO check should
> be dropped. I grepped the codebase for 'ENABLE(VIDEO) || ENABLE(WEB_AUDIO)'
> and found hits in PlatformMediaSession.cpp and
> PlatformMediaSessionManager.cpp that will need to be removed.

Good catch, I'll comb our CMake build files accordingly.
Comment 10 Adrian Perez 2017-11-09 02:22:09 PST
(In reply to Michael Catanzaro from comment #8)

> I'm OK with this, assuming multimedia team agrees. (Please find a multimedia
> team reviewer.) [...]

I am CC'ing Philippe, Alex, and Xabier. Let's see what's their opinion.
Comment 11 Xabier Rodríguez Calvar 2017-11-09 03:10:34 PST
Comment on attachment 326326 [details]
Patch

Let's check what happens in Mac first. If there's the dependency too then we land, otherwise we should go for option 1.
Comment 12 Carlos Alberto Lopez Perez 2017-11-09 09:50:55 PST
Mmm.... 


Are you sure this dependency can be untangled easily?

I was able to build with WebKitGTK+ with -DENABLE_VIDEO=OFF -DENABLE_WEB_AUDIO=ON with the patch below

diff --git a/Source/WebCore/page/DeprecatedGlobalSettings.cpp b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
index 348d93833fd..2cb1c9c20e1 100644
--- a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
+++ b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
@@ -141,7 +141,9 @@ void DeprecatedGlobalSettings::setGStreamerEnabled(bool enabled)
         return;
 
     gGStreamerEnabled = enabled;
+#if ENABLE(VIDEO)
     HTMLMediaElement::resetMediaEngines();
+#endif
 }
 #endif
 



And I tested the minibrowser with this test and it worked fine

Tools/Scripts/run-minibrowser --gtk --enable-webaudio=true  http://webaudiodemos.appspot.com/oscilloscope/index.html


Also tested to run the 111 webaudio/ layout tests. They pass fine, except the 5 below

Regressions: Unexpected text-only failures (4)
  webaudio/createMediaStreamSource-null.html [ Failure ]
  webaudio/mediaelementaudiosourcenode-gc.html [ Failure ]
  webaudio/mediaelementaudiosourcenode.html [ Failure ]
  webaudio/mediastreamaudiodestinationnode.html [ Failure ]

Regressions: Unexpected timeouts (1)
  webaudio/audiocontext-state-interrupted.html [ Timeout ]
Comment 13 Michael Catanzaro 2017-11-09 09:55:54 PST
I think the confusion here is that ENABLE_WEB_AUDIO doesn't have anything to do with HTMLAudioElement. HTMLAudioElement really does depend on ENABLE_VIDEO (for HTMLMediaElement), but ENABLE_WEB_AUDIO seems to be a separate feature.
Comment 14 Michael Catanzaro 2017-11-09 09:56:09 PST
Comment on attachment 326326 [details]
Patch

Let's go with Carlos Lopez's approach instead.
Comment 15 Adrian Perez 2017-11-13 08:54:24 PST
(In reply to Carlos Alberto Lopez Perez from comment #12)
> Mmm.... 
> 
> 
> Are you sure this dependency can be untangled easily?
> 
> I was able to build with WebKitGTK+ with -DENABLE_VIDEO=OFF
> -DENABLE_WEB_AUDIO=ON with the patch below
> 
> diff --git a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> index 348d93833fd..2cb1c9c20e1 100644
> --- a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> +++ b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> @@ -141,7 +141,9 @@ void DeprecatedGlobalSettings::setGStreamerEnabled(bool
> enabled)
>          return;
>  
>      gGStreamerEnabled = enabled;
> +#if ENABLE(VIDEO)
>      HTMLMediaElement::resetMediaEngines();
> +#endif
>  }
>  #endif
>  
> 
> 
> 
> And I tested the minibrowser with this test and it worked fine
> 
> Tools/Scripts/run-minibrowser --gtk --enable-webaudio=true 
> http://webaudiodemos.appspot.com/oscilloscope/index.html
> 
> 
> Also tested to run the 111 webaudio/ layout tests. They pass fine, except
> the 5 below
> 
> Regressions: Unexpected text-only failures (4)
>   webaudio/createMediaStreamSource-null.html [ Failure ]
>   webaudio/mediaelementaudiosourcenode-gc.html [ Failure ]
>   webaudio/mediaelementaudiosourcenode.html [ Failure ]
>   webaudio/mediastreamaudiodestinationnode.html [ Failure ]
> 
> Regressions: Unexpected timeouts (1)
>   webaudio/audiocontext-state-interrupted.html [ Timeout ]

This might be because “HTMLMediaElement::resetMediaEngines()” in turn
calls “MediaPlayer::resetMediaEngines()”. With the guards around the
latter never gets called. I am now trying something like the following
instead:

  diff --git a/Source/WebCore/page/DeprecatedGlobalSettings.cpp b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
  index 348d93833fd..3d56163753b 100644
  --- a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
  +++ b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
  @@ -141,7 +141,13 @@ void DeprecatedGlobalSettings::setGStreamerEnabled(bool enabled)
           return;
 
       gGStreamerEnabled = enabled;
  +#if ENABLE(VIDEO)
       HTMLMediaElement::resetMediaEngines();
  +#else
  +    // HTMLMediaElement is not available, but we can do here what it does,
  +    // to make sure things like WebAudio work.
  +    MediaPlayer::resetMediaEngines();
  +#endif
   }
   #endif
 
I'll see how this goes regarding the test failures (the build is progressing
as I write this :D).
Comment 16 Adrian Perez 2017-11-13 11:41:01 PST
(In reply to Adrian Perez from comment #15)
> (In reply to Carlos Alberto Lopez Perez from comment #12)
> > Mmm.... 
> > 
> > 
> > Are you sure this dependency can be untangled easily?
> > 
> > I was able to build with WebKitGTK+ with -DENABLE_VIDEO=OFF
> > -DENABLE_WEB_AUDIO=ON with the patch below
> > 
> > diff --git a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> > b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> > index 348d93833fd..2cb1c9c20e1 100644
> > --- a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> > +++ b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> > @@ -141,7 +141,9 @@ void DeprecatedGlobalSettings::setGStreamerEnabled(bool
> > enabled)
> >          return;
> >  
> >      gGStreamerEnabled = enabled;
> > +#if ENABLE(VIDEO)
> >      HTMLMediaElement::resetMediaEngines();
> > +#endif
> >  }
> >  #endif
> >  
> > 
> > 
> > 
> > And I tested the minibrowser with this test and it worked fine
> > 
> > Tools/Scripts/run-minibrowser --gtk --enable-webaudio=true 
> > http://webaudiodemos.appspot.com/oscilloscope/index.html
> > 
> > 
> > Also tested to run the 111 webaudio/ layout tests. They pass fine, except
> > the 5 below
> > 
> > Regressions: Unexpected text-only failures (4)
> >   webaudio/createMediaStreamSource-null.html [ Failure ]
> >   webaudio/mediaelementaudiosourcenode-gc.html [ Failure ]
> >   webaudio/mediaelementaudiosourcenode.html [ Failure ]
> >   webaudio/mediastreamaudiodestinationnode.html [ Failure ]
> > 
> > Regressions: Unexpected timeouts (1)
> >   webaudio/audiocontext-state-interrupted.html [ Timeout ]
> 
> This might be because “HTMLMediaElement::resetMediaEngines()” in turn
> calls “MediaPlayer::resetMediaEngines()”. With the guards around the
> latter never gets called. I am now trying something like the following
> instead:
> 
>   diff --git a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
>   index 348d93833fd..3d56163753b 100644
>   --- a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
>   +++ b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
>   @@ -141,7 +141,13 @@ void
> DeprecatedGlobalSettings::setGStreamerEnabled(bool enabled)
>            return;
>  
>        gGStreamerEnabled = enabled;
>   +#if ENABLE(VIDEO)
>        HTMLMediaElement::resetMediaEngines();
>   +#else
>   +    // HTMLMediaElement is not available, but we can do here what it does,
>   +    // to make sure things like WebAudio work.
>   +    MediaPlayer::resetMediaEngines();
>   +#endif
>    }
>    #endif
>  
> I'll see how this goes regarding the test failures (the build is progressing
> as I write this :D).

Noup. MediaPlayer is it all also guarded with “ENABLE(VIDEO)”. This means
that even if the WebAudio API *may* work e.g. for processing sound samples,
there is no way WebKit will ever be able of playing back sound to the user.
Do we really want to allow that? What would be the point? I still think
making ENABLE_WEB_AUDIO depend on ENABLE_VIDEO is the best thing to do:
otherwise we allow to make builds which advertise the WebAudio API, which
cannot produce any kind of multimedia output... that seems like a really
bad idea to me :-\
Comment 17 Carlos Alberto Lopez Perez 2017-11-13 14:06:57 PST
(In reply to Adrian Perez from comment #16)
> Noup. MediaPlayer is it all also guarded with “ENABLE(VIDEO)”. This means
> that even if the WebAudio API *may* work e.g. for processing sound samples,
> there is no way WebKit will ever be able of playing back sound to the user.

I'm able to hear the sound on this demo <http://webaudiodemos.appspot.com/oscilloscope/index.html> with a WebKitGTK+/MiniBrowser built with ENABLE_VIDEO=OFF and ENABLE_WEB_AUDIO=ON (NOTE: you need to pass the run-time flag --enable-webaudio=true to the MB)
Comment 18 Michael Catanzaro 2017-11-28 17:59:08 PST
(In reply to Carlos Alberto Lopez Perez from comment #12)
> I was able to build with WebKitGTK+ with -DENABLE_VIDEO=OFF
> -DENABLE_WEB_AUDIO=ON with the patch below
> 
> diff --git a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> index 348d93833fd..2cb1c9c20e1 100644
> --- a/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> +++ b/Source/WebCore/page/DeprecatedGlobalSettings.cpp
> @@ -141,7 +141,9 @@ void DeprecatedGlobalSettings::setGStreamerEnabled(bool
> enabled)
>          return;
>  
>      gGStreamerEnabled = enabled;
> +#if ENABLE(VIDEO)
>      HTMLMediaElement::resetMediaEngines();
> +#endif
>  }
>  #endif

Want to submit a patch for this?
Comment 19 Adrian Perez 2017-11-30 02:30:33 PST
Created attachment 327961 [details]
Patch
Comment 20 EWS Watchlist 2017-11-30 03:46:18 PST
Comment on attachment 327961 [details]
Patch

Attachment 327961 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/5415953

New failing tests:
imported/w3c/web-platform-tests/html/browsers/offline/appcache/workers/appcache-worker.html
Comment 21 EWS Watchlist 2017-11-30 03:46:19 PST
Created attachment 327965 [details]
Archive of layout-test-results from ews107 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 22 WebKit Commit Bot 2017-11-30 04:00:59 PST
Comment on attachment 327961 [details]
Patch

Clearing flags on attachment: 327961

Committed r225323: <https://trac.webkit.org/changeset/225323>
Comment 23 WebKit Commit Bot 2017-11-30 04:01:01 PST
All reviewed patches have been landed.  Closing bug.
Comment 24 Radar WebKit Bug Importer 2017-11-30 04:01:39 PST
<rdar://problem/35770196>
Comment 25 Michael Catanzaro 2017-11-30 06:46:50 PST
I forgot, you had suggested this:

  +#if ENABLE(VIDEO)
       HTMLMediaElement::resetMediaEngines();
  +#else
  +    // HTMLMediaElement is not available, but we can do here what it does,
  +    // to make sure things like WebAudio work.
  +    MediaPlayer::resetMediaEngines();
  +#endif

Was there a problem with that, or just forgot?
Comment 26 Adrian Perez 2017-11-30 08:22:42 PST
(In reply to Michael Catanzaro from comment #25)
> I forgot, you had suggested this:
> 
>   +#if ENABLE(VIDEO)
>        HTMLMediaElement::resetMediaEngines();
>   +#else
>   +    // HTMLMediaElement is not available, but we can do here what it does,
>   +    // to make sure things like WebAudio work.
>   +    MediaPlayer::resetMediaEngines();
>   +#endif
> 
> Was there a problem with that, or just forgot?

It didn't work: MediaPlayer is also guarded by ENABLE(VIDEO).