This commit is contained in:
Isaac Connor 2018-12-24 11:30:22 -05:00
parent e0a9c4a21e
commit 55e0d82f20
1 changed files with 17 additions and 21 deletions

View File

@ -908,9 +908,9 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
* to flush it. * to flush it.
*/ */
int data_present; int data_present;
if ((ret = avcodec_decode_audio4(audio_in_ctx, in_frame, if ( (ret = avcodec_decode_audio4(
&data_present, ipkt)) < 0) { audio_in_ctx, in_frame, &data_present, ipkt)) < 0 ) {
Error("Could not decode frame (error '%s')\n", Error("Could not decode frame (error '%s')",
av_make_error_string(ret).c_str()); av_make_error_string(ret).c_str());
dumpPacket(ipkt); dumpPacket(ipkt);
av_frame_free(&in_frame); av_frame_free(&in_frame);
@ -925,29 +925,25 @@ 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
#if defined(HAVE_LIBSWRESAMPLE)
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 ((ret = swr_convert(resample_ctx, if (
#if defined(HAVE_LIBSWRESAMPLE)
(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)) < 0) { in_frame->nb_samples))
Error("Could not resample frame (error '%s')\n",
av_make_error_string(ret).c_str());
av_frame_unref(in_frame);
return 0;
}
#else #else
#if defined(HAVE_LIBAVRESAMPLE) #if defined(HAVE_LIBAVRESAMPLE)
if ((ret = (ret = avresample_convert(resample_ctx, NULL, 0, 0, in_frame->data,
avresample_convert(resample_ctx, NULL, 0, 0, in_frame->data, 0, in_frame->nb_samples))
0, in_frame->nb_samples)) < 0) { #endif
Error("Could not resample frame (error '%s')\n", #endif
< 0) {
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); av_frame_unref(in_frame);
return 0; return 0;
} }
#endif
#endif
av_frame_unref(in_frame); av_frame_unref(in_frame);
#if defined(HAVE_LIBAVRESAMPLE) #if defined(HAVE_LIBAVRESAMPLE)