Bug 1923755 - Ship WebCodecs ImageDecoder and VideoFrame to release. r=media-playback-reviewers,chunmin,webidl,saschanaz
Because we are shipping to release on Android without video/audio decoder/encoder support from WebCodecs, we need to ensure VideoFrame is available on Android to allow the user to actually do anything useful, such as drawing the decoded images to a canvas. Differential Revision: https://phabricator.services.mozilla.com/D225150
This commit is contained in:
@@ -421,11 +421,6 @@ void ImageDecoder::CheckOutstandingDecodes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ bool ImageDecoder::PrefEnabled(JSContext* aCx, JSObject* aObj) {
|
|
||||||
return StaticPrefs::dom_media_webcodecs_enabled() &&
|
|
||||||
StaticPrefs::dom_media_webcodecs_image_decoder_enabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ already_AddRefed<ImageDecoder> ImageDecoder::Constructor(
|
/* static */ already_AddRefed<ImageDecoder> ImageDecoder::Constructor(
|
||||||
const GlobalObject& aGlobal, const ImageDecoderInit& aInit,
|
const GlobalObject& aGlobal, const ImageDecoderInit& aInit,
|
||||||
ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
|
|||||||
@@ -56,8 +56,6 @@ class ImageDecoder final : public nsISupports, public nsWrapperCache {
|
|||||||
JSObject* WrapObject(JSContext* aCx,
|
JSObject* WrapObject(JSContext* aCx,
|
||||||
JS::Handle<JSObject*> aGivenProto) override;
|
JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
|
|
||||||
|
|
||||||
static already_AddRefed<ImageDecoder> Constructor(
|
static already_AddRefed<ImageDecoder> Constructor(
|
||||||
const GlobalObject& aGlobal, const ImageDecoderInit& aInit,
|
const GlobalObject& aGlobal, const ImageDecoderInit& aInit,
|
||||||
ErrorResult& aRv);
|
ErrorResult& aRv);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "mozilla/Maybe.h"
|
#include "mozilla/Maybe.h"
|
||||||
#include "mozilla/ResultVariant.h"
|
#include "mozilla/ResultVariant.h"
|
||||||
#include "mozilla/ScopeExit.h"
|
#include "mozilla/ScopeExit.h"
|
||||||
|
#include "mozilla/StaticPrefs_dom.h"
|
||||||
#include "mozilla/Try.h"
|
#include "mozilla/Try.h"
|
||||||
#include "mozilla/UniquePtr.h"
|
#include "mozilla/UniquePtr.h"
|
||||||
#include "mozilla/dom/CanvasUtils.h"
|
#include "mozilla/dom/CanvasUtils.h"
|
||||||
@@ -1418,6 +1419,12 @@ JSObject* VideoFrame::WrapObject(JSContext* aCx,
|
|||||||
return VideoFrame_Binding::Wrap(aCx, this, aGivenProto);
|
return VideoFrame_Binding::Wrap(aCx, this, aGivenProto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
bool VideoFrame::PrefEnabled(JSContext* aCx, JSObject* aObj) {
|
||||||
|
return StaticPrefs::dom_media_webcodecs_enabled() ||
|
||||||
|
StaticPrefs::dom_media_webcodecs_image_decoder_enabled();
|
||||||
|
}
|
||||||
|
|
||||||
// The following constructors are defined in
|
// The following constructors are defined in
|
||||||
// https://w3c.github.io/webcodecs/#dom-videoframe-videoframe
|
// https://w3c.github.io/webcodecs/#dom-videoframe-videoframe
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ class VideoFrame final : public nsISupports, public nsWrapperCache {
|
|||||||
JSObject* WrapObject(JSContext* aCx,
|
JSObject* WrapObject(JSContext* aCx,
|
||||||
JS::Handle<JSObject*> aGivenProto) override;
|
JS::Handle<JSObject*> aGivenProto) override;
|
||||||
|
|
||||||
|
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
|
||||||
|
|
||||||
static already_AddRefed<VideoFrame> Constructor(
|
static already_AddRefed<VideoFrame> Constructor(
|
||||||
const GlobalObject& aGlobal, HTMLImageElement& aImageElement,
|
const GlobalObject& aGlobal, HTMLImageElement& aImageElement,
|
||||||
const VideoFrameInit& aInit, ErrorResult& aRv);
|
const VideoFrameInit& aInit, ErrorResult& aRv);
|
||||||
|
|||||||
@@ -779,11 +779,11 @@ let interfaceNamesInGlobalScope = [
|
|||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "ImageData", insecureContext: true },
|
{ name: "ImageData", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "ImageDecoder", nightly: true },
|
{ name: "ImageDecoder" },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "ImageTrack", nightly: true },
|
{ name: "ImageTrack" },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "ImageTrackList", nightly: true },
|
{ name: "ImageTrackList" },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "InputEvent", insecureContext: true },
|
{ name: "InputEvent", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
@@ -1466,13 +1466,13 @@ let interfaceNamesInGlobalScope = [
|
|||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "ValidityState", insecureContext: true },
|
{ name: "ValidityState", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "VideoColorSpace", insecureContext: true, nightlyAndroid: true },
|
{ name: "VideoColorSpace", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "VideoDecoder", nightlyAndroid: true },
|
{ name: "VideoDecoder", nightlyAndroid: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "VideoEncoder", nightlyAndroid: true },
|
{ name: "VideoEncoder", nightlyAndroid: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "VideoFrame", insecureContext: true, nightlyAndroid: true },
|
{ name: "VideoFrame", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "VideoPlaybackQuality", insecureContext: true },
|
{ name: "VideoPlaybackQuality", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ dictionary ImageDecodeResult {
|
|||||||
|
|
||||||
[Exposed=(Window,DedicatedWorker),
|
[Exposed=(Window,DedicatedWorker),
|
||||||
SecureContext,
|
SecureContext,
|
||||||
Func="mozilla::dom::ImageDecoder::PrefEnabled"]
|
Pref="dom.media.webcodecs.image-decoder.enabled"]
|
||||||
interface ImageTrack {
|
interface ImageTrack {
|
||||||
readonly attribute boolean animated;
|
readonly attribute boolean animated;
|
||||||
readonly attribute unsigned long frameCount;
|
readonly attribute unsigned long frameCount;
|
||||||
@@ -41,7 +41,7 @@ interface ImageTrack {
|
|||||||
|
|
||||||
[Exposed=(Window,DedicatedWorker),
|
[Exposed=(Window,DedicatedWorker),
|
||||||
SecureContext,
|
SecureContext,
|
||||||
Func="mozilla::dom::ImageDecoder::PrefEnabled"]
|
Pref="dom.media.webcodecs.image-decoder.enabled"]
|
||||||
interface ImageTrackList {
|
interface ImageTrackList {
|
||||||
getter ImageTrack (unsigned long index);
|
getter ImageTrack (unsigned long index);
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ interface ImageTrackList {
|
|||||||
|
|
||||||
[Exposed=(Window,DedicatedWorker),
|
[Exposed=(Window,DedicatedWorker),
|
||||||
SecureContext,
|
SecureContext,
|
||||||
Func="mozilla::dom::ImageDecoder::PrefEnabled"]
|
Pref="dom.media.webcodecs.image-decoder.enabled"]
|
||||||
interface ImageDecoder {
|
interface ImageDecoder {
|
||||||
[Throws]
|
[Throws]
|
||||||
constructor(ImageDecoderInit init);
|
constructor(ImageDecoderInit init);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* https://w3c.github.io/webcodecs/#videocolorspace
|
* https://w3c.github.io/webcodecs/#videocolorspace
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[Exposed=(Window,DedicatedWorker), Pref="dom.media.webcodecs.enabled"]
|
[Exposed=(Window,DedicatedWorker), Func="mozilla::dom::VideoFrame::PrefEnabled"]
|
||||||
interface VideoColorSpace {
|
interface VideoColorSpace {
|
||||||
[Throws]
|
[Throws]
|
||||||
constructor(optional VideoColorSpaceInit init = {});
|
constructor(optional VideoColorSpaceInit init = {});
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ enum AlphaOption {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// [Serializable, Transferable] are implemented without adding attributes here.
|
// [Serializable, Transferable] are implemented without adding attributes here.
|
||||||
[Exposed=(Window,DedicatedWorker), Pref="dom.media.webcodecs.enabled"]
|
[Exposed=(Window,DedicatedWorker), Func="mozilla::dom::VideoFrame::PrefEnabled"]
|
||||||
interface VideoFrame {
|
interface VideoFrame {
|
||||||
// The constructors should be shorten to:
|
// The constructors should be shorten to:
|
||||||
// ```
|
// ```
|
||||||
|
|||||||
@@ -260,11 +260,11 @@ let interfaceNamesInGlobalScope = [
|
|||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "ImageData", insecureContext: true },
|
{ name: "ImageData", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "ImageDecoder", nightly: true },
|
{ name: "ImageDecoder" },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "ImageTrack", nightly: true },
|
{ name: "ImageTrack" },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "ImageTrackList", nightly: true },
|
{ name: "ImageTrackList" },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
"Lock",
|
"Lock",
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
@@ -374,13 +374,13 @@ let interfaceNamesInGlobalScope = [
|
|||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "URLSearchParams", insecureContext: true },
|
{ name: "URLSearchParams", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "VideoColorSpace", insecureContext: true, nightlyAndroid: true },
|
{ name: "VideoColorSpace", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "VideoDecoder", nightlyAndroid: true },
|
{ name: "VideoDecoder", nightlyAndroid: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "VideoEncoder", nightlyAndroid: true },
|
{ name: "VideoEncoder", nightlyAndroid: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "VideoFrame", insecureContext: true, nightlyAndroid: true },
|
{ name: "VideoFrame", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{ name: "WebGL2RenderingContext", insecureContext: true },
|
{ name: "WebGL2RenderingContext", insecureContext: true },
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
|||||||
@@ -3241,7 +3241,7 @@
|
|||||||
# WebCodecs API - Image decoder
|
# WebCodecs API - Image decoder
|
||||||
- name: dom.media.webcodecs.image-decoder.enabled
|
- name: dom.media.webcodecs.image-decoder.enabled
|
||||||
type: RelaxedAtomicBool
|
type: RelaxedAtomicBool
|
||||||
value: @IS_NIGHTLY_BUILD@
|
value: true
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
# Number of seconds of very quiet or silent audio before considering the audio
|
# Number of seconds of very quiet or silent audio before considering the audio
|
||||||
|
|||||||
Reference in New Issue
Block a user