From c7800eabce5aeb190dc57484d1b550a81035f409 Mon Sep 17 00:00:00 2001
From: Stefan Sayer <stefan.sayer@googlemail.com>
Date: Wed, 24 Jun 2015 05:42:51 +0200
Subject: [PATCH] core:rtp stream: take fmt params in payload initialization

---
 core/AmRtpAudio.cpp  | 5 +++++
 core/AmRtpStream.cpp | 1 +
 core/AmRtpStream.h   | 1 +
 3 files changed, 7 insertions(+)

diff --git a/core/AmRtpAudio.cpp b/core/AmRtpAudio.cpp
index a6bd259..6df11e2 100644
--- a/core/AmRtpAudio.cpp
+++ b/core/AmRtpAudio.cpp
@@ -44,6 +44,10 @@ AmAudioRtpFormat::~AmAudioRtpFormat()
 int AmAudioRtpFormat::setCurrentPayload(Payload pl)
 {
   if (this->codec_id != pl.codec_id) {
+    DBG("setCurrentPayload({%u, '%s', %u, %u, %u, '%s'})\n",
+	pl.pt, pl.name.c_str(), pl.clock_rate, pl.advertised_clock_rate,
+	pl.codec_id, pl.format_parameters.c_str());
+    log_demangled_stacktrace(3);
     this->codec_id = pl.codec_id;
     DBG("fmt.codec_id = %d", this->codec_id);
     this->channels = 1;
@@ -52,6 +56,7 @@ int AmAudioRtpFormat::setCurrentPayload(Payload pl)
     this->advertized_rate = pl.advertised_clock_rate;
     DBG("fmt.advertized_rate = %d", this->advertized_rate);
     this->frame_size = 20*this->rate/1000;
+    this->sdp_format_parameters = pl.format_parameters;
     DBG("fmt.sdp_format_parameters = %s", this->sdp_format_parameters.c_str());
     if (this->codec != NULL) {
       destroyCodec();
diff --git a/core/AmRtpStream.cpp b/core/AmRtpStream.cpp
index 00903cb..c580278 100644
--- a/core/AmRtpStream.cpp
+++ b/core/AmRtpStream.cpp
@@ -636,6 +636,7 @@ int AmRtpStream::init(const AmSdp& local,
     p_it->codec_id   = a_pl->codec_id;
     p_it->clock_rate = a_pl->sample_rate;
     p_it->advertised_clock_rate = sdp_it->clock_rate;
+    p_it->format_parameters = sdp_it->sdp_format_parameters;
 
     pl_map[sdp_it->payload_type].index     = i;
     pl_map[sdp_it->payload_type].remote_pt = -1;
diff --git a/core/AmRtpStream.h b/core/AmRtpStream.h
index d1eb270..8396ab0 100644
--- a/core/AmRtpStream.h
+++ b/core/AmRtpStream.h
@@ -137,6 +137,7 @@ struct Payload {
   unsigned int  clock_rate;
   unsigned int  advertised_clock_rate; // differs for G722
   int           codec_id;
+  string        format_parameters;
 };
 
 /**
-- 
2.1.4

