diff options
author | Marton Balint <cus@passwd.hu> | 2021-02-09 22:24:50 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2021-03-12 23:55:30 +0100 |
commit | 1a90cf4410a3464c8d749242e23629776f310ee0 (patch) | |
tree | 29e9f37ea37029c880933fa0508e26d6fbfd283d /libavdevice/alsa.c | |
parent | 6e7e3a3820f0888ff92d6be44f40ff733bcce874 (diff) |
avdevice/alsa_dec: make sure we have enough data in non-blocking mode
Otherwise we might return 1-2 samples per packet if av_read_frame() call rate is
only sligthly less than the stream sample rate.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavdevice/alsa.c')
-rw-r--r-- | libavdevice/alsa.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c index 117b2ea144..ee282fac16 100644 --- a/libavdevice/alsa.c +++ b/libavdevice/alsa.c @@ -286,6 +286,10 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode, } } + s->pkt = av_packet_alloc(); + if (!s->pkt) + goto fail1; + s->h = h; return 0; @@ -308,6 +312,7 @@ av_cold int ff_alsa_close(AVFormatContext *s1) if (CONFIG_ALSA_INDEV) ff_timefilter_destroy(s->timefilter); snd_pcm_close(s->h); + av_packet_free(&s->pkt); return 0; } |