Mercurial > mplayer.hg
comparison libmpdemux/audio_in.c @ 7586:d12421dd1265
this patch adds an ability to recover from audio buffer cross-run by Jindrich Makovicka <makovick@kmlinux.fjfi.cvut.cz>
author | alex |
---|---|
date | Wed, 02 Oct 2002 16:56:54 +0000 |
parents | c4434bdf6e51 |
children | ef4046febd24 |
comparison
equal
deleted
inserted
replaced
7585:cfd6a99021ac | 7586:d12421dd1265 |
---|---|
107 #ifdef HAVE_ALSA9 | 107 #ifdef HAVE_ALSA9 |
108 case AUDIO_IN_ALSA: | 108 case AUDIO_IN_ALSA: |
109 if (ai->alsa.device) free(ai->alsa.device); | 109 if (ai->alsa.device) free(ai->alsa.device); |
110 ai->alsa.device = strdup(device); | 110 ai->alsa.device = strdup(device); |
111 /* mplayer cannot handle colons in arguments */ | 111 /* mplayer cannot handle colons in arguments */ |
112 for (i = 0; i < strlen(ai->alsa.device); i++) { | 112 for (i = 0; i < (int)strlen(ai->alsa.device); i++) { |
113 if (ai->alsa.device[i] == '.') ai->alsa.device[i] = ':'; | 113 if (ai->alsa.device[i] == '.') ai->alsa.device[i] = ':'; |
114 } | 114 } |
115 return 0; | 115 return 0; |
116 #endif | 116 #endif |
117 case AUDIO_IN_OSS: | 117 case AUDIO_IN_OSS: |
169 case AUDIO_IN_ALSA: | 169 case AUDIO_IN_ALSA: |
170 ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size); | 170 ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size); |
171 if (ret != ai->alsa.chunk_size) { | 171 if (ret != ai->alsa.chunk_size) { |
172 if (ret < 0) { | 172 if (ret < 0) { |
173 mp_msg(MSGT_TV, MSGL_ERR, "\nerror reading audio: %s\n", snd_strerror(ret)); | 173 mp_msg(MSGT_TV, MSGL_ERR, "\nerror reading audio: %s\n", snd_strerror(ret)); |
174 if (ret == -EPIPE) { | |
175 if (ai_alsa_xrun(ai) == 0) { | |
176 mp_msg(MSGT_TV, MSGL_ERR, "Recovered from cross-run, some frames may be left out!\n"); | |
177 } else { | |
178 mp_msg(MSGT_TV, MSGL_ERR, "Fatal error, cannot recover!\n"); | |
179 } | |
180 } | |
174 } else { | 181 } else { |
175 mp_msg(MSGT_TV, MSGL_ERR, "\nnot enough audio samples!\n"); | 182 mp_msg(MSGT_TV, MSGL_ERR, "\nnot enough audio samples!\n"); |
176 } | 183 } |
177 return -1; | 184 return -1; |
178 } | 185 } |