Bug 20459 - Simplify MediaStream+JingleContent life cycle
Summary: Simplify MediaStream+JingleContent life cycle
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: gabble (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-04 06:10 UTC by Senko Rasic
Modified: 2009-06-02 07:31 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

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.