From 8c99be2bff44b008462151583d9b3ab5ec637cea Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Tue, 26 May 2015 12:57:56 +0200 Subject: [PATCH] media: refactor sipe_backend_media_stream Split sipe_backend_media_stream into common, backend private and Sipe private structures. --- src/api/sipe-backend.h | 65 +++++------ src/api/sipe-core.h | 5 + src/core/sipe-media.c | 194 ++++++++++++++++++++------------- src/miranda/miranda-media.c | 92 +++++++--------- src/purple/purple-media.c | 233 +++++++++++++++++----------------------- src/telepathy/telepathy-stubs.c | 65 ++++++----- 6 files changed, 324 insertions(+), 330 deletions(-) diff --git a/src/api/sipe-backend.h b/src/api/sipe-backend.h index 140a8a1e..43b0d553 100644 --- a/src/api/sipe-backend.h +++ b/src/api/sipe-backend.h @@ -343,16 +343,24 @@ struct sipe_media_call; struct sipe_backend_media; struct sipe_backend_codec; struct sipe_backend_candidate; -struct sipe_backend_stream; +struct sipe_backend_media_stream; struct sipe_backend_media_relays; +struct sipe_media_stream { + struct sipe_backend_media_stream *backend_private; + + gchar *id; +}; + struct sipe_media_call { struct sipe_backend_media *backend_private; gchar *with; void (*stream_initialized_cb)(struct sipe_media_call *, - struct sipe_backend_stream *); + struct sipe_media_stream *); + void (*stream_end_cb)(struct sipe_media_call *, + struct sipe_media_stream *); void (*media_end_cb)(struct sipe_media_call *); void (*call_accept_cb)(struct sipe_media_call *, gboolean local); void (*call_reject_cb)(struct sipe_media_call *, gboolean local); @@ -383,40 +391,37 @@ struct sipe_backend_media_relays * sipe_backend_media_relays_convert(GSList *med gchar *password); void sipe_backend_media_relays_free(struct sipe_backend_media_relays *media_relays); -struct sipe_backend_stream *sipe_backend_media_add_stream(struct sipe_backend_media *media, +struct sipe_backend_media_stream *sipe_backend_media_add_stream(struct sipe_media_call *media, const gchar *id, const gchar *participant, SipeMediaType type, SipeIceVersion ice_version, gboolean initiator, struct sipe_backend_media_relays *media_relays); -void sipe_backend_media_remove_stream(struct sipe_backend_media *media, - struct sipe_backend_stream *stream); -GSList *sipe_backend_media_get_streams(struct sipe_backend_media *media); -struct sipe_backend_stream *sipe_backend_media_get_stream_by_id(struct sipe_backend_media *media, - const gchar *id); -void sipe_backend_media_add_remote_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +void sipe_backend_media_add_remote_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream, GList *candidates); -gboolean sipe_backend_media_is_initiator(struct sipe_backend_media *media, - struct sipe_backend_stream *stream); +gboolean sipe_backend_media_is_initiator(struct sipe_media_call *media, + struct sipe_media_stream *stream); gboolean sipe_backend_media_accepted(struct sipe_backend_media *media); -gboolean sipe_backend_stream_initialized(struct sipe_backend_media *media, - struct sipe_backend_stream *stream); -GList *sipe_backend_media_get_active_local_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream); -GList *sipe_backend_media_get_active_remote_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream); +gboolean sipe_backend_stream_initialized(struct sipe_media_call *media, + struct sipe_media_stream *stream); +GList *sipe_backend_media_get_active_local_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream); +GList *sipe_backend_media_get_active_remote_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream); /* Stream handling */ -const gchar *sipe_backend_stream_get_id(struct sipe_backend_stream *stream); -void sipe_backend_stream_hold(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +void sipe_backend_stream_hold(struct sipe_media_call *media, + struct sipe_media_stream *stream, gboolean local); -void sipe_backend_stream_unhold(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +void sipe_backend_stream_unhold(struct sipe_media_call *media, + struct sipe_media_stream *stream, gboolean local); -gboolean sipe_backend_stream_is_held(struct sipe_backend_stream *stream); +gboolean sipe_backend_stream_is_held(struct sipe_media_stream *stream); +void sipe_backend_media_stream_end(struct sipe_media_call *media, + struct sipe_media_stream *stream); +void sipe_backend_media_stream_free(struct sipe_backend_media_stream *stream); /* Codec handling */ struct sipe_backend_codec *sipe_backend_codec_new(int id, @@ -433,11 +438,11 @@ void sipe_backend_codec_add_optional_parameter(struct sipe_backend_codec *codec, const gchar *name, const gchar *value); GList *sipe_backend_codec_get_optional_parameters(struct sipe_backend_codec *codec); -gboolean sipe_backend_set_remote_codecs(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +gboolean sipe_backend_set_remote_codecs(struct sipe_media_call *media, + struct sipe_media_stream *stream, GList *codecs); -GList* sipe_backend_get_local_codecs(struct sipe_backend_media *media, - struct sipe_backend_stream *stream); +GList* sipe_backend_get_local_codecs(struct sipe_media_call *media, + struct sipe_media_stream *stream); /* Candidate handling */ struct sipe_backend_candidate * sipe_backend_candidate_new(const gchar *foundation, @@ -475,8 +480,8 @@ void sipe_backend_candidate_set_priority(struct sipe_backend_candidate *candidat SipeComponentType sipe_backend_candidate_get_component_type(struct sipe_backend_candidate *candidate); SipeCandidateType sipe_backend_candidate_get_type(struct sipe_backend_candidate *candidate); SipeNetworkProtocol sipe_backend_candidate_get_protocol(struct sipe_backend_candidate *candidate); -GList* sipe_backend_get_local_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream); +GList* sipe_backend_get_local_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream); void sipe_backend_media_accept(struct sipe_backend_media *media, gboolean local); void sipe_backend_media_hangup(struct sipe_backend_media *media, gboolean local); void sipe_backend_media_reject(struct sipe_backend_media *media, gboolean local); diff --git a/src/api/sipe-core.h b/src/api/sipe-core.h index e7c7e03b..6bafec7a 100644 --- a/src/api/sipe-core.h +++ b/src/api/sipe-core.h @@ -395,9 +395,14 @@ void sipe_core_buddy_make_call(struct sipe_core_public *sipe_public, const gchar *phone); /* media */ +struct sipe_media_call *call; + void sipe_core_media_initiate_call(struct sipe_core_public *sipe_public, const char *participant, gboolean with_video); +struct sipe_media_stream * +sipe_core_media_get_stream_by_id(struct sipe_media_call *call, const gchar *id); + /** * Connects to a conference call specified by given chat session * diff --git a/src/core/sipe-media.c b/src/core/sipe-media.c index 1c711dd7..0fdb949b 100644 --- a/src/core/sipe-media.c +++ b/src/core/sipe-media.c @@ -55,6 +55,8 @@ struct sipe_media_call_private { /* private part starts here */ struct sipe_core_private *sipe_private; + GSList *streams; + struct sipmsg *invitation; SipeIceVersion ice_version; gboolean encryption_compatible; @@ -65,6 +67,12 @@ struct sipe_media_call_private { #define SIPE_MEDIA_CALL ((struct sipe_media_call *) call_private) #define SIPE_MEDIA_CALL_PRIVATE ((struct sipe_media_call_private *) call) +struct sipe_media_stream_private { + struct sipe_media_stream public; +}; +#define SIPE_MEDIA_STREAM ((struct sipe_media_stream *) stream_private) +#define SIPE_MEDIA_STREAM_PRIVATE ((struct sipe_media_stream_private *) stream) + static void sipe_media_codec_list_free(GList *codecs) { for (; codecs; codecs = g_list_delete_link(codecs, codecs)) @@ -78,10 +86,28 @@ static void sipe_media_candidate_list_free(GList *candidates) } static void +remove_stream(struct sipe_media_call* call, + struct sipe_media_stream_private *stream_private) +{ + struct sipe_media_call_private *call_private = SIPE_MEDIA_CALL_PRIVATE; + call_private->streams = + g_slist_remove(call_private->streams, stream_private); + sipe_backend_media_stream_free(SIPE_MEDIA_STREAM->backend_private); + g_free(SIPE_MEDIA_STREAM->id); + g_free(stream_private); +} + +static void sipe_media_call_free(struct sipe_media_call_private *call_private) { if (call_private) { struct sip_session *session; + + while (call_private->streams) { + remove_stream(SIPE_MEDIA_CALL, + call_private->streams->data); + } + sipe_backend_media_free(call_private->public.backend_private); session = sipe_session_find_call(call_private->sipe_private, @@ -300,28 +326,28 @@ fill_zero_tcp_act_ports_from_tcp_pass(GSList *candidates) } static struct sdpmedia * -backend_stream_to_sdpmedia(struct sipe_backend_media *backend_media, - struct sipe_backend_stream *backend_stream) +media_stream_to_sdpmedia(struct sipe_media_call_private *call_private, + struct sipe_media_stream_private *stream_private) { - struct sdpmedia *media = g_new0(struct sdpmedia, 1); - GList *codecs = sipe_backend_get_local_codecs(backend_media, - backend_stream); + struct sdpmedia *sdpmedia = g_new0(struct sdpmedia, 1); + GList *codecs = sipe_backend_get_local_codecs(SIPE_MEDIA_CALL, + SIPE_MEDIA_STREAM); guint rtcp_port = 0; SipeMediaType type; GSList *attributes = NULL; GList *candidates; GList *i; - media->name = g_strdup(sipe_backend_stream_get_id(backend_stream)); + sdpmedia->name = g_strdup(SIPE_MEDIA_STREAM->id); - if (sipe_strequal(media->name, "audio")) + if (sipe_strequal(sdpmedia->name, "audio")) type = SIPE_MEDIA_AUDIO; - else if (sipe_strequal(media->name, "video")) + else if (sipe_strequal(sdpmedia->name, "video")) type = SIPE_MEDIA_VIDEO; else { // TODO: incompatible media, should not happen here - g_free(media->name); - g_free(media); + g_free(sdpmedia->name); + g_free(sdpmedia); sipe_media_codec_list_free(codecs); return(NULL); } @@ -352,8 +378,8 @@ backend_stream_to_sdpmedia(struct sipe_backend_media *backend_media, * type) that must not appear in SDP messages we send. Thus, * let's ignore any codec having the same id as one we already * have in the converted list. */ - media->codecs = sipe_utils_slist_insert_unique_sorted( - media->codecs, c, sdpcodec_compare, + sdpmedia->codecs = sipe_utils_slist_insert_unique_sorted( + sdpmedia->codecs, c, sdpcodec_compare, (GDestroyNotify)sdpcodec_free); } @@ -362,28 +388,28 @@ backend_stream_to_sdpmedia(struct sipe_backend_media *backend_media, // Process local candidates // If we have established candidate pairs, send them in SDP response. // Otherwise send all available local candidates. - candidates = sipe_backend_media_get_active_local_candidates(backend_media, - backend_stream); + candidates = sipe_backend_media_get_active_local_candidates(SIPE_MEDIA_CALL, + SIPE_MEDIA_STREAM); if (!candidates) { - candidates = sipe_backend_get_local_candidates(backend_media, - backend_stream); + candidates = sipe_backend_get_local_candidates(SIPE_MEDIA_CALL, + SIPE_MEDIA_STREAM); candidates = remove_wrong_farstream_0_1_tcp_candidates(candidates); } - media->candidates = backend_candidates_to_sdpcandidate(candidates); - fill_zero_tcp_act_ports_from_tcp_pass(media->candidates); + sdpmedia->candidates = backend_candidates_to_sdpcandidate(candidates); + fill_zero_tcp_act_ports_from_tcp_pass(sdpmedia->candidates); sipe_media_candidate_list_free(candidates); - get_stream_ip_and_ports(media->candidates, &media->ip, &media->port, + get_stream_ip_and_ports(sdpmedia->candidates, &sdpmedia->ip, &sdpmedia->port, &rtcp_port, SIPE_CANDIDATE_TYPE_HOST); // No usable HOST candidates, use any candidate - if (media->ip == NULL && media->candidates) { - get_stream_ip_and_ports(media->candidates, &media->ip, &media->port, + if (sdpmedia->ip == NULL && sdpmedia->candidates) { + get_stream_ip_and_ports(sdpmedia->candidates, &sdpmedia->ip, &sdpmedia->port, &rtcp_port, SIPE_CANDIDATE_TYPE_ANY); } - if (sipe_backend_stream_is_held(backend_stream)) + if (sipe_backend_stream_is_held(SIPE_MEDIA_STREAM)) attributes = sipe_utils_nameval_add(attributes, "inactive", ""); if (rtcp_port) { @@ -394,26 +420,26 @@ backend_stream_to_sdpmedia(struct sipe_backend_media *backend_media, attributes = sipe_utils_nameval_add(attributes, "encryption", "rejected"); - media->attributes = attributes; + sdpmedia->attributes = attributes; // Process remote candidates - candidates = sipe_backend_media_get_active_remote_candidates(backend_media, - backend_stream); - media->remote_candidates = backend_candidates_to_sdpcandidate(candidates); + candidates = sipe_backend_media_get_active_remote_candidates(SIPE_MEDIA_CALL, + SIPE_MEDIA_STREAM); + sdpmedia->remote_candidates = backend_candidates_to_sdpcandidate(candidates); sipe_media_candidate_list_free(candidates); - return media; + return sdpmedia; } static struct sdpmsg * sipe_media_to_sdpmsg(struct sipe_media_call_private *call_private) { - struct sipe_backend_media *backend_media = call_private->public.backend_private; struct sdpmsg *msg = g_new0(struct sdpmsg, 1); - GSList *streams = sipe_backend_media_get_streams(backend_media); + GSList *streams = call_private->streams; for (; streams; streams = streams->next) { - struct sdpmedia *media = backend_stream_to_sdpmedia(backend_media, streams->data); + struct sdpmedia *media = media_stream_to_sdpmedia(call_private, + streams->data); if (media) { msg->media = g_slist_append(msg->media, media); @@ -570,26 +596,37 @@ process_invite_call_response(struct sipe_core_private *sipe_private, struct sipmsg *msg, struct transaction *trans); +struct sipe_media_stream * +sipe_core_media_get_stream_by_id(struct sipe_media_call *call, const gchar *id) +{ + GSList *i; + for (i = SIPE_MEDIA_CALL_PRIVATE->streams; i; i = i->next) { + struct sipe_media_stream *stream = i->data; + if (sipe_strequal(stream->id, id)) + return stream; + } + return NULL; +} + static gboolean update_call_from_remote_sdp(struct sipe_media_call_private* call_private, struct sdpmedia *media) { - struct sipe_backend_media *backend_media = SIPE_MEDIA_CALL->backend_private; - struct sipe_backend_stream *backend_stream; + struct sipe_media_stream *stream; GList *backend_candidates = NULL; GList *backend_codecs = NULL; GSList *i; gboolean result = TRUE; - backend_stream = sipe_backend_media_get_stream_by_id(backend_media, - media->name); + stream = sipe_core_media_get_stream_by_id(SIPE_MEDIA_CALL, media->name); if (media->port == 0) { - if (backend_stream) - sipe_backend_media_remove_stream(backend_media, backend_stream); + if (stream) { + sipe_backend_media_stream_end(SIPE_MEDIA_CALL, stream); + } return TRUE; } - if (!backend_stream) + if (!stream) return FALSE; for (i = media->codecs; i; i = i->next) { @@ -613,13 +650,12 @@ update_call_from_remote_sdp(struct sipe_media_call_private* call_private, backend_codecs = g_list_append(backend_codecs, codec); } - result = sipe_backend_set_remote_codecs(backend_media, - backend_stream, + result = sipe_backend_set_remote_codecs(SIPE_MEDIA_CALL, stream, backend_codecs); sipe_media_codec_list_free(backend_codecs); if (result == FALSE) { - sipe_backend_media_remove_stream(backend_media, backend_stream); + sipe_backend_media_stream_end(SIPE_MEDIA_CALL, stream); return FALSE; } @@ -639,15 +675,14 @@ update_call_from_remote_sdp(struct sipe_media_call_private* call_private, backend_candidates = g_list_append(backend_candidates, candidate); } - sipe_backend_media_add_remote_candidates(backend_media, - backend_stream, + sipe_backend_media_add_remote_candidates(SIPE_MEDIA_CALL, stream, backend_candidates); sipe_media_candidate_list_free(backend_candidates); if (sipe_utils_nameval_find(media->attributes, "inactive")) { - sipe_backend_stream_hold(backend_media, backend_stream, FALSE); - } else if (sipe_backend_stream_is_held(backend_stream)) { - sipe_backend_stream_unhold(backend_media, backend_stream, FALSE); + sipe_backend_stream_hold(SIPE_MEDIA_CALL, stream, FALSE); + } else if (sipe_backend_stream_is_held(stream)) { + sipe_backend_stream_unhold(SIPE_MEDIA_CALL, stream, FALSE); } return TRUE; @@ -683,12 +718,9 @@ apply_remote_message(struct sipe_media_call_private* call_private, static gboolean call_initialized(struct sipe_media_call *call) { - GSList *streams = - sipe_backend_media_get_streams(call->backend_private); - + GSList *streams = SIPE_MEDIA_CALL_PRIVATE->streams; for (; streams; streams = streams->next) { - if (!sipe_backend_stream_initialized(call->backend_private, - streams->data)) { + if (!sipe_backend_stream_initialized(call, streams->data)) { return FALSE; } } @@ -732,13 +764,12 @@ send_invite_response_if_ready(struct sipe_media_call_private *call_private) static void stream_initialized_cb(struct sipe_media_call *call, - struct sipe_backend_stream *stream) + struct sipe_media_stream *stream) { if (call_initialized(call)) { struct sipe_media_call_private *call_private = SIPE_MEDIA_CALL_PRIVATE; - struct sipe_backend_media *backend_private = call->backend_private; - if (sipe_backend_media_is_initiator(backend_private, stream)) { + if (sipe_backend_media_is_initiator(call, stream)) { sipe_invite_call(call_private->sipe_private, process_invite_call_response); } else if (call_private->smsg) { @@ -762,6 +793,12 @@ static void phone_state_publish(struct sipe_core_private *sipe_private) } static void +stream_end_cb(struct sipe_media_call* call, struct sipe_media_stream* stream) +{ + remove_stream(call, SIPE_MEDIA_STREAM_PRIVATE); +} + +static void media_end_cb(struct sipe_media_call *call) { g_return_if_fail(call); @@ -823,7 +860,7 @@ error_cb(struct sipe_media_call *call, gchar *message) { struct sipe_media_call_private *call_private = SIPE_MEDIA_CALL_PRIVATE; struct sipe_core_private *sipe_private = call_private->sipe_private; - gboolean initiator = sipe_backend_media_is_initiator(call->backend_private, NULL); + gboolean initiator = sipe_backend_media_is_initiator(call, NULL); gboolean accepted = sipe_backend_media_accepted(call->backend_private); gchar *title = g_strdup_printf("Call with %s failed", call->with); @@ -861,6 +898,7 @@ sipe_media_call_new(struct sipe_core_private *sipe_private, call_private->encryption_compatible = TRUE; call_private->public.stream_initialized_cb = stream_initialized_cb; + call_private->public.stream_end_cb = stream_end_cb; call_private->public.media_end_cb = media_end_cb; call_private->public.call_accept_cb = call_accept_cb; call_private->public.call_reject_cb = call_reject_cb; @@ -881,28 +919,40 @@ void sipe_media_hangup(struct sipe_media_call_private *call_private) } } -static struct sipe_backend_stream * +static gboolean sipe_media_stream_add(struct sipe_core_private *sipe_private, const gchar *id, const gchar *with, SipeMediaType type, SipeIceVersion ice_version, gboolean initiator) { - struct sipe_backend_stream *stream; + struct sipe_media_call_private *call_private = sipe_private->media_call; + struct sipe_media_stream_private *stream_private; + struct sipe_backend_media_stream *backend_stream; struct sipe_backend_media_relays *backend_media_relays; - struct sipe_backend_media *backend_media; backend_media_relays = sipe_backend_media_relays_convert( sipe_private->media_relays, sipe_private->media_relay_username, sipe_private->media_relay_password); - backend_media = sipe_private->media_call->public.backend_private; - stream = sipe_backend_media_add_stream(backend_media, id, with, type, - ice_version, initiator, - backend_media_relays); + backend_stream = sipe_backend_media_add_stream(SIPE_MEDIA_CALL, + id, with, type, ice_version, + initiator, backend_media_relays); sipe_backend_media_relays_free(backend_media_relays); - return stream; + if (!backend_stream) { + return FALSE; + } + + stream_private = g_new0(struct sipe_media_stream_private, 1); + SIPE_MEDIA_STREAM->id = g_strdup(id); + SIPE_MEDIA_STREAM->backend_private = backend_stream; + + sipe_private->media_call->streams = + g_slist_append(sipe_private->media_call->streams, + stream_private); + + return TRUE; } static void @@ -1083,7 +1133,6 @@ process_incoming_invite_call(struct sipe_core_private *sipe_private, struct sipmsg *msg) { struct sipe_media_call_private *call_private = sipe_private->media_call; - struct sipe_backend_media *backend_media; struct sdpmsg *smsg; gboolean has_new_media = FALSE; GSList *i; @@ -1126,8 +1175,6 @@ process_incoming_invite_call(struct sipe_core_private *sipe_private, g_free(with); } - backend_media = call_private->public.backend_private; - if (call_private->invitation) sipmsg_free(call_private->invitation); call_private->invitation = sipmsg_copy(msg); @@ -1139,7 +1186,7 @@ process_incoming_invite_call(struct sipe_core_private *sipe_private, SipeMediaType type; if ( media->port != 0 - && !sipe_backend_media_get_stream_by_id(backend_media, id)) { + && !sipe_core_media_get_stream_by_id(SIPE_MEDIA_CALL, id)) { gchar *with; if (sipe_strequal(id, "audio")) @@ -1236,18 +1283,16 @@ reinvite_on_candidate_pair_cb(struct sipe_core_public *sipe_public) { struct sipe_core_private *sipe_private = SIPE_CORE_PRIVATE; struct sipe_media_call_private *media_call = sipe_private->media_call; - struct sipe_backend_media *backend_media; GSList *streams; if (!media_call) return; - backend_media = media_call->public.backend_private; - streams = sipe_backend_media_get_streams(backend_media); + streams = media_call->streams; for (; streams; streams = streams->next) { - struct sipe_backend_stream *s = streams->data; - GList *remote_candidates = sipe_backend_media_get_active_remote_candidates(backend_media, s); + struct sipe_media_stream *s = streams->data; + GList *remote_candidates = sipe_backend_media_get_active_remote_candidates(&media_call->public, s); guint components = g_list_length(remote_candidates); sipe_media_candidate_list_free(remote_candidates); @@ -1277,8 +1322,7 @@ maybe_retry_call_with_ice_version(struct sipe_core_private *sipe_private, if (call_private->ice_version != ice_version && sip_transaction_cseq(trans) == 1) { gchar *with = g_strdup(SIPE_MEDIA_CALL->with); - struct sipe_backend_media *backend_private = call_private->public.backend_private; - gboolean with_video = sipe_backend_media_get_stream_by_id(backend_private, "video") != NULL; + gboolean with_video = sipe_core_media_get_stream_by_id(SIPE_MEDIA_CALL, "video") != NULL; sipe_media_hangup(call_private); SIPE_DEBUG_INFO("Retrying call with ICEv%d.", @@ -1444,8 +1488,8 @@ void sipe_media_handle_going_offline(struct sipe_media_call_private *call_privat backend_private = call_private->public.backend_private; - if ( !sipe_backend_media_is_initiator(backend_private, NULL) - && !sipe_backend_media_accepted(backend_private)) { + if (!sipe_backend_media_is_initiator(SIPE_MEDIA_CALL, NULL) && + !sipe_backend_media_accepted(backend_private)) { sip_transport_response(call_private->sipe_private, call_private->invitation, 480, "Temporarily Unavailable", NULL); diff --git a/src/miranda/miranda-media.c b/src/miranda/miranda-media.c index 6345c94f..92db3579 100644 --- a/src/miranda/miranda-media.c +++ b/src/miranda/miranda-media.c @@ -38,10 +38,6 @@ struct sipe_backend_media { int dummy; }; -struct sipe_backend_stream { - int dummy; -}; - struct sipe_backend_media * sipe_backend_media_new(struct sipe_core_public *sipe_public, struct sipe_media_call *call, @@ -78,8 +74,8 @@ sipe_backend_media_relays_free(struct sipe_backend_media_relays *media_relays) _NIF(); } -struct sipe_backend_stream * -sipe_backend_media_add_stream(struct sipe_backend_media *media, +struct sipe_backend_media_stream * +sipe_backend_media_add_stream(struct sipe_media_call *media, const gchar *id, const gchar *participant, SipeMediaType type, @@ -92,36 +88,15 @@ sipe_backend_media_add_stream(struct sipe_backend_media *media, } void -sipe_backend_media_remove_stream(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) -{ - _NIF(); -} - -GSList *sipe_backend_media_get_streams(struct sipe_backend_media *media) -{ - _NIF(); - return NULL; -} - -struct sipe_backend_stream * -sipe_backend_media_get_stream_by_id(struct sipe_backend_media *media, - const gchar *id) -{ - _NIF(); - return NULL; -} - -void -sipe_backend_media_add_remote_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +sipe_backend_media_add_remote_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream, GList *candidates) { _NIF(); } -gboolean sipe_backend_media_is_initiator(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +gboolean sipe_backend_media_is_initiator(struct sipe_media_call *media, + struct sipe_media_stream *stream) { _NIF(); return FALSE; @@ -134,54 +109,63 @@ gboolean sipe_backend_media_accepted(struct sipe_backend_media *media) } gboolean -sipe_backend_stream_initialized(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_stream_initialized(struct sipe_media_call *media, + struct sipe_media_stream *stream) { _NIF(); return FALSE; } GList * -sipe_backend_media_get_active_local_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_media_get_active_local_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream) { _NIF(); return NULL; } GList * -sipe_backend_media_get_active_remote_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_media_get_active_remote_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream) { _NIF(); return NULL; } -const gchar * -sipe_backend_stream_get_id(struct sipe_backend_stream *stream) +void +sipe_backend_stream_hold(struct sipe_media_call *media, + struct sipe_media_stream *stream, + gboolean local) { _NIF(); - return NULL; } -void sipe_backend_stream_hold(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, - gboolean local) +void +sipe_backend_stream_unhold(struct sipe_media_call *media, + struct sipe_media_stream *stream, + gboolean local) { _NIF(); } -void sipe_backend_stream_unhold(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, - gboolean local) +gboolean +sipe_backend_stream_is_held(struct sipe_media_stream *stream) { _NIF(); + return FALSE; } -gboolean sipe_backend_stream_is_held(struct sipe_backend_stream *stream) +void +sipe_backend_media_stream_end(struct sipe_media_call *media, + struct sipe_media_stream *stream) +{ + _NIF(); +} + +void +sipe_backend_media_stream_free(struct sipe_backend_media_stream *stream) { _NIF(); - return FALSE; } struct sipe_backend_codec * @@ -233,8 +217,8 @@ sipe_backend_codec_get_optional_parameters(struct sipe_backend_codec *codec) } gboolean -sipe_backend_set_remote_codecs(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +sipe_backend_set_remote_codecs(struct sipe_media_call *media, + struct sipe_media_stream *stream, GList *codecs) { _NIF(); @@ -242,8 +226,8 @@ sipe_backend_set_remote_codecs(struct sipe_backend_media *media, } GList* -sipe_backend_get_local_codecs(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_get_local_codecs(struct sipe_media_call *media, + struct sipe_media_stream *stream) { _NIF(); return NULL; @@ -351,8 +335,8 @@ sipe_backend_candidate_get_protocol(struct sipe_backend_candidate *candidate) } GList * -sipe_backend_get_local_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_get_local_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream) { _NIF(); return FALSE; diff --git a/src/purple/purple-media.c b/src/purple/purple-media.c index 50a6299c..a8078f5c 100644 --- a/src/purple/purple-media.c +++ b/src/purple/purple-media.c @@ -64,16 +64,13 @@ struct sipe_backend_media { PurpleMedia *m; - GSList *streams; /** * Number of media streams that were not yet locally accepted or rejected. */ guint unconfirmed_streams; }; -struct sipe_backend_stream { - gchar *sessionid; - gchar *participant; +struct sipe_backend_media_stream { gboolean local_on_hold; gboolean remote_on_hold; gboolean accepted; @@ -86,14 +83,10 @@ struct sipe_backend_stream { #define SIPE_RELAYS_G_TYPE G_TYPE_VALUE_ARRAY #endif -static void -backend_stream_free(struct sipe_backend_stream *stream) +void +sipe_backend_media_stream_free(struct sipe_backend_media_stream *stream) { - if (stream) { - g_free(stream->sessionid); - g_free(stream->participant); - g_free(stream); - } + g_free(stream); } static PurpleMediaSessionType sipe_media_to_purple(SipeMediaType type); @@ -106,13 +99,13 @@ static void maybe_signal_stream_initialized(struct sipe_media_call *call, gchar *sessionid) { if (call->stream_initialized_cb) { - struct sipe_backend_stream *stream; - stream = sipe_backend_media_get_stream_by_id(call->backend_private, sessionid); + struct sipe_media_stream *stream; + stream = sipe_core_media_get_stream_by_id(call, sessionid); - if (sipe_backend_stream_initialized(call->backend_private, stream) && - !stream->initialized_cb_was_fired) { + if (sipe_backend_stream_initialized(call, stream) && + !stream->backend_private->initialized_cb_was_fired) { call->stream_initialized_cb(call, stream); - stream->initialized_cb_was_fired = TRUE; + stream->backend_private->initialized_cb_was_fired = TRUE; } } } @@ -142,9 +135,17 @@ on_state_changed_cb(SIPE_UNUSED_PARAMETER PurpleMedia *media, struct sipe_media_call *call) { SIPE_DEBUG_INFO("sipe_media_state_changed_cb: %d %s %s\n", state, sessionid, participant); - if (state == PURPLE_MEDIA_STATE_END && - !sessionid && !participant && call->media_end_cb) - call->media_end_cb(call); + if (state == PURPLE_MEDIA_STATE_END) { + if (sessionid && participant) { + struct sipe_media_stream *stream = + sipe_core_media_get_stream_by_id(call, sessionid); + if (stream) { + call->stream_end_cb(call, stream); + } + } else if (!sessionid && !participant && call->media_end_cb) { + call->media_end_cb(call); + } + } } void @@ -165,7 +166,7 @@ on_error_cb(SIPE_UNUSED_PARAMETER PurpleMedia *media, gchar *message, } static void -on_stream_info_cb(SIPE_UNUSED_PARAMETER PurpleMedia *media, +on_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, gchar *sessionid, gchar *participant, @@ -176,13 +177,12 @@ on_stream_info_cb(SIPE_UNUSED_PARAMETER PurpleMedia *media, if (call->call_accept_cb && !sessionid && !participant) call->call_accept_cb(call, local); else if (sessionid && participant) { - struct sipe_backend_stream *stream; - stream = sipe_backend_media_get_stream_by_id(call->backend_private, - sessionid); + struct sipe_media_stream *stream; + stream = sipe_core_media_get_stream_by_id(call, sessionid); if (stream) { - if (!stream->accepted && local) + if (!stream->backend_private->accepted && local) --call->backend_private->unconfirmed_streams; - stream->accepted = TRUE; + stream->backend_private->accepted = TRUE; } } } else if (type == PURPLE_MEDIA_INFO_HOLD || type == PURPLE_MEDIA_INFO_UNHOLD) { @@ -191,25 +191,28 @@ on_stream_info_cb(SIPE_UNUSED_PARAMETER PurpleMedia *media, if (sessionid) { // Hold specific stream - struct sipe_backend_stream *stream; - stream = sipe_backend_media_get_stream_by_id(call->backend_private, - sessionid); + struct sipe_media_stream *stream; + stream = sipe_core_media_get_stream_by_id(call, sessionid); if (local) - stream->local_on_hold = state; + stream->backend_private->local_on_hold = state; else - stream->remote_on_hold = state; + stream->backend_private->remote_on_hold = state; } else { // Hold all streams - GSList *i = sipe_backend_media_get_streams(call->backend_private); - for (; i; i = i->next) { - struct sipe_backend_stream *stream = i->data; + GList *session_ids = purple_media_get_session_ids(media); + + for (; session_ids; session_ids = session_ids->next) { + struct sipe_media_stream *stream = + sipe_core_media_get_stream_by_id(call, session_ids->data); if (local) - stream->local_on_hold = state; + stream->backend_private->local_on_hold = state; else - stream->remote_on_hold = state; + stream->backend_private->remote_on_hold = state; } + + g_list_free(session_ids); } if (call->call_hold_cb) @@ -221,13 +224,10 @@ on_stream_info_cb(SIPE_UNUSED_PARAMETER PurpleMedia *media, else if (type == PURPLE_MEDIA_INFO_REJECT && call->call_reject_cb && !local) call->call_reject_cb(call, local); } else if (sessionid && participant) { - struct sipe_backend_stream *stream; - stream = sipe_backend_media_get_stream_by_id(call->backend_private, - sessionid); + struct sipe_media_stream *stream; + stream = sipe_core_media_get_stream_by_id(call, sessionid); if (stream) { - call->backend_private->streams = g_slist_remove(call->backend_private->streams, stream); - backend_stream_free(stream); if (local && --call->backend_private->unconfirmed_streams == 0 && call->call_reject_cb) call->call_reject_cb(call, local); @@ -294,14 +294,7 @@ sipe_backend_media_new(struct sipe_core_public *sipe_public, void sipe_backend_media_free(struct sipe_backend_media *media) { - if (media) { - GSList *stream = media->streams; - - for (; stream; stream = g_slist_delete_link(stream, stream)) - backend_stream_free(stream->data); - - g_free(media); - } + g_free(media); } void @@ -430,8 +423,8 @@ sipe_backend_media_relays_free(struct sipe_backend_media_relays *media_relays) #endif } -struct sipe_backend_stream * -sipe_backend_media_add_stream(struct sipe_backend_media *media, +struct sipe_backend_media_stream * +sipe_backend_media_add_stream(struct sipe_media_call *call, const gchar *id, const gchar *participant, SipeMediaType type, @@ -439,7 +432,8 @@ sipe_backend_media_add_stream(struct sipe_backend_media *media, gboolean initiator, struct sipe_backend_media_relays *media_relays) { - struct sipe_backend_stream *stream = NULL; + struct sipe_backend_media *media = call->backend_private; + struct sipe_backend_media_stream *stream = NULL; PurpleMediaSessionType prpl_type = sipe_media_to_purple(type); // Preallocate enough space for all potential parameters to fit. GParameter *params = g_new0(GParameter, 5); @@ -476,12 +470,9 @@ sipe_backend_media_add_stream(struct sipe_backend_media *media, if (purple_media_add_stream(media->m, id, participant, prpl_type, initiator, transmitter, params_cnt, params)) { - stream = g_new0(struct sipe_backend_stream, 1); - stream->sessionid = g_strdup(id); - stream->participant = g_strdup(participant); + stream = g_new0(struct sipe_backend_media_stream, 1); stream->initialized_cb_was_fired = FALSE; - media->streams = g_slist_append(media->streams, stream); if (!initiator) ++media->unconfirmed_streams; } @@ -496,37 +487,15 @@ sipe_backend_media_add_stream(struct sipe_backend_media *media, } void -sipe_backend_media_remove_stream(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_media_stream_end(struct sipe_media_call *media, + struct sipe_media_stream *stream) { - g_return_if_fail(media && stream); - - purple_media_end(media->m, stream->sessionid, NULL); - media->streams = g_slist_remove(media->streams, stream); - backend_stream_free(stream); -} - -GSList *sipe_backend_media_get_streams(struct sipe_backend_media *media) -{ - return media->streams; -} - -struct sipe_backend_stream * -sipe_backend_media_get_stream_by_id(struct sipe_backend_media *media, - const gchar *id) -{ - GSList *i; - for (i = media->streams; i; i = i->next) { - struct sipe_backend_stream *stream = i->data; - if (sipe_strequal(stream->sessionid, id)) - return stream; - } - return NULL; + purple_media_end(media->backend_private->m, stream->id, NULL); } void -sipe_backend_media_add_remote_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +sipe_backend_media_add_remote_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream, GList *candidates) { GList *udp_candidates = NULL; @@ -546,19 +515,18 @@ sipe_backend_media_add_remote_candidates(struct sipe_backend_media *media, candidates = udp_candidates; #endif - - purple_media_add_remote_candidates(media->m, stream->sessionid, - stream->participant, candidates); + purple_media_add_remote_candidates(media->backend_private->m, + stream->id, media->with, candidates); g_list_free(udp_candidates); } -gboolean sipe_backend_media_is_initiator(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +gboolean sipe_backend_media_is_initiator(struct sipe_media_call *media, + struct sipe_media_stream *stream) { - return purple_media_is_initiator(media->m, - stream ? stream->sessionid : NULL, - stream ? stream->participant : NULL); + return purple_media_is_initiator(media->backend_private->m, + stream ? stream->id : NULL, + stream ? media->with : NULL); } gboolean sipe_backend_media_accepted(struct sipe_backend_media *media) @@ -567,17 +535,17 @@ gboolean sipe_backend_media_accepted(struct sipe_backend_media *media) } gboolean -sipe_backend_stream_initialized(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_stream_initialized(struct sipe_media_call *media, + struct sipe_media_stream *stream) { g_return_val_if_fail(media, FALSE); g_return_val_if_fail(stream, FALSE); - if (purple_media_candidates_prepared(media->m, - stream->sessionid, - stream->participant)) { + if (purple_media_candidates_prepared(media->backend_private->m, + stream->id, media->with)) { GList *codecs; - codecs = purple_media_get_codecs(media->m, stream->sessionid); + codecs = purple_media_get_codecs(media->backend_private->m, + stream->id); if (codecs) { purple_media_codec_list_free(codecs); return TRUE; @@ -625,52 +593,45 @@ duplicate_tcp_candidates(GList *candidates) } GList * -sipe_backend_media_get_active_local_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_media_get_active_local_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream) { GList *candidates = purple_media_get_active_local_candidates( - media->m, stream->sessionid, stream->participant); + media->backend_private->m, stream->id, media->with); return duplicate_tcp_candidates(candidates); } GList * -sipe_backend_media_get_active_remote_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_media_get_active_remote_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream) { GList *candidates = purple_media_get_active_remote_candidates( - media->m, stream->sessionid, stream->participant); + media->backend_private->m, stream->id, media->with); return duplicate_tcp_candidates(candidates); } -const gchar * -sipe_backend_stream_get_id(struct sipe_backend_stream *stream) -{ - return stream->sessionid; -} - -void sipe_backend_stream_hold(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +void sipe_backend_stream_hold(struct sipe_media_call *media, + struct sipe_media_stream *stream, gboolean local) { - purple_media_stream_info(media->m, PURPLE_MEDIA_INFO_HOLD, - stream->sessionid, stream->participant, - local); + purple_media_stream_info(media->backend_private->m, PURPLE_MEDIA_INFO_HOLD, + stream->id, media->with, local); } -void sipe_backend_stream_unhold(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +void sipe_backend_stream_unhold(struct sipe_media_call *media, + struct sipe_media_stream *stream, gboolean local) { - purple_media_stream_info(media->m, PURPLE_MEDIA_INFO_UNHOLD, - stream->sessionid, stream->participant, - local); + purple_media_stream_info(media->backend_private->m, PURPLE_MEDIA_INFO_UNHOLD, + stream->id, media->with, local); } -gboolean sipe_backend_stream_is_held(struct sipe_backend_stream *stream) +gboolean sipe_backend_stream_is_held(struct sipe_media_stream *stream) { g_return_val_if_fail(stream, FALSE); - return stream->local_on_hold || stream->remote_on_hold; + return stream->backend_private->local_on_hold || + stream->backend_private->remote_on_hold; } struct sipe_backend_codec * @@ -721,25 +682,22 @@ sipe_backend_codec_get_optional_parameters(struct sipe_backend_codec *codec) } gboolean -sipe_backend_set_remote_codecs(struct sipe_backend_media *media, - struct sipe_backend_stream *stream, +sipe_backend_set_remote_codecs(struct sipe_media_call *media, + struct sipe_media_stream *stream, GList *codecs) { - return purple_media_set_remote_codecs(media->m, - stream->sessionid, - stream->participant, - codecs); + return purple_media_set_remote_codecs(media->backend_private->m, + stream->id, media->with, codecs); } GList* -sipe_backend_get_local_codecs(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_get_local_codecs(struct sipe_media_call *media, + struct sipe_media_stream *stream) { - GList *codecs = purple_media_get_codecs(media->m, - stream->sessionid); + GList *codecs = purple_media_get_codecs(media->backend_private->m, + stream->id); GList *i = codecs; - gboolean is_conference = (g_strstr_len(stream->participant, - strlen(stream->participant), + gboolean is_conference = (g_strstr_len(media->with, strlen(media->with), "app:conf:audio-video:") != NULL); /* @@ -928,12 +886,13 @@ ensure_candidate_pairs(GList *candidates) } GList * -sipe_backend_get_local_candidates(struct sipe_backend_media *media, - struct sipe_backend_stream *stream) +sipe_backend_get_local_candidates(struct sipe_media_call *media, + struct sipe_media_stream *stream) { - GList *candidates = purple_media_get_local_candidates(media->m, - stream->sessionid, - stream->participant); + GList *candidates = + purple_media_get_local_candidates(media->backend_private->m, + stream->id, + media->with); candidates = duplicate_tcp_candidates(candidates); /* diff --git a/src/telepathy/telepathy-stubs.c b/src/telepathy/telepathy-stubs.c index 66c8f447..ee934ca6 100644 --- a/src/telepathy/telepathy-stubs.c +++ b/src/telepathy/telepathy-stubs.c @@ -177,38 +177,35 @@ struct sipe_backend_media_relays * sipe_backend_media_relays_convert(SIPE_UNUSED SIPE_UNUSED_PARAMETER gchar *username, SIPE_UNUSED_PARAMETER gchar *password) { return(NULL); } void sipe_backend_media_relays_free(SIPE_UNUSED_PARAMETER struct sipe_backend_media_relays *media_relays) {} -struct sipe_backend_stream *sipe_backend_media_add_stream(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER const gchar *id, - SIPE_UNUSED_PARAMETER const gchar *participant, - SIPE_UNUSED_PARAMETER SipeMediaType type, - SIPE_UNUSED_PARAMETER SipeIceVersion ice_version, - SIPE_UNUSED_PARAMETER gboolean initiator, - SIPE_UNUSED_PARAMETER struct sipe_backend_media_relays *media_relays) { return(NULL); } -void sipe_backend_media_remove_stream(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream) {} -GSList *sipe_backend_media_get_streams(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media) { return(NULL); } -struct sipe_backend_stream *sipe_backend_media_get_stream_by_id(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER const gchar *id) { return(NULL); } -void sipe_backend_media_add_remote_candidates(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream, +struct sipe_backend_media_stream *sipe_backend_media_add_stream(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER const gchar *id, + SIPE_UNUSED_PARAMETER const gchar *participant, + SIPE_UNUSED_PARAMETER SipeMediaType type, + SIPE_UNUSED_PARAMETER SipeIceVersion ice_version, + SIPE_UNUSED_PARAMETER gboolean initiator, + SIPE_UNUSED_PARAMETER struct sipe_backend_media_relays *media_relays) { return(NULL); } +void sipe_backend_media_add_remote_candidates(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream, SIPE_UNUSED_PARAMETER GList *candidates) {} -gboolean sipe_backend_media_is_initiator(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream) { return(FALSE); } +gboolean sipe_backend_media_is_initiator(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream) { return(FALSE); } gboolean sipe_backend_media_accepted(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media) { return(FALSE); } -gboolean sipe_backend_stream_initialized(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream) { return(FALSE); } -GList *sipe_backend_media_get_active_local_candidates(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream) { return(NULL); } -GList *sipe_backend_media_get_active_remote_candidates(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream) { return(NULL); } -const gchar *sipe_backend_stream_get_id(SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream) { return(""); } -void sipe_backend_stream_hold(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream, +gboolean sipe_backend_stream_initialized(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream) { return(FALSE); } +GList *sipe_backend_media_get_active_local_candidates(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream) { return(NULL); } +GList *sipe_backend_media_get_active_remote_candidates(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream) { return(NULL); } +void sipe_backend_stream_hold(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream, SIPE_UNUSED_PARAMETER gboolean local) {} -void sipe_backend_stream_unhold(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream, +void sipe_backend_stream_unhold(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream, SIPE_UNUSED_PARAMETER gboolean local) {} -gboolean sipe_backend_stream_is_held(SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream) { return(FALSE); } +gboolean sipe_backend_stream_is_held(SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream) { return(FALSE); } +void sipe_backend_media_stream_end(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream) {} +void sipe_backend_media_stream_free(SIPE_UNUSED_PARAMETER struct sipe_backend_media_stream *stream) {} struct sipe_backend_codec *sipe_backend_codec_new(SIPE_UNUSED_PARAMETER int id, SIPE_UNUSED_PARAMETER const char *name, SIPE_UNUSED_PARAMETER SipeMediaType type, @@ -221,11 +218,11 @@ void sipe_backend_codec_add_optional_parameter(SIPE_UNUSED_PARAMETER struct sipe SIPE_UNUSED_PARAMETER const gchar *name, SIPE_UNUSED_PARAMETER const gchar *value) {} GList *sipe_backend_codec_get_optional_parameters(SIPE_UNUSED_PARAMETER struct sipe_backend_codec *codec) { return(NULL); } -gboolean sipe_backend_set_remote_codecs(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream, +gboolean sipe_backend_set_remote_codecs(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream, SIPE_UNUSED_PARAMETER GList *codecs) { return(FALSE); } -GList* sipe_backend_get_local_codecs(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream) { return(NULL); } +GList* sipe_backend_get_local_codecs(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream) { return(NULL); } struct sipe_backend_candidate * sipe_backend_candidate_new(SIPE_UNUSED_PARAMETER const gchar *foundation, SIPE_UNUSED_PARAMETER SipeComponentType component, SIPE_UNUSED_PARAMETER SipeCandidateType type, @@ -248,8 +245,8 @@ void sipe_backend_candidate_set_priority(SIPE_UNUSED_PARAMETER struct sipe_backe SipeComponentType sipe_backend_candidate_get_component_type(SIPE_UNUSED_PARAMETER struct sipe_backend_candidate *candidate) { return(SIPE_COMPONENT_NONE); } SipeCandidateType sipe_backend_candidate_get_type(SIPE_UNUSED_PARAMETER struct sipe_backend_candidate *candidate) { return(SIPE_CANDIDATE_TYPE_ANY); } SipeNetworkProtocol sipe_backend_candidate_get_protocol(SIPE_UNUSED_PARAMETER struct sipe_backend_candidate *candidate) { return(SIPE_NETWORK_PROTOCOL_TCP_ACTIVE); } -GList* sipe_backend_get_local_candidates(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, - SIPE_UNUSED_PARAMETER struct sipe_backend_stream *stream) { return(NULL); } +GList* sipe_backend_get_local_candidates(SIPE_UNUSED_PARAMETER struct sipe_media_call *media, + SIPE_UNUSED_PARAMETER struct sipe_media_stream *stream) { return(NULL); } void sipe_backend_media_accept(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, SIPE_UNUSED_PARAMETER gboolean local) {} void sipe_backend_media_hangup(SIPE_UNUSED_PARAMETER struct sipe_backend_media *media, -- 2.11.4.GIT