Commit 8d07bbca authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'f322b207'

* commit 'f322b207':
  lavr: only save/restore the mixing matrix if mixing is being done
  rtpdec_vp8: Cosmetics: Fix bad alignment/indentation
  rtpenc: Allow including a SDES/CNAME block in RTCP SR packets
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 021b3497 f322b207
......@@ -34,6 +34,7 @@ static const AVOption options[] = {
FF_RTP_FLAG_OPTS(RTPMuxContext, flags),
{ "payload_type", "Specify RTP payload type", offsetof(RTPMuxContext, payload_type), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 127, AV_OPT_FLAG_ENCODING_PARAM },
{ "ssrc", "Stream identifier", offsetof(RTPMuxContext, ssrc), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
{ "cname", "CNAME to include in RTCP SR packets", offsetof(RTPMuxContext, cname), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
{ NULL },
};
......@@ -271,6 +272,22 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time)
avio_wb32(s1->pb, rtp_ts);
avio_wb32(s1->pb, s->packet_count);
avio_wb32(s1->pb, s->octet_count);
if (s->cname) {
int len = FFMIN(strlen(s->cname), 255);
avio_w8(s1->pb, (RTP_VERSION << 6) + 1);
avio_w8(s1->pb, RTCP_SDES);
avio_wb16(s1->pb, (7 + len + 3) / 4); /* length in words - 1 */
avio_wb32(s1->pb, s->ssrc);
avio_w8(s1->pb, 0x01); /* CNAME */
avio_w8(s1->pb, len);
avio_write(s1->pb, s->cname, len);
avio_w8(s1->pb, 0); /* END */
for (len = (7 + len) % 4; len % 4; len++)
avio_w8(s1->pb, 0);
}
avio_flush(s1->pb);
}
......
......@@ -30,6 +30,7 @@ struct RTPMuxContext {
AVStream *st;
int payload_type;
uint32_t ssrc;
const char *cname;
uint16_t seq;
uint32_t timestamp;
uint32_t base_timestamp;
......
......@@ -259,6 +259,7 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
AVAudioResampleContext and force resampling */
if (!avr->resample_needed) {
int fifo_samples;
int restore_matrix = 0;
double matrix[AVRESAMPLE_MAX_CHANNELS * AVRESAMPLE_MAX_CHANNELS] = { 0 };
/* buffer any remaining samples in the output FIFO before closing */
......@@ -274,9 +275,12 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
goto reinit_fail;
}
/* save the channel mixing matrix */
if (avr->am) {
ret = avresample_get_matrix(avr, matrix, AVRESAMPLE_MAX_CHANNELS);
if (ret < 0)
goto reinit_fail;
restore_matrix = 1;
}
/* close the AVAudioResampleContext */
avresample_close(avr);
......@@ -284,9 +288,11 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
avr->force_resampling = 1;
/* restore the channel mixing matrix */
if (restore_matrix) {
ret = avresample_set_matrix(avr, matrix, AVRESAMPLE_MAX_CHANNELS);
if (ret < 0)
goto reinit_fail;
}
/* re-open the AVAudioResampleContext */
ret = avresample_open(avr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment