Make stream push packets to sinks

Now that decoder and recorder implement the packet sink trait, make
stream push packets to the sinks without depending on the concrete sink
types.
This commit is contained in:
Romain Vimont 2021-04-11 15:01:05 +02:00
parent c64f5ff71e
commit 3d36915d9b
7 changed files with 82 additions and 65 deletions

View file

@ -41,8 +41,14 @@ decoder_close(struct decoder *decoder) {
avcodec_free_context(&decoder->codec_ctx);
}
bool
static bool
decoder_push(struct decoder *decoder, const AVPacket *packet) {
bool is_config = packet->pts == AV_NOPTS_VALUE;
if (is_config) {
// nothing to do
return true;
}
int ret;
if ((ret = avcodec_send_packet(decoder->codec_ctx, packet)) < 0) {
LOGE("Could not send video packet: %d", ret);