jellyfin / jellyfin-plugin-tvheadend

https://jellyfin.org
MIT License
32 stars 19 forks source link

MissingMethodException Since Upgrading to Jellyfin 10.8.0 #58

Closed articuno1au closed 2 years ago

articuno1au commented 2 years ago

Jellyfin Version: 10.8.0 (Latest) Plugin Version: 10.0.0 (Latest) Environment: Docker

The following exception is thrown when attempting to start a stream from TV Headend


[20:48:29] [INF] [27] Jellyfin.Api.Helpers.MediaInfoHelper: StreamBuilder.BuildVideoItem( Profile=Anonymous Profile, Path=Unknown path, AudioStreamIndex=null, SubtitleStreamIndex=null ) => ( PlayMethod=Transcode, TranscodeReason=VideoCodecNotSupported ) media:/videos/b030e4fb-6b00-e59a-4c1c-5b5a7c65d4aa/master.m3u8?MediaSourceId=b030e4fb6b00e59a4c1c5b5a7c65d4aa&VideoCodec=h264&AudioCodec=aac,mp3&VideoBitrate=1527080727&AudioBitrate=192000&MaxWidth=2560&api_key=<token>&TranscodingMaxAudioChannels=2&RequireAvc=false&SegmentContainer=ts&MinSegments=1&BreakOnNonKeyFrames=True&h264-profile=high,main,baseline,constrainedbaseline,high10&h264-level=52&h264-deinterlace=true&TranscodeReasons=VideoCodecNotSupported
[20:48:29] [INF] [27] Emby.Server.Implementations.LiveTv.LiveTvManager: Opening channel stream from TVHclient LiveTvService, external channel Id: 38001602
[20:48:29] [ERR] [27] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL POST /Items/b030e4fb6b00e59a4c1c5b5a7c65d4aa/PlaybackInfo.
System.MissingMethodException: Method not found: 'Void MediaBrowser.Model.Dto.MediaSourceInfo.set_MediaStreams(System.Collections.Generic.List`1<MediaBrowser.Model.Entities.MediaStream>)'.
   at TVHeadEnd.LiveTvService.GetChannelStream(String channelId, String mediaSourceId, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at TVHeadEnd.LiveTvService.GetChannelStream(String channelId, String mediaSourceId, CancellationToken cancellationToken)
   at Emby.Server.Implementations.LiveTv.LiveTvManager.GetChannelStream(String id, String mediaSourceId, List`1 currentLiveStreams, CancellationToken cancellationToken)
   at Emby.Server.Implementations.LiveTv.LiveTvMediaSourceProvider.OpenMediaSource(String openToken, List`1 currentLiveStreams, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.MediaSourceManager.OpenLiveStreamInternal(LiveStreamRequest request, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.MediaSourceManager.OpenLiveStream(LiveStreamRequest request, CancellationToken cancellationToken)
   at Jellyfin.Api.Helpers.MediaInfoHelper.OpenMediaSource(HttpRequest httpRequest, LiveStreamRequest request)
   at Jellyfin.Api.Controllers.MediaInfoController.GetPostedPlaybackInfo(Guid itemId, Nullable`1 userId, Nullable`1 maxStreamingBitrate, Nullable`1 startTimeTicks, Nullable`1 audioStreamIndex, Nullable`1 subtitleStreamIndex, Nullable`1 maxAudioChannels, String mediaSourceId, String liveStreamId, Nullable`1 autoOpenLiveStream, Nullable`1 enableDirectPlay, Nullable`1 enableDirectStream, Nullable`1 enableTranscoding, Nullable`1 allowVideoStreamCopy, Nullable`1 allowAudioStreamCopy, PlaybackInfoDto playbackInfoDto)
   at lambda_method960(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
   at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
   at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
   at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
   at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context)```

The exception is not thrown when loading other content from Jellyfin. Nothing else of interest appears in the logs.

I'm happy to provide whatever additional information I can on this one, so please let me know.
crobibero commented 2 years ago

I don't have TVHeadend set up so I'm not able to test this, but as far as I can tell the plugin isn't trying to do anything that isn't implemented in Jellyfin 10.8.

Can you try restarting Jellyfin and seeing if the issue persists?

articuno1au commented 2 years ago

Hey @crobibero,

Thanks for getting back to me.

I restarted my docker host and recreated the container just for completeness.

The same stack is still thrown. It kind of looks like an autowiring issue in the setter at https://github.com/jellyfin/jellyfin-plugin-tvheadend/blob/master/TVHeadEnd/LiveTvService.cs#L453

return new MediaSourceInfo
{
    Id = channelId,
    Path = _htsConnectionHandler.GetHttpBaseUrl() + ticket.Url,
    Protocol = MediaProtocol.Http,
    MediaStreams = new List<MediaStream>
    {
        new MediaStream
        {
            Type = MediaStreamType.Video,
            // Set the index to -1 because we don't know the exact index of the video stream within the container
            Index = -1,
            // Set to true if unknown to enable deinterlacing
            IsInterlaced = true
        },
        new MediaStream
        {
            Type = MediaStreamType.Audio,
            // Set the index to -1 because we don't know the exact index of the audio stream within the container
            Index = -1
        }
    }
};

I'm not sure how I can help debugging this further but if you have any ideas, I'm happy to try them.

Ulrar commented 2 years ago

Getting the same issue here, the plugin is broken since the upgrade to 10.8 with that same error

olili commented 2 years ago

same problem with me: plugin broken with 10.8.

sommerhas commented 2 years ago

also the same problem: unable to open any stream from TVHeadend with jellyfin 10.8

articuno1au commented 2 years ago

Yeah, everyone using the plugin is going to be having this problem. It's not environmental, it's that there's a method that the plugin uses that is no longer exposed in 10.8.0. Until that gets fixed, it's going to keep breaking.

mytlogos commented 2 years ago

The code in current master (001d943) is more or less working, contrary to the current release version. I build it myself and copied the dll to a jellyfin docker container (10.8) and streaming works. I would not necessarily recommend using it in production, as it is not stable yet (e.g. accessing recordings do not seem to work yet, at least locally on my server, though it does on my raspberry pi).

So my take is, that it probably is already fixed, but not yet released.

My steps for building it myself:

apt install dotnet-sdk-6.0
git clone https://github.com/jellyfin/jellyfin-plugin-tvheadend.git
cd jellyfin-plugin-tvheadend
dotnet publish --configuration Release --output bin
cp bin/TVHeadEnd.dll /path/to/compose/project/jellyfin/config/data/plugins/TVHeadend_10.0.0.0/
docker compose -f /path/to/compose/project/jellyfin/docker-compose.yml restart

Build System: Linux Mint Cinnamon 20.3 uname -a: Linux Test456 5.13.0-44-generic #49~20.04.1-Ubuntu SMP Wed May 18 18:44:28 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Jellyfin Server (Image: lscr.io/linuxserver/jellyfin): see Build System, Jellyfin Version: 10.8

Raspberry Pi 4 (arm64), Raspberry Pi OS, Jellyfin Version: 10.8 uname -a: Linux raspberrypi 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux

crobibero commented 2 years ago

Surprised to hear that master works, maybe the plugin jus needs a re-release as that commit doesn't change anything related to the issue.

I will cut a release, hopefully the issue will be fixed

articuno1au commented 2 years ago

Nice find @mytlogos.

I made a rather amateur mistake and checked the source against master. I should have been looking at the tag.

It's good you got it working, though I think it might actually have been this commit that fixed it: https://github.com/jellyfin/jellyfin-plugin-tvheadend/pull/46/files?diff=split&w=0#diff-e24f76995d3ebe29c653afc04d98ba67fb7adac235452294790e443292895adcR453

I attempted to use the DLL as you suggested, but I'm getting an FFmpeg issue now. So it seems to be getting further, but not fixed for me just yet.

@crobibero - Awesome. Thank you :)

olili commented 2 years ago

updating to plugin v11 fixed it for me. Thx!

articuno1au commented 2 years ago

Fixed for me also.

The FFmpeg issue continues for me, but not related to this. Going to mark it as closed.

Thanks for cutting a release for us @crobibero :clap:

Ulrar commented 2 years ago

The latest does indeed resolve the method issue, although streaming anything still isn't working. No errors anywhere so I'm not sure what the issue is now, I'll look into it more later.