[TTvd] Fix crash in `TTvdVideoDecoderImpl::OnBufferFilled()` if `CreateVideoFrame... 98/320998/2
authorPiotr Bałut <p.balut@samsung.com>
Wed, 13 Nov 2024 10:53:32 +0000 (11:53 +0100)
committerInsoon Kim <is46.kim@samsung.com>
Wed, 27 Nov 2024 09:48:10 +0000 (09:48 +0000)
[PROBLEM]
CreateVideoFrame() may fail and return nullptr. This can happen for
example when wrapping native texture is not sucesfull during player
cleanup. Such non-existing frame is used by OnBufferFilled(), leading
to a crash.

[SOLUTION]
Check whether or not frame returned by CreateVideoFrame() exists before
using it.

Bug: https://jira-eu.sec.samsung.net/browse/VDGAME-621
Signed-off-by: Piotr Bałut <p.balut@samsung.com>
Change-Id: I827a8b94a506c91371805c5de31a14a5f9da6bbd

media/filters/tizen/ttvd_video_decoder_impl.cc

index 9cdb79c0581b3a7a408f27b9dc55623ed98f8d42..7fba82433a5b2570e570cc204ab999ba33dd5f6c 100644 (file)
@@ -1753,6 +1753,10 @@ void TTvdVideoDecoderImpl::OnBufferFilled(
 
   auto video_frame =
       ttvd_decoded_frame->CreateVideoFrame(output_data.timestamp);
+  if (!video_frame) {
+    TIZEN_MEDIA_LOG(ERROR) << "Cannot create video frame";
+    return;
+  }
   video_frame->metadata().allow_overlay = supports_overlay_;
   // In case texturing mode is not supported, mark video frame as HW protected,
   // so it's force to use overlay or is rendered as black frame.