Skip to content

Commit

Permalink
lavc audio: added some debug
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPulec committed Oct 23, 2023
1 parent d8d0753 commit a081105
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/audio/codec/libavcodec.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "debug.h"
#include "lib_common.h"

#include <inttypes.h>
#include <libavcodec/avcodec.h>
#include <libavutil/channel_layout.h>
#include <libavutil/mem.h>
Expand Down Expand Up @@ -388,6 +389,9 @@ static bool reinitialize_encoder(struct libavcodec_codec_state *s, struct audio_
s->av_frame->channel_layout = AV_CH_LAYOUT_MONO;
#endif
s->av_frame->sample_rate = s->codec_ctx->sample_rate;
MSG(VERBOSE, "Setting AV frame: %d samples, format %d, sample rate %d",
s->av_frame->nb_samples, s->av_frame->format,
s->av_frame->sample_rate);

ret = av_frame_get_buffer(s->av_frame, 0);
if (ret != 0) {
Expand Down Expand Up @@ -560,6 +564,7 @@ static audio_channel *libavcodec_compress(void *state, audio_channel * channel)
} else {
memcpy(s->av_frame->data[0], s->tmp.data + offset, chunk_size);
}
MSG(DEBUG2, "Sending PTS %" PRId64 "\n", s->av_frame->pts);
int ret = avcodec_send_frame(s->codec_ctx, s->av_frame);
if (ret != 0) {
print_libav_audio_error(LOG_LEVEL_ERROR, "Error encoding frame", ret);
Expand Down

0 comments on commit a081105

Please sign in to comment.