Set out_frame duration when resampling. Better error message if failed to write to fifo
parent
75b4f4f2b3
commit
d3a680aaa3
|
@ -1181,6 +1181,9 @@ int VideoStore::resample_audio() {
|
||||||
ret = swr_convert_frame(resample_ctx, out_frame, in_frame);
|
ret = swr_convert_frame(resample_ctx, out_frame, in_frame);
|
||||||
zm_dump_frame(out_frame, "Out frame after convert");
|
zm_dump_frame(out_frame, "Out frame after convert");
|
||||||
|
|
||||||
|
// resampling doesn't change the duration, or set it.
|
||||||
|
out_frame->duration = in_frame->duration;
|
||||||
|
|
||||||
if ( ret < 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());
|
||||||
|
@ -1193,7 +1196,8 @@ int VideoStore::resample_audio() {
|
||||||
/** Store the new samples in the FIFO buffer. */
|
/** Store the new samples in the FIFO buffer. */
|
||||||
ret = av_audio_fifo_write(fifo, (void **)out_frame->data, out_frame->nb_samples);
|
ret = av_audio_fifo_write(fifo, (void **)out_frame->data, out_frame->nb_samples);
|
||||||
if ( ret < out_frame->nb_samples ) {
|
if ( ret < out_frame->nb_samples ) {
|
||||||
Error("Could not write data to FIFO on %d written, expecting %d", ret, out_frame->nb_samples);
|
Error("Could not write data to FIFO. %d written, expecting %d. Reason %s",
|
||||||
|
ret, out_frame->nb_samples, av_make_error_string(ret).c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue