Simplify demuxer
Call the same push_packet_to_sinks() in all cases, and make sc_demuxer_parse() return void.
This commit is contained in:
parent
7dec225ceb
commit
c460243ce2
1 changed files with 16 additions and 26 deletions
|
@ -69,7 +69,7 @@ push_packet_to_sinks(struct sc_demuxer *demuxer, const AVPacket *packet) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static void
|
||||||
sc_demuxer_parse(struct sc_demuxer *demuxer, AVPacket *packet) {
|
sc_demuxer_parse(struct sc_demuxer *demuxer, AVPacket *packet) {
|
||||||
uint8_t *in_data = packet->data;
|
uint8_t *in_data = packet->data;
|
||||||
int in_len = packet->size;
|
int in_len = packet->size;
|
||||||
|
@ -89,14 +89,6 @@ sc_demuxer_parse(struct sc_demuxer *demuxer, AVPacket *packet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
packet->dts = packet->pts;
|
packet->dts = packet->pts;
|
||||||
|
|
||||||
bool ok = push_packet_to_sinks(demuxer, packet);
|
|
||||||
if (!ok) {
|
|
||||||
LOGE("Could not process packet");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
@ -138,25 +130,23 @@ sc_demuxer_push_packet(struct sc_demuxer *demuxer, AVPacket *packet) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_config) {
|
if (!is_config) {
|
||||||
// config packet
|
|
||||||
bool ok = push_packet_to_sinks(demuxer, packet);
|
|
||||||
if (!ok) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// data packet
|
// data packet
|
||||||
bool ok = sc_demuxer_parse(demuxer, packet);
|
sc_demuxer_parse(demuxer, packet);
|
||||||
|
}
|
||||||
|
|
||||||
if (demuxer->pending) {
|
bool ok = push_packet_to_sinks(demuxer, packet);
|
||||||
|
|
||||||
|
if (!is_config && demuxer->pending) {
|
||||||
// the pending packet must be discarded (consumed or error)
|
// the pending packet must be discarded (consumed or error)
|
||||||
av_packet_free(&demuxer->pending);
|
av_packet_free(&demuxer->pending);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
|
LOGE("Could not process packet");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue