mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-29 03:43:50 +02:00
Fix behavior with files with invalid pasp box (with num & den === 0) (fixes #362)
This commit is contained in:
@@ -784,6 +784,37 @@ export const validateVideoChunkMetadata = (metadata: EncodedVideoChunkMetadata |
|
||||
'Video chunk metadata decoder configuration must specify a valid codedHeight (positive integer).',
|
||||
);
|
||||
}
|
||||
if (
|
||||
metadata.decoderConfig.displayAspectWidth !== undefined
|
||||
&& (
|
||||
!Number.isInteger(metadata.decoderConfig.displayAspectWidth)
|
||||
|| metadata.decoderConfig.displayAspectWidth <= 0
|
||||
)
|
||||
) {
|
||||
throw new TypeError(
|
||||
'Video chunk metadata decoder configuration displayAspectWidth, when defined, must be a positive integer.',
|
||||
);
|
||||
}
|
||||
if (
|
||||
metadata.decoderConfig.displayAspectHeight !== undefined
|
||||
&& (
|
||||
!Number.isInteger(metadata.decoderConfig.displayAspectHeight)
|
||||
|| metadata.decoderConfig.displayAspectHeight <= 0
|
||||
)
|
||||
) {
|
||||
throw new TypeError(
|
||||
'Video chunk metadata decoder configuration displayAspectHeight, when defined, must be a positive integer.',
|
||||
);
|
||||
}
|
||||
if (
|
||||
(metadata.decoderConfig.displayAspectWidth !== undefined)
|
||||
!== (metadata.decoderConfig.displayAspectHeight !== undefined)
|
||||
) {
|
||||
throw new TypeError(
|
||||
'Video chunk metadata decoder configuration must specify both displayAspectWidth and displayAspectHeight,'
|
||||
+ ' or neither.',
|
||||
);
|
||||
}
|
||||
if (metadata.decoderConfig.description !== undefined) {
|
||||
if (!isAllowSharedBufferSource(metadata.decoderConfig.description)) {
|
||||
throw new TypeError(
|
||||
|
||||
Reference in New Issue
Block a user