Right now removing last replica triggers (wrongly) assertion on
StreamReplicator.cpp:108, because fNumPerlicas gets decremented before
deactivating.
Also if replicator is created with deleteWhenLastReplicaDies flag set
removing last replica triggers self deletion of replicator and later
deactivateStreamReplica() is called on already destroyed class,
potentially leading to crash.
---
liveMedia/StreamReplicator.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--
Stas Tsymbalov
TrueConf LLC
http://trueconf.com/
diff --git a/liveMedia/StreamReplicator.cpp b/liveMedia/StreamReplicator.cpp
index fe87f8d..bbd569a 100644
--- a/liveMedia/StreamReplicator.cpp
+++ b/liveMedia/StreamReplicator.cpp
@@ -183,6 +183,11 @@ void StreamReplicator::deactivateStreamReplica(StreamReplica* replicaBeingDeacti
}
void StreamReplicator::removeStreamReplica(StreamReplica* replicaBeingRemoved) {
+ // Handle the replica that's being removed the same way that we would if it were merely being deactivated:
+ if (replicaBeingRemoved->fFrameIndex != -1) { // i.e., we haven't already done this
+ deactivateStreamReplica(replicaBeingRemoved);
+ }
+
// Assert: fNumReplicas > 0
if (fNumReplicas == 0) fprintf(stderr, "StreamReplicator::removeStreamReplica() Internal Error!\n"); // should not happen
--fNumReplicas;
@@ -192,11 +197,6 @@ void StreamReplicator::removeStreamReplica(StreamReplica* replicaBeingRemoved) {
Medium::close(this);
return;
}
-
- // Now handle the replica that's being removed the same way that we would if it were merely being deactivated:
- if (replicaBeingRemoved->fFrameIndex != -1) { // i.e., we haven't already done this
- deactivateStreamReplica(replicaBeingRemoved);
- }
}
void StreamReplicator::afterGettingFrame(void* clientData, unsigned frameSize, unsigned numTruncatedBytes,
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel