Revision 15957b19 libavformat/utils.c

View differences:

libavformat/utils.c
689 689
        if (pktl) {
690 690
            *pkt = pktl->pkt;
691 691
            if(s->streams[pkt->stream_index]->codec->codec_id != CODEC_ID_PROBE ||
692
               !s->streams[pkt->stream_index]->probe_packets ||
693
               s->raw_packet_buffer_remaining_size < pkt->size){
694
                AVProbeData *pd = &s->streams[pkt->stream_index]->probe_data;
695
                av_freep(&pd->buf);
696
                pd->buf_size = 0;
692
               !s->streams[pkt->stream_index]->probe_packets){
697 693
                s->raw_packet_buffer = pktl->next;
698 694
                s->raw_packet_buffer_remaining_size += pkt->size;
699 695
                av_free(pktl);
......
731 727
        add_to_pktbuf(&s->raw_packet_buffer, pkt, &s->raw_packet_buffer_end);
732 728
        s->raw_packet_buffer_remaining_size -= pkt->size;
733 729

  
734
        if(st->codec->codec_id == CODEC_ID_PROBE){
730
        if(st->codec->codec_id == CODEC_ID_PROBE && st->probe_packets){
735 731
            AVProbeData *pd = &st->probe_data;
736
            av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);
732
            int end;
733
            av_log(s, AV_LOG_DEBUG, "probing stream %d pp:%d\n", st->index, st->probe_packets);
737 734
            --st->probe_packets;
738 735

  
739 736
            pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
......
741 738
            pd->buf_size += pkt->size;
742 739
            memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
743 740

  
744
            if(av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)){
745
                //FIXME we dont reduce score to 0 for the case of running out of buffer space in bytes
746
                set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);
747
                if(st->codec->codec_id != CODEC_ID_PROBE){
741
            end=    s->raw_packet_buffer_remaining_size <= 0
742
                 || st->probe_packets<=0;
743

  
744
            if(end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)){
745
                set_codec_from_probe_data(s, st, pd, end ? 0 : AVPROBE_SCORE_MAX/4);
746
                if(st->codec->codec_id != CODEC_ID_PROBE || end){
748 747
                    pd->buf_size=0;
749 748
                    av_freep(&pd->buf);
749
                    st->probe_packets= 0;
750
                    if(st->codec->codec_id != CODEC_ID_PROBE){
750 751
                    av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index);
752
                    }else
753
                        av_log(s, AV_LOG_WARNING, "probed stream %d failed\n", st->index);
751 754
                }
752 755
            }
753 756
        }

Also available in: Unified diff