Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1569)

Unified Diff: webrtc/call/rtx_receive_stream_unittest.cc

Issue 3005793002: Fix setting of recovered flag in RtxReceiveStream. (Closed)
Patch Set: Add corresponding unit test. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webrtc/call/rtx_receive_stream.cc ('K') | « webrtc/call/rtx_receive_stream.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/rtx_receive_stream_unittest.cc
diff --git a/webrtc/call/rtx_receive_stream_unittest.cc b/webrtc/call/rtx_receive_stream_unittest.cc
index e9c82105212adec197b49f6298c1e345b5df3be5..2b2eabc423e8f4316ad575a8278c278bfe3584e4 100644
--- a/webrtc/call/rtx_receive_stream_unittest.cc
+++ b/webrtc/call/rtx_receive_stream_unittest.cc
@@ -25,6 +25,7 @@ using ::testing::StrictMock;
constexpr int kMediaPayloadType = 100;
constexpr int kRtxPayloadType = 98;
+constexpr int kUnknownPayloadType = 90;
constexpr uint32_t kMediaSSRC = 0x3333333;
constexpr uint16_t kMediaSeqno = 0x5657;
@@ -55,8 +56,7 @@ constexpr uint8_t kRtxPacketWithCVO[] = {
};
std::map<int, int> PayloadTypeMapping() {
- std::map<int, int> m;
- m[kRtxPayloadType] = kMediaPayloadType;
+ static const std::map<int, int> m = {{kRtxPayloadType, kMediaPayloadType}};
danilchap 2017/08/30 07:54:21 static here look unnecesary: you copy on return an
nisse-webrtc 2017/08/30 08:27:00 Old habit of using static const, to allow the comp
return m;
}
@@ -84,9 +84,26 @@ TEST(RtxReceiveStreamTest, RestoresPacketPayload) {
rtx_sink.OnRtpPacket(rtx_packet);
}
+TEST(RtxReceiveStreamTest, SetsRecoveredFlag) {
+ StrictMock<MockRtpPacketSink> media_sink;
+ RtxReceiveStream rtx_sink(&media_sink, PayloadTypeMapping(), kMediaSSRC);
+ RtpPacketReceived rtx_packet;
+ EXPECT_TRUE(rtx_packet.Parse(rtc::ArrayView<const uint8_t>(kRtxPacket)));
+ EXPECT_FALSE(rtx_packet.recovered());
+ EXPECT_CALL(media_sink, OnRtpPacket(_)).WillOnce(testing::Invoke(
+ [](const RtpPacketReceived& packet) {
nisse-webrtc 2017/08/30 07:29:23 Is there some shorter way to check the value of th
danilchap 2017/08/30 07:54:21 there are, not sure which is nicer: EXPECT_CALL(m
nisse-webrtc 2017/08/30 08:27:00 Hmm. I think the testing::Property variant looks n
+ EXPECT_TRUE(packet.recovered());
+ }));
+
+ rtx_sink.OnRtpPacket(rtx_packet);
+}
+
TEST(RtxReceiveStreamTest, IgnoresUnknownPayloadType) {
StrictMock<MockRtpPacketSink> media_sink;
- RtxReceiveStream rtx_sink(&media_sink, std::map<int, int>(), kMediaSSRC);
+ static const std::map<int, int> payload_type_mapping = {
danilchap 2017/08/30 07:54:21 why you made it static?
+ {kUnknownPayloadType, kMediaPayloadType}};
+
+ RtxReceiveStream rtx_sink(&media_sink, payload_type_mapping, kMediaSSRC);
RtpPacketReceived rtx_packet;
EXPECT_TRUE(rtx_packet.Parse(rtc::ArrayView<const uint8_t>(kRtxPacket)));
rtx_sink.OnRtpPacket(rtx_packet);
« webrtc/call/rtx_receive_stream.cc ('K') | « webrtc/call/rtx_receive_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698