struct rtp_member* rtp_member_fetch(struct rtp_context *ctx, uint32_t ssrc) { struct rtp_member *p; p = rtp_member_list_find(ctx->members, ssrc); if(!p) { // exist in sender list? assert(!rtp_member_list_find(ctx->senders, ssrc)); p = rtp_member_create(ssrc); if(p) { struct rtcp_msg_t msg; // update members list rtp_member_list_add(ctx->members, p); rtp_member_release(p); msg.type = RTCP_MSG_MEMBER; msg.u.member.ssrc = ssrc; ctx->handler.on_rtcp(ctx->cbparam, &msg); } } return p; }
int rtp_destroy(void* rtp) { struct rtp_context *ctx = (struct rtp_context *)rtp; if(ctx->members) rtp_member_list_destroy(ctx->members); if(ctx->senders) rtp_member_list_destroy(ctx->senders); if(ctx->self) rtp_member_release(ctx->self); free(ctx); return 0; }