OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/time/default_tick_clock.h" | 7 #include "base/time/default_tick_clock.h" |
8 #include "chrome/browser/media/cast_transport_host_filter.h" | 8 #include "chrome/browser/media/cast_transport_host_filter.h" |
9 #include "content/public/test/test_browser_thread_bundle.h" | 9 #include "content/public/test/test_browser_thread_bundle.h" |
10 #include "media/cast/logging/logging_defines.h" | 10 #include "media/cast/logging/logging_defines.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 TEST_F(CastTransportHostFilterTest, SimpleMessages) { | 79 TEST_F(CastTransportHostFilterTest, SimpleMessages) { |
80 // Create a cast transport sender. | 80 // Create a cast transport sender. |
81 const int32 kChannelId = 42; | 81 const int32 kChannelId = 42; |
82 CastHostMsg_New new_msg(kChannelId, receive_endpoint_); | 82 CastHostMsg_New new_msg(kChannelId, receive_endpoint_); |
83 FakeSend(new_msg); | 83 FakeSend(new_msg); |
84 | 84 |
85 media::cast::CastTransportRtpConfig audio_config; | 85 media::cast::CastTransportRtpConfig audio_config; |
86 audio_config.stored_frames = 10; | 86 audio_config.stored_frames = 10; |
| 87 audio_config.ssrc = 1; |
| 88 audio_config.feedback_ssrc = 2; |
87 CastHostMsg_InitializeAudio init_audio_msg(kChannelId, audio_config); | 89 CastHostMsg_InitializeAudio init_audio_msg(kChannelId, audio_config); |
88 FakeSend(init_audio_msg); | 90 FakeSend(init_audio_msg); |
89 | 91 |
90 media::cast::CastTransportRtpConfig video_config; | 92 media::cast::CastTransportRtpConfig video_config; |
91 video_config.stored_frames = 10; | 93 video_config.stored_frames = 10; |
| 94 video_config.ssrc = 11; |
| 95 video_config.feedback_ssrc = 12; |
92 CastHostMsg_InitializeVideo init_video_msg(kChannelId, video_config); | 96 CastHostMsg_InitializeVideo init_video_msg(kChannelId, video_config); |
93 FakeSend(init_video_msg); | 97 FakeSend(init_video_msg); |
94 | 98 |
95 media::cast::EncodedFrame audio_frame; | 99 media::cast::EncodedFrame audio_frame; |
96 audio_frame.dependency = media::cast::EncodedFrame::KEY; | 100 audio_frame.dependency = media::cast::EncodedFrame::KEY; |
97 audio_frame.frame_id = 1; | 101 audio_frame.frame_id = 1; |
98 audio_frame.referenced_frame_id = 1; | 102 audio_frame.referenced_frame_id = 1; |
99 audio_frame.rtp_timestamp = 47; | 103 audio_frame.rtp_timestamp = 47; |
100 const int kSamples = 47; | 104 const int kSamples = 47; |
101 const int kBytesPerSample = 2; | 105 const int kBytesPerSample = 2; |
102 const int kChannels = 2; | 106 const int kChannels = 2; |
103 audio_frame.data = std::string(kSamples * kBytesPerSample * kChannels, 'q'); | 107 audio_frame.data = std::string(kSamples * kBytesPerSample * kChannels, 'q'); |
104 CastHostMsg_InsertCodedAudioFrame insert_coded_audio_frame( | 108 CastHostMsg_InsertCodedAudioFrame insert_coded_audio_frame( |
105 kChannelId, audio_frame); | 109 kChannelId, audio_frame); |
106 FakeSend(insert_coded_audio_frame); | 110 FakeSend(insert_coded_audio_frame); |
107 | 111 |
108 media::cast::EncodedFrame video_frame; | 112 media::cast::EncodedFrame video_frame; |
109 video_frame.dependency = media::cast::EncodedFrame::KEY; | 113 video_frame.dependency = media::cast::EncodedFrame::KEY; |
110 video_frame.frame_id = 1; | 114 video_frame.frame_id = 1; |
111 video_frame.referenced_frame_id = 1; | 115 video_frame.referenced_frame_id = 1; |
112 // Let's make sure we try a few kb so multiple packets | 116 // Let's make sure we try a few kb so multiple packets |
113 // are generated. | 117 // are generated. |
114 const int kVideoDataSize = 4711; | 118 const int kVideoDataSize = 4711; |
115 video_frame.data = std::string(kVideoDataSize, 'p'); | 119 video_frame.data = std::string(kVideoDataSize, 'p'); |
116 CastHostMsg_InsertCodedVideoFrame insert_coded_video_frame( | 120 CastHostMsg_InsertCodedVideoFrame insert_coded_video_frame( |
117 kChannelId, video_frame); | 121 kChannelId, video_frame); |
118 FakeSend(insert_coded_video_frame); | 122 FakeSend(insert_coded_video_frame); |
119 | 123 |
120 media::cast::SendRtcpFromRtpSenderData rtcp_data; | 124 CastHostMsg_SendSenderReport rtcp_msg( |
121 rtcp_data.packet_type_flags = 0; | 125 kChannelId, 1, base::TimeTicks(), 2); |
122 rtcp_data.sending_ssrc = 0; | |
123 rtcp_data.c_name = "FNRD"; | |
124 media::cast::RtcpDlrrReportBlock dlrr; | |
125 dlrr.last_rr = 7; | |
126 dlrr.delay_since_last_rr = 8; | |
127 CastHostMsg_SendRtcpFromRtpSender rtcp_msg( | |
128 kChannelId, rtcp_data, dlrr); | |
129 FakeSend(rtcp_msg); | 126 FakeSend(rtcp_msg); |
130 | 127 |
131 media::cast::MissingFramesAndPacketsMap missing_packets; | 128 media::cast::MissingFramesAndPacketsMap missing_packets; |
132 missing_packets[1].insert(4); | 129 missing_packets[1].insert(4); |
133 missing_packets[1].insert(7); | 130 missing_packets[1].insert(7); |
134 CastHostMsg_ResendPackets resend_msg( | 131 CastHostMsg_ResendPackets resend_msg( |
135 kChannelId, false, missing_packets, true, base::TimeDelta()); | 132 kChannelId, false, missing_packets, true, base::TimeDelta()); |
136 FakeSend(resend_msg); | 133 FakeSend(resend_msg); |
137 | 134 |
138 CastHostMsg_Delete delete_msg(kChannelId); | 135 CastHostMsg_Delete delete_msg(kChannelId); |
139 FakeSend(delete_msg); | 136 FakeSend(delete_msg); |
140 } | 137 } |
141 | 138 |
142 } // namespace | 139 } // namespace |
OLD | NEW |