Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: media/filters/android/media_codec_audio_decoder.cc

Issue 2491613004: Make base::Timer sequence-friendly. (Closed)
Patch Set: rebase on r464476 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/android/media_codec_audio_decoder.h" 5 #include "media/filters/android/media_codec_audio_decoder.h"
6 6
7 #include "base/android/build_info.h" 7 #include "base/android/build_info.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 jobject media_crypto_obj = media_crypto_ ? media_crypto_->obj() : nullptr; 119 jobject media_crypto_obj = media_crypto_ ? media_crypto_->obj() : nullptr;
120 std::unique_ptr<MediaCodecBridge> audio_codec_bridge( 120 std::unique_ptr<MediaCodecBridge> audio_codec_bridge(
121 MediaCodecBridgeImpl::CreateAudioDecoder(config_, media_crypto_obj)); 121 MediaCodecBridgeImpl::CreateAudioDecoder(config_, media_crypto_obj));
122 if (!audio_codec_bridge) { 122 if (!audio_codec_bridge) {
123 DLOG(ERROR) << __func__ << " failed: cannot create MediaCodecBridge"; 123 DLOG(ERROR) << __func__ << " failed: cannot create MediaCodecBridge";
124 return false; 124 return false;
125 } 125 }
126 126
127 codec_loop_.reset( 127 codec_loop_.reset(
128 new MediaCodecLoop(base::android::BuildInfo::GetInstance()->sdk_int(), 128 new MediaCodecLoop(base::android::BuildInfo::GetInstance()->sdk_int(),
129 this, std::move(audio_codec_bridge))); 129 this, std::move(audio_codec_bridge),
130 scoped_refptr<base::SingleThreadTaskRunner>()));
130 131
131 return true; 132 return true;
132 } 133 }
133 134
134 void MediaCodecAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, 135 void MediaCodecAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer,
135 const DecodeCB& decode_cb) { 136 const DecodeCB& decode_cb) {
136 DecodeCB bound_decode_cb = BindToCurrentLoop(decode_cb); 137 DecodeCB bound_decode_cb = BindToCurrentLoop(decode_cb);
137 138
138 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp) { 139 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp) {
139 DVLOG(2) << __func__ << " " << buffer->AsHumanReadableString() 140 DVLOG(2) << __func__ << " " << buffer->AsHumanReadableString()
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 RETURN_STRING(STATE_READY); 468 RETURN_STRING(STATE_READY);
468 RETURN_STRING(STATE_ERROR); 469 RETURN_STRING(STATE_ERROR);
469 } 470 }
470 NOTREACHED() << "Unknown state " << state; 471 NOTREACHED() << "Unknown state " << state;
471 return nullptr; 472 return nullptr;
472 } 473 }
473 474
474 #undef RETURN_STRING 475 #undef RETURN_STRING
475 476
476 } // namespace media 477 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698