Skip to content

Commit 243bb78

Browse files
author
Clement Champetier
committed
AudioFrame: use AVFrame accessors when set audio fields
According to the documentation: "The position of these field in the structure is not part of the ABI, they should not be accessed directly outside libavcodec."
1 parent f6bfdcd commit 243bb78

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/AvTranscoder/data/decoded/AudioFrame.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ size_t AudioFrame::getSize() const
7474
void AudioFrame::allocateAVSample(const AudioFrameDesc& desc)
7575
{
7676
// Set Frame properties
77-
_frame->sample_rate = desc._sampleRate;
78-
_frame->channels = desc._nbChannels;
79-
_frame->channel_layout = av_get_default_channel_layout(desc._nbChannels);
77+
av_frame_set_sample_rate(_frame, desc._sampleRate);
78+
av_frame_set_channels(_frame, desc._nbChannels);
79+
av_frame_set_channel_layout(_frame, av_get_default_channel_layout(desc._nbChannels));
8080
_frame->format = desc._sampleFormat;
8181
_frame->nb_samples = desc._sampleRate / 25.; // cannot be known before calling avcodec_decode_audio4
8282

0 commit comments

Comments
 (0)