Unified · Split
| @@ -187,9 +187,16 @@ static int read_packet(AVFormatContext* ctx, AVPacket *pkt) · 186 unmodified lines | |||
| 187 | const char *error_msg; | 187 | const char *error_msg; |
| 188 | ALCint nb_samples; | 188 | ALCint nb_samples; |
| 189 | 189 | ||
| 190 | /* Get number of samples available */ | 190 | for (;;) { |
| 191 | alcGetIntegerv(ad->device, ALC_CAPTURE_SAMPLES, (ALCsizei) sizeof(ALCint), &nb_samples); | 191 | /* Get number of samples available */ |
| 192 | if (error = al_get_error(ad->device, &error_msg)) goto fail; | 192 | alcGetIntegerv(ad->device, ALC_CAPTURE_SAMPLES, (ALCsizei) sizeof(ALCint), &nb_samples); |
| 193 | if (error = al_get_error(ad->device, &error_msg)) goto fail; | ||
| 194 | if (nb_samples > 0) | ||
| 195 | break; | ||
| 196 | if (ctx->flags & AVFMT_FLAG_NONBLOCK) | ||
| 197 | return AVERROR(EAGAIN); | ||
| 198 | av_usleep(1000); | ||
| 199 | } | ||
| 193 | 200 | ||
| 194 | /* Create a packet of appropriate size */ | 201 | /* Create a packet of appropriate size */ |
| 195 | if ((error = av_new_packet(pkt, nb_samples*ad->sample_step)) < 0) | 202 | if ((error = av_new_packet(pkt, nb_samples*ad->sample_step)) < 0) |