]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/fifo.c
lavf/matroskaenc: return an error for unsupported types.
[ffmpeg] / libavfilter / fifo.c
index ba72cca07f3c96049857c52a9948ed16bdf067dc..b06720ec17b14e832c3acdc3456cc81eafcd624c 100644 (file)
@@ -183,8 +183,25 @@ static int return_audio_frame(AVFilterContext *ctx)
         }
 
         while (s->out->nb_samples < s->allocated_samples) {
-            int len = FFMIN(s->allocated_samples - s->out->nb_samples,
-                            head->nb_samples);
+            int len;
+
+            if (!s->root.next) {
+                ret = ff_request_frame(ctx->inputs[0]);
+                if (ret == AVERROR_EOF) {
+                    av_samples_set_silence(s->out->extended_data,
+                                           s->out->nb_samples,
+                                           s->allocated_samples -
+                                           s->out->nb_samples,
+                                           nb_channels, link->format);
+                    s->out->nb_samples = s->allocated_samples;
+                    break;
+                } else if (ret < 0)
+                    return ret;
+            }
+            head = s->root.next->frame;
+
+            len = FFMIN(s->allocated_samples - s->out->nb_samples,
+                        head->nb_samples);
 
             av_samples_copy(s->out->extended_data, head->extended_data,
                             s->out->nb_samples, 0, len, nb_channels,
@@ -194,21 +211,6 @@ static int return_audio_frame(AVFilterContext *ctx)
             if (len == head->nb_samples) {
                 av_frame_free(&head);
                 queue_pop(s);
-
-                if (!s->root.next &&
-                    (ret = ff_request_frame(ctx->inputs[0])) < 0) {
-                    if (ret == AVERROR_EOF) {
-                        av_samples_set_silence(s->out->extended_data,
-                                               s->out->nb_samples,
-                                               s->allocated_samples -
-                                               s->out->nb_samples,
-                                               nb_channels, link->format);
-                        s->out->nb_samples = s->allocated_samples;
-                        break;
-                    }
-                    return ret;
-                }
-                head = s->root.next->frame;
             } else {
                 buffer_offset(link, head, len);
             }