Module: sems Branch: master Commit: f29a3d7f9f439021776859d52aef9897a322922a URL: https://github.com/sems-server/sems/commit/f29a3d7f9f439021776859d52aef9897a322922a
Author: Stefan Sayer <stefan.sa...@googlemail.com> Committer: Stefan Sayer <stefan.sa...@googlemail.com> Date: 2015-05-28T22:46:36+02:00 core: AmAudioFileFormat codec initialization error wrong codec initialization in AmAudioFileFormat cunstructor for non Wav Mu-law files: 1. AmAudioFileFormat inherits AmAudioFormat 2. there is no explicit AmAudioFormat constructor call in AmAudioFileFormat that's why it is called with default parameters: codec_id = CODEC_PCM16, unsigned int rate = SYSTEM_SAMPLECLOCK_RATE 3. AmAudioFormat constructor initializes CODEC_PCM16 4. AmAudioFileFormat constructor calls getCodec(), but codec already initialized result: uninitialized codec and wrong codec_id for non Wav Mu-law files patch in attach ensures consistency between p_subtype codec_id and active codec_id Patch by Michael Furmur --- Modified: core/AmAudioFile.cpp Modified: core/AmAudioFile.h --- Diff: https://github.com/sems-server/sems/commit/f29a3d7f9f439021776859d52aef9897a322922a.diff Patch: https://github.com/sems-server/sems/commit/f29a3d7f9f439021776859d52aef9897a322922a.patch --- diff --git a/core/AmAudioFile.cpp b/core/AmAudioFile.cpp index 62efb62..f09a732 100644 --- a/core/AmAudioFile.cpp +++ b/core/AmAudioFile.cpp @@ -44,6 +44,15 @@ AmAudioFileFormat::AmAudioFileFormat(const string& name, int subtype) } } +amci_codec_t* AmAudioFileFormat::getCodec() +{ + if(p_subtype && p_subtype->codec_id != codec_id){ + codec_id = p_subtype->codec_id; + destroyCodec(); + } + return AmAudioFormat::getCodec(); +} + void AmAudioFileFormat::setSubtypeId(int subtype_id) { if (subtype != subtype_id) { DBG("changing file subtype to ID %d\n", subtype_id); diff --git a/core/AmAudioFile.h b/core/AmAudioFile.h index daecf8b..3a06c56 100644 --- a/core/AmAudioFile.h +++ b/core/AmAudioFile.h @@ -57,6 +57,8 @@ class AmAudioFileFormat: public AmAudioFormat virtual ~AmAudioFileFormat() { } + virtual amci_codec_t* getCodec(); + /** @return Format name. */ string getName() { return name; } /** @return Format subtype. */ _______________________________________________ Semsdev mailing list Semsdev@lists.iptel.org http://lists.iptel.org/mailman/listinfo/semsdev