On Thu, 18 Sep 2014, Reinhard Tartler wrote:

From: Timothy Gu <[email protected]>

Also add a note about SNDCTL_DSP_GETFMTS which may fail even if OSS is
available.

Fixes: CID 1238992
Signed-off-by: Timothy Gu <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>
Reviewed-by: Luca Barbato <[email protected]>
Signed-off-by: Reinhard Tartler <[email protected]>
---
libavdevice/oss_audio.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index ad52d78..ed5f695 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -48,6 +48,7 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output,
    int audio_fd;
    int tmp, err;
    char *flip = getenv("AUDIO_FLIP_LEFT");
+    char errbuff[50];

    if (is_output)
        audio_fd = avpriv_open(audio_device, O_WRONLY);
@@ -68,8 +69,18 @@ int ff_oss_audio_open(AVFormatContext *s1, int is_output,

    s->frame_size = OSS_AUDIO_BLOCK_SIZE;

-    /* select format : favour native format */
-    err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
+#define CHECK_IOCTL_ERROR(event)                                              \
+    if (err < 0) {                                                            \
+        av_strerror(errno, errbuff, sizeof(errbuff));                         \

You need to use AVERROR() around errno here, to map the errno code to the right range for av_strerror.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to