more frame dumping in resample

This commit is contained in:
Isaac Connor 2019-05-12 09:36:26 -04:00
parent aada171440
commit 453bc2afd8
1 changed files with 4 additions and 4 deletions

View File

@ -1011,9 +1011,9 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
//av_frame_unref(in_frame); //av_frame_unref(in_frame);
return 0; return 0;
} }
zm_dump_frame(out_frame, "Out frame after resample");
out_frame->pts = in_frame->pts; out_frame->pts = in_frame->pts;
zm_dump_frame(out_frame, "Out frame after resample");
// out_frame pts is in the input pkt pts... needs to be adjusted before sending to the encoder // out_frame pts is in the input pkt pts... needs to be adjusted before sending to the encoder
if ( out_frame->pts != AV_NOPTS_VALUE ) { if ( out_frame->pts != AV_NOPTS_VALUE ) {
if ( !audio_first_pts ) { if ( !audio_first_pts ) {
@ -1022,6 +1022,7 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
out_frame->pts = 0; out_frame->pts = 0;
} else { } else {
out_frame->pts = out_frame->pts - audio_first_pts; out_frame->pts = out_frame->pts - audio_first_pts;
zm_dump_frame(out_frame, "Out frame after pts adjustment");
} }
// //
} else { } else {
@ -1042,14 +1043,12 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
if ( (ret = avcodec_receive_packet(audio_out_ctx, &opkt)) < 0 ) { if ( (ret = avcodec_receive_packet(audio_out_ctx, &opkt)) < 0 ) {
if ( AVERROR(EAGAIN) == ret ) { if ( AVERROR(EAGAIN) == ret ) {
// The codec may need more samples than it has, perfectly valid // The codec may need more samples than it has, perfectly valid
Debug(3, "Could not recieve packet (error '%s')", Debug(2, "Codec not ready to give us a packet");
av_make_error_string(ret).c_str());
} else { } else {
Error("Could not recieve packet (error %d = '%s')", ret, Error("Could not recieve packet (error %d = '%s')", ret,
av_make_error_string(ret).c_str()); av_make_error_string(ret).c_str());
} }
zm_av_packet_unref(&opkt); zm_av_packet_unref(&opkt);
// av_frame_unref( out_frame );
return 0; return 0;
} }
#else #else
@ -1067,6 +1066,7 @@ int VideoStore::writeAudioFramePacket(AVPacket *ipkt) {
return 0; return 0;
} }
#endif #endif
dumpPacket(audio_out_stream, &opkt, "raw opkt");
opkt.duration = av_rescale_q(opkt.duration, opkt.duration = av_rescale_q(opkt.duration,
audio_in_stream->time_base, audio_in_stream->time_base,
audio_out_stream->time_base); audio_out_stream->time_base);