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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 output_buffer->get()->TrimEnd(discard_padding); | 594 output_buffer->get()->TrimEnd(discard_padding); |
595 frames_decoded -= discard_padding; | 595 frames_decoded -= discard_padding; |
596 } | 596 } |
597 } else if (bytes_decoded > 0) { | 597 } else if (bytes_decoded > 0) { |
598 frames_to_discard_ -= frames_decoded; | 598 frames_to_discard_ -= frames_decoded; |
599 frames_decoded = 0; | 599 frames_decoded = 0; |
600 } | 600 } |
601 | 601 |
602 // Decoding finished successfully, update statistics. | 602 // Decoding finished successfully, update statistics. |
603 PipelineStatistics statistics; | 603 PipelineStatistics statistics; |
604 statistics.audio_bytes_decoded = | 604 statistics.audio_bytes_decoded = input->data_size(); |
605 frames_decoded * | |
606 demuxer_stream_->audio_decoder_config().bytes_per_frame(); | |
607 statistics_cb_.Run(statistics); | 605 statistics_cb_.Run(statistics); |
608 | 606 |
| 607 // Discard the buffer to indicate we need more data. |
| 608 if (!frames_decoded) |
| 609 *output_buffer = NULL; |
| 610 |
609 return true; | 611 return true; |
610 } | 612 } |
611 | 613 |
612 } // namespace media | 614 } // namespace media |
OLD | NEW |