Browse Source

TT#31198 flush encoder queue on shutdown to avoid warnings

Change-Id: Ic4a99083f22d8d2c87edb28539d6e325cbdb34b4
changes/81/18681/5
Richard Fuchs 8 years ago
parent
commit
c6c79f49b8
1 changed files with 13 additions and 3 deletions
  1. +13
    -3
      daemon/codec.c

+ 13
- 3
daemon/codec.c View File

@ -370,12 +370,24 @@ err:
__ssrc_handler_free(ch); __ssrc_handler_free(ch);
return NULL; return NULL;
} }
static int __encoder_flush(encoder_t *enc, void *u1, void *u2) {
int *going = u1;
*going = 1;
return 0;
}
static void __ssrc_handler_free(struct codec_ssrc_handler *ch) { static void __ssrc_handler_free(struct codec_ssrc_handler *ch) {
packet_sequencer_destroy(&ch->sequencer); packet_sequencer_destroy(&ch->sequencer);
if (ch->decoder) if (ch->decoder)
decoder_close(ch->decoder); decoder_close(ch->decoder);
if (ch->encoder)
if (ch->encoder) {
// flush out queue to avoid ffmpeg warnings
int going;
do {
going = 0;
encoder_input_data(ch->encoder, NULL, __encoder_flush, &going, NULL);
} while (going);
encoder_free(ch->encoder); encoder_free(ch->encoder);
}
g_slice_free1(sizeof(*ch), ch); g_slice_free1(sizeof(*ch), ch);
} }
@ -416,8 +428,6 @@ static int __packet_decoded(decoder_t *decoder, AVFrame *frame, void *u1, void *
ilog(LOG_DEBUG, "RTP media successfully decoded: TS %llu, samples %u", ilog(LOG_DEBUG, "RTP media successfully decoded: TS %llu, samples %u",
(unsigned long long) frame->pts, frame->nb_samples); (unsigned long long) frame->pts, frame->nb_samples);
// XXX resample...
encoder_input_data(ch->encoder, frame, __packet_encoded, ch, u2); encoder_input_data(ch->encoder, frame, __packet_encoded, ch, u2);
av_frame_free(&frame); av_frame_free(&frame);


Loading…
Cancel
Save