Module: sems
Branch: master
Commit: 78b154972f8db31153aaa0b29f190a7b1231a8a3
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=78b154972f8db31153aaa0b29f190a7b1231a8a3

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Tue Oct 15 14:59:00 2013 +0200

b/f:mixer: prevent crash on output_sample_rate not set

---

 core/AmConferenceChannel.cpp |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/core/AmConferenceChannel.cpp b/core/AmConferenceChannel.cpp
index 7ba00f2..f2530d4 100644
--- a/core/AmConferenceChannel.cpp
+++ b/core/AmConferenceChannel.cpp
@@ -31,10 +31,13 @@ int AmConferenceChannel::put(unsigned long long system_ts, 
unsigned char* buffer
 int AmConferenceChannel::get(unsigned long long system_ts, unsigned char* 
buffer,
                             int output_sample_rate, unsigned int nb_samples)
 {
+  if (!nb_samples || !output_sample_rate)
+    return 0;
+
   AmMultiPartyMixer* mixer = status->getMixer();
   mixer->lock();
-  unsigned int size = PCM16_S2B(nb_samples * mixer->GetCurrentSampleRate() 
-                               / output_sample_rate);
+  unsigned int size = output_sample_rate ?
+    PCM16_S2B(nb_samples * mixer->GetCurrentSampleRate() / output_sample_rate) 
: 0;
   unsigned int mixer_sample_rate = 0;
   mixer->GetChannelPacket(channel_id,system_ts,buffer,size,mixer_sample_rate);
   size = resampleOutput(buffer,size,mixer_sample_rate,output_sample_rate);

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to