OLD | NEW |
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> // max | 10 #include <algorithm> // max |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 26 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 27 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
28 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" | 28 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" |
29 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" | 29 #include "webrtc/modules/rtp_rtcp/source/rtcp_utility.h" |
30 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h" | 30 #include "webrtc/modules/rtp_rtcp/source/rtp_format_vp9.h" |
31 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" | 31 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
32 #include "webrtc/system_wrappers/include/sleep.h" | 32 #include "webrtc/system_wrappers/include/sleep.h" |
33 #include "webrtc/test/call_test.h" | 33 #include "webrtc/test/call_test.h" |
34 #include "webrtc/test/configurable_frame_size_encoder.h" | 34 #include "webrtc/test/configurable_frame_size_encoder.h" |
35 #include "webrtc/test/fake_texture_frame.h" | 35 #include "webrtc/test/fake_texture_frame.h" |
| 36 #include "webrtc/test/frame_generator.h" |
36 #include "webrtc/test/frame_utils.h" | 37 #include "webrtc/test/frame_utils.h" |
37 #include "webrtc/test/null_transport.h" | 38 #include "webrtc/test/null_transport.h" |
38 #include "webrtc/test/testsupport/perf_test.h" | 39 #include "webrtc/test/testsupport/perf_test.h" |
39 #include "webrtc/video/send_statistics_proxy.h" | 40 #include "webrtc/video/send_statistics_proxy.h" |
40 #include "webrtc/video_frame.h" | 41 #include "webrtc/video_frame.h" |
41 #include "webrtc/video_send_stream.h" | 42 #include "webrtc/video_send_stream.h" |
42 | 43 |
43 namespace webrtc { | 44 namespace webrtc { |
44 | 45 |
45 enum VideoFormat { kGeneric, kVP8, }; | 46 enum VideoFormat { kGeneric, kVP8, }; |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1459 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1459 handle1, width, height, 1, 1, kVideoRotation_0)); | 1460 handle1, width, height, 1, 1, kVideoRotation_0)); |
1460 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1461 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1461 handle2, width, height, 2, 2, kVideoRotation_0)); | 1462 handle2, width, height, 2, 2, kVideoRotation_0)); |
1462 input_frames.push_back(CreateVideoFrame(width, height, 3)); | 1463 input_frames.push_back(CreateVideoFrame(width, height, 3)); |
1463 input_frames.push_back(CreateVideoFrame(width, height, 4)); | 1464 input_frames.push_back(CreateVideoFrame(width, height, 4)); |
1464 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1465 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1465 handle3, width, height, 5, 5, kVideoRotation_0)); | 1466 handle3, width, height, 5, 5, kVideoRotation_0)); |
1466 | 1467 |
1467 video_send_stream_->Start(); | 1468 video_send_stream_->Start(); |
| 1469 test::FrameForwarder forwarder; |
| 1470 video_send_stream_->SetSource(&forwarder); |
1468 for (size_t i = 0; i < input_frames.size(); i++) { | 1471 for (size_t i = 0; i < input_frames.size(); i++) { |
1469 video_send_stream_->Input()->IncomingCapturedFrame(input_frames[i]); | 1472 forwarder.IncomingCapturedFrame(input_frames[i]); |
1470 // Do not send the next frame too fast, so the frame dropper won't drop it. | 1473 // Do not send the next frame too fast, so the frame dropper won't drop it. |
1471 if (i < input_frames.size() - 1) | 1474 if (i < input_frames.size() - 1) |
1472 SleepMs(1000 / video_encoder_config_.streams[0].max_framerate); | 1475 SleepMs(1000 / video_encoder_config_.streams[0].max_framerate); |
1473 // Wait until the output frame is received before sending the next input | 1476 // Wait until the output frame is received before sending the next input |
1474 // frame. Or the previous input frame may be replaced without delivering. | 1477 // frame. Or the previous input frame may be replaced without delivering. |
1475 observer.WaitOutputFrame(); | 1478 observer.WaitOutputFrame(); |
1476 } | 1479 } |
1477 video_send_stream_->Stop(); | 1480 video_send_stream_->Stop(); |
| 1481 video_send_stream_->SetSource(nullptr); |
1478 | 1482 |
1479 // Test if the input and output frames are the same. render_time_ms and | 1483 // Test if the input and output frames are the same. render_time_ms and |
1480 // timestamp are not compared because capturer sets those values. | 1484 // timestamp are not compared because capturer sets those values. |
1481 ExpectEqualFramesVector(input_frames, observer.output_frames()); | 1485 ExpectEqualFramesVector(input_frames, observer.output_frames()); |
1482 | 1486 |
1483 DestroyStreams(); | 1487 DestroyStreams(); |
1484 } | 1488 } |
1485 | 1489 |
1486 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, | 1490 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, |
1487 const std::vector<VideoFrame>& frames2) { | 1491 const std::vector<VideoFrame>& frames2) { |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 observation_complete_.Set(); | 2562 observation_complete_.Set(); |
2559 } | 2563 } |
2560 } | 2564 } |
2561 } test; | 2565 } test; |
2562 | 2566 |
2563 RunBaseTest(&test); | 2567 RunBaseTest(&test); |
2564 } | 2568 } |
2565 #endif // !defined(RTC_DISABLE_VP9) | 2569 #endif // !defined(RTC_DISABLE_VP9) |
2566 | 2570 |
2567 } // namespace webrtc | 2571 } // namespace webrtc |
OLD | NEW |