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 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1467 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1467 handle1, width, height, 1, 1, kVideoRotation_0)); | 1468 handle1, width, height, 1, 1, kVideoRotation_0)); |
1468 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1469 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1469 handle2, width, height, 2, 2, kVideoRotation_0)); | 1470 handle2, width, height, 2, 2, kVideoRotation_0)); |
1470 input_frames.push_back(CreateVideoFrame(width, height, 3)); | 1471 input_frames.push_back(CreateVideoFrame(width, height, 3)); |
1471 input_frames.push_back(CreateVideoFrame(width, height, 4)); | 1472 input_frames.push_back(CreateVideoFrame(width, height, 4)); |
1472 input_frames.push_back(test::FakeNativeHandle::CreateFrame( | 1473 input_frames.push_back(test::FakeNativeHandle::CreateFrame( |
1473 handle3, width, height, 5, 5, kVideoRotation_0)); | 1474 handle3, width, height, 5, 5, kVideoRotation_0)); |
1474 | 1475 |
1475 video_send_stream_->Start(); | 1476 video_send_stream_->Start(); |
| 1477 test::FrameForwarder forwarder; |
| 1478 video_send_stream_->SetSource(&forwarder); |
1476 for (size_t i = 0; i < input_frames.size(); i++) { | 1479 for (size_t i = 0; i < input_frames.size(); i++) { |
1477 video_send_stream_->Input()->IncomingCapturedFrame(input_frames[i]); | 1480 forwarder.IncomingCapturedFrame(input_frames[i]); |
1478 // Do not send the next frame too fast, so the frame dropper won't drop it. | 1481 // Do not send the next frame too fast, so the frame dropper won't drop it. |
1479 if (i < input_frames.size() - 1) | 1482 if (i < input_frames.size() - 1) |
1480 SleepMs(1000 / video_encoder_config_.streams[0].max_framerate); | 1483 SleepMs(1000 / video_encoder_config_.streams[0].max_framerate); |
1481 // Wait until the output frame is received before sending the next input | 1484 // Wait until the output frame is received before sending the next input |
1482 // frame. Or the previous input frame may be replaced without delivering. | 1485 // frame. Or the previous input frame may be replaced without delivering. |
1483 observer.WaitOutputFrame(); | 1486 observer.WaitOutputFrame(); |
1484 } | 1487 } |
1485 video_send_stream_->Stop(); | 1488 video_send_stream_->Stop(); |
| 1489 video_send_stream_->SetSource(nullptr); |
1486 | 1490 |
1487 // Test if the input and output frames are the same. render_time_ms and | 1491 // Test if the input and output frames are the same. render_time_ms and |
1488 // timestamp are not compared because capturer sets those values. | 1492 // timestamp are not compared because capturer sets those values. |
1489 ExpectEqualFramesVector(input_frames, observer.output_frames()); | 1493 ExpectEqualFramesVector(input_frames, observer.output_frames()); |
1490 | 1494 |
1491 DestroyStreams(); | 1495 DestroyStreams(); |
1492 } | 1496 } |
1493 | 1497 |
1494 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, | 1498 void ExpectEqualFramesVector(const std::vector<VideoFrame>& frames1, |
1495 const std::vector<VideoFrame>& frames2) { | 1499 const std::vector<VideoFrame>& frames2) { |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 observation_complete_.Set(); | 2570 observation_complete_.Set(); |
2567 } | 2571 } |
2568 } | 2572 } |
2569 } test; | 2573 } test; |
2570 | 2574 |
2571 RunBaseTest(&test); | 2575 RunBaseTest(&test); |
2572 } | 2576 } |
2573 #endif // !defined(RTC_DISABLE_VP9) | 2577 #endif // !defined(RTC_DISABLE_VP9) |
2574 | 2578 |
2575 } // namespace webrtc | 2579 } // namespace webrtc |
OLD | NEW |