[M120 Migration] Don't invoke Init of DecoderBuffer when size is 0 16/311916/4
authorzhishun.zhou <zhishun.zhou@samsung.com>
Thu, 30 May 2024 06:00:11 +0000 (14:00 +0800)
committerBot Blink <blinkbot@samsung.com>
Mon, 3 Jun 2024 03:41:08 +0000 (03:41 +0000)
For EME case, in SubmitEsPacket, if using tz_handle, the
data of DecoderBuffer should be null, or else crash could
happen in esplusplayer_submit_trust_zone_packet, because it will try to
copy this memory if it's non-null..
When convert media::mojom::DecoderBufferPtr to media::DecoderBuffer,
"new media::DecoderBuffer(0)" will make data of DecoderBuffer non-null,
let's check the input size and don't invoke Initialize() of DecoderBuffer
if size is 0.

Change-Id: I6df4a5cdcc504ac68bf1fd94c198bc0df3b9a22d
Signed-off-by: zhishun.zhou <zhishun.zhou@samsung.com>
media/base/decoder_buffer.cc

index 282ca15969f8aa85a4ca1a2feb57b199ac470ec7..fdcacb1399d0df1b0a9782b90aec64e17a54c285 100644 (file)
@@ -22,6 +22,12 @@ DecoderBuffer::TimeInfo& DecoderBuffer::TimeInfo::operator=(const TimeInfo&) =
     default;
 
 DecoderBuffer::DecoderBuffer(size_t size) : size_(size), is_key_frame_(false) {
+#if BUILDFLAG(IS_TIZEN_TV)
+  if (0 == size) {
+    return;
+  }
+#endif
+
   Initialize();
 }