| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 | 530 |
| 531 DCHECK(buffer_converter_); | 531 DCHECK(buffer_converter_); |
| 532 buffer_converter_->AddInput(buffer); | 532 buffer_converter_->AddInput(buffer); |
| 533 while (buffer_converter_->HasNextBuffer()) { | 533 while (buffer_converter_->HasNextBuffer()) { |
| 534 if (!splicer_->AddInput(buffer_converter_->GetNextBuffer())) { | 534 if (!splicer_->AddInput(buffer_converter_->GetNextBuffer())) { |
| 535 HandleAbortedReadOrDecodeError(true); | 535 HandleAbortedReadOrDecodeError(true); |
| 536 return; | 536 return; |
| 537 } | 537 } |
| 538 } | 538 } |
| 539 } else { | 539 } else { |
| 540 // TODO(chcunningham, tguilbert): Figure out if we want to support implicit |
| 541 // config changes during src=. Doing so requires resampling each individual |
| 542 // stream which is inefficient when there are many tags in a page. |
| 543 // |
| 544 // Check if the buffer we received matches the expected configuration. |
| 545 // Note: We explicitly do not check channel layout here to avoid breaking |
| 546 // weird behavior with multichannel wav files: http://crbug.com/600538. |
| 547 if (!buffer->end_of_stream() && |
| 548 (buffer->sample_rate() != audio_parameters_.sample_rate() || |
| 549 buffer->channel_count() != audio_parameters_.channels())) { |
| 550 MEDIA_LOG(ERROR, media_log_) |
| 551 << "Unsupported midstream configuration change!" |
| 552 << " Sample Rate: " << buffer->sample_rate() << " vs " |
| 553 << audio_parameters_.sample_rate() |
| 554 << ", Channels: " << buffer->channel_count() << " vs " |
| 555 << audio_parameters_.channels(); |
| 556 HandleAbortedReadOrDecodeError(PIPELINE_ERROR_DECODE); |
| 557 return; |
| 558 } |
| 559 |
| 540 if (!splicer_->AddInput(buffer)) { | 560 if (!splicer_->AddInput(buffer)) { |
| 541 HandleAbortedReadOrDecodeError(true); | 561 HandleAbortedReadOrDecodeError(true); |
| 542 return; | 562 return; |
| 543 } | 563 } |
| 544 } | 564 } |
| 545 | 565 |
| 546 if (!splicer_->HasNextBuffer()) { | 566 if (!splicer_->HasNextBuffer()) { |
| 547 AttemptRead_Locked(); | 567 AttemptRead_Locked(); |
| 548 return; | 568 return; |
| 549 } | 569 } |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 << buffering_state; | 907 << buffering_state; |
| 888 DCHECK_NE(buffering_state_, buffering_state); | 908 DCHECK_NE(buffering_state_, buffering_state); |
| 889 lock_.AssertAcquired(); | 909 lock_.AssertAcquired(); |
| 890 buffering_state_ = buffering_state; | 910 buffering_state_ = buffering_state; |
| 891 | 911 |
| 892 task_runner_->PostTask(FROM_HERE, | 912 task_runner_->PostTask(FROM_HERE, |
| 893 base::Bind(buffering_state_cb_, buffering_state_)); | 913 base::Bind(buffering_state_cb_, buffering_state_)); |
| 894 } | 914 } |
| 895 | 915 |
| 896 } // namespace media | 916 } // namespace media |
| OLD | NEW |