fix(video): roll back rejected MP4 samples and keep inspector reports read-only
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
3 files changed
+109
-75
No files matched your search
@@ -198,6 +198,22 @@ public sealed class Mp4MuxerTests(TestContext context)
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => muxer.WriteSample([0, 0, 1, 0x65, 1], 0, true));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParameterSetOnlyUnitsAddNoSampleAndSeiOnlyUnitsAreRejected()
|
||||
{
|
||||
using var ms = new MemoryStream();
|
||||
var muxer = new Mp4Muxer(ms, new VideoTrackConfig { Codec = VideoCodec.H264, Width = 1920, Height = 1080 });
|
||||
muxer.WriteSample(AnnexBParser.ToAnnexB([SyntheticStreams.H264Sps(), SyntheticStreams.H264Pps()]), 3000, true);
|
||||
Assert.Equal(0, muxer.SampleCount);
|
||||
Assert.Throws<ArgumentException>(() => muxer.WriteSample(AnnexBParser.ToAnnexB([[0x06, 0x05, 0x01, 0x00, 0x80]]), 3000, false));
|
||||
muxer.WriteSample(AnnexBParser.ToAnnexB([SyntheticStreams.H264Slice(true, 64, 1)]), 3000, true);
|
||||
muxer.Complete();
|
||||
var report = Mp4Inspector.Inspect(ms);
|
||||
AssertClean(report);
|
||||
Assert.Equal(1, report.FrameCount);
|
||||
Assert.Equal(0, report.Warnings.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InspectorSurvivesTruncationAndCorruption()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user