summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/cast/BUILD.gn328
-rw-r--r--media/cast/cast.gyp4
-rw-r--r--media/cast/cast_testing.gypi5
-rw-r--r--media/cast/logging/proto/BUILD.gn3
-rw-r--r--media/cast/logging/stats_event_subscriber_unittest.cc20
-rw-r--r--media/cast/net/rtcp/rtcp_receiver_unittest.cc2
-rw-r--r--media/cast/net/rtcp/rtcp_sender_unittest.cc6
-rw-r--r--media/cast/net/rtp/frame_buffer_unittest.cc20
-rw-r--r--media/cast/net/rtp/framer_unittest.cc69
-rw-r--r--media/cast/net/rtp/rtp_packetizer_unittest.cc2
-rw-r--r--media/cast/receiver/frame_receiver_unittest.cc2
-rw-r--r--media/cast/test/proto/BUILD.gn12
12 files changed, 414 insertions, 59 deletions
diff --git a/media/cast/BUILD.gn b/media/cast/BUILD.gn
new file mode 100644
index 0000000..95d0077
--- /dev/null
+++ b/media/cast/BUILD.gn
@@ -0,0 +1,328 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+component("cast") {
+ deps = [
+ ":sender",
+ ":receiver",
+ ]
+}
+
+# Common code shared by all cast components.
+source_set("common") {
+ sources = [
+ "cast_config.cc",
+ "cast_config.h",
+ "cast_defines.h",
+ "cast_environment.cc",
+ "cast_environment.h",
+ "common/clock_drift_smoother.cc",
+ "common/clock_drift_smoother.h",
+ "common/transport_encryption_handler.cc",
+ "common/transport_encryption_handler.h",
+ "logging/encoding_event_subscriber.cc",
+ "logging/encoding_event_subscriber.h",
+ "logging/log_deserializer.cc",
+ "logging/log_deserializer.h",
+ "logging/log_serializer.cc",
+ "logging/log_serializer.h",
+ "logging/logging_defines.cc",
+ "logging/logging_defines.h",
+ "logging/logging_impl.cc",
+ "logging/logging_impl.h",
+ "logging/logging_raw.cc",
+ "logging/logging_raw.h",
+ "logging/raw_event_subscriber.h",
+ "logging/raw_event_subscriber_bundle.cc",
+ "logging/raw_event_subscriber_bundle.h",
+ "logging/receiver_time_offset_estimator.h",
+ "logging/receiver_time_offset_estimator_impl.cc",
+ "logging/receiver_time_offset_estimator_impl.h",
+ "logging/simple_event_subscriber.cc",
+ "logging/simple_event_subscriber.h",
+ "logging/stats_event_subscriber.cc",
+ "logging/stats_event_subscriber.h",
+ ]
+
+ deps = [
+ "//base",
+ "//crypto",
+ "//media/cast/logging/proto",
+ "//net",
+ ]
+
+ forward_dependent_configs_from = [
+ "//media/cast/logging/proto",
+ ]
+}
+
+source_set("net") {
+ sources = [
+ "net/cast_transport_config.cc",
+ "net/cast_transport_config.h",
+ "net/cast_transport_defines.h",
+ "net/cast_transport_sender.h",
+ "net/cast_transport_sender_impl.cc",
+ "net/cast_transport_sender_impl.h",
+ "net/pacing/paced_sender.cc",
+ "net/pacing/paced_sender.h",
+ "net/rtcp/receiver_rtcp_event_subscriber.cc",
+ "net/rtcp/rtcp_defines.cc",
+ "net/rtcp/rtcp_defines.h",
+ "net/rtcp/rtcp.h",
+ "net/rtcp/rtcp.cc",
+ "net/rtcp/rtcp_receiver.cc",
+ "net/rtcp/rtcp_receiver.h",
+ "net/rtcp/rtcp_sender.cc",
+ "net/rtcp/rtcp_sender.h",
+ "net/rtcp/rtcp_utility.cc",
+ "net/rtcp/rtcp_utility.h",
+ "net/rtp/packet_storage.cc",
+ "net/rtp/packet_storage.h",
+ "net/rtp/rtp_packetizer.cc",
+ "net/rtp/rtp_packetizer.h",
+ "net/rtp/rtp_sender.cc",
+ "net/rtp/rtp_sender.h",
+ "net/udp_transport.cc",
+ "net/udp_transport.h",
+ "net/rtp/cast_message_builder.cc",
+ "net/rtp/cast_message_builder.h",
+ "net/rtp/frame_buffer.cc",
+ "net/rtp/frame_buffer.h",
+ "net/rtp/frame_id_map.cc",
+ "net/rtp/frame_id_map.h",
+ "net/rtp/framer.cc",
+ "net/rtp/framer.h",
+ "net/rtp/receiver_stats.cc",
+ "net/rtp/receiver_stats.h",
+ "net/rtp/rtp_parser.cc",
+ "net/rtp/rtp_parser.h",
+ "net/rtp/rtp_receiver_defines.cc",
+ "net/rtp/rtp_receiver_defines.h",
+ ]
+
+ deps = [
+ ":common",
+ ]
+}
+
+source_set("sender") {
+ sources = [
+ "cast_sender.h",
+# TODO(hclam): libvpx support.
+# "cast_sender_impl.cc",
+ "cast_sender_impl.h",
+ "sender/audio_encoder.h",
+ "sender/audio_encoder.cc",
+ "sender/audio_sender.h",
+ "sender/audio_sender.cc",
+ "sender/congestion_control.h",
+ "sender/congestion_control.cc",
+ "sender/external_video_encoder.h",
+ "sender/external_video_encoder.cc",
+ "sender/fake_software_video_encoder.h",
+ "sender/fake_software_video_encoder.cc",
+ "sender/frame_sender.cc",
+ "sender/frame_sender.h",
+ "sender/rtp_timestamp_helper.cc",
+ "sender/rtp_timestamp_helper.h",
+ "sender/software_video_encoder.h",
+# TODO(hclam): libvpx support.
+# "sender/video_encoder.h",
+# "sender/video_encoder_impl.h",
+# "sender/video_encoder_impl.cc",
+# "sender/video_sender.h",
+# "sender/video_sender.cc",
+# "sender/vp8_encoder.cc",
+# "sender/vp8_encoder.h",
+ ]
+
+ deps = [
+ ":common",
+ ":net",
+ "//media",
+ "//media:shared_memory_support",
+ "//third_party/opus",
+# TODO(hclam): libvpx support.
+# "//third_party/libvpx",
+ ]
+}
+
+source_set("receiver") {
+ sources = [
+ "cast_receiver.h",
+ "receiver/audio_decoder.cc",
+ "receiver/audio_decoder.h",
+# TODO(hclam): Libvpx support.
+# "receiver/cast_receiver_impl.cc",
+# "receiver/cast_receiver_impl.h",
+ "receiver/frame_receiver.cc",
+ "receiver/frame_receiver.h",
+# TODO(hclam): Need libvpx support.
+# "receiver/video_decoder.cc",
+# "receiver/video_decoder.h",
+ ]
+
+ deps = [
+ ":common",
+ ":net",
+ "//media",
+ "//media:shared_memory_support",
+ "//third_party/opus",
+# TODO(hclam): libvpx support.
+# "//third_party/libvpx",
+ "//ui/gfx",
+ ]
+}
+
+source_set("test_support") {
+ sources = [
+# TODO(hclam): FFmpeg.
+# "test/fake_media_source.cc",
+# "test/fake_media_source.h",
+ "test/fake_single_thread_task_runner.cc",
+ "test/fake_single_thread_task_runner.h",
+ "test/skewed_single_thread_task_runner.cc",
+ "test/skewed_single_thread_task_runner.h",
+ "test/skewed_tick_clock.cc",
+ "test/skewed_tick_clock.h",
+ "test/loopback_transport.cc",
+ "test/loopback_transport.h",
+ "test/utility/audio_utility.cc",
+ "test/utility/audio_utility.h",
+ "test/utility/barcode.cc",
+ "test/utility/barcode.h",
+ "test/utility/default_config.cc",
+ "test/utility/default_config.h",
+# TODO(hclam): libvpx support.
+# "test/utility/in_process_receiver.cc",
+# "test/utility/in_process_receiver.h",
+ "test/utility/input_builder.cc",
+ "test/utility/input_builder.h",
+ "test/utility/net_utility.cc",
+ "test/utility/net_utility.h",
+ "test/utility/standalone_cast_environment.cc",
+ "test/utility/standalone_cast_environment.h",
+ "test/utility/video_utility.cc",
+ "test/utility/video_utility.h",
+ "test/utility/udp_proxy.cc",
+ "test/utility/udp_proxy.h",
+ ]
+
+ deps = [
+ ":net",
+ ":receiver",
+ "//base/test:test_support",
+ "//testing/gtest",
+# TODO(hclam): Does not build on ARM yet.
+# "//third_party/ffmpeg",
+ "//third_party/libyuv",
+ "//third_party/mt19937ar",
+ "//ui/gfx",
+ ]
+}
+
+test("cast_unittests") {
+ sources = [
+ "logging/encoding_event_subscriber_unittest.cc",
+ "logging/serialize_deserialize_test.cc",
+ "logging/logging_impl_unittest.cc",
+ "logging/logging_raw_unittest.cc",
+ "logging/receiver_time_offset_estimator_impl_unittest.cc",
+ "logging/simple_event_subscriber_unittest.cc",
+ "logging/stats_event_subscriber_unittest.cc",
+ "net/cast_transport_sender_impl_unittest.cc",
+ "net/pacing/mock_paced_packet_sender.cc",
+ "net/pacing/mock_paced_packet_sender.h",
+ "net/pacing/paced_sender_unittest.cc",
+ "net/rtcp/mock_rtcp_receiver_feedback.cc",
+ "net/rtcp/mock_rtcp_receiver_feedback.h",
+ "net/rtcp/rtcp_receiver_unittest.cc",
+ "net/rtcp/rtcp_sender_unittest.cc",
+ "net/rtcp/rtcp_unittest.cc",
+ "net/rtcp/receiver_rtcp_event_subscriber_unittest.cc",
+# TODO(miu): The following two are test utility modules. Rename/move the files.
+ "net/rtcp/test_rtcp_packet_builder.cc",
+ "net/rtcp/test_rtcp_packet_builder.h",
+ "net/rtp/cast_message_builder_unittest.cc",
+ "net/rtp/frame_buffer_unittest.cc",
+ "net/rtp/framer_unittest.cc",
+ "net/rtp/mock_rtp_payload_feedback.cc",
+ "net/rtp/mock_rtp_payload_feedback.h",
+ "net/rtp/packet_storage_unittest.cc",
+ "net/rtp/receiver_stats_unittest.cc",
+ "net/rtp/rtp_header_parser.cc",
+ "net/rtp/rtp_header_parser.h",
+ "net/rtp/rtp_packet_builder.cc",
+ "net/rtp/rtp_parser_unittest.cc",
+ "net/rtp/rtp_packetizer_unittest.cc",
+ "net/rtp/rtp_receiver_defines.h",
+ "net/udp_transport_unittest.cc",
+ "receiver/audio_decoder_unittest.cc",
+ "receiver/frame_receiver_unittest.cc",
+# TODO(hclam): libvpx support.
+# "receiver/video_decoder_unittest.cc",
+ "sender/audio_encoder_unittest.cc",
+ "sender/audio_sender_unittest.cc",
+ "sender/congestion_control_unittest.cc",
+ "sender/external_video_encoder_unittest.cc",
+# TODO(hclam): libvpx support.
+# "sender/video_encoder_impl_unittest.cc",
+# "sender/video_sender_unittest.cc",
+# "test/end2end_unittest.cc",
+ "test/fake_receiver_time_offset_estimator.cc",
+ "test/fake_receiver_time_offset_estimator.h",
+ "test/fake_video_encode_accelerator.cc",
+ "test/fake_video_encode_accelerator.h",
+ "test/utility/audio_utility_unittest.cc",
+ "test/utility/barcode_unittest.cc",
+ ]
+
+ deps = [
+ ":common",
+ ":receiver",
+ ":sender",
+ ":test_support",
+ "//base/test:run_all_unittests",
+ "//base/test:test_support",
+ "//testing/gmock",
+ "//testing/gtest",
+ ]
+}
+
+executable("generate_barcode_video") {
+ sources = [
+ "test/utility/generate_barcode_video.cc",
+ ]
+
+ deps = [
+ ":test_support",
+ "//base",
+ "//media",
+ ]
+}
+
+executable("generate_timecode_audio") {
+ sources = [
+ "test/utility/generate_timecode_audio.cc",
+ ]
+
+ deps = [
+ ":test_support",
+ "//base",
+ "//media",
+ ]
+}
+
+executable("udp_proxy") {
+ sources = [
+ "test/utility/udp_proxy_main.cc",
+ ]
+
+ deps = [
+ ":test_support",
+ "//base",
+ "//net",
+ ]
+}
diff --git a/media/cast/cast.gyp b/media/cast/cast.gyp
index eb00855..303748a 100644
--- a/media/cast/cast.gyp
+++ b/media/cast/cast.gyp
@@ -14,6 +14,7 @@
],
'targets': [
{
+ # GN version: //media/cast:common
'target_name': 'cast_base',
'type': 'static_library',
'include_dirs': [
@@ -80,6 +81,7 @@
'includes': ['../../build/protoc.gypi'],
},
{
+ # GN version: //media/cast:receiver
'target_name': 'cast_receiver',
'type': 'static_library',
'include_dirs': [
@@ -122,6 +124,7 @@
], # source
},
{
+ # GN version: //media/cast:sender
'target_name': 'cast_sender',
'type': 'static_library',
'include_dirs': [
@@ -164,6 +167,7 @@
], # source
},
{
+ # GN version: //media/cast:net
'target_name': 'cast_net',
'type': 'static_library',
'include_dirs': [
diff --git a/media/cast/cast_testing.gypi b/media/cast/cast_testing.gypi
index 58dc642..7cfc50c 100644
--- a/media/cast/cast_testing.gypi
+++ b/media/cast/cast_testing.gypi
@@ -5,6 +5,7 @@
{
'targets': [
{
+ # GN version: //media/cast:test_support
'target_name': 'cast_test_utility',
'type': 'static_library',
'include_dirs': [
@@ -51,6 +52,7 @@
], # source
},
{
+ # GN version: //media/cast:cast_unittests
'target_name': 'cast_unittests',
'type': '<(gtest_target_type)',
'include_dirs': [
@@ -268,6 +270,7 @@
'includes': ['../../build/protoc.gypi'],
},
{
+ # GN version: //media/cast:generate_barcode_video
'target_name': 'generate_barcode_video',
'type': 'executable',
'include_dirs': [
@@ -283,6 +286,7 @@
],
},
{
+ # GN version: //media/cast:generate_timecode_audio
'target_name': 'generate_timecode_audio',
'type': 'executable',
'include_dirs': [
@@ -300,6 +304,7 @@
],
},
{
+ # GN version: //media/cast:udp_proxy
'target_name': 'udp_proxy',
'type': 'executable',
'include_dirs': [
diff --git a/media/cast/logging/proto/BUILD.gn b/media/cast/logging/proto/BUILD.gn
index c9fb89b..2576c94 100644
--- a/media/cast/logging/proto/BUILD.gn
+++ b/media/cast/logging/proto/BUILD.gn
@@ -12,6 +12,9 @@ source_set("proto") {
deps = [
":cast_logging_proto",
]
+ forward_dependent_configs_from = [
+ ":cast_logging_proto",
+ ]
}
proto_library("cast_logging_proto") {
diff --git a/media/cast/logging/stats_event_subscriber_unittest.cc b/media/cast/logging/stats_event_subscriber_unittest.cc
index 33faa02..09c418b 100644
--- a/media/cast/logging/stats_event_subscriber_unittest.cc
+++ b/media/cast/logging/stats_event_subscriber_unittest.cc
@@ -91,7 +91,7 @@ TEST_F(StatsEventSubscriberTest, Capture) {
StatsEventSubscriber::StatsMap::iterator it =
stats_map.find(StatsEventSubscriber::CAPTURE_FPS);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
base::TimeDelta duration = end_time - start_time;
EXPECT_DOUBLE_EQ(
@@ -131,7 +131,7 @@ TEST_F(StatsEventSubscriberTest, Encode) {
StatsEventSubscriber::StatsMap::iterator it =
stats_map.find(StatsEventSubscriber::ENCODE_FPS);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
base::TimeDelta duration = end_time - start_time;
EXPECT_DOUBLE_EQ(
@@ -139,7 +139,7 @@ TEST_F(StatsEventSubscriberTest, Encode) {
static_cast<double>(num_frames) / duration.InMillisecondsF() * 1000);
it = stats_map.find(StatsEventSubscriber::ENCODE_KBPS);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
EXPECT_DOUBLE_EQ(it->second,
static_cast<double>(total_size) / duration.InMillisecondsF() * 8);
@@ -170,7 +170,7 @@ TEST_F(StatsEventSubscriberTest, Decode) {
StatsEventSubscriber::StatsMap::iterator it =
stats_map.find(StatsEventSubscriber::DECODE_FPS);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
base::TimeDelta duration = end_time - start_time;
EXPECT_DOUBLE_EQ(
@@ -207,7 +207,7 @@ TEST_F(StatsEventSubscriberTest, PlayoutDelay) {
StatsEventSubscriber::StatsMap::iterator it =
stats_map.find(StatsEventSubscriber::AVG_PLAYOUT_DELAY_MS);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
EXPECT_DOUBLE_EQ(
it->second, static_cast<double>(total_delay_ms) / num_frames);
@@ -252,7 +252,7 @@ TEST_F(StatsEventSubscriberTest, E2ELatency) {
StatsEventSubscriber::StatsMap::iterator it =
stats_map.find(StatsEventSubscriber::AVG_E2E_LATENCY_MS);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
EXPECT_DOUBLE_EQ(
it->second, total_latency.InMillisecondsF() / num_frames);
@@ -370,27 +370,27 @@ TEST_F(StatsEventSubscriberTest, Packets) {
// and PACKET_LOSS_FRACTION.
StatsEventSubscriber::StatsMap::iterator it =
stats_map.find(StatsEventSubscriber::AVG_NETWORK_LATENCY_MS);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
EXPECT_DOUBLE_EQ(
it->second,
total_latency.InMillisecondsF() / num_latency_recorded_packets);
it = stats_map.find(StatsEventSubscriber::TRANSMISSION_KBPS);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
EXPECT_DOUBLE_EQ(it->second,
static_cast<double>(total_size) / duration.InMillisecondsF() * 8);
it = stats_map.find(StatsEventSubscriber::RETRANSMISSION_KBPS);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
EXPECT_DOUBLE_EQ(it->second,
static_cast<double>(retransmit_total_size) /
duration.InMillisecondsF() * 8);
it = stats_map.find(StatsEventSubscriber::PACKET_LOSS_FRACTION);
- ASSERT_NE(it, stats_map.end());
+ ASSERT_TRUE(it != stats_map.end());
EXPECT_DOUBLE_EQ(
it->second,
diff --git a/media/cast/net/rtcp/rtcp_receiver_unittest.cc b/media/cast/net/rtcp/rtcp_receiver_unittest.cc
index 47ae24b..c1c3671 100644
--- a/media/cast/net/rtcp/rtcp_receiver_unittest.cc
+++ b/media/cast/net/rtcp/rtcp_receiver_unittest.cc
@@ -90,7 +90,7 @@ class RtcpMessageVerification : public MockRtcpReceiverFeedback {
++packet_it;
EXPECT_EQ(kLostPacketId3, *packet_it);
++frame_it;
- EXPECT_EQ(frame_it, cast_message.missing_frames_and_packets.end());
+ EXPECT_TRUE(frame_it == cast_message.missing_frames_and_packets.end());
called_on_received_cast_message_ = true;
}
diff --git a/media/cast/net/rtcp/rtcp_sender_unittest.cc b/media/cast/net/rtcp/rtcp_sender_unittest.cc
index b78915d..acc9cd0 100644
--- a/media/cast/net/rtcp/rtcp_sender_unittest.cc
+++ b/media/cast/net/rtcp/rtcp_sender_unittest.cc
@@ -48,8 +48,10 @@ class TestRtcpTransport : public PacedPacketSender {
virtual bool SendRtcpPacket(uint32 ssrc,
PacketRef packet) OVERRIDE {
EXPECT_EQ(expected_packet_.size(), packet->data.size());
- EXPECT_EQ(0, memcmp(expected_packet_.data(),
- packet->data.data(),
+ if (expected_packet_.size() != packet->data.size())
+ return false;
+ EXPECT_EQ(0, memcmp(&expected_packet_[0],
+ &packet->data[0],
packet->data.size()));
packet_count_++;
return true;
diff --git a/media/cast/net/rtp/frame_buffer_unittest.cc b/media/cast/net/rtp/frame_buffer_unittest.cc
index 69ce93d..64b2734 100644
--- a/media/cast/net/rtp/frame_buffer_unittest.cc
+++ b/media/cast/net/rtp/frame_buffer_unittest.cc
@@ -29,7 +29,7 @@ TEST_F(FrameBufferTest, OnePacketInsertSanity) {
rtp_header_.is_key_frame = true;
rtp_header_.frame_id = 5;
rtp_header_.reference_frame_id = 5;
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
EncodedFrame frame;
EXPECT_TRUE(buffer_.AssembleEncodedFrame(&frame));
EXPECT_EQ(EncodedFrame::KEY, frame.dependency);
@@ -45,7 +45,7 @@ TEST_F(FrameBufferTest, EmptyBuffer) {
}
TEST_F(FrameBufferTest, DefaultOnePacketFrame) {
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
EXPECT_TRUE(buffer_.Complete());
EXPECT_FALSE(buffer_.is_key_frame());
EncodedFrame frame;
@@ -56,11 +56,11 @@ TEST_F(FrameBufferTest, DefaultOnePacketFrame) {
TEST_F(FrameBufferTest, MultiplePacketFrame) {
rtp_header_.is_key_frame = true;
rtp_header_.max_packet_id = 2;
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
++rtp_header_.packet_id;
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
++rtp_header_.packet_id;
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
++rtp_header_.packet_id;
EXPECT_TRUE(buffer_.Complete());
EXPECT_TRUE(buffer_.is_key_frame());
@@ -71,19 +71,19 @@ TEST_F(FrameBufferTest, MultiplePacketFrame) {
TEST_F(FrameBufferTest, IncompleteFrame) {
rtp_header_.max_packet_id = 4;
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
++rtp_header_.packet_id;
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
++rtp_header_.packet_id;
// Increment again - skip packet #2.
++rtp_header_.packet_id;
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
++rtp_header_.packet_id;
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
EXPECT_FALSE(buffer_.Complete());
// Insert missing packet.
rtp_header_.packet_id = 2;
- buffer_.InsertPacket(payload_.data(), payload_.size(), rtp_header_);
+ buffer_.InsertPacket(&payload_[0], payload_.size(), rtp_header_);
EXPECT_TRUE(buffer_.Complete());
}
diff --git a/media/cast/net/rtp/framer_unittest.cc b/media/cast/net/rtp/framer_unittest.cc
index 95e60d4..d8c8aef 100644
--- a/media/cast/net/rtp/framer_unittest.cc
+++ b/media/cast/net/rtp/framer_unittest.cc
@@ -49,14 +49,14 @@ TEST_F(FramerTest, AlwaysStartWithKey) {
// Insert non key first frame.
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(complete);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
rtp_header_.frame_id = 1;
rtp_header_.reference_frame_id = 1;
rtp_header_.is_key_frame = true;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(complete);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
@@ -77,7 +77,7 @@ TEST_F(FramerTest, CompleteFrame) {
// Start with a complete key frame.
rtp_header_.is_key_frame = true;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(complete);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
@@ -93,7 +93,7 @@ TEST_F(FramerTest, CompleteFrame) {
rtp_header_.is_key_frame = false;
rtp_header_.max_packet_id = 2;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_FALSE(complete);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -102,7 +102,7 @@ TEST_F(FramerTest, CompleteFrame) {
rtp_header_.reference_frame_id = rtp_header_.frame_id - 1;
rtp_header_.max_packet_id = 0;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(complete);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
}
@@ -119,7 +119,7 @@ TEST_F(FramerTest, DuplicatePackets) {
rtp_header_.max_packet_id = 1;
duplicate = true;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_FALSE(complete);
EXPECT_FALSE(duplicate);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -127,7 +127,7 @@ TEST_F(FramerTest, DuplicatePackets) {
// Add same packet again in incomplete key frame.
duplicate = false;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_FALSE(complete);
EXPECT_TRUE(duplicate);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -136,7 +136,7 @@ TEST_F(FramerTest, DuplicatePackets) {
rtp_header_.packet_id = 1;
duplicate = true;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(complete);
EXPECT_FALSE(duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -147,7 +147,7 @@ TEST_F(FramerTest, DuplicatePackets) {
// Add same packet again in complete key frame.
duplicate = false;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_FALSE(complete);
EXPECT_TRUE(duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -164,7 +164,7 @@ TEST_F(FramerTest, DuplicatePackets) {
rtp_header_.is_key_frame = false;
duplicate = true;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_FALSE(complete);
EXPECT_FALSE(duplicate);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -172,7 +172,7 @@ TEST_F(FramerTest, DuplicatePackets) {
// Add same packet again in incomplete delta frame.
duplicate = false;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_FALSE(complete);
EXPECT_TRUE(duplicate);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -181,7 +181,7 @@ TEST_F(FramerTest, DuplicatePackets) {
rtp_header_.packet_id = 1;
duplicate = true;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(complete);
EXPECT_FALSE(duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -193,7 +193,7 @@ TEST_F(FramerTest, DuplicatePackets) {
// Add same packet again in complete delta frame.
duplicate = false;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_FALSE(complete);
EXPECT_TRUE(duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -213,7 +213,7 @@ TEST_F(FramerTest, ContinuousSequence) {
// Start with a complete key frame.
rtp_header_.is_key_frame = true;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(complete);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
@@ -228,7 +228,7 @@ TEST_F(FramerTest, ContinuousSequence) {
rtp_header_.reference_frame_id = rtp_header_.frame_id - 1;
rtp_header_.is_key_frame = false;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(complete);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
}
@@ -245,7 +245,7 @@ TEST_F(FramerTest, Wrap) {
rtp_header_.frame_id = 255;
rtp_header_.reference_frame_id = 255;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
EXPECT_FALSE(multiple);
@@ -258,7 +258,7 @@ TEST_F(FramerTest, Wrap) {
rtp_header_.is_key_frame = false;
rtp_header_.frame_id = 256;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
EXPECT_FALSE(multiple);
@@ -278,7 +278,7 @@ TEST_F(FramerTest, Reset) {
// Start with a complete key frame.
rtp_header_.is_key_frame = true;
complete = framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(complete);
framer_.Reset();
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
@@ -296,13 +296,13 @@ TEST_F(FramerTest, RequireKeyAfterReset) {
rtp_header_.is_key_frame = false;
rtp_header_.frame_id = 0;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
rtp_header_.frame_id = 1;
rtp_header_.reference_frame_id = 1;
rtp_header_.is_key_frame = true;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
EXPECT_TRUE(multiple);
@@ -317,7 +317,7 @@ TEST_F(FramerTest, BasicNonLastReferenceId) {
rtp_header_.is_key_frame = true;
rtp_header_.frame_id = 0;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_FALSE(multiple);
@@ -327,7 +327,7 @@ TEST_F(FramerTest, BasicNonLastReferenceId) {
rtp_header_.reference_frame_id = 0;
rtp_header_.frame_id = 5;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_FALSE(next_frame);
@@ -344,22 +344,22 @@ TEST_F(FramerTest, InOrderReferenceFrameSelection) {
rtp_header_.is_key_frame = true;
rtp_header_.frame_id = 0;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
rtp_header_.is_key_frame = false;
rtp_header_.frame_id = 1;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
// Insert frame #2 partially.
rtp_header_.frame_id = 2;
rtp_header_.max_packet_id = 1;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
rtp_header_.frame_id = 4;
rtp_header_.max_packet_id = 0;
rtp_header_.reference_frame_id = 0;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_EQ(EncodedFrame::KEY, frame.dependency);
EXPECT_EQ(0u, frame.frame_id);
@@ -384,14 +384,14 @@ TEST_F(FramerTest, InOrderReferenceFrameSelection) {
rtp_header_.frame_id = 2;
rtp_header_.packet_id = 1;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_FALSE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
rtp_header_.frame_id = 5;
rtp_header_.reference_frame_id = rtp_header_.frame_id - 1;
rtp_header_.packet_id = 0;
rtp_header_.max_packet_id = 0;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
EXPECT_FALSE(multiple);
@@ -412,7 +412,7 @@ TEST_F(FramerTest, AudioWrap) {
rtp_header_.reference_frame_id = 254;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
EXPECT_FALSE(multiple);
@@ -424,13 +424,13 @@ TEST_F(FramerTest, AudioWrap) {
rtp_header_.frame_id = 255;
rtp_header_.reference_frame_id = 255;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
// Insert wrapped frame - should be continuous.
rtp_header_.frame_id = 256;
rtp_header_.reference_frame_id = 256;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
@@ -461,7 +461,7 @@ TEST_F(FramerTest, AudioWrapWithMissingFrame) {
rtp_header_.frame_id = 253;
rtp_header_.reference_frame_id = 253;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
EXPECT_TRUE(next_frame);
EXPECT_FALSE(multiple);
@@ -474,11 +474,12 @@ TEST_F(FramerTest, AudioWrapWithMissingFrame) {
rtp_header_.frame_id = 255;
rtp_header_.reference_frame_id = 255;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
rtp_header_.frame_id = 256;
rtp_header_.reference_frame_id = 256;
framer_.InsertPacket(
- payload_.data(), payload_.size(), rtp_header_, &duplicate);
+
+ &payload_[0], payload_.size(), rtp_header_, &duplicate);
// Get third and fourth packets.
EXPECT_TRUE(framer_.GetEncodedFrame(&frame, &next_frame, &multiple));
diff --git a/media/cast/net/rtp/rtp_packetizer_unittest.cc b/media/cast/net/rtp/rtp_packetizer_unittest.cc
index 1e39e59..0d93d91 100644
--- a/media/cast/net/rtp/rtp_packetizer_unittest.cc
+++ b/media/cast/net/rtp/rtp_packetizer_unittest.cc
@@ -63,7 +63,7 @@ class TestRtpPacketTransport : public PacketSender {
virtual bool SendPacket(PacketRef packet, const base::Closure& cb) OVERRIDE {
++packets_sent_;
- RtpHeaderParser parser(packet->data.data(), packet->data.size());
+ RtpHeaderParser parser(&packet->data[0], packet->data.size());
RtpCastTestHeader rtp_header;
parser.Parse(&rtp_header);
VerifyRtpHeader(rtp_header);
diff --git a/media/cast/receiver/frame_receiver_unittest.cc b/media/cast/receiver/frame_receiver_unittest.cc
index 121d12e..abdfb9d 100644
--- a/media/cast/receiver/frame_receiver_unittest.cc
+++ b/media/cast/receiver/frame_receiver_unittest.cc
@@ -113,7 +113,7 @@ class FrameReceiverTest : public ::testing::Test {
void FeedOneFrameIntoReceiver() {
// Note: For testing purposes, a frame consists of only a single packet.
receiver_->ProcessParsedPacket(
- rtp_header_, payload_.data(), payload_.size());
+ rtp_header_, &payload_[0], payload_.size());
}
void FeedLipSyncInfoIntoReceiver() {
diff --git a/media/cast/test/proto/BUILD.gn b/media/cast/test/proto/BUILD.gn
index 7ac71d2..85c19cfe 100644
--- a/media/cast/test/proto/BUILD.gn
+++ b/media/cast/test/proto/BUILD.gn
@@ -5,6 +5,18 @@
import("//third_party/protobuf/proto_library.gni")
# GYP version: media/cast/cast.gyp:cast_logging_proto
+source_set("proto") {
+ deps = [
+ ":cast_network_simulation_proto",
+ ]
+ direct_dependent_configs = [
+ "//third_party/protobuf:protobuf_config"
+ ]
+ forward_dependent_configs_from = [
+ ":cast_network_simulation_proto",
+ ]
+}
+
proto_library("cast_network_simulation_proto") {
visibility = ":proto"
sources = [