Revision 70b462cc libavformat/bink.c

View differences:

libavformat/bink.c
212 212
        bink->current_track++;
213 213
        if (audio_size >= 4) {
214 214
            /* get one audio packet per track */
215
            if ((ret = av_get_packet(pb, pkt, audio_size)) != audio_size)
216
                return ret < 0 ? ret : AVERROR(EIO);;
215
            if ((ret = av_get_packet(pb, pkt, audio_size)) < 0)
216
                return ret;
217 217
            pkt->stream_index = bink->current_track;
218 218
            pkt->pts = bink->audio_pts[bink->current_track - 1];
219 219

  
220 220
            /* Each audio packet reports the number of decompressed samples
221 221
               (in bytes). We use this value to calcuate the audio PTS */
222
            bink->audio_pts[bink->current_track -1] +=
223
                AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels);
222
            if (pkt->size >= 4)
223
                bink->audio_pts[bink->current_track -1] +=
224
                    AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels);
224 225
            return 0;
225 226
        } else {
226 227
            url_fseek(pb, audio_size, SEEK_CUR);
......
228 229
    }
229 230

  
230 231
    /* get video packet */
231
    if ((ret = av_get_packet(pb, pkt, bink->remain_packet_size))
232
                                   != bink->remain_packet_size)
233
        return ret < 0 ? ret : AVERROR(EIO);
232
    if ((ret = av_get_packet(pb, pkt, bink->remain_packet_size)) < 0)
233
        return ret;
234 234
    pkt->stream_index = 0;
235 235
    pkt->pts = bink->video_pts++;
236 236
    pkt->flags |= PKT_FLAG_KEY;

Also available in: Unified diff