History

lavd/openal: don't return zero sized packet if no samples are available

Marton Balint committed 10 years ago

Commit fbf8ac71 parent 2face3e1 file · +10 −3Browse files

Showing the changes to libavdevice (1 of 1 file). Show all

Unified · Split

libavdevice/openal-dec.c+10−3
@@ -187,9 +187,16 @@ static int read_packet(AVFormatContext* ctx, AVPacket *pkt) · 186 unmodified lines
187187 const char *error_msg;
188188 ALCint nb_samples;
189189
190− /* Get number of samples available */
191− alcGetIntegerv(ad->device, ALC_CAPTURE_SAMPLES, (ALCsizei) sizeof(ALCint), &nb_samples);
192− if (error = al_get_error(ad->device, &error_msg)) goto fail;
190+ for (;;) {
191+ /* Get number of samples available */
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+ }
193200
194201 /* Create a packet of appropriate size */
195202 if ((error = av_new_packet(pkt, nb_samples*ad->sample_step)) < 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t