OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/sys_byteorder.h" | 10 #include "base/sys_byteorder.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 << config_.codec_delay(); | 256 << config_.codec_delay(); |
257 return false; | 257 return false; |
258 } | 258 } |
259 | 259 |
260 if (config_.codec_delay() != opus_extra_data.skip_samples) { | 260 if (config_.codec_delay() != opus_extra_data.skip_samples) { |
261 DLOG(WARNING) << "Invalid file. Codec Delay in container does not match " | 261 DLOG(WARNING) << "Invalid file. Codec Delay in container does not match " |
262 << "the value in Opus Extra Data. " << config_.codec_delay() | 262 << "the value in Opus Extra Data. " << config_.codec_delay() |
263 << " vs " << opus_extra_data.skip_samples; | 263 << " vs " << opus_extra_data.skip_samples; |
264 config_.Initialize(config_.codec(), config_.sample_format(), | 264 config_.Initialize(config_.codec(), config_.sample_format(), |
265 config_.channel_layout(), config_.samples_per_second(), | 265 config_.channel_layout(), config_.samples_per_second(), |
266 config_.extra_data(), config_.is_encrypted(), | 266 config_.extra_data(), config_.encryption_scheme(), |
267 config_.seek_preroll(), opus_extra_data.skip_samples); | 267 config_.seek_preroll(), opus_extra_data.skip_samples); |
268 } | 268 } |
269 | 269 |
270 uint8 channel_mapping[OPUS_MAX_VORBIS_CHANNELS] = {0}; | 270 uint8 channel_mapping[OPUS_MAX_VORBIS_CHANNELS] = {0}; |
271 memcpy(&channel_mapping, kDefaultOpusChannelLayout, | 271 memcpy(&channel_mapping, kDefaultOpusChannelLayout, |
272 OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT); | 272 OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT); |
273 | 273 |
274 if (channel_count > OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT) { | 274 if (channel_count > OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT) { |
275 RemapOpusChannelLayout(opus_extra_data.stream_map, | 275 RemapOpusChannelLayout(opus_extra_data.stream_map, |
276 channel_count, | 276 channel_count, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 output_buffer->get()->TrimEnd(trim_frames); | 353 output_buffer->get()->TrimEnd(trim_frames); |
354 | 354 |
355 // Handles discards and timestamping. Discard the buffer if more data needed. | 355 // Handles discards and timestamping. Discard the buffer if more data needed. |
356 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) | 356 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) |
357 *output_buffer = nullptr; | 357 *output_buffer = nullptr; |
358 | 358 |
359 return true; | 359 return true; |
360 } | 360 } |
361 | 361 |
362 } // namespace media | 362 } // namespace media |
OLD | NEW |