History

avcodec/liblc3dec: retrieve duration of the last packet from the demuxer

Use the packet duration field to invalid last samples of the last frame.

Antoine SOULIER committed 2 years ago

Commit 4865ea41 parent 6de00dc1 file · +1 −7Browse files

Unified · Split

libavcodec/liblc3dec.c+1−7
@@ -34,7 +34,6 @@ typedef struct LibLC3DecContext { · 33 unmodified lines
3434 int frame_us, srate_hz, hr_mode;
3535 void *decoder_mem;
3636 lc3_decoder_t decoder[DECODER_MAX_CHANNELS];
37− int64_t length;
3837 } LibLC3DecContext;
3938
4039 static av_cold int liblc3_decode_init(AVCodecContext *avctx)
@@ -57,7 +56,6 @@ static av_cold int liblc3_decode_init(AVCodecContext *avctx) · 16 unmodified lines
5756 liblc3->srate_hz = avctx->sample_rate;
5857 ep_mode = AV_RL16(avctx->extradata + 2);
5958 liblc3->hr_mode = AV_RL16(avctx->extradata + 4);
60− liblc3->length = AV_RL32(avctx->extradata + 6);
6159 if (ep_mode != 0) {
6260 av_log(avctx, AV_LOG_ERROR,
6361 "Error protection mode is not supported.\n");
@@ -126,11 +124,7 @@ static int liblc3_decode(AVCodecContext *avctx, AVFrame *frame, · 62 unmodified lines
126124 in += nbytes;
127125 }
128126
129− if (liblc3->length > 0) {
130− int64_t end_pts = liblc3->length + avctx->delay;
131− frame->nb_samples = FFMIN(frame->nb_samples,
132− FFMAX(end_pts - frame->pts, 0));
133− }
127+ frame->nb_samples = FFMIN(frame->nb_samples, avpkt->duration);
134128
135129 *got_frame_ptr = 1;
136130

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t