aomenc/webmenc: Check for errors.
Test for errors returned by mkvmuxer instead of
taking it on faith that all API calls always work.
Change-Id: Icfa1be7c2f1d37cfb339ecab45ab66625266b109
diff --git a/apps/aomenc.c b/apps/aomenc.c
index 8b5b621..6b2e3e0 100644
--- a/apps/aomenc.c
+++ b/apps/aomenc.c
@@ -1470,9 +1470,11 @@
#if CONFIG_WEBM_IO
if (stream->config.write_webm) {
stream->webm_ctx.stream = stream->file;
- write_webm_file_header(&stream->webm_ctx, &stream->encoder, cfg,
- stream->config.stereo_fmt, global->codec->fourcc,
- pixel_aspect_ratio);
+ if (write_webm_file_header(&stream->webm_ctx, &stream->encoder, cfg,
+ stream->config.stereo_fmt, global->codec->fourcc,
+ pixel_aspect_ratio) != 0) {
+ fatal("WebM writer initialization failed.");
+ }
}
#else
(void)pixel_aspect_ratio;
@@ -1491,7 +1493,9 @@
#if CONFIG_WEBM_IO
if (stream->config.write_webm) {
- write_webm_file_footer(&stream->webm_ctx);
+ if (write_webm_file_footer(&stream->webm_ctx) != 0) {
+ fatal("WebM writer finalization failed.");
+ }
}
#endif
@@ -1714,7 +1718,9 @@
update_rate_histogram(stream->rate_hist, cfg, pkt);
#if CONFIG_WEBM_IO
if (stream->config.write_webm) {
- write_webm_block(&stream->webm_ctx, cfg, pkt);
+ if (write_webm_block(&stream->webm_ctx, cfg, pkt) != 0) {
+ fatal("WebM writer failed.");
+ }
}
#endif
if (!stream->config.write_webm) {