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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 << config_.codec_delay(); | 262 << config_.codec_delay(); |
263 return false; | 263 return false; |
264 } | 264 } |
265 | 265 |
266 if (config_.codec_delay() != opus_extra_data.skip_samples) { | 266 if (config_.codec_delay() != opus_extra_data.skip_samples) { |
267 DLOG(WARNING) << "Invalid file. Codec Delay in container does not match " | 267 DLOG(WARNING) << "Invalid file. Codec Delay in container does not match " |
268 << "the value in Opus Extra Data. " << config_.codec_delay() | 268 << "the value in Opus Extra Data. " << config_.codec_delay() |
269 << " vs " << opus_extra_data.skip_samples; | 269 << " vs " << opus_extra_data.skip_samples; |
270 config_.Initialize(config_.codec(), config_.sample_format(), | 270 config_.Initialize(config_.codec(), config_.sample_format(), |
271 config_.channel_layout(), config_.samples_per_second(), | 271 config_.channel_layout(), config_.samples_per_second(), |
272 config_.extra_data(), config_.is_encrypted(), | 272 config_.extra_data(), config_.encryption_scheme(), |
273 config_.seek_preroll(), opus_extra_data.skip_samples); | 273 config_.seek_preroll(), opus_extra_data.skip_samples); |
274 } | 274 } |
275 | 275 |
276 uint8_t channel_mapping[OPUS_MAX_VORBIS_CHANNELS] = {0}; | 276 uint8_t channel_mapping[OPUS_MAX_VORBIS_CHANNELS] = {0}; |
277 memcpy(&channel_mapping, kDefaultOpusChannelLayout, | 277 memcpy(&channel_mapping, kDefaultOpusChannelLayout, |
278 OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT); | 278 OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT); |
279 | 279 |
280 if (channel_count > OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT) { | 280 if (channel_count > OPUS_MAX_CHANNELS_WITH_DEFAULT_LAYOUT) { |
281 RemapOpusChannelLayout(opus_extra_data.stream_map, | 281 RemapOpusChannelLayout(opus_extra_data.stream_map, |
282 channel_count, | 282 channel_count, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 output_buffer->get()->TrimEnd(trim_frames); | 359 output_buffer->get()->TrimEnd(trim_frames); |
360 | 360 |
361 // Handles discards and timestamping. Discard the buffer if more data needed. | 361 // Handles discards and timestamping. Discard the buffer if more data needed. |
362 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) | 362 if (!discard_helper_->ProcessBuffers(input, *output_buffer)) |
363 *output_buffer = nullptr; | 363 *output_buffer = nullptr; |
364 | 364 |
365 return true; | 365 return true; |
366 } | 366 } |
367 | 367 |
368 } // namespace media | 368 } // namespace media |
OLD | NEW |