Skip to content

Commit

Permalink
Remove sc_demuxer_parse()
Browse files Browse the repository at this point in the history
Now that the key frame flag is known, parsing the packet is useless.
  • Loading branch information
rom1v committed Feb 11, 2022
1 parent 67068e4 commit 1c02b58
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions app/src/demuxer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 1c02b58

Please sign in to comment.