OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 timestamps_per_frame = 160; | 69 timestamps_per_frame = 160; |
70 } else if (payload.size() % 50 == 0) { | 70 } else if (payload.size() % 50 == 0) { |
71 // 30 ms frames. | 71 // 30 ms frames. |
72 bytes_per_frame = 50; | 72 bytes_per_frame = 50; |
73 timestamps_per_frame = 240; | 73 timestamps_per_frame = 240; |
74 } else { | 74 } else { |
75 LOG(LS_WARNING) << "AudioDecoderIlbc::ParsePayload: Invalid payload"; | 75 LOG(LS_WARNING) << "AudioDecoderIlbc::ParsePayload: Invalid payload"; |
76 return results; | 76 return results; |
77 } | 77 } |
78 | 78 |
79 RTC_DCHECK_EQ(0u, payload.size() % bytes_per_frame); | 79 RTC_DCHECK_EQ(0, payload.size() % bytes_per_frame); |
80 if (payload.size() == bytes_per_frame) { | 80 if (payload.size() == bytes_per_frame) { |
81 std::unique_ptr<EncodedAudioFrame> frame( | 81 std::unique_ptr<EncodedAudioFrame> frame( |
82 new LegacyEncodedAudioFrame(this, std::move(payload))); | 82 new LegacyEncodedAudioFrame(this, std::move(payload))); |
83 results.emplace_back(timestamp, 0, std::move(frame)); | 83 results.emplace_back(timestamp, 0, std::move(frame)); |
84 } else { | 84 } else { |
85 size_t byte_offset; | 85 size_t byte_offset; |
86 uint32_t timestamp_offset; | 86 uint32_t timestamp_offset; |
87 for (byte_offset = 0, timestamp_offset = 0; | 87 for (byte_offset = 0, timestamp_offset = 0; |
88 byte_offset < payload.size(); | 88 byte_offset < payload.size(); |
89 byte_offset += bytes_per_frame, | 89 byte_offset += bytes_per_frame, |
90 timestamp_offset += timestamps_per_frame) { | 90 timestamp_offset += timestamps_per_frame) { |
91 std::unique_ptr<EncodedAudioFrame> frame(new LegacyEncodedAudioFrame( | 91 std::unique_ptr<EncodedAudioFrame> frame(new LegacyEncodedAudioFrame( |
92 this, rtc::Buffer(payload.data() + byte_offset, bytes_per_frame))); | 92 this, rtc::Buffer(payload.data() + byte_offset, bytes_per_frame))); |
93 results.emplace_back(timestamp + timestamp_offset, 0, std::move(frame)); | 93 results.emplace_back(timestamp + timestamp_offset, 0, std::move(frame)); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 return results; | 97 return results; |
98 } | 98 } |
99 | 99 |
100 int AudioDecoderIlbc::SampleRateHz() const { | 100 int AudioDecoderIlbc::SampleRateHz() const { |
101 return 8000; | 101 return 8000; |
102 } | 102 } |
103 | 103 |
104 size_t AudioDecoderIlbc::Channels() const { | 104 size_t AudioDecoderIlbc::Channels() const { |
105 return 1; | 105 return 1; |
106 } | 106 } |
107 | 107 |
108 } // namespace webrtc | 108 } // namespace webrtc |
OLD | NEW |