[TTVD] Move setting initialization config earlier 13/318013/2
authorJakub Gajownik <j.gajownik2@samsung.com>
Mon, 16 Sep 2024 17:42:31 +0000 (19:42 +0200)
committerBot Blink <blinkbot@samsung.com>
Mon, 23 Sep 2024 18:47:39 +0000 (18:47 +0000)
Even if we're treating video decoder initialization
specially, we should always properly set configuration,
so other methods use their valid versions.

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

index 5adf8f183e914d62287418663a11c7eea4c02f47..c79e4694e4ed7ea6ccecce2b35ba4d9b3f5ad796 100644 (file)
@@ -708,6 +708,11 @@ void TTvdVideoDecoderImpl::Initialize(VideoDecoderConfig config,
   initialized_ = true;
   waiting_for_key_ = false;
   first_frame_done_ = false;
+  output_cb_ = std::move(output_cb);
+  waiting_cb_ = std::move(waiting_cb);
+  config_ = std::move(config);
+  const bool delay_changed = (low_delay != low_delay_);
+  low_delay_ = low_delay;
 
   if (decoder_state_ == DecoderState::kReleasedBeforeInit) {
     if (config.is_rtc()) {
@@ -735,7 +740,7 @@ void TTvdVideoDecoderImpl::Initialize(VideoDecoderConfig config,
   }
 
   if (decoder_state_ != DecoderState::kCreated) {
-    if (low_delay != low_delay_) {
+    if (delay_changed) {
       std::move(init_cb).Run(DecoderStatus::Codes::kCantChangeCodec);
       return;
     }
@@ -758,10 +763,6 @@ void TTvdVideoDecoderImpl::Initialize(VideoDecoderConfig config,
 
   CHECK_EQ(decoder_state_, DecoderState::kCreated)
       << "Wrong state: " << decoder_state_;
-  output_cb_ = std::move(output_cb);
-  waiting_cb_ = std::move(waiting_cb);
-  config_ = std::move(config);
-  low_delay_ = low_delay;
 
   if (cdm_context && config.is_encrypted()) {
     cdm_bridge_ = cdm_context->GetTizenCdmBridge();