Changing logic to prevent retrying transcode when stopping a playing video

This commit is contained in:
Neil Burrows 2022-07-04 10:31:28 +01:00
parent 055c4e5021
commit f12bf93ebb
3 changed files with 8 additions and 8 deletions

View File

@ -21,9 +21,9 @@ sub onState(msg)
m.bufferCheckTimer.control = "start"
m.bufferCheckTimer.ObserveField("fire", "bufferCheck")
else if m.top.state = "error"
if m.playReported or NOT m.top.retryWithTranscoding
m.top.retryWithTranscoding = false ' If playback was reported, don't retry with transcoding
if not m.playReported and m.top.transcodeAvailable
m.top.retryWithTranscoding = true ' If playback was not reported, retry with transcoding
else
' If an error was encountered, Display dialog
dialog = createObject("roSGNode", "Dialog")
dialog.title = tr("Error During Playback")
@ -32,7 +32,7 @@ sub onState(msg)
dialog.observeField("buttonSelected", "dialogClosed")
m.top.getScene().dialog = dialog
end if
' Stop playback and exit player
m.top.control = "stop"
m.top.backPressed = true

View File

@ -13,6 +13,7 @@
<field id="showID" type="string" />
<field id="transcodeParams" type="assocarray" />
<field id="transcodeAvailable" type="boolean" value="false" />
<field id="retryWithTranscoding" type="boolean" value="false" />
<field id="isTranscoded" type="boolean" />
<field id="transcodeReasons" type="array" />

View File

@ -191,17 +191,16 @@ sub AddVideoContent(video, mediaSourceId, audio_stream_idx = 1, subtitle_idx = -
' For h264 video, Roku spec states that it supports and Encoding level 4.1 and 4.2.
' The device can decode content with a Higher Encoding level but may play it back with certain
' artifacts. If the user preference is set, and the only reason the server says we need to
' artifacts. If the user preference is set, and the only reason the server says we need to
' transcode is that the Envoding Level is not supported, then try to direct play but silently
' fall back to the transcode if that fails.
video.retryWithTranscoding = false
if get_user_setting("playback.tryDirect.h264ProfileLevel") = "true" and playbackInfo.MediaSources[0].TranscodingUrl <> invalid and forceTranscoding = false and playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264"
transcodingReasons = getTranscodeReasons(playbackInfo.MediaSources[0].TranscodingUrl)
if transcodingReasons.Count() = 1 and transcodingReasons[0] = "VideoLevelNotSupported"
video.directPlaySupported = true
video.retryWithTranscoding = true
video.transcodeAvailable = true
end if
end if
end if
if video.directPlaySupported
protocol = LCase(playbackInfo.MediaSources[0].Protocol)