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

Unified Diff: webrtc/call/flexfec_receive_stream_unittest.cc

Issue 2553863003: Parse FlexFEC RTP headers in Call and add integration with BWE. (Closed)
Patch Set: Add basic CongestionController unit test, based on nisse's suggestion. Created 4 years 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
« no previous file with comments | « webrtc/call/flexfec_receive_stream_impl.cc ('k') | webrtc/media/engine/webrtcvideoengine2.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/flexfec_receive_stream_unittest.cc
diff --git a/webrtc/call/flexfec_receive_stream_unittest.cc b/webrtc/call/flexfec_receive_stream_unittest.cc
index 314d9c0efe5d9846b47e265a5cb81a8443f64edb..07d3943257acd3dfec05709cea627bc171feb202 100644
--- a/webrtc/call/flexfec_receive_stream_unittest.cc
+++ b/webrtc/call/flexfec_receive_stream_unittest.cc
@@ -8,24 +8,36 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/base/array_view.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/call/flexfec_receive_stream_impl.h"
#include "webrtc/modules/rtp_rtcp/include/flexfec_receiver.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
+#include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
#include "webrtc/modules/rtp_rtcp/mocks/mock_recovered_packet_receiver.h"
#include "webrtc/test/gmock.h"
#include "webrtc/test/gtest.h"
namespace webrtc {
+namespace {
+
+RtpPacketReceived ParsePacket(rtc::ArrayView<const uint8_t> packet) {
+ RtpPacketReceived parsed_packet(nullptr);
+ EXPECT_TRUE(parsed_packet.Parse(packet));
+ return parsed_packet;
+}
+
+} // namespace
+
TEST(FlexfecReceiveStreamTest, ConstructDestruct) {
FlexfecReceiveStream::Config config;
config.payload_type = 118;
config.remote_ssrc = 424223;
config.protected_media_ssrcs = {912512};
- MockRecoveredPacketReceiver callback;
+ MockRecoveredPacketReceiver recovered_packet_receiver;
- FlexfecReceiveStreamImpl receive_stream(config, &callback);
+ FlexfecReceiveStreamImpl receive_stream(config, &recovered_packet_receiver);
}
TEST(FlexfecReceiveStreamTest, StartStop) {
@@ -33,27 +45,13 @@ TEST(FlexfecReceiveStreamTest, StartStop) {
config.payload_type = 118;
config.remote_ssrc = 1652392;
config.protected_media_ssrcs = {23300443};
- MockRecoveredPacketReceiver callback;
- FlexfecReceiveStreamImpl receive_stream(config, &callback);
+ MockRecoveredPacketReceiver recovered_packet_receiver;
+ FlexfecReceiveStreamImpl receive_stream(config, &recovered_packet_receiver);
receive_stream.Start();
receive_stream.Stop();
}
-TEST(FlexfecReceiveStreamTest, DoesNotProcessPacketWhenNoMediaSsrcGiven) {
- FlexfecReceiveStream::Config config;
- config.payload_type = 118;
- config.remote_ssrc = 424223;
- config.protected_media_ssrcs = {};
- MockRecoveredPacketReceiver callback;
- FlexfecReceiveStreamImpl receive_stream(config, &callback);
- const uint8_t packet[] = {0x00, 0x11, 0x22, 0x33};
- const size_t packet_length = sizeof(packet);
-
- EXPECT_FALSE(
- receive_stream.AddAndProcessReceivedPacket(packet, packet_length));
-}
-
// Create a FlexFEC packet that protects a single media packet and ensure
// that the callback is called. Correctness of recovery is checked in the
// FlexfecReceiver unit tests.
@@ -91,7 +89,6 @@ TEST(FlexfecReceiveStreamTest, RecoversPacketWhenStarted) {
// FEC payload.
kPayloadBits, kPayloadBits, kPayloadBits, kPayloadBits};
// clang-format on
- constexpr size_t kFlexfecPacketLength = sizeof(kFlexfecPacket);
FlexfecReceiveStream::Config config;
config.payload_type = kFlexfecPlType;
@@ -102,16 +99,14 @@ TEST(FlexfecReceiveStreamTest, RecoversPacketWhenStarted) {
FlexfecReceiveStreamImpl receive_stream(config, &recovered_packet_receiver);
// Do not call back before being started.
- receive_stream.AddAndProcessReceivedPacket(kFlexfecPacket,
- kFlexfecPacketLength);
+ receive_stream.AddAndProcessReceivedPacket(ParsePacket(kFlexfecPacket));
// Call back after being started.
receive_stream.Start();
EXPECT_CALL(
recovered_packet_receiver,
OnRecoveredPacket(::testing::_, kRtpHeaderSize + kPayloadLength[1]));
- receive_stream.AddAndProcessReceivedPacket(kFlexfecPacket,
- kFlexfecPacketLength);
+ receive_stream.AddAndProcessReceivedPacket(ParsePacket(kFlexfecPacket));
}
} // namespace webrtc
« no previous file with comments | « webrtc/call/flexfec_receive_stream_impl.cc ('k') | webrtc/media/engine/webrtcvideoengine2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698