Bug 20459

Summary: Simplify MediaStream+JingleContent life cycle
Product: Telepathy Reporter: Senko Rasic <senko>
Component: gabbleAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Senko Rasic 2009-03-04 06:10:51 UTC
Currently MediaStream depends on having a valid reference
to its JingleContent, but doesn't ref the content, instead
relying on the other code (MediaChannel and JingleSession)
to close the stream at the right time in certain situations
(any situation other than content emitting REMOVED signal,
which is handled explicitly in the stream).

This is hard to follow, hard to debug, and we've a couple
of related bugs already.

What should be done:
  - ref the content in property setter of MediaStream
  - unref it in the content_removed_cb handler in media-stream.c
  - make sure JingleSession calls jingle_content_remove
    for every content when disposing
  - make sure JingleSession calls jingle_content_remove
    when replacing the content
  - make sure MediaChannel removes the content by calling
    content_remove

Life cycle of JingleContent will then be:
  - gets created (reference owned by JingleSession)
  - new reference to be owned by MediaStream
  - when it should be removed (either as an effect of
    "content-remove", "session-terminate" or on the
    local side), content emits REMOVED signal
  - MediaStream unrefs the content and closes itself
  - JingleSession unrefs the content by removing it
    from contents hashtable
  - content is disposed
Comment 1 Will Thompson 2009-06-02 07:31:04 UTC
I implemented this suggestion (which I didn't actually read before implementing it! :-)) in 0.7.27. From NEWS:

* The lifecycles of several Jingle-related objects have been cleared up,
  fixing a number of Jingle crashes.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.