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
Unified · Split
| @@ -106,7 +106,7 @@ int main(int argc, char **argv) { · 105 unmodified lines | ||
| 106 | 106 | printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface())); |
| 107 | 107 | |
| 108 | 108 | if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0)) |
| 109 | − die_codec(&codec, "Failed to initialize decoder."); | |
| 109 | + die("Failed to initialize decoder."); | |
| 110 | 110 | |
| 111 | 111 | while (vpx_video_reader_read_frame(reader)) { |
| 112 | 112 | vpx_codec_iter_t iter = NULL; |
| @@ -86,9 +86,9 @@ int main(int argc, char **argv) { · 85 unmodified lines | ||
| 86 | 86 | res = vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, |
| 87 | 87 | VPX_CODEC_USE_POSTPROC); |
| 88 | 88 | if (res == VPX_CODEC_INCAPABLE) |
| 89 | − die_codec(&codec, "Postproc not supported by this decoder."); | |
| 89 | + die("Postproc not supported by this decoder."); | |
| 90 | 90 | |
| 91 | − if (res) die_codec(&codec, "Failed to initialize decoder."); | |
| 91 | + if (res) die("Failed to initialize decoder."); | |
| 92 | 92 | |
| 93 | 93 | while (vpx_video_reader_read_frame(reader)) { |
| 94 | 94 | vpx_codec_iter_t iter = NULL; |
| @@ -209,7 +209,7 @@ int main(int argc, char **argv) { · 208 unmodified lines | ||
| 209 | 209 | die("Failed to open %s for reading.", argv[4]); |
| 210 | 210 | |
| 211 | 211 | if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) |
| 212 | − die_codec(&codec, "Failed to initialize encoder"); | |
| 212 | + die("Failed to initialize encoder"); | |
| 213 | 213 | |
| 214 | 214 | // Encode frames. |
| 215 | 215 | while (vpx_img_read(&raw, infile)) { |
| @@ -118,7 +118,7 @@ int main(int argc, char **argv) { · 117 unmodified lines | ||
| 118 | 118 | printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface())); |
| 119 | 119 | |
| 120 | 120 | if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0)) |
| 121 | − die_codec(&codec, "Failed to initialize decoder."); | |
| 121 | + die("Failed to initialize decoder."); | |
| 122 | 122 | |
| 123 | 123 | while (vpx_video_reader_read_frame(reader)) { |
| 124 | 124 | vpx_codec_iter_t iter = NULL; |
| @@ -218,7 +218,7 @@ int main(int argc, char **argv) { · 217 unmodified lines | ||
| 218 | 218 | die("Failed to open %s for reading.", infile_arg); |
| 219 | 219 | |
| 220 | 220 | if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) |
| 221 | − die_codec(&codec, "Failed to initialize encoder"); | |
| 221 | + die("Failed to initialize encoder"); | |
| 222 | 222 | |
| 223 | 223 | // Encode frames. |
| 224 | 224 | while (vpx_img_read(&raw, infile)) { |
| @@ -128,7 +128,7 @@ static vpx_fixed_buf_t pass0(vpx_image_t *raw, FILE *infile, · 127 unmodified lines | ||
| 128 | 128 | vpx_fixed_buf_t stats = { NULL, 0 }; |
| 129 | 129 | |
| 130 | 130 | if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0)) |
| 131 | − die_codec(&codec, "Failed to initialize encoder"); | |
| 131 | + die("Failed to initialize encoder"); | |
| 132 | 132 | |
| 133 | 133 | // Calculate frame statistics. |
| 134 | 134 | while (vpx_img_read(raw, infile)) { |
| @@ -164,7 +164,7 @@ static void pass1(vpx_image_t *raw, FILE *infile, const char *outfile_name, · 29 unmodified lines | ||
| 164 | 164 | if (!writer) die("Failed to open %s for writing", outfile_name); |
| 165 | 165 | |
| 166 | 166 | if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0)) |
| 167 | − die_codec(&codec, "Failed to initialize encoder"); | |
| 167 | + die("Failed to initialize encoder"); | |
| 168 | 168 | |
| 169 | 169 | // Encode frames. |
| 170 | 170 | while (vpx_img_read(raw, infile)) { |
| @@ -155,7 +155,7 @@ int main(int argc, char **argv) { · 154 unmodified lines | ||
| 155 | 155 | die("Failed to open %s for reading.", argv[3]); |
| 156 | 156 | |
| 157 | 157 | if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) |
| 158 | − die_codec(&codec, "Failed to initialize encoder"); | |
| 158 | + die("Failed to initialize encoder"); | |
| 159 | 159 | |
| 160 | 160 | // Encode frames. |
| 161 | 161 | while (vpx_img_read(&raw, infile)) { |
| @@ -110,7 +110,7 @@ int main(int argc, char **argv) { · 109 unmodified lines | ||
| 110 | 110 | die("Failed to open %s for reading.", argv[3]); |
| 111 | 111 | |
| 112 | 112 | if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) |
| 113 | − die_codec(&codec, "Failed to initialize encoder"); | |
| 113 | + die("Failed to initialize encoder"); | |
| 114 | 114 | |
| 115 | 115 | if (vpx_codec_control_(&codec, VP9E_SET_LOSSLESS, 1)) |
| 116 | 116 | die_codec(&codec, "Failed to use lossless mode"); |
| @@ -251,7 +251,7 @@ int main(int argc, char **argv) { · 250 unmodified lines | ||
| 251 | 251 | die("Failed to open %s for reading.", infile_arg); |
| 252 | 252 | |
| 253 | 253 | if (vpx_codec_enc_init(&ecodec, encoder->codec_interface(), &cfg, 0)) |
| 254 | − die_codec(&ecodec, "Failed to initialize encoder"); | |
| 254 | + die("Failed to initialize encoder"); | |
| 255 | 255 | |
| 256 | 256 | // Disable alt_ref. |
| 257 | 257 | if (vpx_codec_control(&ecodec, VP8E_SET_ENABLEAUTOALTREF, 0)) |
| @@ -815,7 +815,7 @@ int main(int argc, char **argv) { · 814 unmodified lines | ||
| 815 | 815 | #else |
| 816 | 816 | if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) |
| 817 | 817 | #endif // CONFIG_VP9_HIGHBITDEPTH |
| 818 | − die_codec(&codec, "Failed to initialize encoder"); | |
| 818 | + die("Failed to initialize encoder"); | |
| 819 | 819 | |
| 820 | 820 | if (strncmp(encoder->name, "vp8", 3) == 0) { |
| 821 | 821 | vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed); |