Revision 96e39edc

View differences:

libavutil/fifo.c
60 60
    unsigned int old_size= f->end - f->buffer;
61 61

  
62 62
    if(old_size < new_size){
63
        uint8_t *old= f->buffer;
63
        int len= av_fifo_size(f);
64
        AVFifoBuffer f2;
64 65

  
65
        f->buffer= av_realloc(f->buffer, new_size);
66

  
67
        f->rptr += f->buffer - old;
68
        f->wptr += f->buffer - old;
69

  
70
        if(f->wptr < f->rptr){
71
            memmove(f->rptr + new_size - old_size, f->rptr, f->buffer + old_size - f->rptr);
72
            f->rptr += new_size - old_size;
73
        }
74
        f->end= f->buffer + new_size;
66
        av_fifo_init(&f2, new_size);
67
        av_fifo_read(f, f2.buffer, len);
68
        f2.wptr += len;
69
        av_free(f->buffer);
70
        *f= f2;
75 71
    }
76 72
}
77 73

  

Also available in: Unified diff