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

Side by Side Diff: webrtc/video/end_to_end_tests.cc

Issue 2705973002: Replace test::FrameGenerator::ChromaGenerator with new FrameGenerator::SquareGenerator (Closed)
Patch Set: Remove check for pure padding. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include <algorithm> 10 #include <algorithm>
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 CreateMatchingReceiveConfigs(&receiver_transport); 222 CreateMatchingReceiveConfigs(&receiver_transport);
223 223
224 video_receive_configs_[0].renderer = &renderer; 224 video_receive_configs_[0].renderer = &renderer;
225 225
226 CreateVideoStreams(); 226 CreateVideoStreams();
227 Start(); 227 Start();
228 228
229 // Create frames that are smaller than the send width/height, this is done to 229 // Create frames that are smaller than the send width/height, this is done to
230 // check that the callbacks are done after processing video. 230 // check that the callbacks are done after processing video.
231 std::unique_ptr<test::FrameGenerator> frame_generator( 231 std::unique_ptr<test::FrameGenerator> frame_generator(
232 test::FrameGenerator::CreateChromaGenerator(kWidth, kHeight)); 232 test::FrameGenerator::CreateSquareGenerator(kWidth, kHeight));
233 test::FrameForwarder frame_forwarder; 233 test::FrameForwarder frame_forwarder;
234 video_send_stream_->SetSource( 234 video_send_stream_->SetSource(
235 &frame_forwarder, VideoSendStream::DegradationPreference::kBalanced); 235 &frame_forwarder, VideoSendStream::DegradationPreference::kBalanced);
236 236
237 frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame()); 237 frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
238 EXPECT_TRUE(renderer.Wait()) 238 EXPECT_TRUE(renderer.Wait())
239 << "Timed out while waiting for the frame to render."; 239 << "Timed out while waiting for the frame to render.";
240 240
241 Stop(); 241 Stop();
242 242
(...skipping 23 matching lines...) Expand all
266 receiver_transport.SetReceiver(sender_call_->Receiver()); 266 receiver_transport.SetReceiver(sender_call_->Receiver());
267 267
268 CreateSendConfig(1, 0, 0, &sender_transport); 268 CreateSendConfig(1, 0, 0, &sender_transport);
269 CreateMatchingReceiveConfigs(&receiver_transport); 269 CreateMatchingReceiveConfigs(&receiver_transport);
270 video_receive_configs_[0].renderer = &renderer; 270 video_receive_configs_[0].renderer = &renderer;
271 271
272 CreateVideoStreams(); 272 CreateVideoStreams();
273 Start(); 273 Start();
274 274
275 std::unique_ptr<test::FrameGenerator> frame_generator( 275 std::unique_ptr<test::FrameGenerator> frame_generator(
276 test::FrameGenerator::CreateChromaGenerator(kDefaultWidth, 276 test::FrameGenerator::CreateSquareGenerator(kDefaultWidth,
277 kDefaultHeight)); 277 kDefaultHeight));
278 test::FrameForwarder frame_forwarder; 278 test::FrameForwarder frame_forwarder;
279 video_send_stream_->SetSource( 279 video_send_stream_->SetSource(
280 &frame_forwarder, VideoSendStream::DegradationPreference::kBalanced); 280 &frame_forwarder, VideoSendStream::DegradationPreference::kBalanced);
281 frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame()); 281 frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
282 282
283 EXPECT_TRUE(renderer.Wait()) 283 EXPECT_TRUE(renderer.Wait())
284 << "Timed out while waiting for the frame to render."; 284 << "Timed out while waiting for the frame to render.";
285 285
286 Stop(); 286 Stop();
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 // Only drop media, and not on the first stream (otherwise it will be 1665 // Only drop media, and not on the first stream (otherwise it will be
1666 // hard to distinguish from padding, which is always sent on the first 1666 // hard to distinguish from padding, which is always sent on the first
1667 // stream). 1667 // stream).
1668 if (header.payloadType != kSendRtxPayloadType && 1668 if (header.payloadType != kSendRtxPayloadType &&
1669 header.ssrc != first_media_ssrc_ && 1669 header.ssrc != first_media_ssrc_ &&
1670 header.extension.transportSequenceNumber % 17 == 0) { 1670 header.extension.transportSequenceNumber % 17 == 0) {
1671 dropped_seq_[header.ssrc].insert(header.sequenceNumber); 1671 dropped_seq_[header.ssrc].insert(header.sequenceNumber);
1672 drop_packet = true; 1672 drop_packet = true;
1673 } 1673 }
1674 1674
1675 size_t payload_length = 1675 if (header.payloadType == kSendRtxPayloadType) {
1676 length - (header.headerLength + header.paddingLength);
1677 if (payload_length == 0) {
1678 padding_observed_ = true;
1679 } else if (header.payloadType == kSendRtxPayloadType) {
1680 uint16_t original_sequence_number = 1676 uint16_t original_sequence_number =
1681 ByteReader<uint16_t>::ReadBigEndian(&data[header.headerLength]); 1677 ByteReader<uint16_t>::ReadBigEndian(&data[header.headerLength]);
1682 uint32_t original_ssrc = 1678 uint32_t original_ssrc =
1683 rtx_to_media_ssrcs_.find(header.ssrc)->second; 1679 rtx_to_media_ssrcs_.find(header.ssrc)->second;
1684 std::set<uint16_t>* seq_no_map = &dropped_seq_[original_ssrc]; 1680 std::set<uint16_t>* seq_no_map = &dropped_seq_[original_ssrc];
1685 auto it = seq_no_map->find(original_sequence_number); 1681 auto it = seq_no_map->find(original_sequence_number);
1686 if (it != seq_no_map->end()) { 1682 if (it != seq_no_map->end()) {
1687 retransmit_observed_ = true; 1683 retransmit_observed_ = true;
1688 seq_no_map->erase(it); 1684 seq_no_map->erase(it);
1689 } else { 1685 } else {
(...skipping 10 matching lines...) Expand all
1700 return true; 1696 return true;
1701 } 1697 }
1702 } 1698 }
1703 1699
1704 return test::DirectTransport::SendRtp(data, length, options); 1700 return test::DirectTransport::SendRtp(data, length, options);
1705 } 1701 }
1706 1702
1707 bool IsDone() { 1703 bool IsDone() {
1708 bool observed_types_ok = 1704 bool observed_types_ok =
1709 streams_observed_.size() == MultiStreamTest::kNumStreams && 1705 streams_observed_.size() == MultiStreamTest::kNumStreams &&
1710 padding_observed_ && retransmit_observed_ && rtx_padding_observed_; 1706 retransmit_observed_ && rtx_padding_observed_;
1711 if (!observed_types_ok) 1707 if (!observed_types_ok)
1712 return false; 1708 return false;
1713 // We should not have any gaps in the sequence number range. 1709 // We should not have any gaps in the sequence number range.
1714 size_t seqno_range = 1710 size_t seqno_range =
1715 *received_packed_ids_.rbegin() - *received_packed_ids_.begin() + 1; 1711 *received_packed_ids_.rbegin() - *received_packed_ids_.begin() + 1;
1716 return seqno_range == received_packed_ids_.size(); 1712 return seqno_range == received_packed_ids_.size();
1717 } 1713 }
1718 1714
1719 bool Wait() { 1715 bool Wait() {
1720 { 1716 {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 1751
1756 void UpdateSendConfig( 1752 void UpdateSendConfig(
1757 size_t stream_index, 1753 size_t stream_index,
1758 VideoSendStream::Config* send_config, 1754 VideoSendStream::Config* send_config,
1759 VideoEncoderConfig* encoder_config, 1755 VideoEncoderConfig* encoder_config,
1760 test::FrameGeneratorCapturer** frame_generator) override { 1756 test::FrameGeneratorCapturer** frame_generator) override {
1761 send_config->rtp.extensions.clear(); 1757 send_config->rtp.extensions.clear();
1762 send_config->rtp.extensions.push_back(RtpExtension( 1758 send_config->rtp.extensions.push_back(RtpExtension(
1763 RtpExtension::kTransportSequenceNumberUri, kExtensionId)); 1759 RtpExtension::kTransportSequenceNumberUri, kExtensionId));
1764 1760
1765 // Force some padding to be sent. 1761 // Force some padding to be sent. Note that since we do send media
1766 const int kPaddingBitrateBps = 50000; 1762 // packets we can not guarantee that a padding only packet is sent.
1767 encoder_config->max_bitrate_bps = 1000000; 1763 // Instead, padding will most likely be send as an RTX packet.
1764 const int kPaddingBitrateBps = 100000;
1765 encoder_config->max_bitrate_bps = 100000;
1768 encoder_config->min_transmit_bitrate_bps = 1766 encoder_config->min_transmit_bitrate_bps =
1769 encoder_config->max_bitrate_bps + kPaddingBitrateBps; 1767 encoder_config->max_bitrate_bps + kPaddingBitrateBps;
1770 1768
1771 // Configure RTX for redundant payload padding. 1769 // Configure RTX for redundant payload padding.
1772 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 1770 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
1773 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[stream_index]); 1771 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[stream_index]);
1774 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; 1772 send_config->rtp.rtx.payload_type = kSendRtxPayloadType;
1775 rtx_to_media_ssrcs_[kSendRtxSsrcs[stream_index]] = 1773 rtx_to_media_ssrcs_[kSendRtxSsrcs[stream_index]] =
1776 send_config->rtp.ssrcs[0]; 1774 send_config->rtp.ssrcs[0];
1777 1775
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 1947
1950 CreateSendConfig(1, 0, 0, &sender_transport); 1948 CreateSendConfig(1, 0, 0, &sender_transport);
1951 CreateMatchingReceiveConfigs(&receiver_transport); 1949 CreateMatchingReceiveConfigs(&receiver_transport);
1952 video_send_config_.post_encode_callback = &post_encode_observer; 1950 video_send_config_.post_encode_callback = &post_encode_observer;
1953 video_receive_configs_[0].pre_decode_callback = &pre_decode_observer; 1951 video_receive_configs_[0].pre_decode_callback = &pre_decode_observer;
1954 1952
1955 CreateVideoStreams(); 1953 CreateVideoStreams();
1956 Start(); 1954 Start();
1957 1955
1958 std::unique_ptr<test::FrameGenerator> frame_generator( 1956 std::unique_ptr<test::FrameGenerator> frame_generator(
1959 test::FrameGenerator::CreateChromaGenerator(kDefaultWidth, 1957 test::FrameGenerator::CreateSquareGenerator(kDefaultWidth,
1960 kDefaultHeight)); 1958 kDefaultHeight));
1961 test::FrameForwarder forwarder; 1959 test::FrameForwarder forwarder;
1962 video_send_stream_->SetSource( 1960 video_send_stream_->SetSource(
1963 &forwarder, VideoSendStream::DegradationPreference::kBalanced); 1961 &forwarder, VideoSendStream::DegradationPreference::kBalanced);
1964 forwarder.IncomingCapturedFrame(*frame_generator->NextFrame()); 1962 forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
1965 1963
1966 EXPECT_TRUE(post_encode_observer.Wait()) 1964 EXPECT_TRUE(post_encode_observer.Wait())
1967 << "Timed out while waiting for send-side encoded-frame callback."; 1965 << "Timed out while waiting for send-side encoded-frame callback.";
1968 1966
1969 EXPECT_TRUE(pre_decode_observer.Wait()) 1967 EXPECT_TRUE(pre_decode_observer.Wait())
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
4189 std::unique_ptr<VideoEncoder> encoder_; 4187 std::unique_ptr<VideoEncoder> encoder_;
4190 std::unique_ptr<VideoDecoder> decoder_; 4188 std::unique_ptr<VideoDecoder> decoder_;
4191 rtc::CriticalSection crit_; 4189 rtc::CriticalSection crit_;
4192 int recorded_frames_ GUARDED_BY(crit_); 4190 int recorded_frames_ GUARDED_BY(crit_);
4193 } test(this); 4191 } test(this);
4194 4192
4195 RunBaseTest(&test); 4193 RunBaseTest(&test);
4196 } 4194 }
4197 4195
4198 } // namespace webrtc 4196 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698