Skip to content

Commit bc156e5

Browse files
committed
- correction of waitForEvent, it was not waiting anymore
1 parent 311698a commit bc156e5

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

include/RTMFP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ along with Librtmfp. If not, see <http://www.gnu.org/licenses/>.
3535
#include "Base/Logs.h"
3636
#include <map>
3737

38-
#define RTMFP_LIB_VERSION 0x020E0002 // (2.14.2)
38+
#define RTMFP_LIB_VERSION 0x020E0002 // (2.14.3)
3939

4040
#define RTMFP_DEFAULT_KEY (Base::UInt8*)"Adobe Systems 02"
4141
#define RTMFP_KEY_SIZE 0x10

sources/Invoker.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -715,9 +715,7 @@ int Invoker::addStream(UInt32 RTMFPcontext, UInt8 mask, const char* streamName,
715715
}
716716

717717
int Invoker::waitForEvent(UInt32 RTMFPcontext, UInt8 mask) {
718-
int handled = 0;
719-
720-
while (!handled) {
718+
for (;;) {
721719
if (!Thread::running())
722720
return ERROR_APP_INTERRUPT;
723721

@@ -730,13 +728,14 @@ int Invoker::waitForEvent(UInt32 RTMFPcontext, UInt8 mask) {
730728
if (interrupted || it->second->status >= RTMFP::NEAR_CLOSED) {
731729
removeConnection(it, interrupted);
732730
return _mapConnections.empty() ? ERROR_LAST_INTERRUPT : ERROR_CONN_INTERRUPT;
733-
} else if (it->second->flags & mask) // Event handled?
734-
handled = 1;
731+
}
732+
else if (it->second->flags & mask) // Event handled?
733+
break;
735734
}
736-
return 0;
735+
_waitSignal.wait(DELAY_BLOCKING_SIGNALS);
737736
}
738737

739-
return handled;
738+
return 1;
740739
}
741740

742741
bool Invoker::closePublication(UInt32 RTMFPcontext, const char* streamName) {

sources/librtmfp.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ LIBRTMFP_API char RTMFP_WaitForEvent(unsigned int RTMFPcontext, RTMFPMask mask)
243243
}
244244

245245
int res = GlobalInvoker->waitForEvent(RTMFPcontext, mask);
246-
return (res <= 0) ? HandleError(res) : 1;
246+
if (res < 0)
247+
return HandleError(res);
248+
return (char)res;
247249
}
248250

249251
void RTMFP_LogSetCallback(void(* onLog)(unsigned int, const char*, long, const char*)) {

0 commit comments

Comments
 (0)