From ffd50d1ab55ee3aee04c9c2f9ecbf14be473a234 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov <lyubomir.marinov@jitsi.org> Date: Tue, 21 Aug 2012 17:56:38 +0000 Subject: [PATCH] Fixes issues with video conferencing such as the display of a non-focus participant's video to other non-focus participants and the stopping of the streaming between non-focus participants upon stopping of the streaming of the focus' local video. --- .../jitsi/impl/neomedia/MediaStreamImpl.java | 29 +++++++++++++++++-- .../impl/neomedia/RTPTranslatorImpl.java | 10 ++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/org/jitsi/impl/neomedia/MediaStreamImpl.java b/src/org/jitsi/impl/neomedia/MediaStreamImpl.java index feef7edb..e6219a55 100644 --- a/src/org/jitsi/impl/neomedia/MediaStreamImpl.java +++ b/src/org/jitsi/impl/neomedia/MediaStreamImpl.java @@ -1694,10 +1694,23 @@ private void start(MediaDirection direction) if (direction == null) throw new NullPointerException("direction"); + /* + * If the local peer is the focus of a conference for which it is to + * perform RTP translation even without generating media to be sent, it + * should create its StreamRTPManager. + */ + boolean getRTPManagerForRTPTranslator = true; + if (direction.allowsSending() && ((startedDirection == null) || !startedDirection.allowsSending())) { + /* + * The startSendStreams method will be called so the getRTPManager + * method will be called as part of the execution of the former. + */ + getRTPManagerForRTPTranslator = false; + startSendStreams(); getDeviceSession().start(MediaDirection.SENDONLY); @@ -1720,6 +1733,12 @@ else if (startedDirection == null) && ((startedDirection == null) || !startedDirection.allowsReceiving())) { + /* + * The startReceiveStreams method will be called so the getRTPManager + * method will be called as part of the execution of the former. + */ + getRTPManagerForRTPTranslator = false; + startReceiveStreams(); getDeviceSession().start(MediaDirection.RECVONLY); @@ -1729,6 +1748,14 @@ else if (startedDirection == null) else if (startedDirection == null) startedDirection = MediaDirection.RECVONLY; } + + /* + * If the local peer is the focus of a conference for which it is to + * perform RTP translation even without generating media to be sent, it + * should create its StreamRTPManager. + */ + if (getRTPManagerForRTPTranslator && (rtpTranslator != null)) + getRTPManager(); } /** @@ -2476,9 +2503,7 @@ private void printFlowStatistics(StreamRTPManager rtpManager) public void setRTPTranslator(RTPTranslator rtpTranslator) { if (this.rtpTranslator != rtpTranslator) - { this.rtpTranslator = rtpTranslator; - } } /** diff --git a/src/org/jitsi/impl/neomedia/RTPTranslatorImpl.java b/src/org/jitsi/impl/neomedia/RTPTranslatorImpl.java index 6aff34c2..bee04eb1 100644 --- a/src/org/jitsi/impl/neomedia/RTPTranslatorImpl.java +++ b/src/org/jitsi/impl/neomedia/RTPTranslatorImpl.java @@ -40,6 +40,13 @@ public class RTPTranslatorImpl private static final Logger logger = Logger.getLogger(RTPTranslatorImpl.class); + /** + * The indicator which determines whether the method + * {@link #createFakeSendStreamIfNecessary()} is to be executed by + * <tt>RTPTranslatorImpl</tt>. + */ + private static final boolean CREATE_FAKE_SEND_STREAM_IF_NECESSARY = false; + /** * An array with <tt>long</tt> element type and no elements explicitly * defined to reduce unnecessary allocations. @@ -193,7 +200,8 @@ private synchronized void createFakeSendStreamIfNecessary() * because there is no other remote peer to disperse the received RTP * and RTCP to. */ - if ((fakeSendStream == null) + if (CREATE_FAKE_SEND_STREAM_IF_NECESSARY + && (fakeSendStream == null) && sendStreams.isEmpty() && (streamRTPManagers.size() > 1)) { -- GitLab