소스 검색

force audio stream copy when audio transcoding is not allowed

Luke Pulverenti 9 년 전
부모
커밋
235d341524
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 13 0
      MediaBrowser.Api/Playback/BaseStreamingService.cs

+ 13 - 0
MediaBrowser.Api/Playback/BaseStreamingService.cs

@@ -1788,6 +1788,19 @@ namespace MediaBrowser.Api.Playback
             {
                 state.OutputAudioCodec = "copy";
             }
+            else
+            {
+                // If the user doesn't have access to transcoding, then force stream copy, regardless of whether it will be compatible or not
+                var auth = AuthorizationContext.GetAuthorizationInfo(Request);
+                if (!string.IsNullOrWhiteSpace(auth.UserId))
+                {
+                    var user = UserManager.GetUserById(auth.UserId);
+                    if (!user.Policy.EnableAudioPlaybackTranscoding)
+                    {
+                        state.OutputAudioCodec = "copy";
+                    }
+                }
+            }
         }
 
         private void AttachMediaSourceInfo(StreamState state,