Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
18 lines
494 B
Ruby
18 lines
494 B
Ruby
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
|