OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cast/receiver/audio_decoder.h" | 5 #include "media/cast/receiver/audio_decoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 break; | 213 break; |
214 default: | 214 default: |
215 NOTREACHED() << "Unknown or unspecified codec."; | 215 NOTREACHED() << "Unknown or unspecified codec."; |
216 break; | 216 break; |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 AudioDecoder::~AudioDecoder() {} | 220 AudioDecoder::~AudioDecoder() {} |
221 | 221 |
222 CastInitializationStatus AudioDecoder::InitializationResult() const { | 222 CastInitializationStatus AudioDecoder::InitializationResult() const { |
223 if (impl_) | 223 if (impl_.get()) |
224 return impl_->InitializationResult(); | 224 return impl_->InitializationResult(); |
225 return STATUS_UNSUPPORTED_AUDIO_CODEC; | 225 return STATUS_UNSUPPORTED_AUDIO_CODEC; |
226 } | 226 } |
227 | 227 |
228 void AudioDecoder::DecodeFrame( | 228 void AudioDecoder::DecodeFrame( |
229 scoped_ptr<EncodedFrame> encoded_frame, | 229 scoped_ptr<EncodedFrame> encoded_frame, |
230 const DecodeFrameCallback& callback) { | 230 const DecodeFrameCallback& callback) { |
231 DCHECK(encoded_frame.get()); | 231 DCHECK(encoded_frame.get()); |
232 DCHECK(!callback.is_null()); | 232 DCHECK(!callback.is_null()); |
233 if (!impl_ || impl_->InitializationResult() != STATUS_AUDIO_INITIALIZED) { | 233 if (!impl_.get() || |
| 234 impl_->InitializationResult() != STATUS_AUDIO_INITIALIZED) { |
234 callback.Run(make_scoped_ptr<AudioBus>(NULL), false); | 235 callback.Run(make_scoped_ptr<AudioBus>(NULL), false); |
235 return; | 236 return; |
236 } | 237 } |
237 cast_environment_->PostTask(CastEnvironment::AUDIO, | 238 cast_environment_->PostTask(CastEnvironment::AUDIO, |
238 FROM_HERE, | 239 FROM_HERE, |
239 base::Bind(&AudioDecoder::ImplBase::DecodeFrame, | 240 base::Bind(&AudioDecoder::ImplBase::DecodeFrame, |
240 impl_, | 241 impl_, |
241 base::Passed(&encoded_frame), | 242 base::Passed(&encoded_frame), |
242 callback)); | 243 callback)); |
243 } | 244 } |
244 | 245 |
245 } // namespace cast | 246 } // namespace cast |
246 } // namespace media | 247 } // namespace media |
OLD | NEW |