Index: webrtc/test/call_test.cc |
diff --git a/webrtc/test/call_test.cc b/webrtc/test/call_test.cc |
index ad55421f667bc1f73fb195ecf2cb5dd8f3ecd49b..9ffe47497118d9fcdccb8c930e7be8dccc6e0891 100644 |
--- a/webrtc/test/call_test.cc |
+++ b/webrtc/test/call_test.cc |
@@ -26,6 +26,28 @@ namespace { |
const int kVideoRotationRtpExtensionId = 4; |
} |
+void CallTest::PayloadDemuxer::SetReceiver(PacketReceiver* receiver) { |
+ receiver_ = receiver; |
+} |
+ |
+PacketReceiver::DeliveryStatus CallTest::PayloadDemuxer::DeliverPacket( |
+ MediaType media_type, |
+ const uint8_t* packet, |
+ size_t length, |
+ const PacketTime& packet_time) { |
+ if (media_type == MediaType::ANY) { |
+ // This simplistic demux logic will not make much sense for RTCP |
+ // packets, but it seems that doesn't matter. |
+ RTC_CHECK_GE(length, 2); |
+ uint8_t pt = packet[1] & 0x7f; |
+ if (pt == kFakeVideoSendPayloadType || pt == kFlexfecPayloadType) |
+ media_type = MediaType::VIDEO; |
+ else |
+ media_type = MediaType::AUDIO; |
sprang_webrtc
2017/03/29 12:24:30
nit: {} for if/else
nisse-webrtc
2017/03/29 12:37:55
Done.
|
+ } |
+ return receiver_->DeliverPacket(media_type, packet, length, packet_time); |
+} |
+ |
CallTest::CallTest() |
: clock_(Clock::GetRealTimeClock()), |
video_send_config_(nullptr), |
@@ -75,8 +97,15 @@ void CallTest::RunBaseTest(BaseTest* test) { |
send_transport_.reset(test->CreateSendTransport(sender_call_.get())); |
if (test->ShouldCreateReceivers()) { |
- send_transport_->SetReceiver(receiver_call_->Receiver()); |
- receive_transport_->SetReceiver(sender_call_->Receiver()); |
+ if (num_video_streams_ > 0 && num_audio_streams_ > 0) { |
+ receive_demuxer_.SetReceiver(receiver_call_->Receiver()); |
+ send_transport_->SetReceiver(&receive_demuxer_); |
+ send_demuxer_.SetReceiver(sender_call_->Receiver()); |
+ receive_transport_->SetReceiver(&send_demuxer_); |
+ } else { |
stefan-webrtc
2017/03/29 12:27:25
Is there a reason why we don't always use the demu
nisse-webrtc
2017/03/29 12:37:55
I'm afraid it is a bit brittle, so I don't want to
stefan-webrtc
2017/03/30 06:47:11
I'm ok with both options. Maybe good to have one l
nisse-webrtc
2017/03/30 06:56:45
I don't have a strong opinion either. I think I'll
|
+ send_transport_->SetReceiver(receiver_call_->Receiver()); |
+ receive_transport_->SetReceiver(sender_call_->Receiver()); |
+ } |
if (num_video_streams_ > 0) |
receiver_call_->SignalChannelNetworkState(MediaType::VIDEO, kNetworkUp); |
if (num_audio_streams_ > 0) |
@@ -458,11 +487,13 @@ void BaseTest::OnCallsCreated(Call* sender_call, Call* receiver_call) { |
test::PacketTransport* BaseTest::CreateSendTransport(Call* sender_call) { |
return new PacketTransport(sender_call, this, test::PacketTransport::kSender, |
+ MediaType::VIDEO, |
FakeNetworkPipe::Config()); |
} |
test::PacketTransport* BaseTest::CreateReceiveTransport() { |
return new PacketTransport(nullptr, this, test::PacketTransport::kReceiver, |
+ MediaType::VIDEO, |
FakeNetworkPipe::Config()); |
} |