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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 "IncomingPacket invalid RTP header"); | 469 "IncomingPacket invalid RTP header"); |
470 return false; | 470 return false; |
471 } | 471 } |
472 header.payload_type_frequency = | 472 header.payload_type_frequency = |
473 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); | 473 rtp_payload_registry_->GetPayloadTypeFrequency(header.payloadType); |
474 if (header.payload_type_frequency < 0) | 474 if (header.payload_type_frequency < 0) |
475 return false; | 475 return false; |
476 return ReceivePacket(rtp_packet, rtp_packet_length, header, false); | 476 return ReceivePacket(rtp_packet, rtp_packet_length, header, false); |
477 } | 477 } |
478 | 478 |
479 int32_t Channel::GetAudioFrame(int32_t id, AudioFrame* audioFrame) { | 479 int32_t Channel::GetAudioFrame(int32_t id, |
| 480 AudioFrame* audioFrame) { |
| 481 bool muted; |
| 482 int32_t ret = GetAudioFrameWithMuted(id, audioFrame, &muted); |
| 483 if (muted) { |
| 484 // Explicitly set all samples to zero when the |muted| flag was set true. |
| 485 audioFrame->Mute(); |
| 486 } |
| 487 return ret; |
| 488 } |
| 489 |
| 490 int32_t Channel::GetAudioFrameWithMuted(int32_t id, |
| 491 AudioFrame* audioFrame, |
| 492 bool* muted) { |
480 if (event_log_) { | 493 if (event_log_) { |
481 unsigned int ssrc; | 494 unsigned int ssrc; |
482 RTC_CHECK_EQ(GetLocalSSRC(ssrc), 0); | 495 RTC_CHECK_EQ(GetLocalSSRC(ssrc), 0); |
483 event_log_->LogAudioPlayout(ssrc); | 496 event_log_->LogAudioPlayout(ssrc); |
484 } | 497 } |
485 // Get 10ms raw PCM data from the ACM (mixer limits output frequency) | 498 // Get 10ms raw PCM data from the ACM (mixer limits output frequency) |
486 bool muted; | |
487 if (audio_coding_->PlayoutData10Ms(audioFrame->sample_rate_hz_, audioFrame, | 499 if (audio_coding_->PlayoutData10Ms(audioFrame->sample_rate_hz_, audioFrame, |
488 &muted) == -1) { | 500 muted) == -1) { |
489 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), | 501 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, _channelId), |
490 "Channel::GetAudioFrame() PlayoutData10Ms() failed!"); | 502 "Channel::GetAudioFrame() PlayoutData10Ms() failed!"); |
491 // In all likelihood, the audio in this frame is garbage. We return an | 503 // In all likelihood, the audio in this frame is garbage. We return an |
492 // error so that the audio mixer module doesn't add it to the mix. As | 504 // error so that the audio mixer module doesn't add it to the mix. As |
493 // a result, it won't be played out and the actions skipped here are | 505 // a result, it won't be played out and the actions skipped here are |
494 // irrelevant. | 506 // irrelevant. |
495 return -1; | 507 return -1; |
496 } | 508 } |
497 RTC_DCHECK(!muted); | 509 RTC_DCHECK(!*muted); |
498 | 510 |
499 if (_RxVadDetection) { | 511 if (_RxVadDetection) { |
500 UpdateRxVadDetection(*audioFrame); | 512 UpdateRxVadDetection(*audioFrame); |
501 } | 513 } |
502 | 514 |
503 // Convert module ID to internal VoE channel ID | 515 // Convert module ID to internal VoE channel ID |
504 audioFrame->id_ = VoEChannelId(audioFrame->id_); | 516 audioFrame->id_ = VoEChannelId(audioFrame->id_); |
505 // Store speech type for dead-or-alive detection | 517 // Store speech type for dead-or-alive detection |
506 _outputSpeechType = audioFrame->speech_type_; | 518 _outputSpeechType = audioFrame->speech_type_; |
507 | 519 |
(...skipping 3040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3548 int64_t min_rtt = 0; | 3560 int64_t min_rtt = 0; |
3549 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != | 3561 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != |
3550 0) { | 3562 0) { |
3551 return 0; | 3563 return 0; |
3552 } | 3564 } |
3553 return rtt; | 3565 return rtt; |
3554 } | 3566 } |
3555 | 3567 |
3556 } // namespace voe | 3568 } // namespace voe |
3557 } // namespace webrtc | 3569 } // namespace webrtc |
OLD | NEW |