Ticket #550: movenc.c.diff

File movenc.c.diff, 1.5 KB (added by ilevin, 15 years ago)
  • movenc.c

    old new (this hunk was shorter than expected)  
    2020 * License along with FFmpeg; if not, write to the Free Software
    2121 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
    2222 */
     23//------------------------------------------------------Modifications History
     24// DATE       DESCRIPTION
     25// 02/17/2011 Fixed handling of no data AMR frames
    2326
    2427#include "movenc.h"
    2528#include "avformat.h"
    2629
    … …  
    18731967
    18741968    if (enc->codec_id == CODEC_ID_AMR_NB) {
    18751969        /* We must find out how many AMR blocks there are in one packet */
    1876         static uint16_t packed_size[16] =
    1877             {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 0};
     1970
     1971        // This array holds the number of data bytes used for each amr mode.
     1972        static const uint8_t packed_size[16] =
     1973            {12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0};
    18781974        int len = 0;
    18791975
    1880         while (len < size && samplesInChunk < 100) {
    1881             len += packed_size[(pkt->data[len] >> 3) & 0x0F];
     1976        while (len < size && samplesInChunk < 100)
     1977        {
     1978            // The first byte is a TOC byte that contains the AMR mode
     1979            // We add 1 here for the TOC byte
     1980            len += packed_size[(pkt->data[len] >> 3) & 0x0F] + 1;
    18821981            samplesInChunk++;
    18831982        }
     1983
    18841984        if(samplesInChunk > 1){
    18851985            av_log(s, AV_LOG_ERROR, "fatal error, input is not a single packet, implement a AVParser for it\n");
    18861986            return -1;