OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 "webrtc/video/video_quality_test.h" | 10 #include "webrtc/video/video_quality_test.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "webrtc/test/vcm_capturer.h" | 47 #include "webrtc/test/vcm_capturer.h" |
48 #include "webrtc/test/video_renderer.h" | 48 #include "webrtc/test/video_renderer.h" |
49 #include "webrtc/voice_engine/include/voe_base.h" | 49 #include "webrtc/voice_engine/include/voe_base.h" |
50 | 50 |
51 namespace { | 51 namespace { |
52 | 52 |
53 constexpr int kSendStatsPollingIntervalMs = 1000; | 53 constexpr int kSendStatsPollingIntervalMs = 1000; |
54 constexpr int kPayloadTypeH264 = 122; | 54 constexpr int kPayloadTypeH264 = 122; |
55 constexpr int kPayloadTypeVP8 = 123; | 55 constexpr int kPayloadTypeVP8 = 123; |
56 constexpr int kPayloadTypeVP9 = 124; | 56 constexpr int kPayloadTypeVP9 = 124; |
| 57 |
57 constexpr size_t kMaxComparisons = 10; | 58 constexpr size_t kMaxComparisons = 10; |
58 constexpr char kSyncGroup[] = "av_sync"; | 59 constexpr char kSyncGroup[] = "av_sync"; |
59 constexpr int kOpusMinBitrateBps = 6000; | 60 constexpr int kOpusMinBitrateBps = 6000; |
60 constexpr int kOpusBitrateFbBps = 32000; | 61 constexpr int kOpusBitrateFbBps = 32000; |
61 constexpr int kFramesSentInQuickTest = 1; | 62 constexpr int kFramesSentInQuickTest = 1; |
62 constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000; | 63 constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000; |
63 constexpr uint32_t kThumbnailRtxSsrcStart = 0xF0000; | 64 constexpr uint32_t kThumbnailRtxSsrcStart = 0xF0000; |
64 | 65 |
65 struct VoiceEngineState { | 66 struct VoiceEngineState { |
66 VoiceEngineState() | 67 VoiceEngineState() |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 auto it = live_encoders_.find(encoder); | 1024 auto it = live_encoders_.find(encoder); |
1024 RTC_CHECK(it != live_encoders_.end()); | 1025 RTC_CHECK(it != live_encoders_.end()); |
1025 live_encoders_.erase(it); | 1026 live_encoders_.erase(it); |
1026 delete encoder; | 1027 delete encoder; |
1027 } | 1028 } |
1028 | 1029 |
1029 std::set<VideoEncoder*> live_encoders_; | 1030 std::set<VideoEncoder*> live_encoders_; |
1030 }; | 1031 }; |
1031 | 1032 |
1032 VideoQualityTest::VideoQualityTest() | 1033 VideoQualityTest::VideoQualityTest() |
1033 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {} | 1034 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) { |
| 1035 payload_type_map_ = test::CallTest::payload_type_map_; |
| 1036 RTC_DCHECK(payload_type_map_.find(kPayloadTypeH264) == |
| 1037 payload_type_map_.end()); |
| 1038 RTC_DCHECK(payload_type_map_.find(kPayloadTypeVP8) == |
| 1039 payload_type_map_.end()); |
| 1040 RTC_DCHECK(payload_type_map_.find(kPayloadTypeVP9) == |
| 1041 payload_type_map_.end()); |
| 1042 payload_type_map_[kPayloadTypeH264] = webrtc::MediaType::VIDEO; |
| 1043 payload_type_map_[kPayloadTypeVP8] = webrtc::MediaType::VIDEO; |
| 1044 payload_type_map_[kPayloadTypeVP9] = webrtc::MediaType::VIDEO; |
| 1045 } |
1034 | 1046 |
1035 VideoQualityTest::Params::Params() | 1047 VideoQualityTest::Params::Params() |
1036 : call({false, Call::Config::BitrateConfig()}), | 1048 : call({false, Call::Config::BitrateConfig()}), |
1037 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, | 1049 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, |
1038 false, "", ""}), | 1050 false, "", ""}), |
1039 audio({false, false, false}), | 1051 audio({false, false, false}), |
1040 screenshare({false, 10, 0}), | 1052 screenshare({false, 10, 0}), |
1041 analyzer({"", 0.0, 0.0, 0, "", ""}), | 1053 analyzer({"", 0.0, 0.0, 0, "", ""}), |
1042 pipe(), | 1054 pipe(), |
1043 logs(false), | 1055 logs(false), |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 << "!"; | 1596 << "!"; |
1585 } | 1597 } |
1586 | 1598 |
1587 webrtc::RtcEventLogNullImpl event_log; | 1599 webrtc::RtcEventLogNullImpl event_log; |
1588 Call::Config call_config(&event_log_); | 1600 Call::Config call_config(&event_log_); |
1589 call_config.bitrate_config = params.call.call_bitrate_config; | 1601 call_config.bitrate_config = params.call.call_bitrate_config; |
1590 CreateCalls(call_config, call_config); | 1602 CreateCalls(call_config, call_config); |
1591 | 1603 |
1592 test::LayerFilteringTransport send_transport( | 1604 test::LayerFilteringTransport send_transport( |
1593 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, | 1605 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, |
1594 params_.video.selected_tl, params_.ss.selected_sl); | 1606 params_.video.selected_tl, params_.ss.selected_sl, payload_type_map_); |
1595 test::DirectTransport recv_transport( | 1607 |
1596 params_.pipe, receiver_call_.get(), MediaType::VIDEO); | 1608 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get(), |
| 1609 payload_type_map_); |
1597 | 1610 |
1598 std::string graph_title = params_.analyzer.graph_title; | 1611 std::string graph_title = params_.analyzer.graph_title; |
1599 if (graph_title.empty()) | 1612 if (graph_title.empty()) |
1600 graph_title = VideoQualityTest::GenerateGraphTitle(); | 1613 graph_title = VideoQualityTest::GenerateGraphTitle(); |
1601 | 1614 |
1602 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); | 1615 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); |
1603 VideoAnalyzer analyzer( | 1616 VideoAnalyzer analyzer( |
1604 &send_transport, params_.analyzer.test_label, | 1617 &send_transport, params_.analyzer.test_label, |
1605 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, | 1618 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, |
1606 is_quick_test_enabled | 1619 is_quick_test_enabled |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 // adaptation. | 1718 // adaptation. |
1706 audio_send_config_.rtp.extensions.clear(); | 1719 audio_send_config_.rtp.extensions.clear(); |
1707 if (params_.call.send_side_bwe) { | 1720 if (params_.call.send_side_bwe) { |
1708 audio_send_config_.rtp.extensions.push_back( | 1721 audio_send_config_.rtp.extensions.push_back( |
1709 webrtc::RtpExtension(webrtc::RtpExtension::kTransportSequenceNumberUri, | 1722 webrtc::RtpExtension(webrtc::RtpExtension::kTransportSequenceNumberUri, |
1710 test::kTransportSequenceNumberExtensionId)); | 1723 test::kTransportSequenceNumberExtensionId)); |
1711 audio_send_config_.min_bitrate_bps = kOpusMinBitrateBps; | 1724 audio_send_config_.min_bitrate_bps = kOpusMinBitrateBps; |
1712 audio_send_config_.max_bitrate_bps = kOpusBitrateFbBps; | 1725 audio_send_config_.max_bitrate_bps = kOpusBitrateFbBps; |
1713 } | 1726 } |
1714 audio_send_config_.send_codec_spec.codec_inst = | 1727 audio_send_config_.send_codec_spec.codec_inst = |
1715 CodecInst{120, "OPUS", 48000, 960, 2, 64000}; | 1728 CodecInst{kAudioSendPayloadType, "OPUS", 48000, 960, 2, 64000}; |
1716 audio_send_config_.send_codec_spec.enable_opus_dtx = params_.audio.dtx; | 1729 audio_send_config_.send_codec_spec.enable_opus_dtx = params_.audio.dtx; |
1717 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); | 1730 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); |
1718 | 1731 |
1719 AudioReceiveStream::Config audio_config; | 1732 AudioReceiveStream::Config audio_config; |
1720 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; | 1733 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; |
1721 audio_config.rtcp_send_transport = transport; | 1734 audio_config.rtcp_send_transport = transport; |
1722 audio_config.voe_channel_id = receive_channel_id; | 1735 audio_config.voe_channel_id = receive_channel_id; |
1723 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; | 1736 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; |
1724 audio_config.rtp.transport_cc = params_.call.send_side_bwe; | 1737 audio_config.rtp.transport_cc = params_.call.send_side_bwe; |
1725 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; | 1738 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; |
1726 audio_config.decoder_factory = decoder_factory_; | 1739 audio_config.decoder_factory = decoder_factory_; |
| 1740 audio_config.decoder_map = {{kAudioSendPayloadType, {"OPUS", 48000, 2}}}; |
1727 if (params_.video.enabled && params_.audio.sync_video) | 1741 if (params_.video.enabled && params_.audio.sync_video) |
1728 audio_config.sync_group = kSyncGroup; | 1742 audio_config.sync_group = kSyncGroup; |
1729 | 1743 |
1730 *audio_receive_stream = call->CreateAudioReceiveStream(audio_config); | 1744 *audio_receive_stream = call->CreateAudioReceiveStream(audio_config); |
1731 } | 1745 } |
1732 | 1746 |
1733 void VideoQualityTest::RunWithRenderers(const Params& params) { | 1747 void VideoQualityTest::RunWithRenderers(const Params& params) { |
1734 params_ = params; | 1748 params_ = params; |
1735 CheckParams(); | 1749 CheckParams(); |
1736 | 1750 |
(...skipping 11 matching lines...) Expand all Loading... |
1748 audio_state_config.audio_mixer = AudioMixerImpl::Create(); | 1762 audio_state_config.audio_mixer = AudioMixerImpl::Create(); |
1749 call_config.audio_state = AudioState::Create(audio_state_config); | 1763 call_config.audio_state = AudioState::Create(audio_state_config); |
1750 } | 1764 } |
1751 | 1765 |
1752 std::unique_ptr<Call> call(Call::Create(call_config)); | 1766 std::unique_ptr<Call> call(Call::Create(call_config)); |
1753 | 1767 |
1754 // TODO(minyue): consider if this is a good transport even for audio only | 1768 // TODO(minyue): consider if this is a good transport even for audio only |
1755 // calls. | 1769 // calls. |
1756 test::LayerFilteringTransport transport( | 1770 test::LayerFilteringTransport transport( |
1757 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9, | 1771 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9, |
1758 params.video.selected_tl, params_.ss.selected_sl); | 1772 params.video.selected_tl, params_.ss.selected_sl, payload_type_map_); |
| 1773 |
1759 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at | 1774 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at |
1760 // least share as much code as possible. That way this test would also match | 1775 // least share as much code as possible. That way this test would also match |
1761 // the full stack tests better. | 1776 // the full stack tests better. |
1762 transport.SetReceiver(call->Receiver()); | 1777 transport.SetReceiver(call->Receiver()); |
1763 | 1778 |
1764 VideoReceiveStream* video_receive_stream = nullptr; | 1779 VideoReceiveStream* video_receive_stream = nullptr; |
1765 FlexfecReceiveStream* flexfec_receive_stream = nullptr; | 1780 FlexfecReceiveStream* flexfec_receive_stream = nullptr; |
1766 std::unique_ptr<test::VideoRenderer> local_preview; | 1781 std::unique_ptr<test::VideoRenderer> local_preview; |
1767 std::unique_ptr<test::VideoRenderer> loopback_video; | 1782 std::unique_ptr<test::VideoRenderer> loopback_video; |
1768 if (params_.video.enabled) { | 1783 if (params_.video.enabled) { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 if (!params_.video.encoded_frame_base_path.empty()) { | 1899 if (!params_.video.encoded_frame_base_path.empty()) { |
1885 std::ostringstream str; | 1900 std::ostringstream str; |
1886 str << receive_logs_++; | 1901 str << receive_logs_++; |
1887 std::string path = | 1902 std::string path = |
1888 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1903 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1889 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1904 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1890 10000000); | 1905 10000000); |
1891 } | 1906 } |
1892 } | 1907 } |
1893 } // namespace webrtc | 1908 } // namespace webrtc |
OLD | NEW |