Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save j0sh/1609517 to your computer and use it in GitHub Desktop.

Select an option

Save j0sh/1609517 to your computer and use it in GitHub Desktop.
Make stream creation and teardown more resilient to weirdness.
From b7f142b41db08211f211b91996cd6a439cd18fb5 Mon Sep 17 00:00:00 2001
From: Josh Allmann <joshua.allmann@gmail.com>
Date: Fri, 13 Jan 2012 16:20:57 -0800
Subject: [PATCH] Make stream creation and teardown more resilient to
weirdness.
---
.../thelib/src/protocols/rtmp/basertmpprotocol.cpp | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sources/thelib/src/protocols/rtmp/basertmpprotocol.cpp b/sources/thelib/src/protocols/rtmp/basertmpprotocol.cpp
index b2df558..74f3863 100644
--- a/sources/thelib/src/protocols/rtmp/basertmpprotocol.cpp
+++ b/sources/thelib/src/protocols/rtmp/basertmpprotocol.cpp
@@ -359,8 +359,8 @@ bool BaseRTMPProtocol::CloseStream(uint32_t streamId, bool createNeutralStream)
}
if (_streams[streamId] == NULL) {
- FATAL("Try to close a NULL stream");
- return false;
+ WARN("Try to close a NULL stream");
+ return true;
}
if (TAG_KIND_OF(_streams[streamId]->GetType(), ST_OUT_NET_RTMP)) {
@@ -459,9 +459,8 @@ BaseOutNetRTMPStream * BaseRTMPProtocol::CreateONS(uint32_t streamId,
}
if (_streams[streamId] == NULL) {
- FATAL("Try to play a stream on a NULL placeholder");
- return NULL;
- }
+ WARN("Try to play a stream on a NULL placeholder");
+ } else {
if (_streams[streamId]->GetType() != ST_NEUTRAL_RTMP) {
FATAL("Try to play a stream over a non neutral stream: id: %u; type: %"PRIu64,
@@ -471,6 +470,7 @@ BaseOutNetRTMPStream * BaseRTMPProtocol::CreateONS(uint32_t streamId,
delete _streams[streamId];
_streams[streamId] = NULL;
+ }
BaseOutNetRTMPStream *pBaseOutNetRTMPStream = BaseOutNetRTMPStream::GetInstance(
this, GetApplication()->GetStreamsManager(), streamName, streamId,
--
1.7.5.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment