update stream copy bitrate

This commit is contained in:
Luke Pulverenti 2013-10-07 14:22:21 -04:00
parent 4a030a70a9
commit a0df73b21d

View File

@ -120,8 +120,9 @@ namespace MediaBrowser.Api.Playback.Hls
await WaitForMinimumSegmentCount(playlist, 3).ConfigureAwait(false); await WaitForMinimumSegmentCount(playlist, 3).ConfigureAwait(false);
} }
var audioBitrate = GetAudioBitrateParam(state) ?? 0; int audioBitrate;
var videoBitrate = GetVideoBitrateParam(state) ?? 0; int videoBitrate;
GetPlaylistBitrates(state, out audioBitrate, out videoBitrate);
var appendBaselineStream = false; var appendBaselineStream = false;
var baselineStreamBitrate = 64000; var baselineStreamBitrate = 64000;
@ -145,6 +146,37 @@ namespace MediaBrowser.Api.Playback.Hls
} }
} }
/// <summary>
/// Gets the playlist bitrates.
/// </summary>
/// <param name="state">The state.</param>
/// <param name="audioBitrate">The audio bitrate.</param>
/// <param name="videoBitrate">The video bitrate.</param>
private void GetPlaylistBitrates(StreamState state, out int audioBitrate, out int videoBitrate)
{
var audioBitrateParam = GetAudioBitrateParam(state);
var videoBitrateParam = GetVideoBitrateParam(state);
if (!audioBitrateParam.HasValue)
{
if (state.AudioStream != null)
{
audioBitrateParam = state.AudioStream.BitRate;
}
}
if (!videoBitrateParam.HasValue)
{
if (state.VideoStream != null)
{
videoBitrateParam = state.VideoStream.BitRate;
}
}
audioBitrate = audioBitrateParam ?? 0;
videoBitrate = videoBitrateParam ?? 0;
}
private string GetMasterPlaylistFileText(string firstPlaylist, int bitrate, bool includeBaselineStream, int baselineStreamBitrate) private string GetMasterPlaylistFileText(string firstPlaylist, int bitrate, bool includeBaselineStream, int baselineStreamBitrate)
{ {
var builder = new StringBuilder(); var builder = new StringBuilder();