Chromium Code Reviews| 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/renderers/audio_renderer_impl.h" | 5 #include "media/renderers/audio_renderer_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 528 | 528 |
| 529 DCHECK(buffer_converter_); | 529 DCHECK(buffer_converter_); |
| 530 buffer_converter_->AddInput(buffer); | 530 buffer_converter_->AddInput(buffer); |
| 531 while (buffer_converter_->HasNextBuffer()) { | 531 while (buffer_converter_->HasNextBuffer()) { |
| 532 if (!splicer_->AddInput(buffer_converter_->GetNextBuffer())) { | 532 if (!splicer_->AddInput(buffer_converter_->GetNextBuffer())) { |
| 533 HandleAbortedReadOrDecodeError(AUDIO_RENDERER_ERROR_SPLICE_FAILED); | 533 HandleAbortedReadOrDecodeError(AUDIO_RENDERER_ERROR_SPLICE_FAILED); |
| 534 return; | 534 return; |
| 535 } | 535 } |
| 536 } | 536 } |
| 537 } else { | 537 } else { |
| 538 // TODO(chcunningham, tguilbert): Figure out if we want to support implicit | |
|
chcunningham
2016/04/19 00:28:56
Implicit config changes for AAC actually work with
tguilbert
2016/04/19 18:17:57
Discussed offline. Currently, the media used to te
| |
| 539 // config changes during src=. Doing so requires resampling each individual | |
| 540 // stream which is inefficient when there are many tags in a page. | |
| 541 // | |
| 542 // Check if the buffer we received matches the expected configuration. | |
| 543 // Note: We explicitly do not check channel layout here to avoid breaking | |
| 544 // weird behavior with multichannel wav files: http://crbug.com/600538. | |
| 545 if (!buffer->end_of_stream() && | |
| 546 (buffer->sample_rate() != audio_parameters_.sample_rate() || | |
| 547 buffer->channel_count() != audio_parameters_.channels())) { | |
| 548 MEDIA_LOG(ERROR, media_log_) | |
| 549 << "Unsupported midstream configuration change!" | |
| 550 << " Sample Rate: " << buffer->sample_rate() << " vs " | |
| 551 << audio_parameters_.sample_rate() | |
| 552 << ", Channels: " << buffer->channel_count() << " vs " | |
| 553 << audio_parameters_.channels(); | |
| 554 HandleAbortedReadOrDecodeError(PIPELINE_ERROR_DECODE); | |
| 555 return; | |
| 556 } | |
| 557 | |
| 538 if (!splicer_->AddInput(buffer)) { | 558 if (!splicer_->AddInput(buffer)) { |
|
chcunningham
2016/04/19 00:28:56
IIUC, prior to adding the decode error above, we w
tguilbert
2016/04/19 18:17:56
SGTM, but please get a second opinion :)
| |
| 539 HandleAbortedReadOrDecodeError(AUDIO_RENDERER_ERROR_SPLICE_FAILED); | 559 HandleAbortedReadOrDecodeError(AUDIO_RENDERER_ERROR_SPLICE_FAILED); |
| 540 return; | 560 return; |
| 541 } | 561 } |
| 542 } | 562 } |
| 543 | 563 |
| 544 if (!splicer_->HasNextBuffer()) { | 564 if (!splicer_->HasNextBuffer()) { |
| 545 AttemptRead_Locked(); | 565 AttemptRead_Locked(); |
| 546 return; | 566 return; |
| 547 } | 567 } |
| 548 | 568 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 881 << buffering_state; | 901 << buffering_state; |
| 882 DCHECK_NE(buffering_state_, buffering_state); | 902 DCHECK_NE(buffering_state_, buffering_state); |
| 883 lock_.AssertAcquired(); | 903 lock_.AssertAcquired(); |
| 884 buffering_state_ = buffering_state; | 904 buffering_state_ = buffering_state; |
| 885 | 905 |
| 886 task_runner_->PostTask(FROM_HERE, | 906 task_runner_->PostTask(FROM_HERE, |
| 887 base::Bind(buffering_state_cb_, buffering_state_)); | 907 base::Bind(buffering_state_cb_, buffering_state_)); |
| 888 } | 908 } |
| 889 | 909 |
| 890 } // namespace media | 910 } // namespace media |
| OLD | NEW |