#400 Infinite calls

Development_Branch
closed-out-of-date
nobody
OPAL (214)
5
2013-02-15
2012-12-20
No

I've found that OPAL doesn't always call OnMediaFailed and such calls remain established infinitely.

Media Patch thread read data from source RTP stream (empty packets from jitter: OpalRTPMediaStream::ReadPacket -> OpalRTPSession::ReadData -> OpalJitterBuffer::ReadData) and send them to sink stream.
RTP Jitter thread is not running (it was completed).

Discussion

  • It seems that there was some kind of RTP connection error.
    Maybe there is no need to call OnMediaFailed and OPAL should release connection explicitly in such cases?

     
  • Patch #3598019 fixes this bug.

     
  • Patch #3598019 only partially fixes this issue. It fixes those cases which lead to infinite reading from RTP media stream.
    But OnMediaFailed is not called in some cases again and RTP connections are not released.

    For example:

    When OpalJitterBuffer::WriteData returns false (m_frames.size() > 100) then Jitter thread terminates but RTP connection is not released.

    When OpalRTPSession::InternalReadData -> OpalRTPSession::ReadControlPDU() -> OpalRTPSession::OnReceiveControl returns e_AbortTransport (m_closeOnBye is true) then Jitter thread terminates but RTP connection is not released.

     
    • status: open --> closed-out-of-date
     
  • I suspect this may be fixed indirectly. The case where the jitter buffer thread exits due to > 100 packets has been changed so it just maintains a maximum number of packets.

     
  • It's the first case, but what about the second one?

    "When OpalRTPSession::InternalReadData -> OpalRTPSession::ReadControlPDU()
    -> OpalRTPSession::OnReceiveControl returns e_AbortTransport (m_closeOnBye
    is true) then Jitter thread terminates but RTP connection is not released."

     
    • status: closed-out-of-date --> open-out-of-date
     
    • status: open-out-of-date --> pending-out-of-date
     
  • Well, I would argue that if we receive a BYE from the remote, we are doing an "orderly shutdown" and not a media failure, so the m_connection.OnMediaFailed() is not required.

    Do you have evidence to the contrary?

     
    • status: pending-out-of-date --> open-out-of-date
     
  • We CAN do the shutdown correctly, but also we can receive BYE on RTP channel without confirmation on the signal channel (for SIP for example).
    So RTP channel will be closed, but connections are alive.

     
    • status: open-out-of-date --> pending-out-of-date
     
  • The problem I have is how do we distinguish between a received BYE that is part of an orderly shutdown and one that isn't? I am not sure it is possible as the BYE can easily arrive before any SIP BYE or H.323 Release Complete. Se we get a call the OnMediaFailed() which locks in a erroneous EndedByMediaFailed call end reason, when it was really all fine.

    So, unless you specifically have this problem with some system you are interoperating with, I think it is in the "too hard" basket.

     
  • I don't think we must call OnMediaFailed when we have received a RTP BYE, but we can use special handling when RTP channel terminates.

    Also we can rename OnMediaFailed to OnMediaTerminated or something similar, so the application can handle this somehow.

    Anyway if it's hard to fix this we can leave this "as is".

     
    • status: pending-out-of-date --> open-out-of-date
     
    • status: open-out-of-date --> closed-out-of-date
     
  • Just double checked, m_closeOnBye is initialised to false and is never set to true anywhere in OPAL. Must be a piece of ancient history. A lot of that in 14 year old code!

    Definitely not going to anything with it now.