Commit 410fca27 authored by Simon Morlat's avatar Simon Morlat

Attempt to fix an issue where a VP8 decoder requests a PLI because it never...

Attempt to fix an issue where a VP8 decoder requests a PLI because it never had a keyframe, but never receives back a keyframe because the remote encoder sends a recovery frame because he thinks that altref and golden frames have been acknoledged.
parent 528a72e4
......@@ -220,6 +220,8 @@ typedef enum _MSRecorderState MSRecorderState;
MS_FILTER_EVENT(MSFilterVideoDecoderInterface, 3, MSVideoCodecSLI)
#define MS_VIDEO_DECODER_SEND_RPSI \
MS_FILTER_EVENT(MSFilterVideoDecoderInterface, 4, MSVideoCodecRPSI)
#define MS_VIDEO_DECODER_SEND_FIR \
MS_FILTER_EVENT_NO_ARG(MSFilterVideoDecoderInterface, 5)
/** Method definitions for video decoders */
#define MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION \
......
......@@ -688,9 +688,11 @@ static int enc_notify_pli(MSFilter *f, void *data) {
static int enc_notify_fir(MSFilter *f, void *data) {
EncState *s = (EncState *)f->data;
uint8_t seq_nr = *((uint8_t *)data);
if (seq_nr != s->last_fir_seq_nr) {
s->force_keyframe = TRUE;
s->last_fir_seq_nr = seq_nr;
if (should_generate_key_frame(s,MIN_KEY_FRAME_DIST)){
if (seq_nr != s->last_fir_seq_nr) {
s->force_keyframe = TRUE;
s->last_fir_seq_nr = seq_nr;
}
}
return 0;
}
......
......@@ -106,6 +106,10 @@ static void internal_event_cb(void *ud, MSFilter *f, unsigned int event, void *e
const MSVideoCodecRPSI *rpsi;
switch (event) {
case MS_VIDEO_DECODER_SEND_FIR:
ms_message("Request sending of FIR on videostream [%p]", stream);
video_stream_send_fir(stream);
break;
case MS_VIDEO_DECODER_SEND_PLI:
ms_message("Request sending of PLI on videostream [%p]", stream);
video_stream_send_pli(stream);
......
......@@ -411,6 +411,15 @@ static void send_pli(Vp8RtpFmtUnpackerCtx *ctx) {
}
}
static void send_fir(Vp8RtpFmtUnpackerCtx *ctx) {
if (ctx->avpf_enabled == TRUE) {
if(ctx->filter) ms_filter_notify_no_arg(ctx->filter, MS_VIDEO_DECODER_SEND_FIR);
} else {
if(ctx->filter) ms_filter_notify_no_arg(ctx->filter, MS_VIDEO_DECODER_DECODING_ERRORS);
ctx->error_notified = TRUE;
}
}
static void send_sli(Vp8RtpFmtUnpackerCtx *ctx, Vp8RtpFmtFrame *frame) {
if (ctx->avpf_enabled == TRUE) {
if (frame->pictureid_present == TRUE) {
......@@ -752,7 +761,13 @@ static int output_valid_partitions(Vp8RtpFmtUnpackerCtx *ctx, MSQueue *out) {
frame->outputted = TRUE;
} else {
frame->discarded = TRUE;
if (!ctx->valid_keyframe_received) send_pli(ctx);
if (!ctx->valid_keyframe_received) {
/*We send a FIR because:
* in some case the remote encoder thinks that AF and GF are acknoledge and then will create recovery frame based on one of them (or both)
* HOWEVER, the local decoder (if has just been re-instancianted) had no KF at all to start decoding.*/
send_fir(ctx);
send_pli(ctx);
}
if (ctx->waiting_for_reference_frame == TRUE) {
/* Do not decode frames while we are waiting for a reference frame. */
if (frame->pictureid_present == TRUE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment