diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-29 21:25:37 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-29 21:25:37 -0400 |
| commit | 35d512e66121f00335088e8a5b34e991a4b8cade (patch) | |
| tree | f24b697101f13a260b3b5b190d462bbe32c46347 | |
| parent | de8076f68cfcb407c9ac58362edccf07be2dcb07 (diff) | |
hlx fixes
| -rw-r--r-- | MediaBrowser.Api/Playback/Hls/BaseHlsService.cs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs index e94aff02f..41432043b 100644 --- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs @@ -91,6 +91,15 @@ namespace MediaBrowser.Api.Playback.Hls /// <returns>Task{System.Object}.</returns> public async Task<object> ProcessRequestAsync(StreamState state) { + if (!state.VideoRequest.VideoBitRate.HasValue) + { + throw new ArgumentException("A video bitrate is required"); + } + if (!state.Request.AudioBitRate.HasValue) + { + throw new ArgumentException("An audio bitrate is required"); + } + var playlist = GetOutputFilePath(state); var isPlaylistNewlyCreated = false; @@ -110,7 +119,7 @@ namespace MediaBrowser.Api.Playback.Hls await WaitForMinimumSegmentCount(playlist, 3).ConfigureAwait(false); } - var playlistText = GetMasterPlaylistFileText(playlist, state.VideoRequest.VideoBitRate.Value); + var playlistText = GetMasterPlaylistFileText(playlist, state.VideoRequest.VideoBitRate.Value + state.Request.AudioBitRate.Value); try { @@ -234,8 +243,9 @@ namespace MediaBrowser.Api.Playback.Hls { var lowBitratePath = Path.Combine(Path.GetDirectoryName(outputPath), Path.GetFileNameWithoutExtension(outputPath) + "-low.m3u8"); - var lowBitrateParams = string.Format(" -threads 0 -vn -codec:a:0 aac -strict experimental -ac 2 -ab 64000 -hls_time 10 -start_number 0 -hls_list_size 1440 \"{0}\"", - lowBitratePath); + var lowBitrateParams = string.Format(" -threads 0 -vn -codec:a:{1} aac -strict experimental -ac 2 -ab 64000 -hls_time 10 -start_number 0 -hls_list_size 1440 \"{0}\"", + lowBitratePath, + state.AudioStream.Index); args += " " + lowBitrateParams; } |
