Commit 49acd6a5 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Fix FuchsiaVideoDecoder to call DecodeCB asynchronously.

FuchsiaVideoDecoder was calling DecodeCB synchronously in Decode().
DecoderStream doesn't expect this, so it was failing a DCHECK.

Bug: 909018
Change-Id: Ibf445447b3875ae76ff5d69a5ba9af174836a21b
Reviewed-on: https://chromium-review.googlesource.com/c/1351647Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612461}
parent 72a4baa7
...@@ -7,13 +7,16 @@ ...@@ -7,13 +7,16 @@
#include <fuchsia/mediacodec/cpp/fidl.h> #include <fuchsia/mediacodec/cpp/fidl.h>
#include <zircon/rights.h> #include <zircon/rights.h>
#include "base/bind.h"
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/fuchsia/component_context.h" #include "base/fuchsia/component_context.h"
#include "base/fuchsia/fuchsia_logging.h" #include "base/fuchsia/fuchsia_logging.h"
#include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "media/base/bind_to_current_loop.h" #include "media/base/bind_to_current_loop.h"
#include "media/base/video_decoder.h" #include "media/base/video_decoder.h"
#include "media/base/video_decoder_config.h" #include "media/base/video_decoder_config.h"
...@@ -436,7 +439,10 @@ void FuchsiaVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer, ...@@ -436,7 +439,10 @@ void FuchsiaVideoDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
GetMaxDecodeRequests()); GetMaxDecodeRequests());
if (!codec_) { if (!codec_) {
decode_cb.Run(DecodeStatus::DECODE_ERROR); // Post the callback to the current sequence as DecoderStream doesn't expect
// Decode() to complete synchronously.
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(decode_cb, DecodeStatus::DECODE_ERROR));
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment