Imported Upstream version 0.6.2
[fdkaac.git] / src / main.c
index f4ecd756be0e238a9f6456a2c0a7ee7b09337f4c..6ffb7b197cc6228a6fbc5d18d2f9f5fd0433ac98 100644 (file)
@@ -563,11 +563,20 @@ int encode(aacenc_param_ex_t *params, pcm_reader_t *reader,
             ++encoded;
             if (encoded == 1 || encoded == 3)
                 continue;
-            obp = &obuf[flip];
-            if (write_sample(params->output_fp, m4af, obp) < 0)
+
+            if (write_sample(params->output_fp, m4af, &obuf[flip]) < 0)
                 goto END;
             ++frames_written;
         } while (remaining > 0);
+        /*
+         * When interrupted, we haven't pulled out last extrapolated frames
+         * from the reader. Therefore, we have to write the final outcome.
+         */
+        if (g_interrupted) {
+            if (write_sample(params->output_fp, m4af, &obp[flip^1]) < 0)
+                goto END;
+            ++frames_written;
+        }
     }
 DONE:
     if (!params->silent)
This page took 0.009174 seconds and 4 git commands to generate.