mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-24 02:02:29 -04:00
Fix ArgumentNullException on playlist creation (#13837)
mediaSourceId can be null, the IDE doesn't know this as nullable is disabled for BaseEncodingJobOptions
This commit is contained in:
parent
d1ed6593ad
commit
1c2b48182a
@ -1419,9 +1419,9 @@ public class DynamicHlsController : BaseJellyfinApiController
|
||||
TranscodingJobType,
|
||||
cancellationTokenSource.Token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
var mediaSourceId = state.BaseRequest.MediaSourceId;
|
||||
var request = new CreateMainPlaylistRequest(
|
||||
Guid.Parse(state.BaseRequest.MediaSourceId),
|
||||
mediaSourceId is null ? null : Guid.Parse(mediaSourceId),
|
||||
state.MediaPath,
|
||||
state.SegmentLength * 1000,
|
||||
state.RunTimeTicks ?? 0,
|
||||
|
@ -18,7 +18,7 @@ public class CreateMainPlaylistRequest
|
||||
/// <param name="endpointPrefix">The URI prefix for the relative URL in the playlist.</param>
|
||||
/// <param name="queryString">The desired query string to append (must start with ?).</param>
|
||||
/// <param name="isRemuxingVideo">Whether the video is being remuxed.</param>
|
||||
public CreateMainPlaylistRequest(Guid mediaSourceId, string filePath, int desiredSegmentLengthMs, long totalRuntimeTicks, string segmentContainer, string endpointPrefix, string queryString, bool isRemuxingVideo)
|
||||
public CreateMainPlaylistRequest(Guid? mediaSourceId, string filePath, int desiredSegmentLengthMs, long totalRuntimeTicks, string segmentContainer, string endpointPrefix, string queryString, bool isRemuxingVideo)
|
||||
{
|
||||
MediaSourceId = mediaSourceId;
|
||||
FilePath = filePath;
|
||||
@ -33,7 +33,7 @@ public class CreateMainPlaylistRequest
|
||||
/// <summary>
|
||||
/// Gets the media source id.
|
||||
/// </summary>
|
||||
public Guid MediaSourceId { get; }
|
||||
public Guid? MediaSourceId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file path.
|
||||
|
@ -35,7 +35,9 @@ public class DynamicHlsPlaylistGenerator : IDynamicHlsPlaylistGenerator
|
||||
{
|
||||
IReadOnlyList<double> segments;
|
||||
// For video transcodes it is sufficient with equal length segments as ffmpeg will create new keyframes
|
||||
if (request.IsRemuxingVideo && TryExtractKeyframes(request.MediaSourceId, request.FilePath, out var keyframeData))
|
||||
if (request.IsRemuxingVideo
|
||||
&& request.MediaSourceId is not null
|
||||
&& TryExtractKeyframes(request.MediaSourceId.Value, request.FilePath, out var keyframeData))
|
||||
{
|
||||
segments = ComputeSegments(keyframeData, request.DesiredSegmentLengthMs);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user