summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-12-04 18:09:52 +0100
committerAlfred E. Heggestad <aeh@db.org>2015-12-04 18:09:52 +0100
commitc6d7b657441b2025a9a70da42951e7ca53328474 (patch)
treed5ff1107c0fd5dd7977b44d0c732db0e417cb6e8 /modules
parent029ecbaa928aea9b31d805e0e33bf3ed05dfafc9 (diff)
parentf01a096d61c561aa2c35efd9d4fb06dc75a28b5f (diff)
Merge branch 'master' into jack
Diffstat (limited to 'modules')
-rw-r--r--modules/alsa/alsa.c4
-rw-r--r--modules/daala/decode.c25
-rw-r--r--modules/daala/encode.c15
-rw-r--r--modules/oss/oss.c38
-rw-r--r--modules/zrtp/module.mk2
-rw-r--r--modules/zrtp/zrtp.c4
6 files changed, 54 insertions, 34 deletions
diff --git a/modules/alsa/alsa.c b/modules/alsa/alsa.c
index 3239d41..e7d983e 100644
--- a/modules/alsa/alsa.c
+++ b/modules/alsa/alsa.c
@@ -140,6 +140,10 @@ static int alsa_close(void)
ausrc = mem_deref(ausrc);
auplay = mem_deref(auplay);
+ /* releases all resources of the global configuration tree,
+ and sets snd_config to NULL. */
+ snd_config_update_free_global();
+
return 0;
}
diff --git a/modules/daala/decode.c b/modules/daala/decode.c
index 7b6170f..a2c264f 100644
--- a/modules/daala/decode.c
+++ b/modules/daala/decode.c
@@ -104,26 +104,21 @@ int daala_decode(struct viddec_state *vds, struct vidframe *frame,
++vds->stats.n_packet;
++vds->stats.valid;
- ishdr = daala_packet_isheader(mbuf_buf(mb), mbuf_get_left(mb));
-
- if (ishdr)
- ++vds->stats.n_header;
- else if (daala_packet_iskeyframe(mbuf_buf(mb), mbuf_get_left(mb)) > 0)
- ++vds->stats.n_keyframe;
-
-#if 0
- re_printf("decode: [%s] %zu bytes\n",
- ishdr ? "HEADER" : "DATA",
- mbuf_get_left(mb));
-#endif
-
memset(&dp, 0, sizeof(dp));
dp.packet = mbuf_buf(mb);
dp.bytes = mbuf_get_left(mb);
dp.b_o_s = marker;
- if (daala_packet_isheader(mbuf_buf(mb), mbuf_get_left(mb))) {
+ ishdr = daala_packet_isheader(&dp);
+
+ if (ishdr)
+ ++vds->stats.n_header;
+ else if (daala_packet_iskeyframe(&dp) > 0)
+ ++vds->stats.n_keyframe;
+
+
+ if (daala_packet_isheader(&dp)) {
r = daala_decode_header_in(&vds->di, &vds->dc, &vds->ds,
&dp);
@@ -137,7 +132,7 @@ int daala_decode(struct viddec_state *vds, struct vidframe *frame,
vds->got_headers = true;
info("daala: all headers received\n");
- vds->dec = daala_decode_alloc(&vds->di, vds->ds);
+ vds->dec = daala_decode_create(&vds->di, vds->ds);
if (!vds->dec) {
warning("daala: decoder: alloc failed\n");
return ENOMEM;
diff --git a/modules/daala/encode.c b/modules/daala/encode.c
index 6b0249d..7770bd6 100644
--- a/modules/daala/encode.c
+++ b/modules/daala/encode.c
@@ -45,8 +45,15 @@ static void dump_stats(const struct videnc_state *ves)
static int send_packet(struct videnc_state *ves, bool marker,
const uint8_t *pld, size_t pld_len)
{
+ daala_packet dp;
int err;
+ memset(&dp, 0, sizeof(dp));
+
+ dp.packet = (uint8_t *)pld;
+ dp.bytes = pld_len;
+ dp.b_o_s = marker;
+
err = ves->pkth(marker, NULL, 0, pld, pld_len, ves->arg);
if (err)
return err;
@@ -54,9 +61,9 @@ static int send_packet(struct videnc_state *ves, bool marker,
++ves->stats.n_packet;
++ves->stats.valid;
- if (daala_packet_isheader(pld, pld_len))
+ if (daala_packet_isheader(&dp))
++ves->stats.n_header;
- else if (daala_packet_iskeyframe(pld, pld_len) > 0)
+ else if (daala_packet_iskeyframe(&dp) > 0)
++ves->stats.n_keyframe;
return 0;
@@ -181,8 +188,8 @@ static int open_encoder(struct videnc_state *ves, const struct vidsz *size)
debug("daala: header: %lld bytes header=%d key=%d\n",
dp.bytes,
- daala_packet_isheader(dp.packet, dp.bytes),
- daala_packet_iskeyframe(dp.packet, dp.bytes));
+ daala_packet_isheader(&dp),
+ daala_packet_iskeyframe(&dp));
#if 0
re_printf("bos=%lld, eos=%lld, granule=%lld, packetno=%lld\n",
diff --git a/modules/oss/oss.c b/modules/oss/oss.c
index 3d02154..a6a8015 100644
--- a/modules/oss/oss.c
+++ b/modules/oss/oss.c
@@ -34,6 +34,8 @@
struct ausrc_st {
const struct ausrc *as; /* inheritance */
+ pthread_t thread;
+ bool run;
int fd;
int16_t *sampv;
size_t sampc;
@@ -148,7 +150,6 @@ static void auplay_destructor(void *arg)
}
if (-1 != st->fd) {
- fd_close(st->fd);
(void)close(st->fd);
}
@@ -160,8 +161,12 @@ static void ausrc_destructor(void *arg)
{
struct ausrc_st *st = arg;
+ if (st->run) {
+ st->run = false;
+ pthread_join(st->thread, NULL);
+ }
+
if (-1 != st->fd) {
- fd_close(st->fd);
(void)close(st->fd);
}
@@ -169,17 +174,21 @@ static void ausrc_destructor(void *arg)
}
-static void read_handler(int flags, void *arg)
+static void *record_thread(void *arg)
{
struct ausrc_st *st = arg;
int n;
- (void)flags;
- n = read(st->fd, st->sampv, st->sampc*2);
- if (n <= 0)
- return;
+ while (st->run) {
+
+ n = read(st->fd, st->sampv, st->sampc*2);
+ if (n <= 0)
+ continue;
+
+ st->rh(st->sampv, n/2, st->arg);
+ }
- st->rh(st->sampv, n/2, st->arg);
+ return NULL;
}
@@ -243,16 +252,19 @@ static int src_alloc(struct ausrc_st **stp, const struct ausrc *as,
goto out;
}
- err = fd_listen(st->fd, FD_READ, read_handler, st);
- if (err)
- goto out;
-
- err = oss_reset(st->fd, prm->srate, prm->ch, st->sampc, 1);
+ err = oss_reset(st->fd, prm->srate, prm->ch, st->sampc, 0);
if (err)
goto out;
st->as = as;
+ st->run = true;
+ err = pthread_create(&st->thread, NULL, record_thread, st);
+ if (err) {
+ st->run = false;
+ goto out;
+ }
+
out:
if (err)
mem_deref(st);
diff --git a/modules/zrtp/module.mk b/modules/zrtp/module.mk
index 0939abc..6590571 100644
--- a/modules/zrtp/module.mk
+++ b/modules/zrtp/module.mk
@@ -8,6 +8,6 @@ MOD := zrtp
$(MOD)_SRCS += zrtp.c
$(MOD)_LFLAGS += -lzrtp -lbn
$(MOD)_CFLAGS += -I/usr/local/include/libzrtp
-$(MOD)_CFLAGS += -Wno-strict-prototypes -Wno-pedantic
+$(MOD)_CFLAGS += -Wno-strict-prototypes
include mk/mod.mk
diff --git a/modules/zrtp/zrtp.c b/modules/zrtp/zrtp.c
index 4821044..eddb364 100644
--- a/modules/zrtp/zrtp.c
+++ b/modules/zrtp/zrtp.c
@@ -166,7 +166,9 @@ static int media_alloc(struct menc_media **stp, struct menc_sess *sess,
{
struct menc_media *st;
zrtp_status_t s;
+ int layer = 10; /* above zero */
int err = 0;
+ (void)rtcpsock;
if (!stp || !sess || proto != IPPROTO_UDP)
return EINVAL;
@@ -182,7 +184,7 @@ static int media_alloc(struct menc_media **stp, struct menc_sess *sess,
st->sess = sess;
st->rtpsock = mem_ref(rtpsock);
- err = udp_register_helper(&st->uh, rtpsock, 0,
+ err = udp_register_helper(&st->uh, rtpsock, layer,
udp_helper_send, udp_helper_recv, st);
if (err)
goto out;