History

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

James Zern committed 6 years ago

Commit cbc276a1 parent b130f7110 files · +12 −12Browse files

Unified · Split

10 files
  1. examples/decode_with_drops.c +1 −1
  2. examples/postproc.c +2 −2
  3. examples/set_maps.c +1 −1
  4. examples/simple_decoder.c +1 −1
  5. examples/simple_encoder.c +1 −1
  6. examples/twopass_encoder.c +2 −2
  7. examples/vp8cx_set_ref.c +1 −1
  8. examples/vp9_lossless_encoder.c +1 −1
  9. examples/vp9cx_set_ref.c +1 −1
  10. examples/vpx_temporal_svc_encoder.c +1 −1
examples/decode_with_drops.c+1−1
@@ -106,7 +106,7 @@ int main(int argc, char **argv) { · 105 unmodified lines
106106 printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
107107
108108 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.");
110110
111111 while (vpx_video_reader_read_frame(reader)) {
112112 vpx_codec_iter_t iter = NULL;
examples/postproc.c+2−2
@@ -86,9 +86,9 @@ int main(int argc, char **argv) { · 85 unmodified lines
8686 res = vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL,
8787 VPX_CODEC_USE_POSTPROC);
8888 if (res == VPX_CODEC_INCAPABLE)
89− die_codec(&codec, "Postproc not supported by this decoder.");
89+ die("Postproc not supported by this decoder.");
9090
91− if (res) die_codec(&codec, "Failed to initialize decoder.");
91+ if (res) die("Failed to initialize decoder.");
9292
9393 while (vpx_video_reader_read_frame(reader)) {
9494 vpx_codec_iter_t iter = NULL;
examples/set_maps.c+1−1
@@ -209,7 +209,7 @@ int main(int argc, char **argv) { · 208 unmodified lines
209209 die("Failed to open %s for reading.", argv[4]);
210210
211211 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");
213213
214214 // Encode frames.
215215 while (vpx_img_read(&raw, infile)) {
examples/simple_decoder.c+1−1
@@ -118,7 +118,7 @@ int main(int argc, char **argv) { · 117 unmodified lines
118118 printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
119119
120120 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.");
122122
123123 while (vpx_video_reader_read_frame(reader)) {
124124 vpx_codec_iter_t iter = NULL;
examples/simple_encoder.c+1−1
@@ -218,7 +218,7 @@ int main(int argc, char **argv) { · 217 unmodified lines
218218 die("Failed to open %s for reading.", infile_arg);
219219
220220 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");
222222
223223 // Encode frames.
224224 while (vpx_img_read(&raw, infile)) {
examples/twopass_encoder.c+2−2
@@ -128,7 +128,7 @@ static vpx_fixed_buf_t pass0(vpx_image_t *raw, FILE *infile, · 127 unmodified lines
128128 vpx_fixed_buf_t stats = { NULL, 0 };
129129
130130 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");
132132
133133 // Calculate frame statistics.
134134 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
164164 if (!writer) die("Failed to open %s for writing", outfile_name);
165165
166166 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");
168168
169169 // Encode frames.
170170 while (vpx_img_read(raw, infile)) {
examples/vp8cx_set_ref.c+1−1
@@ -155,7 +155,7 @@ int main(int argc, char **argv) { · 154 unmodified lines
155155 die("Failed to open %s for reading.", argv[3]);
156156
157157 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");
159159
160160 // Encode frames.
161161 while (vpx_img_read(&raw, infile)) {
examples/vp9_lossless_encoder.c+1−1
@@ -110,7 +110,7 @@ int main(int argc, char **argv) { · 109 unmodified lines
110110 die("Failed to open %s for reading.", argv[3]);
111111
112112 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");
114114
115115 if (vpx_codec_control_(&codec, VP9E_SET_LOSSLESS, 1))
116116 die_codec(&codec, "Failed to use lossless mode");
examples/vp9cx_set_ref.c+1−1
@@ -251,7 +251,7 @@ int main(int argc, char **argv) { · 250 unmodified lines
251251 die("Failed to open %s for reading.", infile_arg);
252252
253253 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");
255255
256256 // Disable alt_ref.
257257 if (vpx_codec_control(&ecodec, VP8E_SET_ENABLEAUTOALTREF, 0))
examples/vpx_temporal_svc_encoder.c+1−1
@@ -815,7 +815,7 @@ int main(int argc, char **argv) { · 814 unmodified lines
815815 #else
816816 if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
817817 #endif // CONFIG_VP9_HIGHBITDEPTH
818− die_codec(&codec, "Failed to initialize encoder");
818+ die("Failed to initialize encoder");
819819
820820 if (strncmp(encoder->name, "vp8", 3) == 0) {
821821 vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t