mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-08 04:45:31 +00:00
sip: call: Add pipeline as a construct only property
In the future when we will be able to switch pipelines this might change.
This commit is contained in:
parent
7033c1cd75
commit
aeebdfbf53
3 changed files with 35 additions and 16 deletions
|
@ -51,6 +51,7 @@ enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_CALL_HANDLE,
|
PROP_CALL_HANDLE,
|
||||||
PROP_IP,
|
PROP_IP,
|
||||||
|
PROP_PIPELINE,
|
||||||
PROP_LAST_PROP
|
PROP_LAST_PROP
|
||||||
};
|
};
|
||||||
static GParamSpec *props[PROP_LAST_PROP];
|
static GParamSpec *props[PROP_LAST_PROP];
|
||||||
|
@ -85,14 +86,15 @@ try_setting_up_media_pipeline (CallsSipCall *self)
|
||||||
{
|
{
|
||||||
g_assert (CALLS_SIP_CALL (self));
|
g_assert (CALLS_SIP_CALL (self));
|
||||||
|
|
||||||
if (self->codecs == NULL)
|
if (!self->codecs)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (self->pipeline == NULL) {
|
if (calls_sip_media_pipeline_get_state (self->pipeline) ==
|
||||||
|
CALLS_MEDIA_PIPELINE_STATE_NEED_CODEC) {
|
||||||
MediaCodecInfo *codec = (MediaCodecInfo *) self->codecs->data;
|
MediaCodecInfo *codec = (MediaCodecInfo *) self->codecs->data;
|
||||||
|
|
||||||
g_debug ("Creating new pipeline using codec: %s", codec->name);
|
g_debug ("Setting codec '%s' for pipeline", codec->name);
|
||||||
self->pipeline = calls_sip_media_pipeline_new (codec);
|
calls_sip_media_pipeline_set_codec (self->pipeline, codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self->lport_rtp || !self->lport_rtcp || !self->remote ||
|
if (!self->lport_rtp || !self->lport_rtcp || !self->remote ||
|
||||||
|
@ -216,6 +218,10 @@ calls_sip_call_set_property (GObject *object,
|
||||||
self->ip = g_value_dup_string (value);
|
self->ip = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_PIPELINE:
|
||||||
|
self->pipeline = g_value_dup_object (value);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -248,10 +254,9 @@ calls_sip_call_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
CallsSipCall *self = CALLS_SIP_CALL (object);
|
CallsSipCall *self = CALLS_SIP_CALL (object);
|
||||||
|
|
||||||
if (self->pipeline) {
|
calls_sip_media_pipeline_stop (self->pipeline);
|
||||||
calls_sip_media_pipeline_stop (self->pipeline);
|
|
||||||
g_clear_object (&self->pipeline);
|
g_clear_object (&self->pipeline);
|
||||||
}
|
|
||||||
g_clear_pointer (&self->codecs, g_list_free);
|
g_clear_pointer (&self->codecs, g_list_free);
|
||||||
g_clear_pointer (&self->remote, g_free);
|
g_clear_pointer (&self->remote, g_free);
|
||||||
g_clear_pointer (&self->ip, g_free);
|
g_clear_pointer (&self->ip, g_free);
|
||||||
|
@ -285,6 +290,14 @@ calls_sip_call_class_init (CallsSipCallClass *klass)
|
||||||
"Own IP for media and SDP",
|
"Own IP for media and SDP",
|
||||||
NULL,
|
NULL,
|
||||||
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
|
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT);
|
||||||
|
|
||||||
|
props[PROP_PIPELINE] =
|
||||||
|
g_param_spec_object ("pipeline",
|
||||||
|
"Pipeline",
|
||||||
|
"Media pipeline for this call",
|
||||||
|
CALLS_TYPE_SIP_MEDIA_PIPELINE,
|
||||||
|
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,10 +383,11 @@ calls_sip_call_activate_media (CallsSipCall *self,
|
||||||
|
|
||||||
|
|
||||||
CallsSipCall *
|
CallsSipCall *
|
||||||
calls_sip_call_new (const gchar *id,
|
calls_sip_call_new (const gchar *id,
|
||||||
gboolean inbound,
|
gboolean inbound,
|
||||||
const char *own_ip,
|
const char *own_ip,
|
||||||
nua_handle_t *handle)
|
CallsSipMediaPipeline *pipeline,
|
||||||
|
nua_handle_t *handle)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (id, NULL);
|
g_return_val_if_fail (id, NULL);
|
||||||
|
|
||||||
|
@ -381,6 +395,7 @@ calls_sip_call_new (const gchar *id,
|
||||||
"id", id,
|
"id", id,
|
||||||
"inbound", inbound,
|
"inbound", inbound,
|
||||||
"own-ip", own_ip,
|
"own-ip", own_ip,
|
||||||
|
"pipeline", pipeline,
|
||||||
"nua-handle", handle,
|
"nua-handle", handle,
|
||||||
"call-type", CALLS_CALL_TYPE_SIP_VOICE,
|
"call-type", CALLS_CALL_TYPE_SIP_VOICE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "calls-call.h"
|
#include "calls-call.h"
|
||||||
|
#include "calls-sip-media-pipeline.h"
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <sofia-sip/nua.h>
|
#include <sofia-sip/nua.h>
|
||||||
|
@ -35,9 +36,10 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
G_DECLARE_FINAL_TYPE (CallsSipCall, calls_sip_call, CALLS, SIP_CALL, CallsCall)
|
G_DECLARE_FINAL_TYPE (CallsSipCall, calls_sip_call, CALLS, SIP_CALL, CallsCall)
|
||||||
|
|
||||||
CallsSipCall *calls_sip_call_new (const gchar *number,
|
CallsSipCall *calls_sip_call_new (const char *number,
|
||||||
gboolean inbound,
|
gboolean inbound,
|
||||||
const char *own_ip,
|
const char *own_ip,
|
||||||
|
CallsSipMediaPipeline *pipeline,
|
||||||
nua_handle_t *handle);
|
nua_handle_t *handle);
|
||||||
void calls_sip_call_setup_remote_media_connection (CallsSipCall *self,
|
void calls_sip_call_setup_remote_media_connection (CallsSipCall *self,
|
||||||
const char *remote,
|
const char *remote,
|
||||||
|
|
|
@ -235,12 +235,14 @@ add_call (CallsSipOrigin *self,
|
||||||
{
|
{
|
||||||
CallsSipCall *sip_call;
|
CallsSipCall *sip_call;
|
||||||
CallsCall *call;
|
CallsCall *call;
|
||||||
|
CallsSipMediaPipeline *pipeline;
|
||||||
g_autofree gchar *local_sdp = NULL;
|
g_autofree gchar *local_sdp = NULL;
|
||||||
g_auto (GStrv) address_split = NULL;
|
g_auto (GStrv) address_split = NULL;
|
||||||
const char *call_address = address;
|
const char *call_address = address;
|
||||||
|
|
||||||
/* TODO get free port by creating GSocket and passing that to the pipeline */
|
/* TODO get free port by creating GSocket and passing that to the pipeline */
|
||||||
guint local_port = get_port_for_rtp ();
|
guint local_port = get_port_for_rtp ();
|
||||||
|
pipeline = calls_sip_media_manager_get_pipeline (self->media_manager);
|
||||||
|
|
||||||
if (self->can_tel) {
|
if (self->can_tel) {
|
||||||
address_split = g_strsplit_set (address, ":@;", -1);
|
address_split = g_strsplit_set (address, ":@;", -1);
|
||||||
|
@ -250,7 +252,7 @@ add_call (CallsSipOrigin *self,
|
||||||
call_address = address_split[1];
|
call_address = address_split[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
sip_call = calls_sip_call_new (call_address, inbound, self->own_ip, handle);
|
sip_call = calls_sip_call_new (call_address, inbound, self->own_ip, pipeline, handle);
|
||||||
g_assert (sip_call != NULL);
|
g_assert (sip_call != NULL);
|
||||||
|
|
||||||
if (self->oper->call_handle)
|
if (self->oper->call_handle)
|
||||||
|
|
Loading…
Reference in a new issue