Skip to content

Commit

Permalink
requesthandler: Prevent NaN outputCongestion values (null)
Browse files Browse the repository at this point in the history
  • Loading branch information
tt2468 committed Jan 16, 2024
1 parent 9ecc953 commit bbdc5bc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/requesthandler/RequestHandler_Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ RequestResult RequestHandler::GetStreamStatus(const Request &)

uint64_t outputDuration = Utils::Obs::NumberHelper::GetOutputDuration(streamOutput);

float outputCongestion = obs_output_get_congestion(streamOutput);
if (std::isnan(outputCongestion)) // libobs does not handle NaN, so we're handling it here
outputCongestion = 0.0f;

json responseData;
responseData["outputActive"] = obs_output_active(streamOutput);
responseData["outputReconnecting"] = obs_output_reconnecting(streamOutput);
responseData["outputTimecode"] = Utils::Obs::StringHelper::DurationToTimecode(outputDuration);
responseData["outputDuration"] = outputDuration;
responseData["outputCongestion"] = obs_output_get_congestion(streamOutput);
responseData["outputCongestion"] = outputCongestion;
responseData["outputBytes"] = (uint64_t)obs_output_get_total_bytes(streamOutput);
responseData["outputSkippedFrames"] = obs_output_get_frames_dropped(streamOutput);
responseData["outputTotalFrames"] = obs_output_get_total_frames(streamOutput);
Expand Down

0 comments on commit bbdc5bc

Please sign in to comment.