| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/opus_audio_decoder.h" | 5 #include "media/filters/opus_audio_decoder.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 LOG(WARNING) << "Inconsistent channel mapping."; | 237 LOG(WARNING) << "Inconsistent channel mapping."; |
| 238 | 238 |
| 239 for (int i = 0; i < header->channels; ++i) | 239 for (int i = 0; i < header->channels; ++i) |
| 240 header->stream_map[i] = *(data + kOpusHeaderStreamMapOffset + i); | 240 header->stream_map[i] = *(data + kOpusHeaderStreamMapOffset + i); |
| 241 } | 241 } |
| 242 | 242 |
| 243 OpusAudioDecoder::OpusAudioDecoder( | 243 OpusAudioDecoder::OpusAudioDecoder( |
| 244 const scoped_refptr<base::MessageLoopProxy>& message_loop) | 244 const scoped_refptr<base::MessageLoopProxy>& message_loop) |
| 245 : message_loop_(message_loop), | 245 : message_loop_(message_loop), |
| 246 weak_factory_(this), | 246 weak_factory_(this), |
| 247 demuxer_stream_(NULL), |
| 247 opus_decoder_(NULL), | 248 opus_decoder_(NULL), |
| 248 bits_per_channel_(0), | 249 bits_per_channel_(0), |
| 249 channel_layout_(CHANNEL_LAYOUT_NONE), | 250 channel_layout_(CHANNEL_LAYOUT_NONE), |
| 250 samples_per_second_(0), | 251 samples_per_second_(0), |
| 251 last_input_timestamp_(kNoTimestamp()), | 252 last_input_timestamp_(kNoTimestamp()), |
| 252 output_bytes_to_drop_(0), | 253 output_bytes_to_drop_(0), |
| 253 skip_samples_(0) { | 254 skip_samples_(0) { |
| 254 } | 255 } |
| 255 | 256 |
| 256 void OpusAudioDecoder::Initialize( | 257 void OpusAudioDecoder::Initialize( |
| 257 const scoped_refptr<DemuxerStream>& stream, | 258 DemuxerStream* stream, |
| 258 const PipelineStatusCB& status_cb, | 259 const PipelineStatusCB& status_cb, |
| 259 const StatisticsCB& statistics_cb) { | 260 const StatisticsCB& statistics_cb) { |
| 260 DCHECK(message_loop_->BelongsToCurrentThread()); | 261 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 261 PipelineStatusCB initialize_cb = BindToCurrentLoop(status_cb); | 262 PipelineStatusCB initialize_cb = BindToCurrentLoop(status_cb); |
| 262 | 263 |
| 263 if (demuxer_stream_) { | 264 if (demuxer_stream_) { |
| 264 // TODO(scherkus): initialization currently happens more than once in | 265 // TODO(scherkus): initialization currently happens more than once in |
| 265 // PipelineIntegrationTest.BasicPlayback. | 266 // PipelineIntegrationTest.BasicPlayback. |
| 266 LOG(ERROR) << "Initialize has already been called."; | 267 LOG(ERROR) << "Initialize has already been called."; |
| 267 CHECK(false); | 268 CHECK(false); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 559 |
| 559 // Decoding finished successfully, update statistics. | 560 // Decoding finished successfully, update statistics. |
| 560 PipelineStatistics statistics; | 561 PipelineStatistics statistics; |
| 561 statistics.audio_bytes_decoded = decoded_audio_size; | 562 statistics.audio_bytes_decoded = decoded_audio_size; |
| 562 statistics_cb_.Run(statistics); | 563 statistics_cb_.Run(statistics); |
| 563 | 564 |
| 564 return true; | 565 return true; |
| 565 } | 566 } |
| 566 | 567 |
| 567 } // namespace media | 568 } // namespace media |
| OLD | NEW |