diff options
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | docs/ChangeLog | 62 | ||||
-rw-r--r-- | docs/README | 2 | ||||
-rw-r--r-- | docs/TODO | 20 | ||||
-rw-r--r-- | include/baresip.h | 3 | ||||
-rw-r--r-- | mk/Doxyfile | 2 | ||||
-rw-r--r-- | modules/alsa/alsa.c | 4 | ||||
-rw-r--r-- | modules/daala/decode.c | 25 | ||||
-rw-r--r-- | modules/daala/encode.c | 15 | ||||
-rw-r--r-- | modules/oss/oss.c | 38 | ||||
-rw-r--r-- | modules/zrtp/module.mk | 2 | ||||
-rw-r--r-- | modules/zrtp/zrtp.c | 4 | ||||
-rw-r--r-- | rpm/baresip.spec | 2 | ||||
-rw-r--r-- | src/main.c | 46 | ||||
-rw-r--r-- | src/ua.c | 22 | ||||
-rw-r--r-- | test/call.c | 14 | ||||
-rw-r--r-- | test/cplusplus.cpp | 8 |
18 files changed, 220 insertions, 64 deletions
@@ -13,7 +13,7 @@ USE_VIDEO := 1 PROJECT := baresip -VERSION := 0.4.15 +VERSION := 0.4.16 DESCR := "Baresip is a modular SIP User-Agent with audio and video support" # Verbose and silent build modes @@ -144,6 +144,11 @@ endif LIBS += -lrem -lm LIBS += -L$(SYSROOT)/lib +ifeq ($(OS),win32) +TEST_LIBS += -static-libgcc +endif + + -include $(APP_OBJS:.o=.d) -include $(TEST_OBJS:.o=.d) @@ -210,7 +215,7 @@ $(TEST_BIN): $(STATICLIB) $(TEST_OBJS) @echo " LD $@" $(HIDE)$(CXX) $(LFLAGS) $(TEST_OBJS) \ -L$(LIBRE_SO) -L. \ - -l$(PROJECT) -lre $(LIBS) -o $@ + -l$(PROJECT) -lre $(LIBS) $(TEST_LIBS) -o $@ $(BUILD)/%.o: %.c $(BUILD) Makefile $(APP_MK) @echo " CC $@" diff --git a/debian/changelog b/debian/changelog index 37c6a62..8134488 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +baresip (0.4.16) unstable; urgency=low + + * version 0.4.16 + + -- Alfred E. Heggestad <aeh@db.org> Tue, 1 Dec 2015 12:00:00 +0100 + baresip (0.4.15) unstable; urgency=low * version 0.4.15 diff --git a/docs/ChangeLog b/docs/ChangeLog index 49ee31e..1abbe85 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -1,3 +1,65 @@ +2015-12-01 Alfred E. Heggestad <aeh@db.org> + + * Version 0.4.16 + + * GIT URL: https://github.com/alfredh/baresip.git + * GIT commit bed2241da3261e472f09b21958f0cc1324a94f27 + * GIT tag: v0.4.16 + * NOTE: Requires libre v0.4.14 or later + + * new modules: + - v4l2_codec Video4Linux2 video codec (H264 hardware encoding) + - vidinfo Video info overlay module + + * baresip-core: + - audio: add audio_set_source() and audio_set_player() + - audio: flush tx-buffer for all modes (thanks Thibault Gueslin) + - call: add call_is_outgoing() + - call: check address-family of incoming SDP offer (thanks Olle) + - h264: move H.264 packetization code to core + - main: add -u option to append extra global UA parameters + - main: pre-load modules after all arguments are parsed + - ua: add events UA_EVENT_SHUTDOWN,UA_EXIT + - ua: add ua_hold_answer() + - ua: add ua_set_media_af() + - ua: delay mod-unloading if mods has a ref to struct ua + + * build: + - add verbose build with V=1 (thanks Dmitrij D. Czarkoff) + - add pkg-config file (thanks William King) + - add travis.yml file for Github build-system + + * Modules: + + * alsa: fix memory leaks + + * avcodec: move common H.264 packetization code to core + + * cairo: use pkg-config in makefile + + * daala: update to latest libdaala (thanks Dmitrij D. Czarkoff) + + * gst_video: use H.264 packetization API from core + + * gst_video1: use H.264 packetization API from core + + * gtk: fix segmentation fault on window close + + * mwi: add 500ms delay after closing subscription + + * oss: use pthread for ausrc instead of fd_listen (fixes FreeBSD) + + * presence: use sipevent_sock instance from UA core + add 500ms delay after closing subscription + + * v4l2_codec: new module + + * vidinfo: new module + + * zrtp: fix ZRTP over TURN by moving helper to layer 10 + fix ZID verification (thanks Ingo Feinerer) + + 2015-09-26 Alfred E. Heggestad <aeh@db.org> * Version 0.4.15 diff --git a/docs/README b/docs/README index ff1187f..737e519 100644 --- a/docs/README +++ b/docs/README @@ -317,7 +317,7 @@ Supported compilers: External dependencies: -libre v0.4.11 or later +libre v0.4.14 or later librem v0.4.6 or later @@ -3,21 +3,25 @@ TODO: ------------------------------------------------------------------------------- Version v0.x.y: - conf: move generation of config template to a module ('config.so') + config-object is not available during pre-loading of modules + keep config-object around, add support for appending config + + conf: move generation of config template to a module ('config.so') ? improve first-time user experience, add a new module that will prompt the user for a SIP uri and (optionally) a password. - video rate-control, the outgoing video-stream bandwidth should be - configurable and the encoder should limit the rate to the configured - range. possibly also add a FPS throttler for fast vidsrc modules - improve gui and multi-UA and multi-call interaction - avcodec-audio.so -- create a new audio-codec module that will use - audio codecs from FFmpeg libavcodec, as a supplement to existing codecs. + vumeter code is common for vumeter-module and gtk-module. + move to a common place ? + + move playing of ringtones from ua.c to menu.so ? + + move password-prompt from ua (core) to module ? + + add a FPS (framerate) throttler for fast vidsrc modules - move common H.264 code to either baresip-core or librem ------------------------------------------------------------------------------- BUGS: diff --git a/include/baresip.h b/include/baresip.h index 32a4ee8..401b7fc 100644 --- a/include/baresip.h +++ b/include/baresip.h @@ -13,7 +13,7 @@ extern "C" { /** Defines the Baresip version string */ -#define BARESIP_VERSION "0.4.15" +#define BARESIP_VERSION "0.4.16" /* forward declarations */ @@ -551,6 +551,7 @@ int uag_event_register(ua_event_h *eh, void *arg); void uag_event_unregister(ua_event_h *eh); void uag_set_sub_handler(sip_msg_h *subh); int ua_print_sip_status(struct re_printf *pf, void *unused); +int uag_set_extra_params(const char *eprm); struct ua *uag_find(const struct pl *cuser); struct ua *uag_find_aor(const char *aor); struct ua *uag_find_param(const char *name, const char *val); diff --git a/mk/Doxyfile b/mk/Doxyfile index 2655bbf..10be927 100644 --- a/mk/Doxyfile +++ b/mk/Doxyfile @@ -4,7 +4,7 @@ # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = baresip -PROJECT_NUMBER = 0.4.15 +PROJECT_NUMBER = 0.4.16 OUTPUT_DIRECTORY = ../baresip-dox CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English 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; diff --git a/rpm/baresip.spec b/rpm/baresip.spec index ac23046..4603797 100644 --- a/rpm/baresip.spec +++ b/rpm/baresip.spec @@ -1,5 +1,5 @@ %define name baresip -%define ver 0.4.15 +%define ver 0.4.16 %define rel 1 Summary: Modular SIP useragent @@ -45,10 +45,11 @@ static void usage(void) "\t-d Daemon\n" "\t-e <commands> Exec commands\n" "\t-f <path> Config path\n" - "\t-m <module> Pre-load module\n" + "\t-m <module> Pre-load modules (repeat)\n" "\t-p <path> Audio files\n" "\t-h -? Help\n" "\t-t Test and exit\n" + "\t-u <parameters> Extra UA parameters\n" "\t-v Verbose debug\n" ); } @@ -57,7 +58,10 @@ static void usage(void) int main(int argc, char *argv[]) { bool prefer_ipv6 = false, run_daemon = false, test = false; + const char *ua_eprm = NULL; const char *exec = NULL; + const char *modv[16]; + size_t modc = 0; int err; (void)re_fprintf(stderr, "baresip v%s" @@ -73,7 +77,7 @@ int main(int argc, char *argv[]) #ifdef HAVE_GETOPT for (;;) { - const int c = getopt(argc, argv, "6de:f:p:hvtm:"); + const int c = getopt(argc, argv, "6de:f:p:hu:vtm:"); if (0 > c) break; @@ -103,12 +107,13 @@ int main(int argc, char *argv[]) break; case 'm': - err = module_preload(optarg); - if (err) { - re_fprintf(stderr, - "could not pre-load module" - " '%s' (%m)\n", optarg, err); + if (modc >= ARRAY_SIZE(modv)) { + warning("max %zu modules\n", + ARRAY_SIZE(modv)); + err = EINVAL; + goto out; } + modv[modc++] = optarg; break; case 'p': @@ -119,6 +124,10 @@ int main(int argc, char *argv[]) test = true; break; + case 'u': + ua_eprm = optarg; + break; + case 'v': log_enable_debug(true); break; @@ -132,6 +141,23 @@ int main(int argc, char *argv[]) (void)argv; #endif + /* NOTE: must be done after all arguments are processed */ + if (modc) { + size_t i; + + info("pre-loading modules: %zu\n", modc); + + for (i=0; i<modc; i++) { + + err = module_preload(modv[i]); + if (err) { + re_fprintf(stderr, + "could not pre-load module" + " '%s' (%m)\n", modv[i], err); + } + } + } + err = conf_configure(); if (err) { warning("main: configure failed: %m\n", err); @@ -144,6 +170,12 @@ int main(int argc, char *argv[]) if (err) goto out; + if (ua_eprm) { + err = uag_set_extra_params(ua_eprm); + if (err) + goto out; + } + if (test) goto out; @@ -58,6 +58,7 @@ static struct { bool use_tls; /**< Use TLS transport */ bool prefer_ipv6; /**< Force IPv6 transport */ sip_msg_h *subh; + char *eprm; /**< Extra UA parameters */ #ifdef USE_TLS struct tls *tls; /**< TLS Context */ #endif @@ -75,6 +76,7 @@ static struct { true, false, NULL, + NULL, #ifdef USE_TLS NULL, #endif @@ -586,6 +588,7 @@ static void add_extension(struct ua *ua, const char *extension) int ua_alloc(struct ua **uap, const char *aor) { struct ua *ua; + char *buf = NULL; int err; if (!aor) @@ -606,6 +609,12 @@ int ua_alloc(struct ua **uap, const char *aor) #endif /* Decode SIP address */ + if (uag.eprm) { + err = re_sdprintf(&buf, "%s;%s", aor, uag.eprm); + if (err) + goto out; + aor = buf; + } err = account_alloc(&ua->acc, aor); if (err) @@ -677,6 +686,7 @@ int ua_alloc(struct ua **uap, const char *aor) uag_current_set(ua); out: + mem_deref(buf); if (err) mem_deref(ua); else if (uap) { @@ -1411,6 +1421,7 @@ void ua_close(void) uag.sock = mem_deref(uag.sock); uag.lsnr = mem_deref(uag.lsnr); uag.sip = mem_deref(uag.sip); + uag.eprm = mem_deref(uag.eprm); #ifdef USE_TLS uag.tls = mem_deref(uag.tls); @@ -1931,3 +1942,14 @@ void ua_set_media_af(struct ua *ua, int af_media) ua->af_media = af_media; } + + +int uag_set_extra_params(const char *eprm) +{ + uag.eprm = mem_deref(uag.eprm); + + if (eprm) + return str_dup(&uag.eprm, eprm); + + return 0; +} diff --git a/test/call.c b/test/call.c index d1b3ed1..dfb39dd 100644 --- a/test/call.c +++ b/test/call.c @@ -87,8 +87,11 @@ static void event_handler(struct ua *ua, enum ua_event ev, int err = 0; (void)prm; - ASSERT_TRUE(ua != NULL); - ASSERT_TRUE(call != NULL); +#if 0 + re_printf("[ %s ] event: %s (%s)\n", + ua_aor(ua), uag_event_str(ev), prm); +#endif + ASSERT_TRUE(f != NULL); ASSERT_EQ(MAGIC, f->magic); @@ -97,15 +100,10 @@ static void event_handler(struct ua *ua, enum ua_event ev, else if (ua == f->b.ua) ag = &f->b; else { - warning("ua not found\n"); + warning("ua %p not found\n", ua); return; } -#if 0 - re_printf("[ %s ] event: %s (%s)\n", - ua_aor(ua), uag_event_str(ev), prm); -#endif - switch (ev) { case UA_EVENT_CALL_INCOMING: diff --git a/test/cplusplus.cpp b/test/cplusplus.cpp index b6ddaa9..7d2b208 100644 --- a/test/cplusplus.cpp +++ b/test/cplusplus.cpp @@ -11,6 +11,12 @@ int test_cplusplus(void) { + const char *version = sys_libre_version_get(); + int err = 0; + + ASSERT_TRUE(str_isset(version)); re_printf("c++ ok\n"); - return 0; + +out: + return err; } |