Commit b8567a4c authored by Simon Morlat's avatar Simon Morlat

add support of outgoing metadatas

parent bb269321
......@@ -108,6 +108,8 @@ MS2_PUBLIC void ms_queue_destroy(MSQueue *q);
#define mblk_set_cseq(m,value) (m)->reserved2=(m)->reserved2| ((value&0xFFFF)<<16);
#define mblk_get_cseq(m) ((m)->reserved2>>16)
#define HAVE_ms_bufferizer_fill_current_metas
struct _MSBufferizer{
queue_t q;
......
......@@ -78,6 +78,7 @@ static void alaw_enc_process(MSFilter *obj){
*o->b_wptr=Snack_Lin2Alaw(((int16_t*)buffer)[i]);
o->b_wptr++;
}
ms_bufferizer_fill_current_metas(bz, o);
mblk_set_timestamp_info(o,dt->ts);
dt->ts+=size_of_pcm/2;
ms_queue_put(obj->outputs[0],o);
......
......@@ -88,6 +88,7 @@ static void enc_process(MSFilter *f){
while(ms_bufferizer_read(s->input,(uint8_t*)pcmbuf,s->nsamples*2)!=0){
mblk_t *om=allocb(encoded_bytes,0);
om->b_wptr+=g726_encode(s->impl,om->b_wptr,pcmbuf,s->nsamples);
ms_bufferizer_fill_current_metas(d->bufferizer, om);
mblk_set_timestamp_info(om,s->ts);
s->ts+=s->nsamples;
ms_queue_put(f->outputs[0],om);
......
......@@ -107,6 +107,7 @@ static void enc_process(MSFilter *f){
gsm_encode(s->state,(gsm_signal*)&buff[offset/sizeof(int16_t)],(gsm_byte*)om->b_wptr);
om->b_wptr+=33;
}
ms_bufferizer_fill_current_metas(s->bufferizer, om);
mblk_set_timestamp_info(om,s->ts);
ms_queue_put(f->outputs[0],om);
s->ts+=buff_size/sizeof(int16_t)/*sizeof(buf)/2*/;
......
......@@ -81,6 +81,7 @@ static void enc_process(MSFilter *f){
mblk_t *om=allocb(s->nbytes,0);
om->b_wptr+=ms_bufferizer_read(s->bufferizer,om->b_wptr,s->nbytes);
host_to_network((int16_t*)om->b_rptr,s->nbytes/2);
ms_bufferizer_fill_current_metas(s->bufferizer, om);
mblk_set_timestamp_info(om,s->ts);
ms_queue_put(f->outputs[0],om);
s->ts += s->nbytes/(2*s->nchannels);
......
......@@ -99,7 +99,8 @@ static void enc_process(MSFilter *f)
scale_down((int16_t *)buf,chunksize/2);
k = g722_encode(s->state, om->b_wptr, (int16_t *)buf, chunksize/2);
om->b_wptr += k;
mblk_set_timestamp_info(om,s->ts);
ms_bufferizer_fill_current_metas(s->bufferizer, om);
mblk_set_timestamp_info(om,s->ts);
ms_queue_put(f->outputs[0],om);
s->ts += chunksize/4; // Nr of samples is really chunksize/2 but for G722 we must
// pretend we have a 8KHZ sampling rate
......
......@@ -203,6 +203,7 @@ static void ms_opus_enc_process(MSFilter *f) {
om->b_wptr += ret;
mblk_set_timestamp_info(om, d->ts);
ms_bufferizer_fill_current_metas(d->bufferizer, om);
ms_queue_put(f->outputs[0], om);
d->ts += packet_size*48000/d->samplerate; /* RFC payload RTP opus 03 - section 4: RTP timestamp multiplier : WARNING works only with sr at 48000 */
ret = 0;
......
......@@ -273,6 +273,7 @@ static void enc_process(MSFilter *f){
om->b_wptr+=k;
mblk_set_timestamp_info(om,s->ts-s->frame_size);
ms_bufferizer_fill_current_metas(s->bufferizer, om);
ms_queue_put(f->outputs[0],om);
speex_bits_destroy(&bits);
}
......
......@@ -54,11 +54,9 @@ static void ulaw_enc_process(MSFilter *obj){
uint8_t buffer[2240];
int frame_per_packet=2;
int size_of_pcm=320;
mblk_t *m;
if (dt->ptime>=10)
{
if (dt->ptime>=10){
frame_per_packet = dt->ptime/10;
}
......@@ -81,6 +79,7 @@ static void ulaw_enc_process(MSFilter *obj){
o->b_wptr++;
}
mblk_set_timestamp_info(o,dt->ts);
ms_bufferizer_fill_current_metas(bz, o);
dt->ts+=size_of_pcm/2;
ms_queue_put(obj->outputs[0],o);
}
......
......@@ -112,8 +112,12 @@ int ms_bufferizer_read(MSBufferizer *obj, uint8_t *data, int datalen){
return 0;
}
void ms_bufferizer_fill_current_metas(MSBufferizer *obj, mblk_t *m){
mblk_meta_copy(&obj->q._q_stopper, m);
void ms_bufferizer_fill_current_metas(MSBufferizer *obj, mblk_t *dest){
mblk_t *source=&obj->q._q_stopper;
#if defined(ORTP_TIMESTAMP)
dest->timestamp = source->timestamp;
#endif
dest->ttl_or_hl = source->ttl_or_hl;
}
void ms_bufferizer_skip_bytes(MSBufferizer *obj, int bytes){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment