summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Mangani <lorenzo.mangani@gmail.com>2014-05-18 15:58:03 +0200
committerLorenzo Mangani <lorenzo.mangani@gmail.com>2014-05-18 15:58:03 +0200
commita047649785498f35e467b9d964b3f4b8a77b4b6f (patch)
tree3acaf4c5737431d539292f7d1a0c127d836d7d56
parent009257e5139c1bc03f82883f9f6bf5f628923bbb (diff)
parentdd2e332a65af6dce2e540f27fdb2b815f4358574 (diff)
Merge remote-tracking branch 'upstream/master'
-rw-r--r--include/baresip.h1
-rw-r--r--modules/menu/menu.c6
-rw-r--r--src/audio.c18
-rw-r--r--src/call.c2
-rw-r--r--src/core.h29
-rw-r--r--src/stream.c37
6 files changed, 51 insertions, 42 deletions
diff --git a/include/baresip.h b/include/baresip.h
index 6f0deae..8ccdee1 100644
--- a/include/baresip.h
+++ b/include/baresip.h
@@ -813,6 +813,7 @@ int vidfilt_dec_append(struct list *filtl, void **ctx,
struct audio;
void audio_mute(struct audio *a, bool muted);
+bool audio_ismuted(const struct audio *a);
void audio_set_devicename(struct audio *a, const char *src, const char *play);
void audio_encoder_cycle(struct audio *audio);
int audio_debug(struct re_printf *pf, const struct audio *a);
diff --git a/modules/menu/menu.c b/modules/menu/menu.c
index 583fb69..e0e6e22 100644
--- a/modules/menu/menu.c
+++ b/modules/menu/menu.c
@@ -340,12 +340,12 @@ static int call_reinvite(struct re_printf *pf, void *unused)
static int call_mute(struct re_printf *pf, void *unused)
{
- static bool muted = false;
+ struct audio *audio = call_audio(ua_call(uag_cur()));
+ bool muted = !audio_ismuted(audio);
(void)unused;
- muted = !muted;
(void)re_hprintf(pf, "\ncall %smuted\n", muted ? "" : "un-");
- audio_mute(call_audio(ua_call(uag_cur())), muted);
+ audio_mute(audio, muted);
return 0;
}
diff --git a/src/audio.c b/src/audio.c
index d8bb689..4f03591 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -1278,7 +1278,7 @@ int audio_send_digit(struct audio *a, char key)
/**
- * Mute the audio stream
+ * Mute the audio stream source (i.e. Microphone)
*
* @param a Audio stream
* @param muted True to mute, false to un-mute
@@ -1292,6 +1292,22 @@ void audio_mute(struct audio *a, bool muted)
}
+/**
+ * Get the mute state of an audio source
+ *
+ * @param a Audio stream
+ *
+ * @return True if muted, otherwise false
+ */
+bool audio_ismuted(const struct audio *a)
+{
+ if (!a)
+ return false;
+
+ return a->tx.muted;
+}
+
+
void audio_sdp_attr_decode(struct audio *a)
{
const char *attr;
diff --git a/src/call.c b/src/call.c
index bf60bf7..967aca8 100644
--- a/src/call.c
+++ b/src/call.c
@@ -663,6 +663,8 @@ int call_progress(struct call *call)
if (!call)
return EINVAL;
+ tmr_cancel(&call->tmr_inv);
+
err = call_sdp_get(call, &desc, false);
if (err)
return err;
diff --git a/src/core.h b/src/core.h
index cf0a4b4..cdfaa8d 100644
--- a/src/core.h
+++ b/src/core.h
@@ -292,7 +292,6 @@ const struct sdp_format *sdp_media_format_cycle(struct sdp_media *m);
* Stream
*/
-struct stream;
struct rtp_header;
enum {STREAM_PRESZ = 4+12}; /* same as RTP_HEADER_SIZE */
@@ -301,6 +300,34 @@ typedef void (stream_rtp_h)(const struct rtp_header *hdr, struct mbuf *mb,
void *arg);
typedef void (stream_rtcp_h)(struct rtcp_msg *msg, void *arg);
+/** Defines a generic media stream */
+struct stream {
+ struct le le; /**< Linked list element */
+ struct config_avt cfg; /**< Stream configuration */
+ struct call *call; /**< Ref. to call object */
+ struct sdp_media *sdp; /**< SDP Media line */
+ struct rtp_sock *rtp; /**< RTP Socket */
+ struct rtpkeep *rtpkeep; /**< RTP Keepalive */
+ struct rtcp_stats rtcp_stats;/**< RTCP statistics */
+ struct jbuf *jbuf; /**< Jitter Buffer for incoming RTP */
+ struct mnat_media *mns; /**< Media NAT traversal state */
+ const struct menc *menc; /**< Media encryption module */
+ struct menc_sess *mencs; /**< Media encryption session state */
+ struct menc_media *mes; /**< Media Encryption media state */
+ struct metric metric_tx; /**< Metrics for transmit */
+ struct metric metric_rx; /**< Metrics for receiving */
+ char *cname; /**< RTCP Canonical end-point identifier */
+ uint32_t ssrc_rx; /**< Incoming syncronizing source */
+ uint32_t pseq; /**< Sequence number for incoming RTP */
+ int pt_enc; /**< Payload type for encoding */
+ bool rtcp; /**< Enable RTCP */
+ bool rtcp_mux; /**< RTP/RTCP multiplex supported by peer */
+ bool jbuf_started; /**< True if jitter-buffer was started */
+ stream_rtp_h *rtph; /**< Stream RTP handler */
+ stream_rtcp_h *rtcph; /**< Stream RTCP handler */
+ void *arg; /**< Handler argument */
+};
+
int stream_alloc(struct stream **sp, const struct config_avt *cfg,
struct call *call, struct sdp_session *sdp_sess,
const char *name, int label,
diff --git a/src/stream.c b/src/stream.c
index ffb1e82..086369f 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -10,46 +10,11 @@
#include "core.h"
-#define MAGIC 0x00814ea5
-#include "magic.h"
-
-
enum {
RTP_RECV_SIZE = 8192,
};
-/** Defines a generic media stream */
-struct stream {
- MAGIC_DECL
-
- struct le le; /**< Linked list element */
- struct config_avt cfg; /**< Stream configuration */
- struct call *call; /**< Ref. to call object */
- struct sdp_media *sdp; /**< SDP Media line */
- struct rtp_sock *rtp; /**< RTP Socket */
- struct rtpkeep *rtpkeep; /**< RTP Keepalive */
- struct rtcp_stats rtcp_stats;/**< RTCP statistics */
- struct jbuf *jbuf; /**< Jitter Buffer for incoming RTP */
- struct mnat_media *mns; /**< Media NAT traversal state */
- const struct menc *menc; /**< Media encryption module */
- struct menc_sess *mencs; /**< Media encryption session state */
- struct menc_media *mes; /**< Media Encryption media state */
- struct metric metric_tx; /**< Metrics for transmit */
- struct metric metric_rx; /**< Metrics for receiving */
- char *cname; /**< RTCP Canonical end-point identifier */
- uint32_t ssrc_rx; /**< Incoming syncronizing source */
- uint32_t pseq; /**< Sequence number for incoming RTP */
- int pt_enc; /**< Payload type for encoding */
- bool rtcp; /**< Enable RTCP */
- bool rtcp_mux; /**< RTP/RTCP multiplex supported by peer */
- bool jbuf_started; /**< True if jitter-buffer was started */
- stream_rtp_h *rtph; /**< Stream RTP handler */
- stream_rtcp_h *rtcph; /**< Stream RTCP handler */
- void *arg; /**< Handler argument */
-};
-
-
static inline int lostcalc(struct stream *s, uint16_t seq)
{
const uint16_t delta = seq - s->pseq;
@@ -263,8 +228,6 @@ int stream_alloc(struct stream **sp, const struct config_avt *cfg,
if (!s)
return ENOMEM;
- MAGIC_INIT(s);
-
s->cfg = *cfg;
s->call = call;
s->rtph = rtph;