decoder/ffmpeg: pass AVPacket copy to ffmpeg_send_packet()
This commit is contained in:
parent
49f6b50ed3
commit
13b954c765
@ -307,7 +307,7 @@ copy_interleave_frame(const AVCodecContext &codec_context,
|
|||||||
|
|
||||||
static DecoderCommand
|
static DecoderCommand
|
||||||
ffmpeg_send_packet(Decoder &decoder, InputStream &is,
|
ffmpeg_send_packet(Decoder &decoder, InputStream &is,
|
||||||
const AVPacket &packet,
|
AVPacket packet,
|
||||||
AVCodecContext &codec_context,
|
AVCodecContext &codec_context,
|
||||||
const AVStream &stream,
|
const AVStream &stream,
|
||||||
AVFrame &frame,
|
AVFrame &frame,
|
||||||
@ -321,22 +321,20 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
|
|||||||
stream.time_base));
|
stream.time_base));
|
||||||
}
|
}
|
||||||
|
|
||||||
AVPacket packet2 = packet;
|
|
||||||
|
|
||||||
DecoderCommand cmd = DecoderCommand::NONE;
|
DecoderCommand cmd = DecoderCommand::NONE;
|
||||||
while (packet2.size > 0 && cmd == DecoderCommand::NONE) {
|
while (packet.size > 0 && cmd == DecoderCommand::NONE) {
|
||||||
int got_frame = 0;
|
int got_frame = 0;
|
||||||
int len = avcodec_decode_audio4(&codec_context,
|
int len = avcodec_decode_audio4(&codec_context,
|
||||||
&frame, &got_frame,
|
&frame, &got_frame,
|
||||||
&packet2);
|
&packet);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
/* if error, we skip the frame */
|
/* if error, we skip the frame */
|
||||||
LogFfmpegError(len, "decoding failed, frame skipped");
|
LogFfmpegError(len, "decoding failed, frame skipped");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
packet2.data += len;
|
packet.data += len;
|
||||||
packet2.size -= len;
|
packet.size -= len;
|
||||||
|
|
||||||
if (!got_frame)
|
if (!got_frame)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user