rtp: Make init return a value for success/failure

This will be used in the future when writing other RTP implementations
that can fail on init.

Signed-off-by: Arun Raghavan <arun@arunraghavan.net>
This commit is contained in:
Arun Raghavan 2016-05-12 17:56:43 +05:30
parent 7670dffe59
commit a9a3f0874a
3 changed files with 5 additions and 4 deletions

View file

@ -491,7 +491,8 @@ int pa__init(pa_module*m) {
pa_xfree(n); 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)) < 0)
goto fail;
pa_sap_context_init_send(&u->sap_context, sap_fd, p); 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); 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);

View file

@ -43,7 +43,7 @@
#include "rtp.h" #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) { int 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(c);
pa_assert(fd >= 0); pa_assert(fd >= 0);
@ -58,7 +58,7 @@ pa_rtp_context* pa_rtp_context_init_send(pa_rtp_context *c, int fd, uint32_t ssr
c->recv_buf_size = 0; c->recv_buf_size = 0;
pa_memchunk_reset(&c->memchunk); pa_memchunk_reset(&c->memchunk);
return c; return 0;
} }
#define MAX_IOVECS 16 #define MAX_IOVECS 16

View file

@ -39,7 +39,7 @@ typedef struct pa_rtp_context {
pa_memchunk memchunk; pa_memchunk memchunk;
} pa_rtp_context; } 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); int 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 /* 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. */ * guarantee that the current read index doesn't point to a hole. */