Changeset 1320 for pjproject


Ignore:
Timestamp:
May 30, 2007 7:24:19 AM (18 years ago)
Author:
bennylp
Message:

Workaround for ticket #290: Bug in WAV player when frame size is larger than file buffer size (thanks Samuel Vinson)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/wav_player.c

    r1266 r1320  
    205205        ptime = 20; 
    206206 
     207    /* Normalize buff_size */ 
     208    if (buff_size < 1) buff_size = PJMEDIA_FILE_PORT_BUFSIZE; 
     209 
     210 
    207211    /* Create fport instance. */ 
    208212    fport = create_file_port(pool); 
     
    345349    /* Create file buffer. 
    346350     */ 
    347     if (buff_size < 1) buff_size = PJMEDIA_FILE_PORT_BUFSIZE; 
    348351    fport->bufsize = buff_size; 
    349352 
     353 
     354    /* samples_per_frame must be smaller than bufsize (because get_frame() 
     355     * doesn't handle this case). 
     356     */ 
     357    if (fport->base.info.samples_per_frame*fport->base.info.bits_per_sample >= 
     358        fport->bufsize) 
     359    { 
     360        pj_file_close(fport->fd); 
     361        return PJ_EINVAL; 
     362    } 
    350363 
    351364    /* Create buffer. */ 
     
    539552    return PJ_SUCCESS; 
    540553} 
     554 
Note: See TracChangeset for help on using the changeset viewer.