| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 class ExtensionVerifyTransport : public webrtc::Transport { | 22 class ExtensionVerifyTransport : public webrtc::Transport { |
| 23 public: | 23 public: |
| 24 ExtensionVerifyTransport() | 24 ExtensionVerifyTransport() |
| 25 : parser_(webrtc::RtpHeaderParser::Create()), | 25 : parser_(webrtc::RtpHeaderParser::Create()), |
| 26 received_packets_(0), | 26 received_packets_(0), |
| 27 bad_packets_(0), | 27 bad_packets_(0), |
| 28 audio_level_id_(-1), | 28 audio_level_id_(-1), |
| 29 absolute_sender_time_id_(-1) {} | 29 absolute_sender_time_id_(-1) {} |
| 30 | 30 |
| 31 int SendPacket(int channel, const void* data, size_t len) override { | 31 int SendPacket(const void* data, size_t len) override { |
| 32 webrtc::RTPHeader header; | 32 webrtc::RTPHeader header; |
| 33 if (parser_->Parse(reinterpret_cast<const uint8_t*>(data), len, &header)) { | 33 if (parser_->Parse(reinterpret_cast<const uint8_t*>(data), len, &header)) { |
| 34 bool ok = true; | 34 bool ok = true; |
| 35 if (audio_level_id_ >= 0 && | 35 if (audio_level_id_ >= 0 && |
| 36 !header.extension.hasAudioLevel) { | 36 !header.extension.hasAudioLevel) { |
| 37 ok = false; | 37 ok = false; |
| 38 } | 38 } |
| 39 if (absolute_sender_time_id_ >= 0 && | 39 if (absolute_sender_time_id_ >= 0 && |
| 40 !header.extension.hasAbsoluteSendTime) { | 40 !header.extension.hasAbsoluteSendTime) { |
| 41 ok = false; | 41 ok = false; |
| 42 } | 42 } |
| 43 if (!ok) { | 43 if (!ok) { |
| 44 // bad_packets_ count packets we expected to have an extension but | 44 // bad_packets_ count packets we expected to have an extension but |
| 45 // didn't have one. | 45 // didn't have one. |
| 46 ++bad_packets_; | 46 ++bad_packets_; |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 // received_packets_ count all packets we receive. | 49 // received_packets_ count all packets we receive. |
| 50 ++received_packets_; | 50 ++received_packets_; |
| 51 return static_cast<int>(len); | 51 return static_cast<int>(len); |
| 52 } | 52 } |
| 53 | 53 |
| 54 int SendRTCPPacket(int channel, const void* data, size_t len) override { | 54 int SendRTCPPacket(const void* data, size_t len) override { |
| 55 return static_cast<int>(len); | 55 return static_cast<int>(len); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void SetAudioLevelId(int id) { | 58 void SetAudioLevelId(int id) { |
| 59 audio_level_id_ = id; | 59 audio_level_id_ = id; |
| 60 parser_->RegisterRtpHeaderExtension(webrtc::kRtpExtensionAudioLevel, id); | 60 parser_->RegisterRtpHeaderExtension(webrtc::kRtpExtensionAudioLevel, id); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void SetAbsoluteSenderTimeId(int id) { | 63 void SetAbsoluteSenderTimeId(int id) { |
| 64 absolute_sender_time_id_ = id; | 64 absolute_sender_time_id_ = id; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 EXPECT_EQ(0, voe_rtp_rtcp_->SetSendAbsoluteSenderTimeStatus(channel_, true, | 144 EXPECT_EQ(0, voe_rtp_rtcp_->SetSendAbsoluteSenderTimeStatus(channel_, true, |
| 145 3)); | 145 3)); |
| 146 EXPECT_EQ(0, voe_rtp_rtcp_->SetSendAudioLevelIndicationStatus(channel_, true, | 146 EXPECT_EQ(0, voe_rtp_rtcp_->SetSendAudioLevelIndicationStatus(channel_, true, |
| 147 9)); | 147 9)); |
| 148 verifying_transport_.SetAbsoluteSenderTimeId(3); | 148 verifying_transport_.SetAbsoluteSenderTimeId(3); |
| 149 // Don't register audio level with header parser - unknown extensions should | 149 // Don't register audio level with header parser - unknown extensions should |
| 150 // be ignored when parsing. | 150 // be ignored when parsing. |
| 151 ResumePlaying(); | 151 ResumePlaying(); |
| 152 EXPECT_TRUE(verifying_transport_.Wait()); | 152 EXPECT_TRUE(verifying_transport_.Wait()); |
| 153 } | 153 } |
| OLD | NEW |