| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/media/cma/decoder/cast_audio_decoder.h" | 5 #include "chromecast/media/cma/decoder/cast_audio_decoder.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 DecodeNow(d.first, d.second); | 177 DecodeNow(d.first, d.second); |
| 178 decode_queue_.pop(); | 178 decode_queue_.pop(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 if (!initialized_callback_.is_null()) | 181 if (!initialized_callback_.is_null()) |
| 182 initialized_callback_.Run(initialized_); | 182 initialized_callback_.Run(initialized_); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void OnDecodeStatus(base::TimeDelta buffer_timestamp, | 185 void OnDecodeStatus(base::TimeDelta buffer_timestamp, |
| 186 const DecodeCallback& decode_callback, | 186 const DecodeCallback& decode_callback, |
| 187 ::media::AudioDecoder::Status status) { | 187 ::media::DecoderStatus status) { |
| 188 Status result_status = kDecodeOk; | 188 Status result_status = kDecodeOk; |
| 189 scoped_refptr<media::DecoderBufferBase> decoded; | 189 scoped_refptr<media::DecoderBufferBase> decoded; |
| 190 if (status == ::media::AudioDecoder::kOk && !decoded_chunks_.empty()) { | 190 if (status == ::media::DecoderStatus::OK && !decoded_chunks_.empty()) { |
| 191 decoded = ConvertDecoded(); | 191 decoded = ConvertDecoded(); |
| 192 } else { | 192 } else { |
| 193 if (status != ::media::AudioDecoder::kOk) | 193 if (status != ::media::DecoderStatus::OK) |
| 194 result_status = kDecodeError; | 194 result_status = kDecodeError; |
| 195 decoded = new media::DecoderBufferAdapter(config_.id, | 195 decoded = new media::DecoderBufferAdapter(config_.id, |
| 196 new ::media::DecoderBuffer(0)); | 196 new ::media::DecoderBuffer(0)); |
| 197 } | 197 } |
| 198 decoded_chunks_.clear(); | 198 decoded_chunks_.clear(); |
| 199 decoded->set_timestamp(buffer_timestamp); | 199 decoded->set_timestamp(buffer_timestamp); |
| 200 base::WeakPtr<CastAudioDecoderImpl> self = weak_factory_.GetWeakPtr(); | 200 base::WeakPtr<CastAudioDecoderImpl> self = weak_factory_.GetWeakPtr(); |
| 201 decode_callback.Run(result_status, decoded); | 201 decode_callback.Run(result_status, decoded); |
| 202 if (!self.get()) | 202 if (!self.get()) |
| 203 return; // Return immediately if the decode callback deleted this. | 203 return; // Return immediately if the decode callback deleted this. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 return 2; | 327 return 2; |
| 328 case CastAudioDecoder::OutputFormat::kOutputPlanarFloat: | 328 case CastAudioDecoder::OutputFormat::kOutputPlanarFloat: |
| 329 return 4; | 329 return 4; |
| 330 } | 330 } |
| 331 NOTREACHED(); | 331 NOTREACHED(); |
| 332 return 1; | 332 return 1; |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace media | 335 } // namespace media |
| 336 } // namespace chromecast | 336 } // namespace chromecast |
| OLD | NEW |