OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 memcpy(last_audio_buffer_.get(), audio_frame->data_, | 189 memcpy(last_audio_buffer_.get(), audio_frame->data_, |
190 sizeof(int16_t) * audio_frame->samples_per_channel_ * | 190 sizeof(int16_t) * audio_frame->samples_per_channel_ * |
191 audio_frame->num_channels_); | 191 audio_frame->num_channels_); |
192 | 192 |
193 call_stats_.DecodedByNetEq(audio_frame->speech_type_); | 193 call_stats_.DecodedByNetEq(audio_frame->speech_type_); |
194 | 194 |
195 // Computes the RTP timestamp of the first sample in |audio_frame| from | 195 // Computes the RTP timestamp of the first sample in |audio_frame| from |
196 // |GetPlayoutTimestamp|, which is the timestamp of the last sample of | 196 // |GetPlayoutTimestamp|, which is the timestamp of the last sample of |
197 // |audio_frame|. | 197 // |audio_frame|. |
198 // TODO(henrik.lundin) Move setting of audio_frame->timestamp_ inside NetEq. | 198 // TODO(henrik.lundin) Move setting of audio_frame->timestamp_ inside NetEq. |
199 uint32_t playout_timestamp = 0; | 199 rtc::Optional<uint32_t> playout_timestamp = GetPlayoutTimestamp(); |
200 if (GetPlayoutTimestamp(&playout_timestamp)) { | 200 if (playout_timestamp) { |
201 audio_frame->timestamp_ = playout_timestamp - | 201 audio_frame->timestamp_ = |
202 *playout_timestamp - | |
minyue-webrtc
2016/04/04 15:53:50
"*playout_timestamp -" may be moved to follow afte
hlundin-webrtc
2016/04/04 21:02:54
Done. The extra line break is what git cl format g
| |
202 static_cast<uint32_t>(audio_frame->samples_per_channel_); | 203 static_cast<uint32_t>(audio_frame->samples_per_channel_); |
203 } else { | 204 } else { |
204 // Remain 0 until we have a valid |playout_timestamp|. | 205 // Remain 0 until we have a valid |playout_timestamp|. |
205 audio_frame->timestamp_ = 0; | 206 audio_frame->timestamp_ = 0; |
206 } | 207 } |
207 | 208 |
208 return 0; | 209 return 0; |
209 } | 210 } |
210 | 211 |
211 int32_t AcmReceiver::AddCodec(int acm_codec_id, | 212 int32_t AcmReceiver::AddCodec(int acm_codec_id, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 return -1; | 312 return -1; |
312 } | 313 } |
313 if (last_audio_decoder_ == &it->second) { | 314 if (last_audio_decoder_ == &it->second) { |
314 last_audio_decoder_ = nullptr; | 315 last_audio_decoder_ = nullptr; |
315 last_packet_sample_rate_hz_ = rtc::Optional<int>(); | 316 last_packet_sample_rate_hz_ = rtc::Optional<int>(); |
316 } | 317 } |
317 decoders_.erase(it); | 318 decoders_.erase(it); |
318 return 0; | 319 return 0; |
319 } | 320 } |
320 | 321 |
321 bool AcmReceiver::GetPlayoutTimestamp(uint32_t* timestamp) { | 322 rtc::Optional<uint32_t> AcmReceiver::GetPlayoutTimestamp() { |
322 return neteq_->GetPlayoutTimestamp(timestamp); | 323 return neteq_->GetPlayoutTimestamp(); |
323 } | 324 } |
324 | 325 |
325 int AcmReceiver::LastAudioCodec(CodecInst* codec) const { | 326 int AcmReceiver::LastAudioCodec(CodecInst* codec) const { |
326 rtc::CritScope lock(&crit_sect_); | 327 rtc::CritScope lock(&crit_sect_); |
327 if (!last_audio_decoder_) { | 328 if (!last_audio_decoder_) { |
328 return -1; | 329 return -1; |
329 } | 330 } |
330 *codec = *RentACodec::CodecInstById( | 331 *codec = *RentACodec::CodecInstById( |
331 *RentACodec::CodecIdFromIndex(last_audio_decoder_->acm_codec_id)); | 332 *RentACodec::CodecIdFromIndex(last_audio_decoder_->acm_codec_id)); |
332 codec->pltype = last_audio_decoder_->payload_type; | 333 codec->pltype = last_audio_decoder_->payload_type; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 | 425 |
425 void AcmReceiver::GetDecodingCallStatistics( | 426 void AcmReceiver::GetDecodingCallStatistics( |
426 AudioDecodingCallStats* stats) const { | 427 AudioDecodingCallStats* stats) const { |
427 rtc::CritScope lock(&crit_sect_); | 428 rtc::CritScope lock(&crit_sect_); |
428 *stats = call_stats_.GetDecodingStatistics(); | 429 *stats = call_stats_.GetDecodingStatistics(); |
429 } | 430 } |
430 | 431 |
431 } // namespace acm2 | 432 } // namespace acm2 |
432 | 433 |
433 } // namespace webrtc | 434 } // namespace webrtc |
OLD | NEW |