| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MEDIA_BASE_AUDIO_DISCARD_HELPER_H_ | 5 #ifndef MEDIA_BASE_AUDIO_DISCARD_HELPER_H_ |
| 6 #define MEDIA_BASE_AUDIO_DISCARD_HELPER_H_ | 6 #define MEDIA_BASE_AUDIO_DISCARD_HELPER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // | 53 // |
| 54 // If AudioDiscardHelper is not initialized() the timestamp of the first | 54 // If AudioDiscardHelper is not initialized() the timestamp of the first |
| 55 // |encoded_buffer| will be used as the basis for all future timestamps set on | 55 // |encoded_buffer| will be used as the basis for all future timestamps set on |
| 56 // |decoded_buffer|s. If the first buffer has a negative timestamp it will be | 56 // |decoded_buffer|s. If the first buffer has a negative timestamp it will be |
| 57 // clamped to zero. | 57 // clamped to zero. |
| 58 bool ProcessBuffers(const scoped_refptr<DecoderBuffer>& encoded_buffer, | 58 bool ProcessBuffers(const scoped_refptr<DecoderBuffer>& encoded_buffer, |
| 59 const scoped_refptr<AudioBuffer>& decoded_buffer); | 59 const scoped_refptr<AudioBuffer>& decoded_buffer); |
| 60 | 60 |
| 61 // Whether any buffers have been processed. | 61 // Whether any buffers have been processed. |
| 62 bool initialized() const { | 62 bool initialized() const { |
| 63 return timestamp_helper_.base_timestamp() != kNoTimestamp(); | 63 return timestamp_helper_.base_timestamp() != kNoTimestamp; |
| 64 } | 64 } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 // The sample rate of the decoded audio samples. Used by TimeDeltaToFrames() | 67 // The sample rate of the decoded audio samples. Used by TimeDeltaToFrames() |
| 68 // and the timestamp helper. | 68 // and the timestamp helper. |
| 69 const int sample_rate_; | 69 const int sample_rate_; |
| 70 | 70 |
| 71 // Some codecs output extra samples during the first decode. In order to trim | 71 // Some codecs output extra samples during the first decode. In order to trim |
| 72 // DiscardPadding correctly the helper must know the offset into the decoded | 72 // DiscardPadding correctly the helper must know the offset into the decoded |
| 73 // buffers at which real samples start. | 73 // buffers at which real samples start. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 99 // from the next buffer. The index at which to start discarding is calculated | 99 // from the next buffer. The index at which to start discarding is calculated |
| 100 // by subtracting |delayed_end_discard_| from |decoder_delay_|. | 100 // by subtracting |delayed_end_discard_| from |decoder_delay_|. |
| 101 size_t delayed_end_discard_; | 101 size_t delayed_end_discard_; |
| 102 | 102 |
| 103 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioDiscardHelper); | 103 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioDiscardHelper); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace media | 106 } // namespace media |
| 107 | 107 |
| 108 #endif // MEDIA_BASE_AUDIO_DISCARD_HELPER_H_ | 108 #endif // MEDIA_BASE_AUDIO_DISCARD_HELPER_H_ |
| OLD | NEW |