Revision abdff646

View differences:

ffplay.c
1571 1571
static int audio_decode_frame(VideoState *is, uint8_t *audio_buf, int buf_size, double *pts_ptr)
1572 1572
{
1573 1573
    AVPacket *pkt = &is->audio_pkt;
1574
    AVCodecContext *dec= is->audio_st->codec;
1574 1575
    int n, len1, data_size;
1575 1576
    double pts;
1576 1577

  
......
1578 1579
        /* NOTE: the audio packet can contain several frames */
1579 1580
        while (is->audio_pkt_size > 0) {
1580 1581
            data_size = buf_size;
1581
            len1 = avcodec_decode_audio2(is->audio_st->codec,
1582
            len1 = avcodec_decode_audio2(dec,
1582 1583
                                        (int16_t *)audio_buf, &data_size,
1583 1584
                                        is->audio_pkt_data, is->audio_pkt_size);
1584 1585
            if (len1 < 0) {
......
1594 1595
            /* if no pts, then compute it */
1595 1596
            pts = is->audio_clock;
1596 1597
            *pts_ptr = pts;
1597
            n = 2 * is->audio_st->codec->channels;
1598
            n = 2 * dec->channels;
1598 1599
            is->audio_clock += (double)data_size /
1599
                (double)(n * is->audio_st->codec->sample_rate);
1600
                (double)(n * dec->sample_rate);
1600 1601
#if defined(DEBUG_SYNC)
1601 1602
            {
1602 1603
                static double last_clock;
......
1621 1622
        if (packet_queue_get(&is->audioq, pkt, 1) < 0)
1622 1623
            return -1;
1623 1624
        if(pkt->data == flush_pkt.data){
1624
            avcodec_flush_buffers(is->audio_st->codec);
1625
            avcodec_flush_buffers(dec);
1625 1626
            continue;
1626 1627
        }
1627 1628

  

Also available in: Unified diff