mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing tracks array size with unknown/font tracks
This commit is contained in:
parent
fcf56c205a
commit
341d20883d
@ -142,16 +142,15 @@ namespace Kyoo.Core.Controllers
|
|||||||
tracks = new Track[trackCount];
|
tracks = new Track[trackCount];
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int i = 0; i < arrayLength; i++)
|
for (int i = 0; i < arrayLength; i++, streamsPtr += size)
|
||||||
{
|
{
|
||||||
FTrack stream = Marshal.PtrToStructure<FTrack>(streamsPtr);
|
FTrack stream = Marshal.PtrToStructure<FTrack>(streamsPtr);
|
||||||
if (stream!.Type != FTrackType.Unknown && stream.Type != FTrackType.Attachment)
|
if (stream!.Type == FTrackType.Unknown || stream.Type == FTrackType.Attachment)
|
||||||
{
|
continue;
|
||||||
tracks[j] = stream.ToTrack();
|
tracks[j] = stream.ToTrack();
|
||||||
j++;
|
j++;
|
||||||
}
|
|
||||||
streamsPtr += size;
|
|
||||||
}
|
}
|
||||||
|
Array.Resize(ref tracks, j);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tracks = Array.Empty<Track>();
|
tracks = Array.Empty<Track>();
|
||||||
@ -207,11 +206,12 @@ namespace Kyoo.Core.Controllers
|
|||||||
{
|
{
|
||||||
if (fastStop && _initialized)
|
if (fastStop && _initialized)
|
||||||
return;
|
return;
|
||||||
if (TranscoderAPI.Init() == Marshal.SizeOf<FTrack>())
|
if (TranscoderAPI.Init() != Marshal.SizeOf<FTrack>())
|
||||||
return;
|
{
|
||||||
|
_logger.LogCritical("The transcoder library could not be initialized correctly");
|
||||||
|
throw new HealthException("The transcoder library is corrupted or invalid.");
|
||||||
|
}
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
_logger.LogCritical("The transcoder library could not be initialized correctly");
|
|
||||||
throw new HealthException("The transcoder library is corrupted or invalid.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user