static void process_rtp_data(session_t *sp, uint32_t ssrc, rtp_packet *p) { struct s_source *s; pdb_entry_t *e; if (sp->filter_loopback && ssrc == rtp_my_ssrc(sp->rtp_session[0])) { /* This packet is from us and we are filtering our own */ /* packets. */ xfree(p); return; } if (pdb_item_get(sp->pdb, ssrc, &e) == FALSE) { debug_msg("Packet discarded: unknown source (0x%08x).\n", ssrc); xfree(p); return; } e->received++; s = source_get_by_ssrc(sp->active_sources, ssrc); if (s == NULL) { s = source_create(sp->active_sources, ssrc, sp->pdb); ui_send_rtp_active(sp, sp->mbus_ui_addr, ssrc); debug_msg("Source created\n"); } /* Calculate the relative playout delay, for this source. Needed for lip-sync. */ /* Discard packet if output is muted... no point wasting time decoding it... */ if ((sp->playing_audio == FALSE) || (e->mute)) { xfree(p); return; } /* Discard packets that contain no data */ if (p->meta.data_len == 0) { printf("Zero length packet\n"); xfree(p); return; } /* Remove any padding */ if (p->fields.p) { p->meta.data_len -= p->meta.data[p->meta.data_len - 1]; p->fields.p = 0; } source_add_packet(s, p); }
NNTP * nntp_create (NNTP *n) { if (!n) { n = calloc (1, sizeof (NNTP)); if (!n) { return NULL; } } source_create (&n->source); // Construct parent OBJECT *o = &n->source.container.object; o->type = MAGIC_NNTP; o->name = strdup ("nntp"); o->destroy = (object_destroy_fn) nntp_destroy; return n; }