OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // Fake a timestamp in case audio doesn't contain a correct timestamp. | 88 // Fake a timestamp in case audio doesn't contain a correct timestamp. |
89 // Make a local copy of the audio frame since audio is const | 89 // Make a local copy of the audio frame since audio is const |
90 AudioFrame audio_frame; | 90 AudioFrame audio_frame; |
91 audio_frame.CopyFrom(audio); | 91 audio_frame.CopyFrom(audio); |
92 audio_frame.timestamp_ = encode_timestamp_; | 92 audio_frame.timestamp_ = encode_timestamp_; |
93 encode_timestamp_ += static_cast<uint32_t>(audio_frame.samples_per_channel_); | 93 encode_timestamp_ += static_cast<uint32_t>(audio_frame.samples_per_channel_); |
94 | 94 |
95 // For any codec with a frame size that is longer than 10 ms the encoded | 95 // For any codec with a frame size that is longer than 10 ms the encoded |
96 // length in bytes should be zero until a a full frame has been encoded. | 96 // length in bytes should be zero until a a full frame has been encoded. |
97 encoded_length_in_bytes_ = 0; | 97 encoded_length_in_bytes_ = 0; |
| 98 encoded_data_ = encoded_data; |
98 if (acm_->Add10MsData((AudioFrame&)audio_frame) == -1) { | 99 if (acm_->Add10MsData((AudioFrame&)audio_frame) == -1) { |
99 return -1; | 100 return -1; |
100 } | 101 } |
101 encoded_data_ = encoded_data; | 102 |
102 *encoded_length_in_bytes = encoded_length_in_bytes_; | 103 *encoded_length_in_bytes = encoded_length_in_bytes_; |
103 return 0; | 104 return 0; |
104 } | 105 } |
105 | 106 |
106 int32_t AudioCoder::SendData(FrameType /* frame_type */, | 107 int32_t AudioCoder::SendData(FrameType /* frame_type */, |
107 uint8_t /* payload_type */, | 108 uint8_t /* payload_type */, |
108 uint32_t /* time_stamp */, | 109 uint32_t /* time_stamp */, |
109 const uint8_t* payload_data, | 110 const uint8_t* payload_data, |
110 size_t payload_size, | 111 size_t payload_size, |
111 const RTPFragmentationHeader* /* fragmentation*/) { | 112 const RTPFragmentationHeader* /* fragmentation*/) { |
112 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size); | 113 memcpy(encoded_data_, payload_data, sizeof(uint8_t) * payload_size); |
113 encoded_length_in_bytes_ = payload_size; | 114 encoded_length_in_bytes_ = payload_size; |
114 return 0; | 115 return 0; |
115 } | 116 } |
116 | 117 |
117 } // namespace webrtc | 118 } // namespace webrtc |
OLD | NEW |