Reset fallback state on decoder reinit earlier 30/320930/3 submit/tizen/20241126.160151
authorJakub Gajownik <j.gajownik2@samsung.com>
Tue, 19 Nov 2024 21:17:57 +0000 (22:17 +0100)
committerBot Blink <blinkbot@samsung.com>
Tue, 26 Nov 2024 09:09:31 +0000 (09:09 +0000)
This change fixes rare issue with decoder stream reinitialization:
When decoder emits a frame, decoder stream sets flag to indicated
that no decoder fallback should be done. In case config change is
received and decoder reinitialization is finished before first
decoder buffer, flag is not reset. Then if first decode fails,
fallback is not enabled leading to persistent error on DecoderStream.

Flag reset should be done always when decoder initialization is
finished, no matter result.

Related upstream patch:
> Reset fallback state on decoder reinit
> https://chromium-review.googlesource.com/c/chromium/src/+/601210

Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-627
Change-Id: Iff21f35155dce9d9502007060d696eeea4fd518c
Signed-off-by: Jakub Gajownik <j.gajownik2@samsung.com>
media/filters/decoder_stream.cc

index 326c328751b02b4d2cc382e104bc929ffe6e6fb1..bf7c86b474ca7d8db9f30a90c91ecdd6a1da0814 100644 (file)
@@ -966,6 +966,11 @@ void DecoderStream<StreamType>::CompleteDecoderReinitialization(
         << GetStreamTypeString() << " decoder reinitialization failed";
   }
 
+  // Re-enable fallback to software after reinitialization. This is the last
+  // place we can clear that state, and as such is the least likely to interfere
+  // with the rest of the fallback algorithm.
+  decoder_produced_a_frame_ = false;
+
   if (reset_cb_) {
     std::move(reset_cb_).Run();
     return;
@@ -979,14 +984,6 @@ void DecoderStream<StreamType>::CompleteDecoderReinitialization(
     return;
   }
 
-  // Re-enable fallback to software after reinitialization. This is the last
-  // place we can clear that state, and as such is the least likely to interfere
-  // with the rest of the fallback algorithm.
-  // TODO(tguilbert): investigate setting this flag at an earlier time. This
-  // could fix the hypothetical edge case of receiving a decode error when
-  // flushing the decoder during a seek operation.
-  decoder_produced_a_frame_ = false;
-
   // We may still have too many |ready_outputs_| or |unprepared_outputs_| to
   // initiate another read to the demuxer stream. If so, the read will be
   // initiated later once we vended enough outputs to read again.