summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/mpa/encode.c13
-rw-r--r--modules/mpa/mpa.c4
-rw-r--r--src/audio.c6
3 files changed, 12 insertions, 11 deletions
diff --git a/modules/mpa/encode.c b/modules/mpa/encode.c
index db18a61..8e903a0 100644
--- a/modules/mpa/encode.c
+++ b/modules/mpa/encode.c
@@ -23,13 +23,15 @@ static void destructor(void *arg)
{
struct auenc_state *aes = arg;
- if(aes->resampler)
+ if(aes->resampler) {
speex_resampler_destroy(aes->resampler);
+ aes->resampler = NULL;
+ }
if (aes->enc)
twolame_close(&aes->enc);
#ifdef DEBUG
- debug("mpa: encoder destroyed\n");
+ info("mpa encode destroyed\n");
#endif
}
@@ -47,7 +49,6 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
aes = *aesp;
if (aes) {
- info("ever?");
mem_deref(aes);
}
@@ -60,7 +61,7 @@ int mpa_encode_update(struct auenc_state **aesp, const struct aucodec *ac,
}
aes->channels = ac->ch;
#ifdef DEBUG
- debug("mpa: encoder created %s\n",fmtp);
+ info("mpa: encoder created %s\n",fmtp);
#endif
prm.samplerate = 32000;
@@ -150,7 +151,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len,
aes->intermediate_buffer, intermediate_len,
buf+4, (*len)-4);
#ifdef DEBUG
- debug("mpa encode %d %d %d %d %d\n",intermediate_len,sampc,
+ info("mpa encode %d %d %d %d %d\n",intermediate_len,sampc,
aes->channels,*len,n);
#endif
}
@@ -171,7 +172,7 @@ int mpa_encode_frm(struct auenc_state *aes, uint8_t *buf, size_t *len,
*len = 0;
#ifdef DEBUG
- debug("mpa encode %d %d %d %d\n",sampc,aes->channels,*len,n);
+ info("mpa encode %d %d %d %d\n",sampc,aes->channels,*len,n);
#endif
return 0;
}
diff --git a/modules/mpa/mpa.c b/modules/mpa/mpa.c
index 2086ee4..1733a8e 100644
--- a/modules/mpa/mpa.c
+++ b/modules/mpa/mpa.c
@@ -82,8 +82,8 @@ static struct aucodec mpa = {
.pt = "14",
.name = "MPA",
.srate = 90000,
- .ch = 2,
- .fmtp = "",
+ .ch = 1, /* MPA does not expect channels count, even thoes it is stereo */
+ .fmtp = "layer=2",
.encupdh = mpa_encode_update,
.ench = mpa_encode_frm,
.decupdh = mpa_decode_update,
diff --git a/src/audio.c b/src/audio.c
index 47b4c36..a445a91 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -278,7 +278,7 @@ static bool aucodec_equal(const struct aucodec *a, const struct aucodec *b)
if (!a || !b)
return false;
- return get_srate(a) == get_srate(b) && a->ch == b->ch;
+ return get_srate(a) == get_srate(b) && get_ch(a) == get_ch(b);
}
@@ -337,8 +337,8 @@ static void encode_rtp_send(struct audio *a, struct autx *tx,
tx->mb->end = STREAM_PRESZ + len;
if (mbuf_get_left(tx->mb)) {
-
- err = stream_send(a->strm, tx->marker, -1, tx->ts, tx->mb);
+ if(len)
+ err = stream_send(a->strm, tx->marker, -1, tx->ts, tx->mb);
if (err)
goto out;
}