[M108 Aura Migration][NaCl][PPFwk] Add error logs + SVACE/DLOG/Static analysis fix
[platform/framework/web/chromium-efl.git] / content / renderer / pepper / ppb_video_decoder_impl.cc
index 3b6b0a5..90e287d 100644 (file)
@@ -7,6 +7,7 @@
 #include <string>
 
 #include "base/check_op.h"
+#include "base/logging.h"
 #include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/notreached.h"
@@ -156,12 +157,16 @@ const PPP_VideoDecoder_Dev* PPB_VideoDecoder_Impl::GetPPP() {
 int32_t PPB_VideoDecoder_Impl::Decode(
     const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
     scoped_refptr<TrackedCallback> callback) {
-  if (!decoder_)
+  if (!decoder_) {
+    LOG(ERROR) << "Decoder is NULL";
     return PP_ERROR_BADRESOURCE;
+  }
 
   EnterResourceNoLock<PPB_Buffer_API> enter(bitstream_buffer->data, true);
-  if (enter.failed())
+  if (enter.failed()) {
+    LOG(ERROR) << "Enter Buffer failed";
     return PP_ERROR_FAILED;
+  }
 
   PPB_Buffer_Impl* buffer = static_cast<PPB_Buffer_Impl*>(enter.object());
   DCHECK_GE(bitstream_buffer->id, 0);
@@ -170,8 +175,10 @@ int32_t PPB_VideoDecoder_Impl::Decode(
   media::BitstreamBuffer decode_buffer(bitstream_buffer->id,
                                        buffer->shared_memory().Duplicate(),
                                        bitstream_buffer->size);
-  if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback))
+  if (!SetBitstreamBufferCallback(bitstream_buffer->id, callback)) {
+    LOG(ERROR) << "SetBitstreamBufferCallback failed";
     return PP_ERROR_BADARGUMENT;
+  }
 
   FlushCommandBuffer();
   decoder_->Decode(std::move(decode_buffer));
@@ -212,11 +219,15 @@ void PPB_VideoDecoder_Impl::ReusePictureBuffer(int32_t picture_buffer_id) {
 }
 
 int32_t PPB_VideoDecoder_Impl::Flush(scoped_refptr<TrackedCallback> callback) {
-  if (!decoder_)
+  if (!decoder_) {
+    LOG(ERROR) << "Decoder is NULL";
     return PP_ERROR_BADRESOURCE;
+  }
 
-  if (!SetFlushCallback(callback))
+  if (!SetFlushCallback(callback)) {
+    LOG(ERROR) << "SetFlushCallback failed";
     return PP_ERROR_INPROGRESS;
+  }
 
   FlushCommandBuffer();
   decoder_->Flush();
@@ -224,11 +235,15 @@ int32_t PPB_VideoDecoder_Impl::Flush(scoped_refptr<TrackedCallback> callback) {
 }
 
 int32_t PPB_VideoDecoder_Impl::Reset(scoped_refptr<TrackedCallback> callback) {
-  if (!decoder_)
+  if (!decoder_) {
+    LOG(ERROR) << "Decoder is NULL";
     return PP_ERROR_BADRESOURCE;
+  }
 
-  if (!SetResetCallback(callback))
+  if (!SetResetCallback(callback)) {
+    LOG(ERROR) << "SetFlushCallback failed";
     return PP_ERROR_INPROGRESS;
+  }
 
   FlushCommandBuffer();
   decoder_->Reset();