/* Sets blocksize based on samplerate Chooses the closest predefined blocksize >= BLOCK_TIME_MS milliseconds  */
static int select_blocksize(int samplerate, int block_time_ms)
/* Sets blocksize based on samplerate Chooses the closest predefined blocksize >= BLOCK_TIME_MS milliseconds  */
static int select_blocksize(int samplerate, int block_time_ms)
{
    int i;
    int target;
    int blocksize;
    assert(samplerate > 0);
    blocksize = ff_flac_blocksize_table[1];
    target = (samplerate * block_time_ms) / 1000;
    for(i=0; i<16; i++) {
        if(target >= ff_flac_blocksize_table[i] && ff_flac_blocksize_table[i] > blocksize) {
            blocksize = ff_flac_blocksize_table[i];
        }
    }
    return blocksize;
}