This commit is contained in:
Isaac Connor 2019-02-12 14:20:33 -05:00
parent 2f301cf5fe
commit 3177764db4
1 changed files with 9 additions and 11 deletions

View File

@ -891,7 +891,7 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
} }
ret = avcodec_receive_frame(audio_in_ctx, in_frame); ret = avcodec_receive_frame(audio_in_ctx, in_frame);
if (ret < 0) { if ( ret < 0 ) {
Error("avcodec_receive_frame fail %s", av_make_error_string(ret).c_str()); Error("avcodec_receive_frame fail %s", av_make_error_string(ret).c_str());
return 0; return 0;
} }
@ -926,25 +926,23 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
// Resample the in into the audioSampleBuffer until we proceed the whole // Resample the in into the audioSampleBuffer until we proceed the whole
// decoded data // decoded data
Debug(2, "Converting %d to %d samples", in_frame->nb_samples, out_frame->nb_samples); Debug(2, "Converting %d to %d samples", in_frame->nb_samples, out_frame->nb_samples);
if (
#if defined(HAVE_LIBSWRESAMPLE) #if defined(HAVE_LIBSWRESAMPLE)
(ret = swr_convert(resample_ctx, (ret = swr_convert(resample_ctx,
out_frame->data, frame_size, out_frame->data, frame_size,
(const uint8_t**)in_frame->data, (const uint8_t**)in_frame->data,
in_frame->nb_samples)) in_frame->nb_samples));
#else #else
#if defined(HAVE_LIBAVRESAMPLE) #if defined(HAVE_LIBAVRESAMPLE)
(ret = avresample_convert(resample_ctx, NULL, 0, 0, in_frame->data, (ret = avresample_convert(resample_ctx, NULL, 0, 0, in_frame->data,
0, in_frame->nb_samples)) 0, in_frame->nb_samples))
#endif
#endif #endif
#endif av_frame_unref(in_frame);
< 0) { if ( ret < 0 ) {
Error("Could not resample frame (error '%s')", Error("Could not resample frame (error '%s')",
av_make_error_string(ret).c_str()); av_make_error_string(ret).c_str());
av_frame_unref(in_frame);
return 0; return 0;
} }
av_frame_unref(in_frame);
#if defined(HAVE_LIBAVRESAMPLE) #if defined(HAVE_LIBAVRESAMPLE)
int samples_available = avresample_available(resample_ctx); int samples_available = avresample_available(resample_ctx);