[pulseaudio-discuss] [PATCH 1/8] rtp; Make init return a boolean value for success/failure
arun at accosted.net
arun at accosted.net
Mon Feb 29 10:16:29 UTC 2016
From: Arun Raghavan <git at arunraghavan.net>
---
src/modules/rtp/module-rtp-send.c | 3 ++-
src/modules/rtp/rtp.c | 4 ++--
src/modules/rtp/rtp.h | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c
index 15a7436..22a5f44 100644
--- a/src/modules/rtp/module-rtp-send.c
+++ b/src/modules/rtp/module-rtp-send.c
@@ -489,7 +489,8 @@ int pa__init(pa_module*m) {
pa_xfree(n);
- pa_rtp_context_init_send(&u->rtp_context, fd, m->core->cookie, payload, pa_frame_size(&ss));
+ if (!pa_rtp_context_init_send(&u->rtp_context, fd, m->core->cookie, payload, pa_frame_size(&ss)))
+ goto fail;
pa_sap_context_init_send(&u->sap_context, sap_fd, p);
pa_log_info("RTP stream initialized with mtu %u on %s:%u from %s ttl=%u, SSRC=0x%08x, payload=%u, initial sequence #%u", mtu, dst_addr, port, src_addr, ttl, u->rtp_context.ssrc, payload, u->rtp_context.sequence);
diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c
index 17c8d3c..f188345 100644
--- a/src/modules/rtp/rtp.c
+++ b/src/modules/rtp/rtp.c
@@ -43,7 +43,7 @@
#include "rtp.h"
-pa_rtp_context* pa_rtp_context_init_send(pa_rtp_context *c, int fd, uint32_t ssrc, uint8_t payload, size_t frame_size) {
+bool pa_rtp_context_init_send(pa_rtp_context *c, int fd, uint32_t ssrc, uint8_t payload, size_t frame_size) {
pa_assert(c);
pa_assert(fd >= 0);
@@ -56,7 +56,7 @@ pa_rtp_context* pa_rtp_context_init_send(pa_rtp_context *c, int fd, uint32_t ssr
pa_memchunk_reset(&c->memchunk);
- return c;
+ return true;
}
#define MAX_IOVECS 16
diff --git a/src/modules/rtp/rtp.h b/src/modules/rtp/rtp.h
index bbd4278..61f23cf 100644
--- a/src/modules/rtp/rtp.h
+++ b/src/modules/rtp/rtp.h
@@ -37,7 +37,7 @@ typedef struct pa_rtp_context {
pa_memchunk memchunk;
} pa_rtp_context;
-pa_rtp_context* pa_rtp_context_init_send(pa_rtp_context *c, int fd, uint32_t ssrc, uint8_t payload, size_t frame_size);
+bool pa_rtp_context_init_send(pa_rtp_context *c, int fd, uint32_t ssrc, uint8_t payload, size_t frame_size);
/* If the memblockq doesn't have a silence memchunk set, then the caller must
* guarantee that the current read index doesn't point to a hole. */
--
2.5.0
More information about the pulseaudio-discuss
mailing list