Revision 0fe99630 chunker_streamer/chunker_streamer.c
chunker_streamer/chunker_streamer.c | ||
---|---|---|
612 | 612 |
#ifdef DEBUG_ANOMALIES |
613 | 613 |
fprintf(stderr, "\n\n\t\t************************* SKIPPING VIDEO FRAME %ld ***********************************\n\n", sleep); |
614 | 614 |
#endif |
615 |
av_free_packet(&packet); |
|
615 | 616 |
continue; |
616 | 617 |
} |
617 | 618 |
} |
... | ... | |
651 | 652 |
{ |
652 | 653 |
//a Dts with a noPts value is troublesome case for delta calculation based on Dts |
653 | 654 |
contFrameVideo = STREAMER_MAX(contFrameVideo-1, 0); |
655 |
av_free_packet(&packet); |
|
654 | 656 |
continue; |
655 | 657 |
} |
656 | 658 |
last_pkt_dts = packet.dts; |
... | ... | |
665 | 667 |
{ |
666 | 668 |
//a Dts with a noPts value is troublesome case for delta calculation based on Dts |
667 | 669 |
contFrameVideo = STREAMER_MAX(contFrameVideo-1, 0); |
670 |
av_free_packet(&packet); |
|
668 | 671 |
continue; |
669 | 672 |
} |
670 | 673 |
} |
... | ... | |
676 | 679 |
video_frame_size = packet.size; |
677 | 680 |
if (video_frame_size > video_outbuf_size) { |
678 | 681 |
fprintf(stderr, "VIDEO: error, outbuf too small, SKIPPING\n");; |
682 |
av_free_packet(&packet); |
|
679 | 683 |
continue; |
680 | 684 |
} else { |
681 | 685 |
memcpy(video_outbuf, packet.data, video_frame_size); |
... | ... | |
701 | 705 |
if(video_frame_size <= 0) |
702 | 706 |
{ |
703 | 707 |
contFrameVideo = STREAMER_MAX(contFrameVideo-1, 0); |
708 |
av_free_packet(&packet); |
|
704 | 709 |
continue; |
705 | 710 |
} |
706 | 711 |
|
... | ... | |
720 | 725 |
else |
721 | 726 |
{ |
722 | 727 |
contFrameVideo = STREAMER_MAX(contFrameVideo-1, 0); |
728 |
av_free_packet(&packet); |
|
723 | 729 |
continue; |
724 | 730 |
} |
725 | 731 |
|
... | ... | |
766 | 772 |
fprintf(stderr, "READLOOP: NEWTIME negative video timestamp anomaly detected number %d\n", newtime_anomalies_counter); |
767 | 773 |
#endif |
768 | 774 |
contFrameVideo = STREAMER_MAX(contFrameVideo-1, 0); |
775 |
av_free_packet(&packet); |
|
769 | 776 |
continue; //SKIP THIS FRAME, bad timestamp |
770 | 777 |
} |
771 | 778 |
|
... | ... | |
906 | 913 |
/* if a frame has been decoded, output it */ |
907 | 914 |
//fwrite(samples, 1, audio_data_size, outfileaudio); |
908 | 915 |
} |
909 |
else |
|
916 |
else { |
|
917 |
av_free_packet(&packet); |
|
910 | 918 |
continue; |
919 |
} |
|
911 | 920 |
|
912 | 921 |
audio_frame_size = avcodec_encode_audio(aCodecCtxEnc, audio_outbuf, audio_data_size, samples); |
913 |
if(audio_frame_size <= 0) |
|
922 |
if(audio_frame_size <= 0) { |
|
923 |
av_free_packet(&packet); |
|
914 | 924 |
continue; |
925 |
} |
|
915 | 926 |
|
916 | 927 |
frame->number = contFrameAudio; |
917 | 928 |
|
918 | 929 |
if(frame->number==0) { |
919 |
if(packet.dts==AV_NOPTS_VALUE) |
|
930 |
if(packet.dts==AV_NOPTS_VALUE) { |
|
931 |
av_free_packet(&packet); |
|
920 | 932 |
continue; |
933 |
} |
|
921 | 934 |
last_pkt_dts_audio = packet.dts; |
922 | 935 |
newTime = 0; |
923 | 936 |
} |
... | ... | |
926 | 939 |
delta_audio = packet.dts-last_pkt_dts_audio; |
927 | 940 |
last_pkt_dts_audio = packet.dts; |
928 | 941 |
} |
929 |
else if(delta_audio==0) |
|
942 |
else if(delta_audio==0) { |
|
943 |
av_free_packet(&packet); |
|
930 | 944 |
continue; |
945 |
} |
|
931 | 946 |
} |
932 | 947 |
#ifdef DEBUG_AUDIO_FRAMES |
933 | 948 |
fprintf(stderr, "AUDIO: original codec frame number %d vs. encoded %d vs. packed %d\n", aCodecCtx->frame_number, aCodecCtxEnc->frame_number, frame->number); |
... | ... | |
935 | 950 |
//use pts if dts is invalid |
936 | 951 |
if(packet.dts!=AV_NOPTS_VALUE) |
937 | 952 |
target_pts = packet.dts; |
938 |
else if(packet.pts!=AV_NOPTS_VALUE) |
|
953 |
else if(packet.pts!=AV_NOPTS_VALUE) {
|
|
939 | 954 |
target_pts = packet.pts; |
940 |
else |
|
955 |
} else { |
|
956 |
av_free_packet(&packet); |
|
941 | 957 |
continue; |
958 |
} |
|
942 | 959 |
|
943 | 960 |
if(!offset_av) |
944 | 961 |
{ |
... | ... | |
982 | 999 |
#ifdef DEBUG_ANOMALIES |
983 | 1000 |
fprintf(stderr, "READLOOP: NEWTIME negative audio timestamp anomaly detected number %d\n", newtime_anomalies_counter); |
984 | 1001 |
#endif |
1002 |
av_free_packet(&packet); |
|
985 | 1003 |
continue; //SKIP THIS FRAME, bad timestamp |
986 | 1004 |
} |
987 | 1005 |
|
Also available in: Unified diff