提交 d3c163b7 编写于 作者: J jp9000

UI: Fix Stats not showing stream data until start

上级 65049533
...@@ -388,8 +388,8 @@ void OBSBasicStats::Update() ...@@ -388,8 +388,8 @@ void OBSBasicStats::Update()
/* ------------------------------------------- */ /* ------------------------------------------- */
/* recording/streaming stats */ /* recording/streaming stats */
outputLabels[0].Update(strOutput); outputLabels[0].Update(strOutput, false);
outputLabels[1].Update(recOutput); outputLabels[1].Update(recOutput, true);
} }
void OBSBasicStats::Reset() void OBSBasicStats::Reset()
...@@ -411,15 +411,9 @@ void OBSBasicStats::Reset() ...@@ -411,15 +411,9 @@ void OBSBasicStats::Reset()
Update(); Update();
} }
void OBSBasicStats::OutputLabels::Update(obs_output_t *output) void OBSBasicStats::OutputLabels::Update(obs_output_t *output, bool rec)
{ {
if (!output) uint64_t totalBytes = output ? obs_output_get_total_bytes(output) : 0;
return;
const char *id = obs_obj_get_id(output);
bool rec = strcmp(id, "rtmp_output") != 0;
uint64_t totalBytes = obs_output_get_total_bytes(output);
uint64_t curTime = os_gettime_ns(); uint64_t curTime = os_gettime_ns();
uint64_t bytesSent = totalBytes; uint64_t bytesSent = totalBytes;
...@@ -439,12 +433,17 @@ void OBSBasicStats::OutputLabels::Update(obs_output_t *output) ...@@ -439,12 +433,17 @@ void OBSBasicStats::OutputLabels::Update(obs_output_t *output)
QString str = QTStr("Basic.Stats.Status.Inactive"); QString str = QTStr("Basic.Stats.Status.Inactive");
QString themeID; QString themeID;
bool active = output ? obs_output_active(output) : false;
if (rec) { if (rec) {
if (obs_output_active(output)) if (active)
str = QTStr("Basic.Stats.Status.Recording"); str = QTStr("Basic.Stats.Status.Recording");
} else { } else {
if (obs_output_active(output)) { if (active) {
if (obs_output_reconnecting(output)) { bool reconnecting = output
? obs_output_reconnecting(output)
: false;
if (reconnecting) {
str = QTStr("Basic.Stats.Status.Reconnecting"); str = QTStr("Basic.Stats.Status.Reconnecting");
themeID = "error"; themeID = "error";
} else { } else {
...@@ -465,8 +464,8 @@ void OBSBasicStats::OutputLabels::Update(obs_output_t *output) ...@@ -465,8 +464,8 @@ void OBSBasicStats::OutputLabels::Update(obs_output_t *output)
QString("%1 kb/s").arg(QString::number(kbps, 'f', 0))); QString("%1 kb/s").arg(QString::number(kbps, 'f', 0)));
if (!rec) { if (!rec) {
int total = obs_output_get_total_frames(output); int total = output ? obs_output_get_total_frames(output) : 0;
int dropped = obs_output_get_frames_dropped(output); int dropped = output ? obs_output_get_frames_dropped(output) : 0;
if (total < first_total || dropped < first_dropped) { if (total < first_total || dropped < first_dropped) {
first_total = 0; first_total = 0;
......
...@@ -42,7 +42,7 @@ class OBSBasicStats : public QWidget { ...@@ -42,7 +42,7 @@ class OBSBasicStats : public QWidget {
int first_total = 0; int first_total = 0;
int first_dropped = 0; int first_dropped = 0;
void Update(obs_output_t *output); void Update(obs_output_t *output, bool rec);
void Reset(obs_output_t *output); void Reset(obs_output_t *output);
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册