diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-11-27 13:37:53 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-11-27 13:37:53 +0000 |
commit | fed0c2fb71bdaed366ba5118dcbd487f22fa44c9 (patch) | |
tree | 7622a9be2862d8f72cd06293abe80bf923fd1a50 /libavdevice/oss_audio.c | |
parent | 6866dd12379d2a834f478c7d84a7fcb7615bbc91 (diff) | |
download | ffmpeg-fed0c2fb71bdaed366ba5118dcbd487f22fa44c9.tar.gz |
Replace very odd and completely broken oss read_packet() by the obvious way to
read.
Fixes issue348.
Originally committed as revision 20629 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavdevice/oss_audio.c')
-rw-r--r-- | libavdevice/oss_audio.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c index ed1a7a14a8..8876bd2d24 100644 --- a/libavdevice/oss_audio.c +++ b/libavdevice/oss_audio.c @@ -250,32 +250,13 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) if (av_new_packet(pkt, s->frame_size) < 0) return AVERROR(EIO); - for(;;) { - struct timeval tv; - fd_set fds; - - tv.tv_sec = 0; - tv.tv_usec = 30 * 1000; /* 30 msecs -- a bit shorter than 1 frame at 30fps */ - - FD_ZERO(&fds); - FD_SET(s->fd, &fds); - - /* This will block until data is available or we get a timeout */ - (void) select(s->fd + 1, &fds, 0, 0, &tv); ret = read(s->fd, pkt->data, pkt->size); - if (ret > 0) - break; - if (ret == -1 && (errno == EAGAIN || errno == EINTR)) { - av_free_packet(pkt); - pkt->size = 0; - pkt->pts = av_gettime(); - return 0; - } - if (!(ret == 0 || (ret == -1 && (errno == EAGAIN || errno == EINTR)))) { - av_free_packet(pkt); - return AVERROR(EIO); - } + if (ret <= 0){ + av_free_packet(pkt); + pkt->size = 0; + if (ret<0) return AVERROR(errno); + else return AVERROR(EOF); } pkt->size = ret; |