OLD | NEW |
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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 jobject media_crypto_obj = media_crypto_ ? media_crypto_->obj() : nullptr; | 133 jobject media_crypto_obj = media_crypto_ ? media_crypto_->obj() : nullptr; |
134 std::unique_ptr<MediaCodecBridge> audio_codec_bridge( | 134 std::unique_ptr<MediaCodecBridge> audio_codec_bridge( |
135 MediaCodecBridgeImpl::CreateAudioDecoder(config_, media_crypto_obj)); | 135 MediaCodecBridgeImpl::CreateAudioDecoder(config_, media_crypto_obj)); |
136 if (!audio_codec_bridge) { | 136 if (!audio_codec_bridge) { |
137 DLOG(ERROR) << __func__ << " failed: cannot create MediaCodecBridge"; | 137 DLOG(ERROR) << __func__ << " failed: cannot create MediaCodecBridge"; |
138 return false; | 138 return false; |
139 } | 139 } |
140 | 140 |
141 codec_loop_.reset( | 141 codec_loop_.reset( |
142 new MediaCodecLoop(base::android::BuildInfo::GetInstance()->sdk_int(), | 142 new MediaCodecLoop(base::android::BuildInfo::GetInstance()->sdk_int(), |
143 this, std::move(audio_codec_bridge))); | 143 this, std::move(audio_codec_bridge), |
| 144 scoped_refptr<base::SingleThreadTaskRunner>())); |
144 | 145 |
145 return true; | 146 return true; |
146 } | 147 } |
147 | 148 |
148 void MediaCodecAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, | 149 void MediaCodecAudioDecoder::Decode(const scoped_refptr<DecoderBuffer>& buffer, |
149 const DecodeCB& decode_cb) { | 150 const DecodeCB& decode_cb) { |
150 DecodeCB bound_decode_cb = BindToCurrentLoop(decode_cb); | 151 DecodeCB bound_decode_cb = BindToCurrentLoop(decode_cb); |
151 | 152 |
152 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp) { | 153 if (!buffer->end_of_stream() && buffer->timestamp() == kNoTimestamp) { |
153 DVLOG(2) << __func__ << " " << buffer->AsHumanReadableString() | 154 DVLOG(2) << __func__ << " " << buffer->AsHumanReadableString() |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 RETURN_STRING(STATE_READY); | 514 RETURN_STRING(STATE_READY); |
514 RETURN_STRING(STATE_ERROR); | 515 RETURN_STRING(STATE_ERROR); |
515 } | 516 } |
516 NOTREACHED() << "Unknown state " << state; | 517 NOTREACHED() << "Unknown state " << state; |
517 return nullptr; | 518 return nullptr; |
518 } | 519 } |
519 | 520 |
520 #undef RETURN_STRING | 521 #undef RETURN_STRING |
521 | 522 |
522 } // namespace media | 523 } // namespace media |
OLD | NEW |