Skip to content

🎥 Make videos programmatically with React

always nullify samples

Jonny Burgere0305e4dfea1
diff --git a/packages/media-parser/src/boxes/webm/parse-ebml.ts b/packages/media-parser/src/boxes/webm/parse-ebml.ts
index 4ce4d0f653..82d7785b86 100644
--- a/packages/media-parser/src/boxes/webm/parse-ebml.ts
+++ b/packages/media-parser/src/boxes/webm/parse-ebml.ts
@@ -181,7 +181,7 @@ export const postprocessEbml = async ({
if (ebml.type === 'Block' || ebml.type === 'SimpleBlock') {
const sample = getSampleFromBlock(ebml, state, offset);
- if (sample.type === 'video-sample' && state.nullifySamples) {
+ if (sample.type === 'video-sample') {
await state.callbacks.onVideoSample(
sample.videoSample.trackId,
sample.videoSample,
@@ -193,7 +193,7 @@ export const postprocessEbml = async ({
};
}
- if (sample.type === 'audio-sample' && state.nullifySamples) {
+ if (sample.type === 'audio-sample') {
await state.callbacks.onAudioSample(
sample.audioSample.trackId,
sample.audioSample,
@@ -205,7 +205,7 @@ export const postprocessEbml = async ({
};
}
- if (sample.type === 'no-sample' && state.nullifySamples) {
+ if (sample.type === 'no-sample') {
return {
type: 'Block',
value: new Uint8Array([]),
@@ -247,13 +247,11 @@ export const postprocessEbml = async ({
);
}
- if (state.nullifySamples) {
- return {
- type: 'BlockGroup',
- value: [],
- minVintWidth: ebml.minVintWidth,
- };
- }
+ return {
+ type: 'BlockGroup',
+ value: [],
+ minVintWidth: ebml.minVintWidth,
+ };
}
return ebml;
diff --git a/packages/media-parser/src/parse-media.ts b/packages/media-parser/src/parse-media.ts
index 766fd08dea..91ce802854 100644
--- a/packages/media-parser/src/parse-media.ts
+++ b/packages/media-parser/src/parse-media.ts
@@ -64,9 +64,6 @@ export const parseMedia: ParseMedia = async function <
fields,
onAudioTrack: onAudioTrack ?? null,
onVideoTrack: onVideoTrack ?? null,
- nullifySamples: !(
- typeof process !== 'undefined' && typeof process.env !== 'undefined'
- ),
supportsContentRange,
});
diff --git a/packages/media-parser/src/state/parser-state.ts b/packages/media-parser/src/state/parser-state.ts
index b20570e54e..522db004e1 100644
--- a/packages/media-parser/src/state/parser-state.ts
+++ b/packages/media-parser/src/state/parser-state.ts
@@ -26,7 +26,6 @@ export const makeParserState = ({
signal,
getIterator,
fields,
- nullifySamples,
onAudioTrack,
onVideoTrack,
supportsContentRange,
@@ -36,7 +35,6 @@ export const makeParserState = ({
signal: AbortSignal | undefined;
getIterator: () => BufferIterator | null;
fields: Options<ParseMediaFields>;
- nullifySamples: boolean;
supportsContentRange: boolean;
onAudioTrack: OnAudioTrack | null;
onVideoTrack: OnVideoTrack | null;
@@ -71,7 +69,6 @@ export const makeParserState = ({
increaseSkippedBytes,
keyframes,
structure,
- nullifySamples,
onAudioTrack,
onVideoTrack,
supportsContentRange,
diff --git a/packages/webcodecs/src/test/create-matroska.test.ts b/packages/webcodecs/src/test/create-matroska.test.ts
index e2111b5ab8..2d8636e06e 100644
--- a/packages/webcodecs/src/test/create-matroska.test.ts
+++ b/packages/webcodecs/src/test/create-matroska.test.ts
@@ -10,7 +10,6 @@ const state = MediaParserInternals.makeParserState({
fields: {},
onAudioTrack: null,
onVideoTrack: null,
- nullifySamples: false,
supportsContentRange: true,
});
diff --git a/packages/webcodecs/src/test/stsd.test.ts b/packages/webcodecs/src/test/stsd.test.ts
index 386744758b..f57a29fd7c 100644
--- a/packages/webcodecs/src/test/stsd.test.ts
+++ b/packages/webcodecs/src/test/stsd.test.ts
@@ -47,7 +47,6 @@ test('Should be able to parse a STSD audio box correctly', async () => {
signal: undefined,
getIterator: () => null,
fields: {},
- nullifySamples: false,
supportsContentRange: true,
}),
signal: null,
@@ -218,8 +217,6 @@ test('Should be able to parse a STSD video box correctly', async () => {
fields: {
structure: true,
},
-
- nullifySamples: false,
supportsContentRange: true,
}),