From 1c02b58412db2646ba6e57a7e305d26482b9bc0d Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 11 Feb 2022 19:35:47 +0100 Subject: [PATCH] Remove sc_demuxer_parse() Now that the key frame flag is known, parsing the packet is useless. --- app/src/demuxer.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/app/src/demuxer.c b/app/src/demuxer.c index 417abd27..96c0192a 100644 --- a/app/src/demuxer.c +++ b/app/src/demuxer.c @@ -73,6 +73,7 @@ sc_demuxer_recv_packet(struct sc_demuxer *demuxer, AVPacket *packet) { packet->flags |= AV_PKT_FLAG_KEY; } + packet->dts = packet->pts; return true; } @@ -89,28 +90,6 @@ push_packet_to_sinks(struct sc_demuxer *demuxer, const AVPacket *packet) { return true; } -static void -sc_demuxer_parse(struct sc_demuxer *demuxer, AVPacket *packet) { - uint8_t *in_data = packet->data; - int in_len = packet->size; - uint8_t *out_data = NULL; - int out_len = 0; - int r = av_parser_parse2(demuxer->parser, demuxer->codec_ctx, - &out_data, &out_len, in_data, in_len, - AV_NOPTS_VALUE, AV_NOPTS_VALUE, -1); - - // PARSER_FLAG_COMPLETE_FRAMES is set - assert(r == in_len); - (void) r; - assert(out_len == in_len); - - if (demuxer->parser->key_frame == 1) { - packet->flags |= AV_PKT_FLAG_KEY; - } - - packet->dts = packet->pts; -} - static bool sc_demuxer_push_packet(struct sc_demuxer *demuxer, AVPacket *packet) { bool is_config = packet->pts == AV_NOPTS_VALUE; @@ -150,11 +129,6 @@ sc_demuxer_push_packet(struct sc_demuxer *demuxer, AVPacket *packet) { } } - if (!is_config) { - // data packet - sc_demuxer_parse(demuxer, packet); - } - bool ok = push_packet_to_sinks(demuxer, packet); if (!is_config && demuxer->pending) {