summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2020-05-06 13:01:57 -0700
committerJames Zern <jzern@google.com>2020-05-07 17:15:42 -0700
commitcbc276a3d4e3ff91d155e6f0d66f9033cec8b32b (patch)
tree6ef2a68989652cc9eaf7d451ce21fccb87b5c684 /examples
parentb130f71bf0c9eb0911fc27b17fc543366ceffc3e (diff)
downloadlibvpx-cbc276a3d4e3ff91d155e6f0d66f9033cec8b32b.tar
libvpx-cbc276a3d4e3ff91d155e6f0d66f9033cec8b32b.tar.gz
libvpx-cbc276a3d4e3ff91d155e6f0d66f9033cec8b32b.tar.bz2
libvpx-cbc276a3d4e3ff91d155e6f0d66f9033cec8b32b.zip
examples: use die() on dec/enc_init() failure
rather than die_codec(). calling any api functions with an uninitialized codec context is undefined. this avoids a crash in a call to vpx_codec_error_detail(). BUG=webm:1688 Change-Id: I4a4feeabc1cafa44c8d2f24587fad79e313dba6d
Diffstat (limited to 'examples')
-rw-r--r--examples/decode_with_drops.c2
-rw-r--r--examples/postproc.c4
-rw-r--r--examples/set_maps.c2
-rw-r--r--examples/simple_decoder.c2
-rw-r--r--examples/simple_encoder.c2
-rw-r--r--examples/twopass_encoder.c4
-rw-r--r--examples/vp8cx_set_ref.c2
-rw-r--r--examples/vp9_lossless_encoder.c2
-rw-r--r--examples/vp9cx_set_ref.c2
-rw-r--r--examples/vpx_temporal_svc_encoder.c2
10 files changed, 12 insertions, 12 deletions
diff --git a/examples/decode_with_drops.c b/examples/decode_with_drops.c
index e69e2a9f9..03c79a456 100644
--- a/examples/decode_with_drops.c
+++ b/examples/decode_with_drops.c
@@ -106,7 +106,7 @@ int main(int argc, char **argv) {
printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0))
- die_codec(&codec, "Failed to initialize decoder.");
+ die("Failed to initialize decoder.");
while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL;
diff --git a/examples/postproc.c b/examples/postproc.c
index 15713b946..be999b429 100644
--- a/examples/postproc.c
+++ b/examples/postproc.c
@@ -86,9 +86,9 @@ int main(int argc, char **argv) {
res = vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL,
VPX_CODEC_USE_POSTPROC);
if (res == VPX_CODEC_INCAPABLE)
- die_codec(&codec, "Postproc not supported by this decoder.");
+ die("Postproc not supported by this decoder.");
- if (res) die_codec(&codec, "Failed to initialize decoder.");
+ if (res) die("Failed to initialize decoder.");
while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL;
diff --git a/examples/set_maps.c b/examples/set_maps.c
index c0c7d10e7..867e473ae 100644
--- a/examples/set_maps.c
+++ b/examples/set_maps.c
@@ -209,7 +209,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", argv[4]);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
+ die("Failed to initialize encoder");
// Encode frames.
while (vpx_img_read(&raw, infile)) {
diff --git a/examples/simple_decoder.c b/examples/simple_decoder.c
index 2bb1a0524..d089e826d 100644
--- a/examples/simple_decoder.c
+++ b/examples/simple_decoder.c
@@ -118,7 +118,7 @@ int main(int argc, char **argv) {
printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0))
- die_codec(&codec, "Failed to initialize decoder.");
+ die("Failed to initialize decoder.");
while (vpx_video_reader_read_frame(reader)) {
vpx_codec_iter_t iter = NULL;
diff --git a/examples/simple_encoder.c b/examples/simple_encoder.c
index dde6344f8..dffdd6d7d 100644
--- a/examples/simple_encoder.c
+++ b/examples/simple_encoder.c
@@ -218,7 +218,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", infile_arg);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
+ die("Failed to initialize encoder");
// Encode frames.
while (vpx_img_read(&raw, infile)) {
diff --git a/examples/twopass_encoder.c b/examples/twopass_encoder.c
index 4e63a7a6c..3d950b2c4 100644
--- a/examples/twopass_encoder.c
+++ b/examples/twopass_encoder.c
@@ -128,7 +128,7 @@ static vpx_fixed_buf_t pass0(vpx_image_t *raw, FILE *infile,
vpx_fixed_buf_t stats = { NULL, 0 };
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
+ die("Failed to initialize encoder");
// Calculate frame statistics.
while (vpx_img_read(raw, infile)) {
@@ -164,7 +164,7 @@ static void pass1(vpx_image_t *raw, FILE *infile, const char *outfile_name,
if (!writer) die("Failed to open %s for writing", outfile_name);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
+ die("Failed to initialize encoder");
// Encode frames.
while (vpx_img_read(raw, infile)) {
diff --git a/examples/vp8cx_set_ref.c b/examples/vp8cx_set_ref.c
index 846477c61..ca528f9e9 100644
--- a/examples/vp8cx_set_ref.c
+++ b/examples/vp8cx_set_ref.c
@@ -155,7 +155,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", argv[3]);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
+ die("Failed to initialize encoder");
// Encode frames.
while (vpx_img_read(&raw, infile)) {
diff --git a/examples/vp9_lossless_encoder.c b/examples/vp9_lossless_encoder.c
index cb5ca6bfe..c4eb3a8b1 100644
--- a/examples/vp9_lossless_encoder.c
+++ b/examples/vp9_lossless_encoder.c
@@ -110,7 +110,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", argv[3]);
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
- die_codec(&codec, "Failed to initialize encoder");
+ die("Failed to initialize encoder");
if (vpx_codec_control_(&codec, VP9E_SET_LOSSLESS, 1))
die_codec(&codec, "Failed to use lossless mode");
diff --git a/examples/vp9cx_set_ref.c b/examples/vp9cx_set_ref.c
index 911ad3863..1a0823153 100644
--- a/examples/vp9cx_set_ref.c
+++ b/examples/vp9cx_set_ref.c
@@ -251,7 +251,7 @@ int main(int argc, char **argv) {
die("Failed to open %s for reading.", infile_arg);
if (vpx_codec_enc_init(&ecodec, encoder->codec_interface(), &cfg, 0))
- die_codec(&ecodec, "Failed to initialize encoder");
+ die("Failed to initialize encoder");
// Disable alt_ref.
if (vpx_codec_control(&ecodec, VP8E_SET_ENABLEAUTOALTREF, 0))
diff --git a/examples/vpx_temporal_svc_encoder.c b/examples/vpx_temporal_svc_encoder.c
index 925043d10..872751cef 100644
--- a/examples/vpx_temporal_svc_encoder.c
+++ b/examples/vpx_temporal_svc_encoder.c
@@ -815,7 +815,7 @@ int main(int argc, char **argv) {
#else
if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
#endif // CONFIG_VP9_HIGHBITDEPTH
- die_codec(&codec, "Failed to initialize encoder");
+ die("Failed to initialize encoder");
if (strncmp(encoder->name, "vp8", 3) == 0) {
vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed);