comparison libpurple/media.c @ 26166:218f052b9bf5

Fix removing output windows when the session is rejected.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Thu, 05 Feb 2009 00:15:13 +0000
parents 1aed9a92b657
children 8a402c91fe6f 23038e1a1754
comparison
equal deleted inserted replaced
26157:1aed9a92b657 26166:218f052b9bf5
2388 2388
2389 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); 2389 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
2390 2390
2391 if (session_id != NULL && participant == NULL) { 2391 if (session_id != NULL && participant == NULL) {
2392 PurpleMediaSession *session; 2392 PurpleMediaSession *session;
2393 GstPad *pad, *peer;
2394
2393 session = purple_media_get_session(media, session_id); 2395 session = purple_media_get_session(media, session_id);
2394 2396
2395 if (session == NULL) 2397 if (session == NULL)
2396 return FALSE; 2398 return FALSE;
2397 2399
2398 sink = session->sink; 2400 sink = session->sink;
2401
2402 if (!GST_IS_ELEMENT(sink))
2403 return FALSE;
2404
2405 pad = gst_element_get_static_pad(sink, "ghostsink");
2406 peer = gst_pad_get_peer(pad);
2407 gst_object_unref(pad);
2408
2409 gst_element_release_request_pad(GST_ELEMENT_PARENT(peer), peer);
2410 gst_object_unref(peer);
2411
2412 gst_element_set_state(sink, GST_STATE_NULL);
2413
2414 gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(sink)), sink);
2415 session->sink = NULL;
2416 return TRUE;
2399 } else if (session_id != NULL && participant != NULL) { 2417 } else if (session_id != NULL && participant != NULL) {
2400 PurpleMediaStream *stream; 2418 PurpleMediaStream *stream;
2401 stream = purple_media_get_stream(media, 2419 stream = purple_media_get_stream(media,
2402 session_id, participant); 2420 session_id, participant);
2403 2421
2411 if (!GST_IS_ELEMENT(sink)) 2429 if (!GST_IS_ELEMENT(sink))
2412 return FALSE; 2430 return FALSE;
2413 2431
2414 /* Remove sink */ 2432 /* Remove sink */
2415 parent = GST_ELEMENT(gst_element_get_parent(sink)); 2433 parent = GST_ELEMENT(gst_element_get_parent(sink));
2434
2435 if (parent == NULL) {
2436 /* It's not added and therefore not linked */
2437 gst_object_unref(sink);
2438 return FALSE;
2439 }
2440
2416 pad = gst_element_get_static_pad(sink, "ghostsink"); 2441 pad = gst_element_get_static_pad(sink, "ghostsink");
2417 2442
2418 if (pad == NULL) { 2443 if (pad == NULL) {
2419 /* It's already a fakesink */ 2444 /* It's already a fakesink */
2420 gst_object_unref(parent); 2445 gst_object_unref(parent);