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

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: philipel comments 1 + danilchap comments 2. LACKING TESTS. 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
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 68f2a2d0203640c6fb3df8b065614f8d7bf03951..170362916a1916351c413fad4eb2dd2e6ca407e5 100644
--- a/webrtc/call/flexfec_receive_stream_unittest.cc
+++ b/webrtc/call/flexfec_receive_stream_unittest.cc
@@ -8,24 +8,40 @@
* 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.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 {
+
+using ::testing::_;
+using ::testing::Return;
+
+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;
- internal::FlexfecReceiveStream receive_stream(config, &callback);
+ internal::FlexfecReceiveStream receive_stream(config,
+ &recovered_packet_receiver);
}
TEST(FlexfecReceiveStreamTest, StartStop) {
@@ -33,27 +49,14 @@ TEST(FlexfecReceiveStreamTest, StartStop) {
config.payload_type = 118;
config.remote_ssrc = 1652392;
config.protected_media_ssrcs = {23300443};
- MockRecoveredPacketReceiver callback;
- internal::FlexfecReceiveStream receive_stream(config, &callback);
+ MockRecoveredPacketReceiver recovered_packet_receiver;
+ internal::FlexfecReceiveStream 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;
- internal::FlexfecReceiveStream 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.
@@ -103,16 +106,15 @@ TEST(FlexfecReceiveStreamTest, RecoversPacketWhenStarted) {
&recovered_packet_receiver);
// Do not call back before being started.
- receive_stream.AddAndProcessReceivedPacket(kFlexfecPacket,
- kFlexfecPacketLength);
+ receive_stream.AddAndProcessReceivedPacket(ParsePacket(
+ rtc::ArrayView<const uint8_t>(kFlexfecPacket, kFlexfecPacketLength)));
danilchap 2016/12/14 13:39:02 just ParsePacket(kFlexfecPacket) ArrayView would d
brandtr 2016/12/14 14:08:31 Nice!
// Call back after being started.
receive_stream.Start();
- EXPECT_CALL(
- recovered_packet_receiver,
- OnRecoveredPacket(::testing::_, kRtpHeaderSize + kPayloadLength[1]));
- receive_stream.AddAndProcessReceivedPacket(kFlexfecPacket,
- kFlexfecPacketLength);
+ EXPECT_CALL(recovered_packet_receiver,
+ OnRecoveredPacket(_, kRtpHeaderSize + kPayloadLength[1]));
+ receive_stream.AddAndProcessReceivedPacket(ParsePacket(
danilchap 2016/12/14 13:39:02 ditto
brandtr 2016/12/14 14:08:31 Done.
+ rtc::ArrayView<const uint8_t>(kFlexfecPacket, kFlexfecPacketLength)));
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698