From 4338cf57e6ef1ac98149dd2402d54eeec9fe34f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Tue, 25 Feb 2020 15:24:26 +0100 Subject: [PATCH] OBSRemoteProtocol: rely only on event data when encoding an event --- src/protocol/OBSRemoteProtocol.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/protocol/OBSRemoteProtocol.cpp b/src/protocol/OBSRemoteProtocol.cpp index 4daf2ba3..a7555b6e 100644 --- a/src/protocol/OBSRemoteProtocol.cpp +++ b/src/protocol/OBSRemoteProtocol.cpp @@ -67,13 +67,15 @@ std::string OBSRemoteProtocol::encodeEvent(const RpcEvent& event) QString updateType = event.updateType(); obs_data_set_string(eventData, "update-type", updateType.toUtf8().constData()); - if (obs_frontend_streaming_active()) { - QString streamingTimecode = Utils::nsToTimestamp(event.streamTime().value()); + std::optional streamTime = event.streamTime(); + if (streamTime.has_value()) { + QString streamingTimecode = Utils::nsToTimestamp(streamTime.value()); obs_data_set_string(eventData, "stream-timecode", streamingTimecode.toUtf8().constData()); } - if (obs_frontend_recording_active()) { - QString recordingTimecode = Utils::nsToTimestamp(event.recordingTime().value()); + std::optional recordingTime = event.recordingTime(); + if (recordingTime.has_value()) { + QString recordingTimecode = Utils::nsToTimestamp(recordingTime.value()); obs_data_set_string(eventData, "rec-timecode", recordingTimecode.toUtf8().constData()); }