examples/decoding_encoding: check av_samples_get_buffer_size() for a negative value
authorStefano Sabatini <stefasab@gmail.com>
Sun, 15 Dec 2013 19:09:26 +0000 (20:09 +0100)
committerStefano Sabatini <stefasab@gmail.com>
Sun, 15 Dec 2013 19:09:26 +0000 (20:09 +0100)
Fix broken != 0 check.

doc/examples/decoding_encoding.c

index 4d2813b0529a71b16c248191c0a0d4a514630a18..08e8b9212ce9aea50e14c1105b3e3ed837b2f627 100644 (file)
@@ -170,7 +170,7 @@ static void audio_encode_example(const char *filename)
      * we calculate the size of the samples buffer in bytes */
     buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size,
                                              c->sample_fmt, 0);
      * we calculate the size of the samples buffer in bytes */
     buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size,
                                              c->sample_fmt, 0);
-    if (!buffer_size) {
+    if (buffer_size < 0) {
         fprintf(stderr, "Could not get sample buffer size\n");
         exit(1);
     }
         fprintf(stderr, "Could not get sample buffer size\n");
         exit(1);
     }