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
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.