OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 #endif | 132 #endif |
133 blockcount++; | 133 blockcount++; |
134 | 134 |
135 /* encoding */ | 135 /* encoding */ |
136 fprintf(stderr, "--- Encoding block %i --- ",blockcount); | 136 fprintf(stderr, "--- Encoding block %i --- ",blockcount); |
137 #ifdef SPLIT_10MS | 137 #ifdef SPLIT_10MS |
138 len=WebRtcIlbcfix_Encode(Enc_Inst, data, 80, encoded_data); | 138 len=WebRtcIlbcfix_Encode(Enc_Inst, data, 80, encoded_data); |
139 #else | 139 #else |
140 len=WebRtcIlbcfix_Encode(Enc_Inst, data, (short)(mode<<3), encoded_data); | 140 len=WebRtcIlbcfix_Encode(Enc_Inst, data, (short)(mode<<3), encoded_data); |
141 #endif | 141 #endif |
| 142 if (len < 0) { |
| 143 fprintf(stderr, "Error encoding\n"); |
| 144 exit(0); |
| 145 } |
142 fprintf(stderr, "\r"); | 146 fprintf(stderr, "\r"); |
143 | 147 |
144 #ifdef JUNK_DATA | 148 #ifdef JUNK_DATA |
145 for ( i = 0; i < len; i++) { | 149 for ( i = 0; i < len; i++) { |
146 encoded_data[i] = (short) (encoded_data[i] + (short) rand()); | 150 encoded_data[i] = (short) (encoded_data[i] + (short) rand()); |
147 } | 151 } |
148 #endif | 152 #endif |
149 /* write byte file */ | 153 /* write byte file */ |
150 if(len != 0){ //len may be 0 in 10ms split case | 154 if(len != 0){ //len may be 0 in 10ms split case |
151 fwrite(encoded_data,1,len,efileid); | 155 fwrite(encoded_data,1,len,efileid); |
(...skipping 17 matching lines...) Expand all Loading... |
169 } | 173 } |
170 } else { | 174 } else { |
171 pli=1; | 175 pli=1; |
172 } | 176 } |
173 | 177 |
174 /* decoding */ | 178 /* decoding */ |
175 fprintf(stderr, "--- Decoding block %i --- ",blockcount); | 179 fprintf(stderr, "--- Decoding block %i --- ",blockcount); |
176 if (pli==1) { | 180 if (pli==1) { |
177 len=WebRtcIlbcfix_Decode(Dec_Inst, encoded_data, (int16_t)len, data, | 181 len=WebRtcIlbcfix_Decode(Dec_Inst, encoded_data, (int16_t)len, data, |
178 &speechType); | 182 &speechType); |
| 183 if (len < 0) { |
| 184 fprintf(stderr, "Error decoding\n"); |
| 185 exit(0); |
| 186 } |
179 } else { | 187 } else { |
180 len=WebRtcIlbcfix_DecodePlc(Dec_Inst, data, 1); | 188 len=WebRtcIlbcfix_DecodePlc(Dec_Inst, data, 1); |
181 } | 189 } |
182 fprintf(stderr, "\r"); | 190 fprintf(stderr, "\r"); |
183 | 191 |
184 /* write output file */ | 192 /* write output file */ |
185 fwrite(data,sizeof(short),len,ofileid); | 193 fwrite(data,sizeof(short),len,ofileid); |
186 } | 194 } |
187 } | 195 } |
188 | 196 |
(...skipping 11 matching lines...) Expand all Loading... |
200 WebRtcIlbcfix_EncoderFree(Enc_Inst); | 208 WebRtcIlbcfix_EncoderFree(Enc_Inst); |
201 WebRtcIlbcfix_DecoderFree(Dec_Inst); | 209 WebRtcIlbcfix_DecoderFree(Dec_Inst); |
202 | 210 |
203 /* close files */ | 211 /* close files */ |
204 fclose(ifileid); | 212 fclose(ifileid); |
205 fclose(efileid); | 213 fclose(efileid); |
206 fclose(ofileid); | 214 fclose(ofileid); |
207 | 215 |
208 return 0; | 216 return 0; |
209 } | 217 } |
OLD | NEW |