Commit Graph

3254 Commits

Author SHA1 Message Date
Sandor Molnar
2557cd3d7d Backed out 6 changesets (bug 1921288) for causing build bustages. CLOSED TREE
Backed out changeset c03d69e623b9 (bug 1921288)
Backed out changeset 111bef5016a9 (bug 1921288)
Backed out changeset 17130f51de88 (bug 1921288)
Backed out changeset a4acd335a710 (bug 1921288)
Backed out changeset c5fc8bc8273a (bug 1921288)
Backed out changeset 744f7a82c471 (bug 1921288)
2024-10-02 21:11:06 +03:00
Paul Adenot
9202d3beba Bug 1921288 - Fix users of MediaTimer. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D223795
2024-10-02 16:01:04 +00:00
Andrew Osmond
5983c39c74 Bug 1898773 - Ensure we also check for ffmpeg + OpenH264 when determining codec support. r=media-playback-reviewers,padenot
When we create a video decoder with ffmpeg, we check if the underlying
decoder implementation is supplied by OpenH264. If so, and the
media.ffmpeg.allow-openh264 is set to false (the default), we refuse to
create the video decoder. This is a problem because the decoder module
for ffmpeg declared support for H264, so we did not try falling back to
our own OpenH264 plugin exposed via GMP.

This patch duplicates the logic check for ffmpeg + OpenH264 in
FFmpegDecoderModule::Supports to ensure we fallback properly.

Differential Revision: https://phabricator.services.mozilla.com/D223843
2024-09-26 21:01:38 +00:00
alwu
fb69105575 Bug 1866265 - part6 : if no compatible type, check preferred type, then the last available type as final fallback. r=media-playback-reviewers,jolin
When running hevc test on the try server, the MFT on the try server has
MFVideoFormat_NV12 and MFVideoFormat_IYUV on its list. If we choose last
available type, it would be MFVideoFormat_IYUV, causing 10-bit hevc
failed to play on the try server.

As we know what format is usually used for video and audio, we should
use the preferred type first if we can't find the compatible type. If
none of them are found, then the last available type should be used as
a final fallback option.

Differential Revision: https://phabricator.services.mozilla.com/D223652
2024-09-26 19:39:24 +00:00
alwu
dc97548762 Bug 1866265 - part3 : use last available type as fallback if the compatible type is not found. r=media-playback-reviewers,padenot
Based on [1], `IMFTransform::GetOutputAvailableType()` won't guarantee
to return a full list of support type. Some MFTs would even can not
provide an accurate list of output types until the MFT receives the
first input sample.

Therefore, we should set the last available type if we can't find the
compatible type, instead of throwing and error.

[1] https://learn.microsoft.com/en-us/windows/win32/api/mftransform/nf-mftransform-imftransform-getoutputavailabletype#remarks

Differential Revision: https://phabricator.services.mozilla.com/D223446
2024-09-26 19:39:23 +00:00
alwu
bf69042f73 Bug 1866265 - part2 : add logs. r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D223445
2024-09-26 19:39:22 +00:00
alwu
50e52b328e Bug 1866265 - part1 : use marcos to have better error logging and warning. r=media-playback-reviewers,padenot
By using the new marcos, it would show error via logging or error for
the failure function, instead of a general ENSURE_TRUE check.

Differential Revision: https://phabricator.services.mozilla.com/D223444
2024-09-26 19:39:22 +00:00
Chun-Min Chang
9bd663d2cf Bug 1920740 - Release CFNumberRef for SVC setting automatically r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222557
2024-09-24 23:04:45 +00:00
Chun-Min Chang
51677dffc6 Bug 1920740 - Remove realtime settings for SVC r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222560
2024-09-24 23:04:45 +00:00
Chun-Min Chang
a4fafe1c9a Bug 1920740 - Remove duplicate kVTCompressionPropertyKey_AllowFrameReordering settings r=media-playback-reviewers,aosmond
`kVTCompressionPropertyKey_AllowFrameReordering` is set to
`kCFBooleanFalse` in `Init()`. No need to set it to `SetRealtime` again.

Differential Revision: https://phabricator.services.mozilla.com/D223366
2024-09-24 23:04:44 +00:00
Chun-Min Chang
bab059d6fa Bug 1920740 - Correct SetFrameRate setting r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222556
2024-09-24 23:04:44 +00:00
Chun-Min Chang
beccd15d80 Bug 1920740 - Add debugging logs r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222554
2024-09-24 23:04:44 +00:00
Chun-Min Chang
3461e8d834 Bug 1920740 - Assert ProcessShutdown is called on the right thread r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D223365
2024-09-24 23:04:43 +00:00
Chun-Min Chang
e254e0c2be Bug 1920740 - Remove an unused function r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222555
2024-09-24 23:04:43 +00:00
Chun-Min Chang
76cf4a9973 Bug 1920740 - Remove empty comment r=media-playback-reviewers,aosmond
Differential Revision: https://phabricator.services.mozilla.com/D222883
2024-09-24 23:04:42 +00:00
Paul Adenot
82d1a9e091 Bug 1917627 - Use doubles when computing display size in H264.cpp. r=media-playback-reviewers,aosmond
INT32_MAX doesn't fit in a 32-bits float, it's not exact.

Differential Revision: https://phabricator.services.mozilla.com/D223360
2024-09-24 20:31:59 +00:00
Paul Adenot
6b8716442b Bug 1917579 - Don't crash when Flac description isn't from the Flac demuxer. r=chunmin
When it's from Web Codecs, it's raw, and not the Flac variant.

Differential Revision: https://phabricator.services.mozilla.com/D221654
2024-09-18 16:50:38 +00:00
Sandor Molnar
9f6a7500e9 Backed out 2 changesets (bug 1917579) for causing webcodecs failures CLOSED TREE
Backed out changeset e78a07b9f2a7 (bug 1917579)
Backed out changeset 2792465bc5d6 (bug 1917579)
2024-09-17 17:29:07 +03:00
Paul Adenot
e9bccbd55a Bug 1917579 - Don't crash when Flac description isn't from the Flac demuxer. r=chunmin
When it's from Web Codecs, it's raw, and not the Flac variant.

Differential Revision: https://phabricator.services.mozilla.com/D221654
2024-09-17 13:36:18 +00:00
Paul Adenot
026de4e78d Bug 1915143 - Prevent FFmpegAudioDecoder creating an Opus decoder with > 2 channels and invalid extradata. r=chunmin
It doesn't error out, but create a broken decoder, that only has 2 channels, and
then I don't know what's going to happen, but it isn't going to be correct.

Differential Revision: https://phabricator.services.mozilla.com/D221652
2024-09-16 15:46:59 +00:00
Iulian Moraru
0f3df44b32 Backed out 2 changesets (bug 1917579) for causing multiple webcodecs failures. CLOSED TREE
Backed out changeset b273a1944495 (bug 1917579)
Backed out changeset e521ec72705f (bug 1917579)
2024-09-13 15:53:21 +03:00
Paul Adenot
d479b6351c Bug 1917579 - Don't crash when Flac description isn't from the Flac demuxer. r=chunmin
When it's from Web Codecs, it's raw, and not the Flac variant.

Differential Revision: https://phabricator.services.mozilla.com/D221654
2024-09-13 09:41:29 +00:00
alwu
43b29b02a1 Bug 1917873 - part3 : check key Id and status in test. r=media-playback-reviewers,padenot
This patch allows us to check non-GUID keyid in our test to ensure the
key is equal to the one set in the init data.

Differential Revision: https://phabricator.services.mozilla.com/D221699
2024-09-11 03:46:21 +00:00
alwu
683b9ec37f Bug 1917873 - part1 : cast to correct type to fix the conversion result. r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D221697
2024-09-11 03:46:21 +00:00
Tamas Szentpeteri
5c59b80d05 Backed out 3 changesets (bug 1917873) for causing bpnu bustages on MFCDMSession.cpp. CLOSED TREE
Backed out changeset f073db877894 (bug 1917873)
Backed out changeset acf167a789d8 (bug 1917873)
Backed out changeset c82fc68684e4 (bug 1917873)
2024-09-11 01:46:25 +03:00
alwu
60ba0243e7 Bug 1917873 - part3 : check key Id and status in test. r=media-playback-reviewers,padenot
This patch allows us to check non-GUID keyid in our test to ensure the
key is equal to the one set in the init data.

Differential Revision: https://phabricator.services.mozilla.com/D221699
2024-09-10 20:15:48 +00:00
alwu
2e38761f8f Bug 1917873 - part1 : cast to correct type to fix the conversion result. r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D221697
2024-09-10 20:15:47 +00:00
Chun-Min Chang
598914c4a2 Bug 1891082 - Enable decoder reconfiguration in DecoderAgent for AAC/ADTS data through MediaChangeMonitor r=media-playback-reviewers,padenot
This patch enhances `DecoderAgent` by enabling it to reconfigure the
underlying decoder when processing *AAC/ADTS* data via
`MediaChangeMonitor`.

In cases where the `description` field is absent in the
`AudioDecoderConfig` for `mp4a.*` (*AAC*) codec, the data stream is
assumed to be in *ADTS* format. However, some websites provide raw AAC
data under these circumstances, leading to decoding failure since the
underlying decoder requires AAC-specific configuration.

This patch resolves the issue by allowing the underling decoder to be
reconfigured - recreated and reinitialized - through
`MediaChangeMonitor` whenever an AAV format change is detected. This
process mirros the handling of video format changes, such as when H264
data format changes between AnnexB and AVCC. With this change,
`DecoderAgent` simply cues the `PDMFactory` to create a
`MediaChangeMonitor` that wraps the underlying decoder, similar to the
approach used for video decoders, ensuring correct handling of both AAC
and ADTS formats without altering other components.

Depends on D220505

Differential Revision: https://phabricator.services.mozilla.com/D220506
2024-09-09 23:22:02 +00:00
Chun-Min Chang
9b6fc77576 Bug 1891082 - Implement CodecChangeMonitor for AAC in MediaChangeMonitor r=media-playback-reviewers,padenot
This patch implements a `CodecChangeMonitor` specifically for *AAC*
format, which will later be integrated into the `MediaChangeMonitor`.
The `CheckForChange` function within `CodecChangeMonitor` is designed to
detect changes in the data format and signal `MediaChangeMonitor` to
re-create and re-initialize the underlying decoder accordingly.

When the data stream format changes from *ADTS* to *AAC*, the
`CodecChangeMonitor` will add an AAC-specific configuration that is
missing in *ADTS* for proper decoder configuration. Conversely, when the
format switches from *AAC* to *ADTS*, it will reconfigure the decoder
without the AAC-specific configuration.

Depends on D219147

Differential Revision: https://phabricator.services.mozilla.com/D220505
2024-09-09 23:22:01 +00:00
Chun-Min Chang
ee6a610d09 Bug 1891082 - Add a function for making AAC specific config r=media-playback-reviewers,padenot
Depends on D219146

Differential Revision: https://phabricator.services.mozilla.com/D219147
2024-09-09 23:22:01 +00:00
Jamie Nicol
0c43a18e35 Bug 1913568 - Handle SurfaceTexture transforms in webrender, for reals this time. r=gfx-reviewers,media-playback-reviewers,padenot,nical
On Android, SurfaceTextures provide a transform that should be applied
to texture coordinates when sampling from the texture. Usually this is
simply a y-flip, but sometimes it includes a scale and slight
translation, eg when the video frame is contained within a larger
texture. Previously we ignored this transform but performed a y-flip,
meaning we rendered correctly most of the time, but not all of the
time.

Our first attempt to fix this was in bug 1731980. When rendering as a
compositor surface with RenderCompositorOGLSWGL, we supplied the
transform to CompositorOGL's shaders, which correctly fixed the bug
for this rendering path.

However, the attempted fix for hardware webrender in fact made things
worse. As UV coordinates are supplied to webrender unnormalized, then
the shaders normalize them by dividing by the actual texture size,
this effectively handled the scale component of the transform. (Though
not quite scaling by the correct amount, and ignoring the translation
component, sometimes resulting in a pixel-wide green seam being
visible at the video's edges.) When we additionally applied the
transformation to the coordinates, it resulted in the scale being
applied twice, and the video being rendered too far zoomed
in.

To make matters worse, when we received subsequent bug reports of
incorrect rendering on various devices we mistakenly assumed that the
devices must be buggy, rather than our code being incorrect. We
therefore reverted to ignoring the transform on these devices, thereby
breaking the software webrender path again.

Additionally, on devices without GL_OES_EGL_image_external_essl3
support, we must sample from the SurfaceTexture using an ESSL1
shader. This means we do not have access to the correct texture size,
meaning we cannot correctly normalize the UV coordinates. This results
in the video being rendered too far zoomed out. And in the
non-compositor-surface software webrender path, we were accidentally
downscaling the texture when reading back into a CPU buffer, resulting
in the video being rendered at the correct zoom, but being very
blurry.

This patch aims to handle the transform correctly, in all rendering
paths, hopefully once and for all.

For hardware webrender, we now supply the texture coordinates to
webrender already normalized, using the functionality added in the
previous patch. This avoids the shaders scaling the coordinates again,
or using an incorrect texture size to do so.

For RenderCompositorOGLSWGL, we continue to apply the transform using
CompositorOGL's shaders.

In the non-compositor-surface software webrender path, we make
GLReadPixelsHelper apply the transform when reading from the
SurfaceTexture in to the CPU buffer. Again using functionality added
earlier in this patch series. This avoids downscaling the image. We
can then provide the default untransformed and unnormalized UVs to
webrender. As a result we can now remove the virtual function
RenderTextureHost::GetUvCoords(), added in bug 1731980, as it no
longer serves any purpose: we no longer want to share the
implementation between RenderAndroidSurfaceTextureHost::Lock and
RenderTextureHostSWGL::LockSWGL.

Finally, we remove all transform overrides on the devices we
mistakenly assumed were buggy.

Differential Revision: https://phabricator.services.mozilla.com/D220582
2024-09-09 14:06:26 +00:00
Iulian Moraru
e53fc69e92 Backed out 3 changesets (bug 1913568) for causing multiple wrench build bustages related to normalized_uvs. CLOSED TREE
Backed out changeset 08890d5674ad (bug 1913568)
Backed out changeset 4aaa0e9d0a6f (bug 1913568)
Backed out changeset b6f9d83c6da0 (bug 1913568)
2024-09-09 13:14:14 +03:00
Jamie Nicol
566512fb28 Bug 1913568 - Handle SurfaceTexture transforms in webrender, for reals this time. r=gfx-reviewers,media-playback-reviewers,padenot,nical
On Android, SurfaceTextures provide a transform that should be applied
to texture coordinates when sampling from the texture. Usually this is
simply a y-flip, but sometimes it includes a scale and slight
translation, eg when the video frame is contained within a larger
texture. Previously we ignored this transform but performed a y-flip,
meaning we rendered correctly most of the time, but not all of the
time.

Our first attempt to fix this was in bug 1731980. When rendering as a
compositor surface with RenderCompositorOGLSWGL, we supplied the
transform to CompositorOGL's shaders, which correctly fixed the bug
for this rendering path.

However, the attempted fix for hardware webrender in fact made things
worse. As UV coordinates are supplied to webrender unnormalized, then
the shaders normalize them by dividing by the actual texture size,
this effectively handled the scale component of the transform. (Though
not quite scaling by the correct amount, and ignoring the translation
component, sometimes resulting in a pixel-wide green seam being
visible at the video's edges.) When we additionally applied the
transformation to the coordinates, it resulted in the scale being
applied twice, and the video being rendered too far zoomed
in.

To make matters worse, when we received subsequent bug reports of
incorrect rendering on various devices we mistakenly assumed that the
devices must be buggy, rather than our code being incorrect. We
therefore reverted to ignoring the transform on these devices, thereby
breaking the software webrender path again.

Additionally, on devices without GL_OES_EGL_image_external_essl3
support, we must sample from the SurfaceTexture using an ESSL1
shader. This means we do not have access to the correct texture size,
meaning we cannot correctly normalize the UV coordinates. This results
in the video being rendered too far zoomed out. And in the
non-compositor-surface software webrender path, we were accidentally
downscaling the texture when reading back into a CPU buffer, resulting
in the video being rendered at the correct zoom, but being very
blurry.

This patch aims to handle the transform correctly, in all rendering
paths, hopefully once and for all.

For hardware webrender, we now supply the texture coordinates to
webrender already normalized, using the functionality added in the
previous patch. This avoids the shaders scaling the coordinates again,
or using an incorrect texture size to do so.

For RenderCompositorOGLSWGL, we continue to apply the transform using
CompositorOGL's shaders.

In the non-compositor-surface software webrender path, we make
GLReadPixelsHelper apply the transform when reading from the
SurfaceTexture in to the CPU buffer. Again using functionality added
earlier in this patch series. This avoids downscaling the image. We
can then provide the default untransformed and unnormalized UVs to
webrender. As a result we can now remove the virtual function
RenderTextureHost::GetUvCoords(), added in bug 1731980, as it no
longer serves any purpose: we no longer want to share the
implementation between RenderAndroidSurfaceTextureHost::Lock and
RenderTextureHostSWGL::LockSWGL.

Finally, we remove all transform overrides on the devices we
mistakenly assumed were buggy.

Differential Revision: https://phabricator.services.mozilla.com/D220582
2024-09-09 09:10:24 +00:00
serge-sans-paille
59302983cc Bug 1917261 - Statically initialize H264Profiles in FFmpeg instead of initializing them at load time r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D221317
2024-09-07 20:03:56 +00:00
Chun-Min Chang
238ed006b7 Bug 1916008 - Init mEncryptedCustomIdent in CreateDecoderParams r=media-playback-reviewers,padenot
Fix `WARNING: constructor does not initialize these fields:
mEncryptedCustomIdent`

Depends on D220753

Differential Revision: https://phabricator.services.mozilla.com/D221278
2024-09-06 16:20:35 +00:00
Chun-Min Chang
4571a09402 Bug 1916008 - Separate signal handling for AudioTrimmer and MediaChangeMonitor creation r=media-playback-reviewers,padenot
Previously, `AudioTrimmer` and `MediaChangeMonitor` relied on the same
signal for their creation since `AudioTrimmer` was used exclusively for
audio and `MediaChangeMonitor` for video. However, changes introduced in
the patches for Bug 1891082 will enable MediaChangeMonitor to work with
audio as well. To allow for the possibility of wrapping an
`AudioTrimmer` within a `MediaChangeMonitor`, these components now
require separate signals for their creation.

This patch replaces the `NoWrapper` class, which was previosuly used to
signal the creation of both `AudioTrimmer` and `MediaChangeMonitor`,
with a new `Wrapper` class that includes two bit flags:
`Wrapper::AudioTrimmer` and `Wrapper::MediaChangeMonitor`. This allows
the creation of `AudioTrimmer` and `MediaChangeMonitor` to be controlled
independently, or together, by using `Wrapper::AudioTrimmer`,
`Wrapper::MediaChangeMonitor`, or `Wrapper::AudioTrimmer |
Wrapper::MediaChangeMonitor` respectively.

Depends on D220965

Differential Revision: https://phabricator.services.mozilla.com/D220753
2024-09-06 16:20:34 +00:00
Chun-Min Chang
0dbdfc976c Bug 1916008 - Remove unused parameters in AudioTrimmer r=media-playback-reviewers,padenot
Depends on D220964

Differential Revision: https://phabricator.services.mozilla.com/D220965
2024-09-06 16:20:34 +00:00
Chun-Min Chang
d9e45d71d1 Bug 1916008 - Log CreateDecoderParams in MediaChangeMonitor r=media-playback-reviewers,padenot
Depends on D220963

Differential Revision: https://phabricator.services.mozilla.com/D220964
2024-09-06 16:20:33 +00:00
Chun-Min Chang
244c9a3e1f Bug 1916008 - Add ToString() for CreateDecoderParams r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D220963
2024-09-06 16:20:33 +00:00
Chris Tam
d5b66c733f Bug 1915265 - Fix VP9 color info detection r=media-playback-reviewers,padenot
Differential Revision: https://phabricator.services.mozilla.com/D220440
2024-08-29 13:13:56 +00:00
Chun-Min Chang
1bc8296d85 Bug 1913311 - Add a testcase r=media-playback-reviewers,aosmond
This patch introduces a test that demonstrates a crash occurring when
`DecoderAgent::Shutdown` is called without an active `MediaDataDecoder`.
The issue arises when `PDMFactory::CreateDecoder` in
`DecoderAgent::Configure`, rejects decoder creation, leaving
`DecoderAgent::mDecoder` as `null`. Subsequently, when
`DecoderAgent::Shutdown` is invoked, the assertion that checks for the
existence of `mDecoder` fails, leading to a crash.

To replicate this scenario, the test includes a pref that forces the use
of a `NullDecoderModule`, and ensures that this module rejects decoder
creation.

Differential Revision: https://phabricator.services.mozilla.com/D219709
2024-08-21 23:31:31 +00:00
sotaro
44a42ef01a Bug 1910990 - Don't use ID3D11Query to wait for video copy complete for remote canvas. with AMD GPUs r=gfx-reviewers,lsalzman
With AMD GPUs, crash happened when  ID3D11Query was used for video rendering to remote canvas. Then the ID3D11Query usage needs to be limited only for video overlay with AMD GPUs. To do it, video rendering optimization to remove canvas is disabled when the ID3D11Query usage is detected with AMD GPUs.

GpuProcessQueryId.mOnlyForOverlay is added to deliver the information.

Differential Revision: https://phabricator.services.mozilla.com/D218390
2024-08-02 23:51:44 +00:00
stransky
954a67ba86 Bug 1898501 [Linux] Allow to play H264/YUV444 format on Linux r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D211370
2024-08-02 06:44:30 +00:00
Chun-Min Chang
09f1e76aac Bug 1865896 - Apply DefineEnum to WMFStreamType r=media-playback-reviewers,padenot
Depends on D209282

Differential Revision: https://phabricator.services.mozilla.com/D209283
2024-07-31 16:32:10 +00:00
Chun-Min Chang
6942676eb6 Bug 1865896 - Alphabetize include headers in WMFDecoderModule.cpp r=media-playback-reviewers,padenot
Depends on D209281

Differential Revision: https://phabricator.services.mozilla.com/D209282
2024-07-31 16:32:09 +00:00
Chun-Min Chang
612978036a Bug 1865896 - Apply DefineEnum to AppleVTDecoder::StreamType r=media-playback-reviewers,padenot
Depends on D209280

Differential Revision: https://phabricator.services.mozilla.com/D209281
2024-07-31 16:32:09 +00:00
Chun-Min Chang
86b59641a4 Bug 1865896 - Alphabetize include headers in AppleVTDecoder.* r=media-playback-reviewers,padenot
Depends on D205243

Differential Revision: https://phabricator.services.mozilla.com/D209280
2024-07-31 16:32:08 +00:00
Chun-Min Chang
b8848a4090 Bug 1865896 - Apply DefineEnum to FFmpegLibWrapper::LinkResult r=media-playback-reviewers,padenot
Depends on D204449

Differential Revision: https://phabricator.services.mozilla.com/D194261
2024-07-31 00:09:55 +00:00
Chun-Min Chang
3778f80cd0 Bug 1865896 - Alphabetize headers in FFmpegRuntimeLinker.cpp r=media-playback-reviewers,padenot
Depends on D194551

Differential Revision: https://phabricator.services.mozilla.com/D204449
2024-07-31 00:09:55 +00:00
Stanca Serban
e6c1e89d42 Backed out 3 changesets (bug 1898501) for causing reftests failures. CLOSED TREE
Backed out changeset acc5c64134ee (bug 1898501)
Backed out changeset 5017e396b69b (bug 1898501)
Backed out changeset 49a31919e147 (bug 1898501)
2024-07-30 17:45:11 +03:00