summaryrefslogtreecommitdiff
path: root/chromium/media/filters/android/media_codec_audio_decoder.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-07-31 15:50:41 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-08-30 12:35:23 +0000
commit7b2ffa587235a47d4094787d72f38102089f402a (patch)
tree30e82af9cbab08a7fa028bb18f4f2987a3f74dfa /chromium/media/filters/android/media_codec_audio_decoder.cc
parentd94af01c90575348c4e81a418257f254b6f8d225 (diff)
downloadqtwebengine-chromium-7b2ffa587235a47d4094787d72f38102089f402a.tar.gz
BASELINE: Update Chromium to 76.0.3809.94
Change-Id: I321c3f5f929c105aec0f98c5091ef6108822e647 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/media/filters/android/media_codec_audio_decoder.cc')
-rw-r--r--chromium/media/filters/android/media_codec_audio_decoder.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/chromium/media/filters/android/media_codec_audio_decoder.cc b/chromium/media/filters/android/media_codec_audio_decoder.cc
index b6e66352232..9040ff98048 100644
--- a/chromium/media/filters/android/media_codec_audio_decoder.cc
+++ b/chromium/media/filters/android/media_codec_audio_decoder.cc
@@ -63,7 +63,7 @@ std::string MediaCodecAudioDecoder::GetDisplayName() const {
void MediaCodecAudioDecoder::Initialize(const AudioDecoderConfig& config,
CdmContext* cdm_context,
- const InitCB& init_cb,
+ InitCB init_cb,
const OutputCB& output_cb,
const WaitingCB& waiting_cb) {
DVLOG(1) << __func__ << ": " << config.AsHumanReadableString();
@@ -76,7 +76,6 @@ void MediaCodecAudioDecoder::Initialize(const AudioDecoderConfig& config,
DCHECK(input_queue_.empty());
ClearInputQueue(DecodeStatus::ABORTED);
- InitCB bound_init_cb = BindToCurrentLoop(init_cb);
is_passthrough_ = MediaCodecUtil::IsPassthroughAudioFormat(config.codec());
sample_format_ = kSampleFormatS16;
@@ -89,7 +88,7 @@ void MediaCodecAudioDecoder::Initialize(const AudioDecoderConfig& config,
if (state_ == STATE_ERROR) {
DVLOG(1) << "Decoder is in error state.";
- bound_init_cb.Run(false);
+ BindToCurrentLoop(std::move(init_cb)).Run(false);
return;
}
@@ -101,7 +100,7 @@ void MediaCodecAudioDecoder::Initialize(const AudioDecoderConfig& config,
config.codec() == kCodecOpus || is_passthrough_;
if (!is_codec_supported) {
DVLOG(1) << "Unsuported codec " << GetCodecName(config.codec());
- bound_init_cb.Run(false);
+ BindToCurrentLoop(std::move(init_cb)).Run(false);
return;
}
@@ -120,24 +119,24 @@ void MediaCodecAudioDecoder::Initialize(const AudioDecoderConfig& config,
LOG(ERROR) << "The stream is encrypted but there is no CdmContext or "
"MediaCryptoContext is not supported";
SetState(STATE_ERROR);
- bound_init_cb.Run(false);
+ BindToCurrentLoop(std::move(init_cb)).Run(false);
return;
}
// Postpone initialization after MediaCrypto is available.
// SetCdm uses init_cb in a method that's already bound to the current loop.
SetState(STATE_WAITING_FOR_MEDIA_CRYPTO);
- SetCdm(init_cb);
+ SetCdm(std::move(init_cb));
return;
}
if (!CreateMediaCodecLoop()) {
- bound_init_cb.Run(false);
+ BindToCurrentLoop(std::move(init_cb)).Run(false);
return;
}
SetState(STATE_READY);
- bound_init_cb.Run(true);
+ BindToCurrentLoop(std::move(init_cb)).Run(true);
}
bool MediaCodecAudioDecoder::CreateMediaCodecLoop() {
@@ -205,7 +204,7 @@ void MediaCodecAudioDecoder::Decode(scoped_refptr<DecoderBuffer> buffer,
codec_loop_->ExpectWork();
}
-void MediaCodecAudioDecoder::Reset(const base::Closure& closure) {
+void MediaCodecAudioDecoder::Reset(base::OnceClosure closure) {
DVLOG(2) << __func__;
ClearInputQueue(DecodeStatus::ABORTED);
@@ -221,7 +220,7 @@ void MediaCodecAudioDecoder::Reset(const base::Closure& closure) {
SetState(success ? STATE_READY : STATE_ERROR);
- task_runner_->PostTask(FROM_HERE, closure);
+ task_runner_->PostTask(FROM_HERE, std::move(closure));
}
bool MediaCodecAudioDecoder::NeedsBitstreamConversion() const {
@@ -230,7 +229,7 @@ bool MediaCodecAudioDecoder::NeedsBitstreamConversion() const {
return config_.codec() == kCodecAAC;
}
-void MediaCodecAudioDecoder::SetCdm(const InitCB& init_cb) {
+void MediaCodecAudioDecoder::SetCdm(InitCB init_cb) {
DCHECK(media_crypto_context_);
// Register CDM callbacks. The callbacks registered will be posted back to
@@ -247,8 +246,8 @@ void MediaCodecAudioDecoder::SetCdm(const InitCB& init_cb) {
base::DoNothing());
media_crypto_context_->SetMediaCryptoReadyCB(media::BindToCurrentLoop(
- base::Bind(&MediaCodecAudioDecoder::OnMediaCryptoReady,
- weak_factory_.GetWeakPtr(), init_cb)));
+ base::BindOnce(&MediaCodecAudioDecoder::OnMediaCryptoReady,
+ weak_factory_.GetWeakPtr(), std::move(init_cb))));
}
void MediaCodecAudioDecoder::OnKeyAdded() {
@@ -261,7 +260,7 @@ void MediaCodecAudioDecoder::OnKeyAdded() {
}
void MediaCodecAudioDecoder::OnMediaCryptoReady(
- const InitCB& init_cb,
+ InitCB init_cb,
JavaObjectPtr media_crypto,
bool /*requires_secure_video_codec*/) {
DVLOG(1) << __func__;
@@ -272,7 +271,7 @@ void MediaCodecAudioDecoder::OnMediaCryptoReady(
if (media_crypto->is_null()) {
LOG(ERROR) << "MediaCrypto is not available, can't play encrypted stream.";
SetState(STATE_UNINITIALIZED);
- init_cb.Run(false);
+ std::move(init_cb).Run(false);
return;
}
@@ -285,12 +284,12 @@ void MediaCodecAudioDecoder::OnMediaCryptoReady(
// After receiving |media_crypto_| we can configure MediaCodec.
if (!CreateMediaCodecLoop()) {
SetState(STATE_UNINITIALIZED);
- init_cb.Run(false);
+ std::move(init_cb).Run(false);
return;
}
SetState(STATE_READY);
- init_cb.Run(true);
+ std::move(init_cb).Run(true);
}
bool MediaCodecAudioDecoder::IsAnyInputPending() const {