Live stream fixes, http client rewrite, telemetry improvements
This commit is contained in:
1 parent
df4e16b846
commit
9200bd1c74
63 files changed
+4382
-1157
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import "pkg:/components/Services/Dash/LiveHeadCounts.bs"
|
||||
import "pkg:/components/VideoPlayerDev/VideoNode.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
@@ -105,6 +106,8 @@ namespace PlaybackTelemetry
|
||||
private healSamples as object = invalid
|
||||
private tailResolveCount as integer = 0
|
||||
private tailResolveSamples as object = invalid
|
||||
private startSegmentBitrateBps as integer = 0
|
||||
private startMeasuredBitrateBps as integer = 0
|
||||
|
||||
function new(deps as object)
|
||||
m.playerTimer = deps.playerTimer
|
||||
@@ -128,6 +131,7 @@ namespace PlaybackTelemetry
|
||||
m.span = PlaybackTelemetry.Span.Playing
|
||||
if m.firstPlayingAtMs < 0
|
||||
m.firstPlayingAtMs = nowMs
|
||||
m.startMeasuredBitrateBps = ValidInt(ValidAssociativeArray(m.top.streamInfo).measuredBitrate)
|
||||
end if
|
||||
' playing under an error dialog: the playback recovered, so the error did not end it.
|
||||
if m.outcome = PlaybackTelemetry.Outcome.Error
|
||||
@@ -170,6 +174,18 @@ namespace PlaybackTelemetry
|
||||
end if
|
||||
end function
|
||||
|
||||
' True once the first segment carrying video started streaming: its bitrate is the one kept.
|
||||
function OnStreamingSegment(segment as object) as boolean
|
||||
if segment = invalid or not IsInt(segment.segType)
|
||||
return false
|
||||
end if
|
||||
if segment.segType <> SegmentType.Mux and segment.segType <> SegmentType.Video
|
||||
return false
|
||||
end if
|
||||
m.startSegmentBitrateBps = ValidInt(segment.segBitrateBps)
|
||||
return true
|
||||
end function
|
||||
|
||||
function OnErrorDialog() as void
|
||||
m.outcome = PlaybackTelemetry.Outcome.Error
|
||||
end function
|
||||
@@ -328,13 +344,20 @@ namespace PlaybackTelemetry
|
||||
"tail_resolve_count": m.tailResolveCount
|
||||
"tail_resolve_samples": m.tailResolveSamples
|
||||
}
|
||||
if m.transport.isLive
|
||||
liveHead = StringUtils.ParseJsonSafe(ReadAsciiFile(LIVE_HEAD_COUNTS_PATH))
|
||||
if liveHead <> invalid and liveHead["video_load_id"] = summary["video_load_id"]
|
||||
summary["live_head"] = liveHead["counts"]
|
||||
DeleteFile(LIVE_HEAD_COUNTS_PATH)
|
||||
end if
|
||||
summary["start_segment_bitrate_bps"] = m.startSegmentBitrateBps
|
||||
summary["start_measured_bitrate_bps"] = m.startMeasuredBitrateBps
|
||||
end if
|
||||
if content <> invalid
|
||||
summary["video_id"] = content.videoId
|
||||
summary["stream_source"] = content.playletStreamSource
|
||||
summary["drm"] = not StringUtils.IsNullOrEmpty(ValidAssociativeArray(content.drmParams).keySystem)
|
||||
summary["stream_url_index"] = content.playletStreamUrlIndex
|
||||
if m.firstPlayingAtMs < 0 or m.underrunCount > 0 or m.bufferingsWithoutStatusCount > 0 or m.isUnderrunChangeCount > 0 or m.errorCount > 0 or m.healCount > 0 or m.outcome = PlaybackTelemetry.Outcome.Error
|
||||
summary["video_id"] = content.videoId
|
||||
end if
|
||||
end if
|
||||
LogTelemetryEvent({
|
||||
level: "info"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
' The Roku Video node's `state` and `control` field values (see Video node reference). String-valued so members
|
||||
' compare and assign directly against m.top.state / m.top.control.
|
||||
' compare and assign directly against m.top.state / m.top.control. SegmentType is `streamingSegment.segType`.
|
||||
|
||||
enum VideoState
|
||||
None = "none"
|
||||
@@ -22,3 +22,10 @@ enum VideoControl
|
||||
Prebuffer = "prebuffer"
|
||||
SkipContent = "skipcontent"
|
||||
end enum
|
||||
|
||||
enum SegmentType
|
||||
Mux = 0
|
||||
Audio = 1
|
||||
Video = 2
|
||||
Captions = 3
|
||||
end enum
|
||||
@@ -171,6 +171,7 @@ function OnNodeReady()
|
||||
m.top.ObserveField("setSeek", FuncName(OnSetSeek))
|
||||
m.top.ObserveField("bufferingStatus", FuncName(OnBufferingStatus))
|
||||
m.top.ObserveField("playStartInfo", FuncName(OnPlayStartInfo))
|
||||
m.top.ObserveField("streamingSegment", FuncName(OnStreamingSegment))
|
||||
|
||||
' a player that starts minimized shows the PiP hint (1s after the shrink settles, auto-hides after 5s).
|
||||
m.showFullScreenHint = not m.container.fullscreen
|
||||
@@ -805,6 +806,16 @@ function OnPlayStartInfo(event as object) as void
|
||||
m.playbackTelemetry.OnPlayStartInfo(event.getData())
|
||||
end function
|
||||
|
||||
' Only the first video segment is wanted: no callback per segment for the rest of the play.
|
||||
function OnStreamingSegment(event as object) as void
|
||||
if m.onCloseCalled = true
|
||||
return
|
||||
end if
|
||||
if m.playbackTelemetry.OnStreamingSegment(event.getData())
|
||||
m.top.unobserveField("streamingSegment")
|
||||
end if
|
||||
end function
|
||||
|
||||
' A transport freezes the video; if the device is playing under an active transport (Roku resumes a paused
|
||||
' Video on a seek, or a freeze command was dropped), re-pause. The transport stays active so the bif stays
|
||||
' visible over the now-paused video. Called from OnVideoState (the change edge) and OnPosition (the net —
|
||||
@@ -1506,6 +1517,7 @@ function OnClose() as void
|
||||
m.top.unobserveField("setSeek")
|
||||
m.top.unobserveField("bufferingStatus")
|
||||
m.top.unobserveField("playStartInfo")
|
||||
m.top.unobserveField("streamingSegment")
|
||||
m.top.unobserveField("close")
|
||||
content = m.top.content
|
||||
if content <> invalid
|
||||
|
||||
@@ -73,7 +73,7 @@ function TestSetup() as void
|
||||
' nudge counter above — stacked observers fire a handler once per prior TestSetup on every write,
|
||||
' and OnPosition's latency learning reads two identical fires as a CONFIRMED min-gap, poisoning
|
||||
' LiveEdgeMs for any live test that runs after another test in the suite.
|
||||
for each deviceField in ["state", "position", "duration", "close", "thumbnailTiles", "control", "setSeek", "bufferingStatus", "playStartInfo"]
|
||||
for each deviceField in ["state", "position", "duration", "close", "thumbnailTiles", "control", "setSeek", "bufferingStatus", "playStartInfo", "streamingSegment"]
|
||||
m.top.unobserveField(deviceField)
|
||||
end for
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
<field id="errorInfo" type="assocarray" />
|
||||
<field id="bufferingStatus" type="assocarray" alwaysNotify="true" />
|
||||
<field id="playStartInfo" type="assocarray" alwaysNotify="true" />
|
||||
<field id="streamingSegment" type="assocarray" alwaysNotify="true" />
|
||||
<field id="streamInfo" type="assocarray" />
|
||||
<!-- AutoBind deps + layout (set by TestSetup; NOT bound). -->
|
||||
<field id="appController" type="node" />
|
||||
<field id="jobQueue" type="node" />
|
||||
|
||||
Reference in new issue
Block a user