Browse code

core: use codec's PLC function if it is provided

Michal Matyska authored on 04/03/2014 16:55:56 • Stefan Sayer committed on 24/07/2014 19:27:19
Showing 1 changed files
... ...
@@ -52,6 +52,7 @@ int AmAudioRtpFormat::setCurrentPayload(Payload pl)
52 52
     this->advertized_rate = pl.advertised_clock_rate;
53 53
     DBG("fmt.advertized_rate = %d", this->advertized_rate);
54 54
     this->frame_size = 20*this->rate/1000;
55
+    DBG("fmt.sdp_format_parameters = %s", this->sdp_format_parameters.c_str());
55 56
     if (this->codec != NULL) {
56 57
       destroyCodec();
57 58
     }
... ...
@@ -333,6 +334,8 @@ int AmRtpAudio::init(const AmSdp& local,
333 334
   }
334 335
   fmt_p->setCurrentPayload(payloads[pl_it->second.index]);
335 336
   fmt.reset(fmt_p);
337
+  amci_codec_t* codec = fmt->getCodec();
338
+  use_default_plc = ((codec==NULL) || (codec->plc == NULL));
336 339
 
337 340
   fec.reset(new LowcFE(getSampleRate()));
338 341
 
... ...
@@ -371,7 +374,13 @@ int AmRtpAudio::setCurrentPayload(int payload)
371 374
     }
372 375
     
373 376
     this->payload = payload;
374
-    return ((AmAudioRtpFormat*)fmt.get())->setCurrentPayload(payloads[index]);
377
+    int res = ((AmAudioRtpFormat*)fmt.get())->setCurrentPayload(payloads[index]);
378
+
379
+    amci_codec_t* codec = fmt->getCodec();
380
+    use_default_plc = ((codec==NULL) || (codec->plc == NULL));
381
+
382
+    return res;
383
+
375 384
   }
376 385
   else {
377 386
     return 0;