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

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

Issue 2794243002: Making FakeNetworkPipe demux audio and video packets. (Closed)
Patch Set: fixing android Created 3 years, 8 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) 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
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
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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 << "Can't open the file " << params_.analyzer.graph_data_output_filename 1595 << "Can't open the file " << params_.analyzer.graph_data_output_filename
1584 << "!"; 1596 << "!";
1585 } 1597 }
1586 1598
1587 Call::Config call_config(event_log_.get()); 1599 Call::Config call_config(event_log_.get());
1588 call_config.bitrate_config = params.call.call_bitrate_config; 1600 call_config.bitrate_config = params.call.call_bitrate_config;
1589 CreateCalls(call_config, call_config); 1601 CreateCalls(call_config, call_config);
1590 1602
1591 test::LayerFilteringTransport send_transport( 1603 test::LayerFilteringTransport send_transport(
1592 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, 1604 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9,
1593 params_.video.selected_tl, params_.ss.selected_sl); 1605 params_.video.selected_tl, params_.ss.selected_sl, payload_type_map_);
1594 test::DirectTransport recv_transport( 1606
1595 params_.pipe, receiver_call_.get(), MediaType::VIDEO); 1607 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get(),
1608 payload_type_map_);
1596 1609
1597 std::string graph_title = params_.analyzer.graph_title; 1610 std::string graph_title = params_.analyzer.graph_title;
1598 if (graph_title.empty()) 1611 if (graph_title.empty())
1599 graph_title = VideoQualityTest::GenerateGraphTitle(); 1612 graph_title = VideoQualityTest::GenerateGraphTitle();
1600 1613
1601 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); 1614 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest");
1602 VideoAnalyzer analyzer( 1615 VideoAnalyzer analyzer(
1603 &send_transport, params_.analyzer.test_label, 1616 &send_transport, params_.analyzer.test_label,
1604 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, 1617 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold,
1605 is_quick_test_enabled 1618 is_quick_test_enabled
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 // adaptation. 1717 // adaptation.
1705 audio_send_config_.rtp.extensions.clear(); 1718 audio_send_config_.rtp.extensions.clear();
1706 if (params_.call.send_side_bwe) { 1719 if (params_.call.send_side_bwe) {
1707 audio_send_config_.rtp.extensions.push_back( 1720 audio_send_config_.rtp.extensions.push_back(
1708 webrtc::RtpExtension(webrtc::RtpExtension::kTransportSequenceNumberUri, 1721 webrtc::RtpExtension(webrtc::RtpExtension::kTransportSequenceNumberUri,
1709 test::kTransportSequenceNumberExtensionId)); 1722 test::kTransportSequenceNumberExtensionId));
1710 audio_send_config_.min_bitrate_bps = kOpusMinBitrateBps; 1723 audio_send_config_.min_bitrate_bps = kOpusMinBitrateBps;
1711 audio_send_config_.max_bitrate_bps = kOpusBitrateFbBps; 1724 audio_send_config_.max_bitrate_bps = kOpusBitrateFbBps;
1712 } 1725 }
1713 audio_send_config_.send_codec_spec.codec_inst = 1726 audio_send_config_.send_codec_spec.codec_inst =
1714 CodecInst{120, "OPUS", 48000, 960, 2, 64000}; 1727 CodecInst{kAudioSendPayloadType, "OPUS", 48000, 960, 2, 64000};
1715 audio_send_config_.send_codec_spec.enable_opus_dtx = params_.audio.dtx; 1728 audio_send_config_.send_codec_spec.enable_opus_dtx = params_.audio.dtx;
1716 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); 1729 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_);
1717 1730
1718 AudioReceiveStream::Config audio_config; 1731 AudioReceiveStream::Config audio_config;
1719 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; 1732 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
1720 audio_config.rtcp_send_transport = transport; 1733 audio_config.rtcp_send_transport = transport;
1721 audio_config.voe_channel_id = receive_channel_id; 1734 audio_config.voe_channel_id = receive_channel_id;
1722 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; 1735 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc;
1723 audio_config.rtp.transport_cc = params_.call.send_side_bwe; 1736 audio_config.rtp.transport_cc = params_.call.send_side_bwe;
1724 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; 1737 audio_config.rtp.extensions = audio_send_config_.rtp.extensions;
1725 audio_config.decoder_factory = decoder_factory_; 1738 audio_config.decoder_factory = decoder_factory_;
1739 audio_config.decoder_map = {{kAudioSendPayloadType, {"OPUS", 48000, 2}}};
1726 if (params_.video.enabled && params_.audio.sync_video) 1740 if (params_.video.enabled && params_.audio.sync_video)
1727 audio_config.sync_group = kSyncGroup; 1741 audio_config.sync_group = kSyncGroup;
1728 1742
1729 *audio_receive_stream = call->CreateAudioReceiveStream(audio_config); 1743 *audio_receive_stream = call->CreateAudioReceiveStream(audio_config);
1730 } 1744 }
1731 1745
1732 void VideoQualityTest::RunWithRenderers(const Params& params) { 1746 void VideoQualityTest::RunWithRenderers(const Params& params) {
1733 params_ = params; 1747 params_ = params;
1734 CheckParams(); 1748 CheckParams();
1735 1749
(...skipping 10 matching lines...) Expand all
1746 audio_state_config.audio_mixer = AudioMixerImpl::Create(); 1760 audio_state_config.audio_mixer = AudioMixerImpl::Create();
1747 call_config.audio_state = AudioState::Create(audio_state_config); 1761 call_config.audio_state = AudioState::Create(audio_state_config);
1748 } 1762 }
1749 1763
1750 std::unique_ptr<Call> call(Call::Create(call_config)); 1764 std::unique_ptr<Call> call(Call::Create(call_config));
1751 1765
1752 // TODO(minyue): consider if this is a good transport even for audio only 1766 // TODO(minyue): consider if this is a good transport even for audio only
1753 // calls. 1767 // calls.
1754 test::LayerFilteringTransport transport( 1768 test::LayerFilteringTransport transport(
1755 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9, 1769 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9,
1756 params.video.selected_tl, params_.ss.selected_sl); 1770 params.video.selected_tl, params_.ss.selected_sl, payload_type_map_);
1771
1757 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at 1772 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at
1758 // least share as much code as possible. That way this test would also match 1773 // least share as much code as possible. That way this test would also match
1759 // the full stack tests better. 1774 // the full stack tests better.
1760 transport.SetReceiver(call->Receiver()); 1775 transport.SetReceiver(call->Receiver());
1761 1776
1762 VideoReceiveStream* video_receive_stream = nullptr; 1777 VideoReceiveStream* video_receive_stream = nullptr;
1763 FlexfecReceiveStream* flexfec_receive_stream = nullptr; 1778 FlexfecReceiveStream* flexfec_receive_stream = nullptr;
1764 std::unique_ptr<test::VideoRenderer> local_preview; 1779 std::unique_ptr<test::VideoRenderer> local_preview;
1765 std::unique_ptr<test::VideoRenderer> loopback_video; 1780 std::unique_ptr<test::VideoRenderer> loopback_video;
1766 if (params_.video.enabled) { 1781 if (params_.video.enabled) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 if (!params_.video.encoded_frame_base_path.empty()) { 1897 if (!params_.video.encoded_frame_base_path.empty()) {
1883 std::ostringstream str; 1898 std::ostringstream str;
1884 str << receive_logs_++; 1899 str << receive_logs_++;
1885 std::string path = 1900 std::string path =
1886 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 1901 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
1887 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 1902 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
1888 10000000); 1903 10000000);
1889 } 1904 }
1890 } 1905 }
1891 } // namespace webrtc 1906 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698