| 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_CAST_TEST_UTILITY_AUDIO_UTILITY_H_ | 5 #ifndef MEDIA_CAST_TEST_UTILITY_AUDIO_UTILITY_H_ |
| 6 #define MEDIA_CAST_TEST_UTILITY_AUDIO_UTILITY_H_ | 6 #define MEDIA_CAST_TEST_UTILITY_AUDIO_UTILITY_H_ |
| 7 | 7 |
| 8 #include "media/audio/simple_sources.h" | 8 #include "media/audio/simple_sources.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 int CountZeroCrossings(const float* samples, int length); | 60 int CountZeroCrossings(const float* samples, int length); |
| 61 | 61 |
| 62 // Encode |timestamp| into the samples pointed to by 'samples' in a way | 62 // Encode |timestamp| into the samples pointed to by 'samples' in a way |
| 63 // that should be decodable even after compressing/decompressing the audio. | 63 // that should be decodable even after compressing/decompressing the audio. |
| 64 // Assumes 48Khz sampling rate and needs at least 240 samples. Returns | 64 // Assumes 48Khz sampling rate and needs at least 240 samples. Returns |
| 65 // false if |length| of |samples| is too small. If more than 240 samples are | 65 // false if |length| of |samples| is too small. If more than 240 samples are |
| 66 // available, then the timestamp will be repeated. |sample_offset| should | 66 // available, then the timestamp will be repeated. |sample_offset| should |
| 67 // contain how many samples has been encoded so far, so that we can make smooth | 67 // contain how many samples has been encoded so far, so that we can make smooth |
| 68 // transitions between encoded chunks. | 68 // transitions between encoded chunks. |
| 69 // See audio_utility.cc for details on how the encoding is done. | 69 // See audio_utility.cc for details on how the encoding is done. |
| 70 bool EncodeTimestamp(uint16 timestamp, | 70 bool EncodeTimestamp(uint16_t timestamp, |
| 71 size_t sample_offset, | 71 size_t sample_offset, |
| 72 size_t length, | 72 size_t length, |
| 73 float* samples); | 73 float* samples); |
| 74 | 74 |
| 75 // Decode a timestamp encoded with EncodeTimestamp. Returns true if a | 75 // Decode a timestamp encoded with EncodeTimestamp. Returns true if a |
| 76 // timestamp was found in |samples|. | 76 // timestamp was found in |samples|. |
| 77 bool DecodeTimestamp(const float* samples, size_t length, uint16* timestamp); | 77 bool DecodeTimestamp(const float* samples, size_t length, uint16_t* timestamp); |
| 78 | 78 |
| 79 } // namespace cast | 79 } // namespace cast |
| 80 } // namespace media | 80 } // namespace media |
| 81 | 81 |
| 82 #endif // MEDIA_CAST_TEST_UTILITY_AUDIO_UTILITY_H_ | 82 #endif // MEDIA_CAST_TEST_UTILITY_AUDIO_UTILITY_H_ |
| OLD | NEW |