]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-6815 FS-6903 #resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 9 Oct 2014 20:47:31 +0000 (15:47 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 9 Oct 2014 20:47:36 +0000 (15:47 -0500)
src/fs_encode.c

index d3052a98d628c581875ff081aa8dd0475b5497ef..626601d9d6661197a70c790b8bf4335e7948c35d 100644 (file)
@@ -175,15 +175,6 @@ int main(int argc, char *argv[])
        }
 
 
-       if (switch_core_file_open(&fh_output, output, channels, rate, out_flags, NULL) != SWITCH_STATUS_SUCCESS) {
-               fprintf(stderr, "Couldn't open %s\n", output);
-               goto end;       
-       }
-       
-       if (switch_test_flag(&fh_input, SWITCH_FILE_NATIVE)) {
-               in_asis = 1;
-       }
-
        if (out_asis) {
                if (switch_core_codec_init_with_bitrate(&codec, format, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
                        fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", format, rate, ptime);
@@ -206,6 +197,20 @@ int main(int argc, char *argv[])
                }
        }
 
+
+
+
+       if (switch_core_file_open(&fh_output, output, channels, codec.implementation->actual_samples_per_second, out_flags, NULL) != SWITCH_STATUS_SUCCESS) {
+               fprintf(stderr, "Couldn't open %s\n", output);
+               goto end;       
+       }
+       
+       if (switch_test_flag(&fh_input, SWITCH_FILE_NATIVE)) {
+               in_asis = 1;
+       }
+
+
+
        if (in_asis) {
                blocksize = len = codec.implementation->encoded_bytes_per_packet;
        } else {