output/recorder, test/*: invoke encoder_read() after _open()

Make sure the file header gets written at the beginning, before
_write() gets called.
This commit is contained in:
Max Kellermann
2012-10-01 23:17:13 +02:00
parent 674b4ab647
commit 43d8252050
4 changed files with 15 additions and 0 deletions

View File

@@ -119,6 +119,10 @@ encoder_finish(struct encoder *encoder)
* Before you free it, you must call encoder_close(). You may open
* and close (reuse) one encoder any number of times.
*
* After this function returns successfully and before the first
* encoder_write() call, you should invoke encoder_read() to obtain
* the file header.
*
* @param encoder the encoder
* @param audio_format the encoder's input audio format; the plugin
* may modify the struct to adapt it to its abilities

View File

@@ -192,6 +192,13 @@ recorder_output_open(struct audio_output *ao,
return false;
}
if (!recorder_output_encoder_to_file(recorder, error_r)) {
encoder_close(recorder->encoder);
close(recorder->fd);
unlink(recorder->path);
return false;
}
return true;
}