WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
187850
[MediaCapabilities] Platform integration
https://bugs.webkit.org/show_bug.cgi?id=187850
Summary
[MediaCapabilities] Platform integration
Philippe Normand
Reported
2018-07-20 02:21:08 PDT
The current implementation of MediaCapabilities::decodingInfo() and MediaCapabilities::encodingInfo() are incomplete. I wonder if the platform probing should be done by extending MediaPlayer with new static functions, would that be acceptable or should I implement a new platform abstraction for this?
Attachments
Patch
(38.63 KB, patch)
2018-07-25 05:26 PDT
,
Philippe Normand
no flags
Details
Formatted Diff
Diff
Patch
(72.00 KB, patch)
2018-08-03 07:09 PDT
,
Philippe Normand
no flags
Details
Formatted Diff
Diff
Patch
(74.52 KB, patch)
2018-08-03 07:31 PDT
,
Philippe Normand
no flags
Details
Formatted Diff
Diff
Patch
(74.12 KB, patch)
2018-08-03 07:58 PDT
,
Philippe Normand
no flags
Details
Formatted Diff
Diff
Patch
(74.63 KB, patch)
2018-08-03 08:56 PDT
,
Philippe Normand
no flags
Details
Formatted Diff
Diff
Patch
(75.15 KB, patch)
2018-08-03 09:32 PDT
,
Philippe Normand
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Jer Noble
Comment 1
2018-07-20 09:23:10 PDT
@Philippe, we've introduced new platform abstractions, even for MediaPlayer-like capabilities, for Modern EME. I think it would be acceptable to introduce a new abstraction rather than re-use MediaPlayer.
Philippe Normand
Comment 2
2018-07-20 09:37:28 PDT
Ok Jer, that totally makes sense indeed. I'll work on a patch in that direction.
Philippe Normand
Comment 3
2018-07-25 05:26:26 PDT
Created
attachment 345754
[details]
Patch
Philippe Normand
Comment 4
2018-07-25 05:27:30 PDT
This is my current WIP patch which has a decodingInfo() platform integration and a mock test. Before going further I'd like to gather some initial feedback on the approach taken.
Eric Carlson
Comment 5
2018-07-25 09:03:15 PDT
Comment on
attachment 345754
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=345754&action=review
> Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp:203 > + auto info = MediaCapabilitiesInfo::create(); > + auto engineConfiguration = MediaEngineConfigurationFactory::createDecodingConfiguration(configuration);
Nit: I wonder if it would be better to pass a lambda to createDecodingConfiguration in case a platform isn't able to get the platform capabilities synchronously?
> Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.cpp:42 > + if (ok) > + return;
Shouldn't this be "if (!ok)"?
> Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.cpp:60 > + double numerator = frameratePieces[0].toDouble(&ok); > + if (!ok) > + return; > + > + double denominator = frameratePieces[1].toDouble(&ok); > + if (!ok) > + return; > + > + if (!std::isfinite(numerator) || !std::isfinite(denominator)) > + return; > + > + m_framerate = numerator / denominator;
Nit: I think it would be better to store the numerator and denominator in case a platform can use a rational number. You can always keep the frameRate() method and do the division there.
> Source/WebCore/testing/Internals.cpp:512 > + MediaEngineConfigurationFactory::disableMock();
This will leave GStreamer and AVFoundation disabled.
> Source/WebCore/testing/Internals.cpp:3447 > +#if USE(AVFOUNDATION) > + WebCore::DeprecatedGlobalSettings::setAVFoundationEnabled(false); > +#endif > +#if USE(GSTREAMER) > + WebCore::DeprecatedGlobalSettings::setGStreamerEnabled(false); > +#endif
Why is this necessary?
Philippe Normand
Comment 6
2018-07-25 09:41:15 PDT
Comment on
attachment 345754
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=345754&action=review
Thanks for the early feedback Eric. I'll update the patch, add audio support to the decoding config, add a mock implementation for the encoding side, add a few more tests and fix EWS
>> Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp:203 >> + auto engineConfiguration = MediaEngineConfigurationFactory::createDecodingConfiguration(configuration); > > Nit: I wonder if it would be better to pass a lambda to createDecodingConfiguration in case a platform isn't able to get the platform capabilities synchronously?
Good point! The GStreamer implementation shouldn't need this but I can change the code already if the AVF backend will require it.
>> Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.cpp:42 >> + return; > > Shouldn't this be "if (!ok)"?
Oh, indeed :)
>> Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.cpp:60 >> + m_framerate = numerator / denominator; > > Nit: I think it would be better to store the numerator and denominator in case a platform can use a rational number. You can always keep the frameRate() method and do the division there.
Makes sense!
>> Source/WebCore/testing/Internals.cpp:512 >> + MediaEngineConfigurationFactory::disableMock(); > > This will leave GStreamer and AVFoundation disabled.
Right, but the code below should be removed, as you hinted already.
>> Source/WebCore/testing/Internals.cpp:3447 >> +#endif > > Why is this necessary?
Ah no, it isn't, because the factory checks the mock case first anyway.
Philippe Normand
Comment 7
2018-08-03 07:09:41 PDT
Created
attachment 346480
[details]
Patch
Eric Carlson
Comment 8
2018-08-03 07:27:58 PDT
Comment on
attachment 346480
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=346480&action=review
> Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp:202 > + MediaEngineConfigurationFactory::DecodingConfigurationCallback callback = [promise = WTFMove(promise)] (RefPtr<MediaEngineDecodingConfiguration> engineConfiguration) mutable {
Nit: I think you can use "auto" here.
> Source/WebCore/Modules/mediacapabilities/MediaCapabilities.cpp:252 > + MediaEngineConfigurationFactory::EncodingConfigurationCallback callback = [promise = WTFMove(promise)] (RefPtr<MediaEngineEncodingConfiguration> engineConfiguration) mutable {
Ditto.
> Source/WebCore/platform/mediacapabilities/MediaEngineConfiguration.cpp:56 > + double numerator = frameratePieces[0].toDouble(&ok); > + if (!ok) > + return; > + > + double denominator = frameratePieces[1].toDouble(&ok); > + if (!ok) > + return;
You should also fail if numerator or denominator is zero.
> Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp:43 > + RefPtr<MediaEngineVideoConfiguration> videoConfig = videoConfiguration();
Nit: you can use "auto" here.
> Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp:51 > + RefPtr<MediaEngineAudioConfiguration> audioConfig = audioConfiguration();
Ditto.
> Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp:60 > + RefPtr<MediaEngineVideoConfiguration> videoConfig = videoConfiguration();
Ditto.
> Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp:66 > + RefPtr<MediaEngineAudioConfiguration> audioConfig = audioConfiguration();
Ditto.
> Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp:75 > + RefPtr<MediaEngineVideoConfiguration> videoConfig = videoConfiguration();
Ditto.
> Source/WebCore/platform/mock/MediaEngineDecodingConfigurationMock.cpp:81 > + RefPtr<MediaEngineAudioConfiguration> audioConfig = audioConfiguration();
Ditto.
> Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp:43 > + RefPtr<MediaEngineVideoConfiguration> videoConfig = videoConfiguration();
Ditto.
> Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp:51 > + RefPtr<MediaEngineAudioConfiguration> audioConfig = audioConfiguration();
Ditto.
> Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp:60 > + RefPtr<MediaEngineVideoConfiguration> videoConfig = videoConfiguration();
Ditto.
> Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp:62 > + if (videoConfig) { > + if (videoConfig->framerate() > 30)
Nit: these two lines can be collapsed.
> Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp:66 > + RefPtr<MediaEngineAudioConfiguration> audioConfig = audioConfiguration();
"auto".
> Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp:77 > + RefPtr<MediaEngineVideoConfiguration> videoConfig = videoConfiguration(); > + if (videoConfig) { > + if (videoConfig->contentType().containerType() != "video/mp4")
Ditto the above.
> Source/WebCore/platform/mock/MediaEngineEncodingConfigurationMock.cpp:81 > + RefPtr<MediaEngineAudioConfiguration> audioConfig = audioConfiguration();
"auto".
Philippe Normand
Comment 9
2018-08-03 07:31:54 PDT
Created
attachment 346481
[details]
Patch
Philippe Normand
Comment 10
2018-08-03 07:33:24 PDT
Comment on
attachment 346481
[details]
Patch Ah, sorry I didn't notice your review. This patch was a win EWS build fix attempt. Will update the patch again taking into account your review :) Thanks!
Philippe Normand
Comment 11
2018-08-03 07:58:33 PDT
Created
attachment 346484
[details]
Patch
Philippe Normand
Comment 12
2018-08-03 08:56:33 PDT
Created
attachment 346492
[details]
Patch
Philippe Normand
Comment 13
2018-08-03 09:32:01 PDT
Created
attachment 346498
[details]
Patch
Philippe Normand
Comment 14
2018-08-03 10:29:27 PDT
No idea what's wrong now with the win EWS... Welp :)
Eric Carlson
Comment 15
2018-08-03 11:02:47 PDT
(In reply to Philippe Normand from
comment #14
)
> No idea what's wrong now with the win EWS... Welp :)
Not likely your fault: "Unable to build without patch"
Philippe Normand
Comment 16
2018-08-05 02:26:30 PDT
Committed
r234582
: <
https://trac.webkit.org/changeset/234582
>
Radar WebKit Bug Importer
Comment 17
2018-08-05 02:27:18 PDT
<
rdar://problem/42943258
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug