Merge branch 'master' into storageareas

pull/2562/head
Isaac Connor 2018-10-24 13:45:54 -04:00
commit ed50856d40
1 changed files with 18 additions and 11 deletions

View File

@ -249,13 +249,13 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in,
ret = avcodec_parameters_to_context(audio_out_ctx, ret = avcodec_parameters_to_context(audio_out_ctx,
audio_in_stream->codecpar); audio_in_stream->codecpar);
if ( ret < 0 ) { if ( ret < 0 ) {
Error("Unable to copy audio params to ctx %s\n", Error("Unable to copy audio params to ctx %s",
av_make_error_string(ret).c_str()); av_make_error_string(ret).c_str());
} }
ret = avcodec_parameters_from_context(audio_out_stream->codecpar, ret = avcodec_parameters_from_context(audio_out_stream->codecpar,
audio_out_ctx); audio_out_ctx);
if ( ret < 0 ) { if ( ret < 0 ) {
Error("Unable to copy audio params to stream %s\n", Error("Unable to copy audio params to stream %s",
av_make_error_string(ret).c_str()); av_make_error_string(ret).c_str());
} }
@ -272,7 +272,7 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in,
audio_out_ctx->codec_tag = 0; audio_out_ctx->codec_tag = 0;
#endif #endif
if ( ret < 0 ) { if ( ret < 0 ) {
Error("Unable to copy audio ctx %s\n", Error("Unable to copy audio ctx %s",
av_make_error_string(ret).c_str()); av_make_error_string(ret).c_str());
audio_out_stream = NULL; audio_out_stream = NULL;
} else { } else {
@ -523,7 +523,7 @@ bool VideoStore::setup_resampler() {
audio_out_ctx = avcodec_alloc_context3(audio_out_codec); audio_out_ctx = avcodec_alloc_context3(audio_out_codec);
if ( !audio_out_ctx ) { if ( !audio_out_ctx ) {
Error("could not allocate codec ctx for AAC\n"); Error("could not allocate codec ctx for AAC");
audio_out_stream = NULL; audio_out_stream = NULL;
return false; return false;
} }
@ -546,6 +546,13 @@ bool VideoStore::setup_resampler() {
#else #else
audio_out_ctx->refcounted_frames = 1; audio_out_ctx->refcounted_frames = 1;
#endif #endif
if ( ! audio_out_ctx->channel_layout ) {
Debug(3, "Correcting channel layout from (%d) to (%d)",
audio_out_ctx->channel_layout,
av_get_default_channel_layout(audio_out_ctx->channels)
);
audio_out_ctx->channel_layout = av_get_default_channel_layout(audio_out_ctx->channels);
}
if (audio_out_codec->supported_samplerates) { if (audio_out_codec->supported_samplerates) {
int found = 0; int found = 0;