libeplayer3/container_ffmpeg: no need for copying the input packet

This commit is contained in:
martii
2013-07-23 21:45:44 +02:00
committed by Stefan Seyfried
parent 0c295bcfc0
commit 6395850a91

View File

@@ -519,7 +519,6 @@ static void FFMPEGThread(Context_t *context) {
else if (audioTrack->inject_as_pcm == 1) else if (audioTrack->inject_as_pcm == 1)
{ {
AVCodecContext *c = ((AVStream*)(audioTrack->stream))->codec; AVCodecContext *c = ((AVStream*)(audioTrack->stream))->codec;
AVPacket avpkt = packet;
if (restart_audio_resampling) { if (restart_audio_resampling) {
restart_audio_resampling = 0; restart_audio_resampling = 0;
@@ -535,7 +534,7 @@ static void FFMPEGThread(Context_t *context) {
context->output->Command(context, OUTPUT_PLAY, NULL); context->output->Command(context, OUTPUT_PLAY, NULL);
} }
while(avpkt.size > 0) while(packet.size > 0)
{ {
int got_frame = 0; int got_frame = 0;
if (!decoded_frame) { if (!decoded_frame) {
@@ -546,14 +545,14 @@ static void FFMPEGThread(Context_t *context) {
} else } else
avcodec_get_frame_defaults(decoded_frame); avcodec_get_frame_defaults(decoded_frame);
int len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); int len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &packet);
if (len < 0) { if (len < 0) {
// fprintf(stderr, "avcodec_decode_audio4: %d\n", len); // fprintf(stderr, "avcodec_decode_audio4: %d\n", len);
break; break;
} }
avpkt.data += len; packet.data += len;
avpkt.size -= len; packet.size -= len;
if (!got_frame) if (!got_frame)
continue; continue;