Changeset 1014:587430e7483c in mediastreamer2


Ignore:
Timestamp:
Jun 23, 2010 4:32:53 PM (3 years ago)
Author:
Simon Morlat <simon.morlat@…>
Branch:
default
Message:

fix crash in alsa
enhance rfc2190 support

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • NEWS

    r997 r1014  
    1 mediastreamer-2.5.1: ??? 
     1mediastreamer-2.6.0: June 23, 2010 
     2        * fix crash when video window is closed on windows 
     3        * move H264 decoder from msx264 to mediastreamer2 
     4        * MSVolume improvements and cleanup, with native AGC support. 
     5        * Echo canceller reworked: use soundcard stream to synchronise far-end stream. 
     6        * fix segfault in ALSA support when capturing a stereo stream. 
     7        * H263 RFC2190 support improvements 
    28 
    39mediastreamer-2.5.0: June 3, 2010 
  • src/alsa.c

    r992 r1014  
    873873        while (alsa_can_read(ad->handle)>=samples){ 
    874874           
    875                 int size=samples*2; 
     875                int size=samples*2*ad->nchannels; 
    876876                om=allocb(size,0); 
    877877                if ((err=alsa_read(ad->handle,om->b_wptr,samples))<=0) { 
     
    893893        mblk_t *om=NULL; 
    894894        int samples=(160*ad->rate)/8000; 
    895  
     895        int size=samples*2*ad->nchannels; 
     896         
    896897        ms_mutex_lock(&ad->mutex); 
    897         while (ms_bufferizer_get_avail(ad->bufferizer)>=samples*2){ 
     898        while (ms_bufferizer_get_avail(ad->bufferizer)>=size){ 
    898899           
    899           om=allocb(samples*2,0); 
    900           ms_bufferizer_read(ad->bufferizer,om->b_wptr,samples*2);         
    901           om->b_wptr+=samples*2; 
     900          om=allocb(size,0); 
     901          ms_bufferizer_read(ad->bufferizer,om->b_wptr,size);      
     902          om->b_wptr+=size; 
    902903          /*ms_message("alsa_read_process: Outputing %i bytes",size);*/ 
    903904          ms_queue_put(obj->outputs[0],om); 
  • src/videodec.c

    r890 r1014  
    142142 
    143143static mblk_t * skip_rfc2190_header(mblk_t *inm){ 
    144         if (msgdsize(inm) >= 4) { 
    145                 uint8_t *ph = inm->b_rptr; 
    146                 int F = (ph[0]>>7) & 0x1; 
    147                 int P = (ph[0]>>6) & 0x1; 
    148                 if (F == 0) inm->b_rptr += 4;  // mode A 
    149                 else if (P == 0) inm->b_rptr += 8; // mode B 
    150                 else inm->b_rptr += 12;   // mode C 
     144        uint8_t *ph = inm->b_rptr; 
     145        uint8_t sbit = (ph[0] >> 3) & 0x07;  
     146        //unsigned int ebit = ph[0] & 0x7; 
     147        bool_t isIFrame=0; 
     148        unsigned hdrLen; 
     149        char mode; 
     150        if (msgdsize(inm) < 5 ) { 
     151                ms_warning("RFC2190 packet too small (size %d) to scan!", msgdsize(inm)); 
     152                freemsg(inm); 
     153                return NULL; 
     154        } 
     155        if ((ph[0] & 0x80) == 0) { 
     156                isIFrame = (ph[1] & 0x10) == 0; 
     157                hdrLen = 4; 
     158                mode = 'A'; 
     159        } else if ((ph[0] & 0x40) == 0) { 
     160                isIFrame = (ph[4] & 0x80) == 0; 
     161                hdrLen = 8; 
     162                mode = 'B'; 
    151163        } else { 
     164                isIFrame = (ph[4] & 0x80) == 0; 
     165                hdrLen = 12; 
     166                mode = 'C'; 
     167        } 
     168        if (msgdsize(inm) > hdrLen) { 
     169                inm->reserved2 |= (sbit << 11); 
     170                inm->b_rptr += hdrLen; 
     171        } else { 
     172                ms_warning("RFC2190 packet mode:%c%s too small (size %d)", mode, isIFrame ? 
     173                                " (I-Frame)":"", msgdsize(inm));  
    152174                freemsg(inm); 
    153175                inm=NULL; 
     
    598620        return dupmsg(s->yuv_msg); 
    599621} 
     622/* Bitmasks to select bits of a byte from low side */ 
     623static unsigned char smasks[7] = { 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01 }; 
    600624 
    601625static void dec_process_frame(MSFilter *f, mblk_t *inm){ 
     
    613637                if (s->input==NULL){ 
    614638                        s->input=inm; 
    615                 }else{ 
     639                }else{  
     640                        uint8_t sbit = (inm->reserved2 >> 11) & 0x7; 
     641                        if (sbit!=0) {   
     642                                mblk_t *mp = s->input; 
     643                                while ( mp->b_cont != NULL ) mp = mp->b_cont; 
     644                                mp->b_wptr--; 
     645                                mp->b_wptr[0] |= ( inm->b_rptr[0] & smasks[sbit-1] ); 
     646                                mp->b_wptr++; 
     647                                inm->b_rptr++; 
     648                        } 
    616649                        concatb(s->input,inm); 
    617650                } 
     
    632665                                pkt.size = remain; 
    633666                                len=avcodec_decode_video2(&s->av_context,&orig,&got_picture,&pkt); 
    634                                 /*len=avcodec_decode_video(&s->av_context,&orig,&got_picture,(uint8_t*)frame->b_rptr,remain );*/ 
    635667                                if (len<=0) { 
    636668                                        ms_warning("ms_AVdecoder_process: error %i.",len); 
Note: See TracChangeset for help on using the changeset viewer.