c->index=0;
c->index= index;
int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx){    int dst_index, i;    int index= c->index;    int frac= c->frac;    int dst_incr_frac= c->dst_incr % c->src_incr;    int dst_incr=      c->dst_incr / c->src_incr;        if(c->compensation_distance && c->compensation_distance < dst_size)        dst_size= c->compensation_distance;        for(dst_index=0; dst_index < dst_size; dst_index++){        short *filter= c->filter_bank + c->filter_length*(index & PHASE_MASK);        int sample_index= index >> PHASE_SHIFT;        int val=0;                if(sample_index < 0){            for(i=0; i<c->filter_length; i++)                val += src[ABS(sample_index + i)] * filter[i];        }else if(sample_index + c->filter_length > src_size){            break;        }else{#if 0            int64_t v=0;            int sub_phase= (frac<<12) / c->src_incr;            for(i=0; i<c->filter_length; i++){                int64_t coeff= filter[i]*(4096 - sub_phase) + filter[i + c->filter_length]*sub_phase;                v += src[sample_index + i] * coeff;            }            val= v>>12;#else            for(i=0; i<c->filter_length; i++){                val += src[sample_index + i] * filter[i];            }#endif        }        val = (val + (1<<(FILTER_SHIFT-1)))>>FILTER_SHIFT;        dst[dst_index] = (unsigned)(val + 32768) > 65535 ? (val>>31) ^ 32767 : val;        frac += dst_incr_frac;        index += dst_incr;        if(frac >= c->src_incr){            frac -= c->src_incr;            index++;        }    }    if(update_ctx){        if(c->compensation_distance){            c->compensation_distance -= dst_index;            if(!c->compensation_distance)                c->dst_incr= c->ideal_dst_incr;        }        c->frac= frac;        c->index=0;    }    *consumed= index >> PHASE_SHIFT;#if 0        if(update_ctx && !c->compensation_distance){#undef rand        av_resample_compensate(c, rand() % (8000*2) - 8000, 8000*2);av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->compensation_distance);    }#endif        return dst_index;}