diff libmpcodecs/ad_ffmpeg.c @ 32496:5376d7337fcf

Handle EAGAIN in ad_ffmpeg, this is necessary for LATM to work properly with native TS demuxer.
author reimar
date Sat, 06 Nov 2010 15:48:21 +0000
parents b33aed46ecda
children 414aaa8b9357
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c	Sat Nov 06 15:41:44 2010 +0000
+++ b/libmpcodecs/ad_ffmpeg.c	Sat Nov 06 15:48:21 2010 +0000
@@ -234,6 +234,9 @@
 	}
 	y=avcodec_decode_audio3(sh_audio->context,(int16_t*)buf,&len2,&pkt);
 //printf("return:%d samples_out:%d bitstream_in:%d sample_sum:%d\n", y, len2, x, len); fflush(stdout);
+	// LATM may need many packets to find mux info
+	if (y == AVERROR(EAGAIN))
+	    continue;
 	if(y<0){ mp_msg(MSGT_DECAUDIO,MSGL_V,"lavc_audio: error\n");break; }
 	if(!sh_audio->parser && y<x)
 	    sh_audio->ds->buffer_pos+=y-x;  // put back data (HACK!)