Title: [250227] trunk/Source/WebCore
- Revision
- 250227
- Author
- [email protected]
- Date
- 2019-09-23 03:31:24 -0700 (Mon, 23 Sep 2019)
Log Message
[GStreamer] isAVC1CodecSupported is crashing several media source tests due to avc1.4d4001 codec type
https://bugs.webkit.org/show_bug.cgi?id=201870
Reviewed by Xabier Rodriguez-Calvar.
The GStreamer codec-utils package expects all level_idc's to be
multiples of 10 from the spec idc, i.e., 1.1 -> 11, 3.1 -> 31, 1
-> 10, etc.
In the WPT tests, there is some confusion of this *10 multiplier,
and the level_idc is given in several places as simply "1". This
causes the get_level codec helper to return NULL, which the
registry scanner was not handling properly, and crashing on.
Fix this by special casing "web level idc's" that violate the *10
rule in isAVC1CodecSupported.
There is prior art along these lines in Gecko:
https://searchfox.org/mozilla-central/source/dom/media/VideoUtils.cpp#453
I assume Chrome/IE/etc must do something similar. The fix does not
belong in GStreamer since these are actually invalid inputs to the
get_level function.
Tested by imported/w3c/web-platform-tests/media-source
* platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
(WebCore::GStreamerRegistryScanner::isAVC1CodecSupported const):
Special case levels 1..5, even though these *should* be
represented as 10 through 50 respectively, they are not in
web-land. The two-byte local storage trick was contributed to me
by Adrian Perez de Castro.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (250226 => 250227)
--- trunk/Source/WebCore/ChangeLog 2019-09-23 10:14:48 UTC (rev 250226)
+++ trunk/Source/WebCore/ChangeLog 2019-09-23 10:31:24 UTC (rev 250227)
@@ -1,3 +1,37 @@
+2019-09-23 Charlie Turner <[email protected]>
+
+ [GStreamer] isAVC1CodecSupported is crashing several media source tests due to avc1.4d4001 codec type
+ https://bugs.webkit.org/show_bug.cgi?id=201870
+
+ Reviewed by Xabier Rodriguez-Calvar.
+
+ The GStreamer codec-utils package expects all level_idc's to be
+ multiples of 10 from the spec idc, i.e., 1.1 -> 11, 3.1 -> 31, 1
+ -> 10, etc.
+
+ In the WPT tests, there is some confusion of this *10 multiplier,
+ and the level_idc is given in several places as simply "1". This
+ causes the get_level codec helper to return NULL, which the
+ registry scanner was not handling properly, and crashing on.
+
+ Fix this by special casing "web level idc's" that violate the *10
+ rule in isAVC1CodecSupported.
+
+ There is prior art along these lines in Gecko:
+ https://searchfox.org/mozilla-central/source/dom/media/VideoUtils.cpp#453
+ I assume Chrome/IE/etc must do something similar. The fix does not
+ belong in GStreamer since these are actually invalid inputs to the
+ get_level function.
+
+ Tested by imported/w3c/web-platform-tests/media-source
+
+ * platform/graphics/gstreamer/GStreamerRegistryScanner.cpp:
+ (WebCore::GStreamerRegistryScanner::isAVC1CodecSupported const):
+ Special case levels 1..5, even though these *should* be
+ represented as 10 through 50 respectively, they are not in
+ web-land. The two-byte local storage trick was contributed to me
+ by Adrian Perez de Castro.
+
2019-09-23 Rob Buis <[email protected]>
Sync operator dictionary
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp (250226 => 250227)
--- trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp 2019-09-23 10:14:48 UTC (rev 250226)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp 2019-09-23 10:31:24 UTC (rev 250227)
@@ -318,6 +318,21 @@
const char* profile = "" 3);
const char* level = gst_codec_utils_h264_get_level(sps, 3);
+
+ // To avoid going through a class hierarchy for such a simple
+ // string conversion, we use a little trick here: See
+ // https://bugs.webkit.org/show_bug.cgi?id=201870.
+ char levelAsStringFallback[2] = { '\0', '\0' };
+ if (!level && sps[2] > 0 && sps[2] <= 5) {
+ levelAsStringFallback[0] = static_cast<char>('0' + sps[2]);
+ level = levelAsStringFallback;
+ }
+
+ if (!profile || !level) {
+ GST_ERROR("H.264 profile / level was not recognised in codec %s", codec.utf8().data());
+ return false;
+ }
+
GST_DEBUG("Codec %s translates to H.264 profile %s and level %s", codec.utf8().data(), profile, level);
auto checkH264Caps = [&](const char* capsString) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes