Initial commit: monorepo Match Live TV.
Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
17
backend/app/jobs/notify_stream_health_job.rb
Normal file
17
backend/app/jobs/notify_stream_health_job.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class NotifyStreamHealthJob
|
||||
include Sidekiq::Job
|
||||
|
||||
def perform(session_id)
|
||||
session = StreamSession.find_by(id: session_id)
|
||||
return unless session&.live?
|
||||
|
||||
camera = session.device_states.find_by(device_role: "camera")
|
||||
return unless camera&.current_bitrate && camera.current_bitrate < session.target_bitrate * 0.5
|
||||
|
||||
SessionChannel.broadcast_message(session, {
|
||||
type: "stream_event",
|
||||
event: "quality_degraded",
|
||||
bitrate: camera.current_bitrate
|
||||
})
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user