Audio decoder: copy network address to pbuf struct

This commit is contained in:
Martin Pulec
2017-01-10 11:00:32 +01:00
parent a07536db75
commit da99638660
3 changed files with 9 additions and 2 deletions

View File

@@ -509,6 +509,7 @@ static struct rtp *initialize_audio_network(struct audio_network_parameters *par
pdb_add(params->participants, rtp_my_ssrc(r));
rtp_set_option(r, RTP_OPT_WEAK_VALIDATION, TRUE);
rtp_set_option(r, RTP_OPT_PROMISC, TRUE);
rtp_set_option(r, RTP_OPT_RECORD_SOURCE, TRUE);
rtp_set_sdes(r, rtp_my_ssrc(r), RTCP_SDES_TOOL,
PACKAGE_STRING, strlen(PACKAGE_VERSION));
rtp_set_recv_buf(r, 256*1024);

View File

@@ -374,14 +374,15 @@ static void *adec_compute_and_print_stats(void *arg) {
}
int decode_audio_frame(struct coded_data *cdata, void *data, struct pbuf_stats *)
int decode_audio_frame(struct coded_data *cdata, void *pbuf_data, struct pbuf_stats *)
{
struct pbuf_audio_data *s = (struct pbuf_audio_data *) data;
struct pbuf_audio_data *s = (struct pbuf_audio_data *) pbuf_data;
struct state_audio_decoder *decoder = s->decoder;
int input_channels = 0;
int output_channels = 0;
int bps, sample_rate, channel;
bool first = true;
if(!cdata) {
return FALSE;
@@ -522,6 +523,10 @@ int decode_audio_frame(struct coded_data *cdata, void *data, struct pbuf_stats *
unsigned int buffer_len = ntohl(audio_hdr[2]);
//fprintf(stderr, "%d-%d-%d ", length, bufnum, channel);
if (first) {
memcpy(&s->source, ((char *) cdata->data) + RTP_MAX_PACKET_LEN, sizeof(struct sockaddr_storage));
first = false;
}
received_frame.replace(channel, offset, data, length);

View File

@@ -102,6 +102,7 @@ struct vcodec_state {
struct pbuf_audio_data {
audio_frame buffer;
struct sockaddr_storage source; // network source address
struct state_audio_decoder *decoder;
bool reconfigured;