aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/decoder_api.c')
-rw-r--r--src/decoder_api.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c
index cb1052f5c..20e976e69 100644
--- a/src/decoder_api.c
+++ b/src/decoder_api.c
@@ -183,25 +183,19 @@ size_t decoder_read(struct decoder *decoder,
if (length == 0)
return 0;
- while (true) {
- if (decoder_check_cancel_read(decoder))
- return 0;
-
- nbytes = input_stream_read(is, buffer, length, &error);
-
- if (G_UNLIKELY(nbytes == 0 && error != NULL)) {
- g_warning("%s", error->message);
- g_error_free(error);
- return 0;
- }
+ if (decoder_check_cancel_read(decoder))
+ return 0;
- if (nbytes > 0 || input_stream_eof(is))
- return nbytes;
+ nbytes = input_stream_read(is, buffer, length, &error);
+ assert(nbytes == 0 || error == NULL);
+ assert(nbytes > 0 || error != NULL || input_stream_eof(is));
- /* sleep for a fraction of a second! */
- /* XXX don't sleep, wait for an event instead */
- g_usleep(10000);
+ if (G_UNLIKELY(nbytes == 0 && error != NULL)) {
+ g_warning("%s", error->message);
+ g_error_free(error);
}
+
+ return nbytes;
}
void