| 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 #ifndef MEDIA_BASE_AUDIO_SPLICER_H_ | 5 #ifndef MEDIA_BASE_AUDIO_SPLICER_H_ |
| 6 #define MEDIA_BASE_AUDIO_SPLICER_H_ | 6 #define MEDIA_BASE_AUDIO_SPLICER_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "media/audio/audio_parameters.h" | 11 #include "media/audio/audio_parameters.h" |
| 12 #include "media/base/buffers.h" | 12 #include "media/base/buffers.h" |
| 13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 14 | 14 |
| 15 namespace media { | 15 namespace media { |
| 16 | 16 |
| 17 class AudioBuffer; | 17 class AudioBuffer; |
| 18 class AudioBus; | 18 class AudioBus; |
| 19 class AudioStreamSanitizer; | 19 class AudioStreamSanitizer; |
| 20 class MediaLog; |
| 20 | 21 |
| 21 // Helper class that handles filling gaps and resolving overlaps. | 22 // Helper class that handles filling gaps and resolving overlaps. |
| 22 class MEDIA_EXPORT AudioSplicer { | 23 class MEDIA_EXPORT AudioSplicer { |
| 23 public: | 24 public: |
| 24 explicit AudioSplicer(int samples_per_second); | 25 AudioSplicer(int samples_per_second, |
| 26 const scoped_refptr<MediaLog>& media_log); |
| 25 ~AudioSplicer(); | 27 ~AudioSplicer(); |
| 26 | 28 |
| 27 enum { | 29 enum { |
| 28 // The number of ms to crossfade before trimming when buffers overlap. | 30 // The number of ms to crossfade before trimming when buffers overlap. |
| 29 kCrossfadeDurationInMilliseconds = 5, | 31 kCrossfadeDurationInMilliseconds = 5, |
| 30 | 32 |
| 31 // Largest gap or overlap allowed between buffers. Anything larger than | 33 // Largest gap or overlap allowed between buffers. Anything larger than |
| 32 // this will trigger an error. This is an arbitrary value, but the initial | 34 // this will trigger an error. This is an arbitrary value, but the initial |
| 33 // selection of 50ms roughly represents the duration of 2 compressed AAC or | 35 // selection of 50ms roughly represents the duration of 2 compressed AAC or |
| 34 // MP3 frames. | 36 // MP3 frames. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 // Whether all buffers which should go into |pre_splice_sanitizer_| have been | 117 // Whether all buffers which should go into |pre_splice_sanitizer_| have been |
| 116 // received. If true, buffers should now be put in |post_splice_sanitizer_|. | 118 // received. If true, buffers should now be put in |post_splice_sanitizer_|. |
| 117 bool have_all_pre_splice_buffers_; | 119 bool have_all_pre_splice_buffers_; |
| 118 | 120 |
| 119 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSplicer); | 121 DISALLOW_IMPLICIT_CONSTRUCTORS(AudioSplicer); |
| 120 }; | 122 }; |
| 121 | 123 |
| 122 } // namespace media | 124 } // namespace media |
| 123 | 125 |
| 124 #endif | 126 #endif |
| OLD | NEW |