Commit ab07cdd4 authored by Max Kellermann's avatar Max Kellermann

ffmpeg: removed loop from mpd_ffmpeg_read()

The function decoder_read() already cares about the decoder command, and loops until data is available. Reduced mpd_ffmpeg_read() to no more than the decoder_read() call.
parent 292334a2
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
#include "../decoder_api.h" #include "../decoder_api.h"
#include "../log.h" #include "../log.h"
#include "../utils.h"
#include "../log.h"
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
...@@ -84,19 +82,8 @@ static int mpd_ffmpeg_read(URLContext *h, unsigned char *buf, int size) ...@@ -84,19 +82,8 @@ static int mpd_ffmpeg_read(URLContext *h, unsigned char *buf, int size)
{ {
struct ffmpeg_stream *stream = (struct ffmpeg_stream *) h->priv_data; struct ffmpeg_stream *stream = (struct ffmpeg_stream *) h->priv_data;
while (true) { return decoder_read(stream->decoder, stream->input,
size_t ret = decoder_read(stream->decoder, stream->input, (void *)buf, size);
(void *)buf, size);
if (ret > 0)
return ret;
if (input_stream_eof(stream->input) ||
(stream->decoder &&
decoder_get_command(stream->decoder) != DECODE_COMMAND_NONE))
return 0;
my_usleep(10000);
}
} }
static int64_t mpd_ffmpeg_seek(URLContext *h, int64_t pos, int whence) static int64_t mpd_ffmpeg_seek(URLContext *h, int64_t pos, int whence)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment