Deepen all 20 media-streaming modules with expanded APIs and tests.
Add batch ingest, tree depth/path, peer scoring helpers, scheduler peek, FEC and ABR controls, telemetry sessions, and richer production api.md for bandwidth-aggregator and media-tree-orchestrator. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -58,6 +58,22 @@ class HyperP2PAdaptiveStreamingEngine extends EventEmitter {
|
||||
return { ...this._recommendation, bufferMs: this._bufferMs, swarmHealth: this._swarmHealth }
|
||||
}
|
||||
|
||||
canSustain (targetBitrate) {
|
||||
return this._recommendation.bitrate >= (targetBitrate | 0)
|
||||
}
|
||||
|
||||
downgrade () {
|
||||
this._swarmHealth = Math.max(0.2, this._swarmHealth - 0.15)
|
||||
this._recompute()
|
||||
return this._recommendation
|
||||
}
|
||||
|
||||
upgrade () {
|
||||
this._swarmHealth = Math.min(1, this._swarmHealth + 0.1)
|
||||
this._recompute()
|
||||
return this._recommendation
|
||||
}
|
||||
|
||||
getStats () {
|
||||
return mediaStats(this._stats, PROTOCOL, { recommendation: this._recommendation })
|
||||
}
|
||||
|
||||
@@ -9,5 +9,6 @@ test('recommend', async (t) => {
|
||||
m.reportBuffer(3000)
|
||||
m.reportSwarmHealth(0.9)
|
||||
t.ok(m.currentRecommendation().bitrate > 0)
|
||||
t.ok(m.canSustain(1_000_000))
|
||||
await m.close()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user