| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // Post the task to ensure that |decode_callback| is not called from | 130 // Post the task to ensure that |decode_callback| is not called from |
| 131 // within a call to Decode(). | 131 // within a call to Decode(). |
| 132 task_runner_->PostTask(FROM_HERE, | 132 task_runner_->PostTask(FROM_HERE, |
| 133 base::Bind(decode_callback, kDecodeOk, data)); | 133 base::Bind(decode_callback, kDecodeOk, data)); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 // FFmpegAudioDecoder requires a timestamp to be set. | 137 // FFmpegAudioDecoder requires a timestamp to be set. |
| 138 base::TimeDelta timestamp = | 138 base::TimeDelta timestamp = |
| 139 base::TimeDelta::FromMicroseconds(data->timestamp()); | 139 base::TimeDelta::FromMicroseconds(data->timestamp()); |
| 140 if (timestamp == ::media::kNoTimestamp()) | 140 if (timestamp == ::media::kNoTimestamp) |
| 141 data->set_timestamp(base::TimeDelta()); | 141 data->set_timestamp(base::TimeDelta()); |
| 142 | 142 |
| 143 decode_pending_ = true; | 143 decode_pending_ = true; |
| 144 decoder_->Decode( | 144 decoder_->Decode( |
| 145 data->ToMediaBuffer(), | 145 data->ToMediaBuffer(), |
| 146 base::Bind(&CastAudioDecoderImpl::OnDecodeStatus, | 146 base::Bind(&CastAudioDecoderImpl::OnDecodeStatus, |
| 147 weak_factory_.GetWeakPtr(), timestamp, decode_callback)); | 147 weak_factory_.GetWeakPtr(), timestamp, decode_callback)); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void OnInitialized(bool success) { | 150 void OnInitialized(bool success) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 return 2; | 297 return 2; |
| 298 case CastAudioDecoder::OutputFormat::kOutputPlanarFloat: | 298 case CastAudioDecoder::OutputFormat::kOutputPlanarFloat: |
| 299 return 4; | 299 return 4; |
| 300 } | 300 } |
| 301 NOTREACHED(); | 301 NOTREACHED(); |
| 302 return 1; | 302 return 1; |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace media | 305 } // namespace media |
| 306 } // namespace chromecast | 306 } // namespace chromecast |
| OLD | NEW |