Skip to content

Commit 4ca0340

Browse files
committed
Use stackalloc on dash-hreader check
1 parent 9adb3dc commit 4ca0340

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

CollapseLauncher/Classes/Helper/Background/Loaders/MediaPlayerLoader.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,12 @@ private static void EnsureIfFormatIsDashOrUnsupported(Stream stream)
302302
{
303303
ReadOnlySpan<byte> dashSignature = "ftypdash"u8;
304304

305-
byte[] buffer = new byte[64];
305+
Span<byte> buffer = stackalloc byte[64];
306306
stream.ReadExactly(buffer);
307307

308308
try
309309
{
310-
if (buffer.AsSpan(4).StartsWith(dashSignature))
310+
if (buffer.StartsWith(dashSignature))
311311
throw new FormatException("The video format is in \"MPEG-DASH\" format, which is unsupported.");
312312
}
313313
finally
@@ -338,10 +338,10 @@ private async void FrameGrabberEvent(MediaPlayer mediaPlayer, object args)
338338
{
339339
lock (_currentLock)
340340
{
341-
if (_currentCanvasVirtualImageSource is null)
342-
{
343-
return;
344-
}
341+
if (_currentCanvasVirtualImageSource is null)
342+
{
343+
return;
344+
}
345345

346346
if (_currentCanvasDrawingSession is not null)
347347
{

0 commit comments

Comments
 (0)