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

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

Issue 2794243002: Making FakeNetworkPipe demux audio and video packets. (Closed)
Patch Set: new solution 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 const std::map<uint8_t, webrtc::MediaType> additional_pt_map = {
nisse-webrtc 2017/04/06 12:23:56 What do you think about defining *all* payload typ
minyue-webrtc 2017/04/06 18:45:10 sure. will try
58 {kPayloadTypeH264, webrtc::MediaType::VIDEO},
59 {kPayloadTypeVP8, webrtc::MediaType::VIDEO},
60 {kPayloadTypeVP9, webrtc::MediaType::VIDEO},
61 };
62
57 constexpr size_t kMaxComparisons = 10; 63 constexpr size_t kMaxComparisons = 10;
58 constexpr char kSyncGroup[] = "av_sync"; 64 constexpr char kSyncGroup[] = "av_sync";
59 constexpr int kOpusMinBitrateBps = 6000; 65 constexpr int kOpusMinBitrateBps = 6000;
60 constexpr int kOpusBitrateFbBps = 32000; 66 constexpr int kOpusBitrateFbBps = 32000;
61 constexpr int kFramesSentInQuickTest = 1; 67 constexpr int kFramesSentInQuickTest = 1;
62 constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000; 68 constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000;
63 constexpr uint32_t kThumbnailRtxSsrcStart = 0xF0000; 69 constexpr uint32_t kThumbnailRtxSsrcStart = 0xF0000;
64 70
65 struct VoiceEngineState { 71 struct VoiceEngineState {
66 VoiceEngineState() 72 VoiceEngineState()
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 RTC_CHECK(graph_data_output_file) 1588 RTC_CHECK(graph_data_output_file)
1583 << "Can't open the file " << params_.analyzer.graph_data_output_filename 1589 << "Can't open the file " << params_.analyzer.graph_data_output_filename
1584 << "!"; 1590 << "!";
1585 } 1591 }
1586 1592
1587 webrtc::RtcEventLogNullImpl event_log; 1593 webrtc::RtcEventLogNullImpl event_log;
1588 Call::Config call_config(&event_log_); 1594 Call::Config call_config(&event_log_);
1589 call_config.bitrate_config = params.call.call_bitrate_config; 1595 call_config.bitrate_config = params.call.call_bitrate_config;
1590 CreateCalls(call_config, call_config); 1596 CreateCalls(call_config, call_config);
1591 1597
1598 std::map<uint8_t, MediaType> payload_type_map = payload_type_map_;
1599 payload_type_map.insert(additional_pt_map.begin(), additional_pt_map.end());
1600
1592 test::LayerFilteringTransport send_transport( 1601 test::LayerFilteringTransport send_transport(
1593 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, 1602 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9,
1594 params_.video.selected_tl, params_.ss.selected_sl); 1603 params_.video.selected_tl, params_.ss.selected_sl, payload_type_map);
1595 test::DirectTransport recv_transport( 1604
1596 params_.pipe, receiver_call_.get(), MediaType::VIDEO); 1605 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get(),
1606 payload_type_map);
1597 1607
1598 std::string graph_title = params_.analyzer.graph_title; 1608 std::string graph_title = params_.analyzer.graph_title;
1599 if (graph_title.empty()) 1609 if (graph_title.empty())
1600 graph_title = VideoQualityTest::GenerateGraphTitle(); 1610 graph_title = VideoQualityTest::GenerateGraphTitle();
1601 1611
1602 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); 1612 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest");
1603 VideoAnalyzer analyzer( 1613 VideoAnalyzer analyzer(
1604 &send_transport, params_.analyzer.test_label, 1614 &send_transport, params_.analyzer.test_label,
1605 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, 1615 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold,
1606 is_quick_test_enabled 1616 is_quick_test_enabled
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 // adaptation. 1715 // adaptation.
1706 audio_send_config_.rtp.extensions.clear(); 1716 audio_send_config_.rtp.extensions.clear();
1707 if (params_.call.send_side_bwe) { 1717 if (params_.call.send_side_bwe) {
1708 audio_send_config_.rtp.extensions.push_back( 1718 audio_send_config_.rtp.extensions.push_back(
1709 webrtc::RtpExtension(webrtc::RtpExtension::kTransportSequenceNumberUri, 1719 webrtc::RtpExtension(webrtc::RtpExtension::kTransportSequenceNumberUri,
1710 test::kTransportSequenceNumberExtensionId)); 1720 test::kTransportSequenceNumberExtensionId));
1711 audio_send_config_.min_bitrate_bps = kOpusMinBitrateBps; 1721 audio_send_config_.min_bitrate_bps = kOpusMinBitrateBps;
1712 audio_send_config_.max_bitrate_bps = kOpusBitrateFbBps; 1722 audio_send_config_.max_bitrate_bps = kOpusBitrateFbBps;
1713 } 1723 }
1714 audio_send_config_.send_codec_spec.codec_inst = 1724 audio_send_config_.send_codec_spec.codec_inst =
1715 CodecInst{120, "OPUS", 48000, 960, 2, 64000}; 1725 CodecInst{kAudioSendPayloadType, "OPUS", 48000, 960, 2, 64000};
1716 audio_send_config_.send_codec_spec.enable_opus_dtx = params_.audio.dtx; 1726 audio_send_config_.send_codec_spec.enable_opus_dtx = params_.audio.dtx;
1717 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); 1727 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_);
1718 1728
1719 AudioReceiveStream::Config audio_config; 1729 AudioReceiveStream::Config audio_config;
1720 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; 1730 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
1721 audio_config.rtcp_send_transport = transport; 1731 audio_config.rtcp_send_transport = transport;
1722 audio_config.voe_channel_id = receive_channel_id; 1732 audio_config.voe_channel_id = receive_channel_id;
1723 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; 1733 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc;
1724 audio_config.rtp.transport_cc = params_.call.send_side_bwe; 1734 audio_config.rtp.transport_cc = params_.call.send_side_bwe;
1725 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; 1735 audio_config.rtp.extensions = audio_send_config_.rtp.extensions;
1726 audio_config.decoder_factory = decoder_factory_; 1736 audio_config.decoder_factory = decoder_factory_;
1737 audio_config.decoder_map = {{kAudioSendPayloadType, {"OPUS", 48000, 2}}};
1727 if (params_.video.enabled && params_.audio.sync_video) 1738 if (params_.video.enabled && params_.audio.sync_video)
1728 audio_config.sync_group = kSyncGroup; 1739 audio_config.sync_group = kSyncGroup;
1729 1740
1730 *audio_receive_stream = call->CreateAudioReceiveStream(audio_config); 1741 *audio_receive_stream = call->CreateAudioReceiveStream(audio_config);
1731 } 1742 }
1732 1743
1733 void VideoQualityTest::RunWithRenderers(const Params& params) { 1744 void VideoQualityTest::RunWithRenderers(const Params& params) {
1734 params_ = params; 1745 params_ = params;
1735 CheckParams(); 1746 CheckParams();
1736 1747
1737 // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to 1748 // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to
1738 // match the full stack tests. 1749 // match the full stack tests.
1739 webrtc::RtcEventLogNullImpl event_log; 1750 webrtc::RtcEventLogNullImpl event_log;
1740 Call::Config call_config(&event_log_); 1751 Call::Config call_config(&event_log_);
1741 call_config.bitrate_config = params_.call.call_bitrate_config; 1752 call_config.bitrate_config = params_.call.call_bitrate_config;
1742 1753
1743 ::VoiceEngineState voe; 1754 ::VoiceEngineState voe;
1744 if (params_.audio.enabled) { 1755 if (params_.audio.enabled) {
1745 CreateVoiceEngine(&voe, decoder_factory_); 1756 CreateVoiceEngine(&voe, decoder_factory_);
1746 AudioState::Config audio_state_config; 1757 AudioState::Config audio_state_config;
1747 audio_state_config.voice_engine = voe.voice_engine; 1758 audio_state_config.voice_engine = voe.voice_engine;
1748 audio_state_config.audio_mixer = AudioMixerImpl::Create(); 1759 audio_state_config.audio_mixer = AudioMixerImpl::Create();
1749 call_config.audio_state = AudioState::Create(audio_state_config); 1760 call_config.audio_state = AudioState::Create(audio_state_config);
1750 } 1761 }
1751 1762
1752 std::unique_ptr<Call> call(Call::Create(call_config)); 1763 std::unique_ptr<Call> call(Call::Create(call_config));
1753 1764
1754 // TODO(minyue): consider if this is a good transport even for audio only 1765 // TODO(minyue): consider if this is a good transport even for audio only
1755 // calls. 1766 // calls.
1767 std::map<uint8_t, MediaType> payload_type_map = payload_type_map_;
1768 payload_type_map.insert(additional_pt_map.begin(), additional_pt_map.end());
1756 test::LayerFilteringTransport transport( 1769 test::LayerFilteringTransport transport(
1757 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9, 1770 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9,
1758 params.video.selected_tl, params_.ss.selected_sl); 1771 params.video.selected_tl, params_.ss.selected_sl, payload_type_map);
1772
1759 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at 1773 // 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 1774 // least share as much code as possible. That way this test would also match
1761 // the full stack tests better. 1775 // the full stack tests better.
1762 transport.SetReceiver(call->Receiver()); 1776 transport.SetReceiver(call->Receiver());
1763 1777
1764 VideoReceiveStream* video_receive_stream = nullptr; 1778 VideoReceiveStream* video_receive_stream = nullptr;
1765 FlexfecReceiveStream* flexfec_receive_stream = nullptr; 1779 FlexfecReceiveStream* flexfec_receive_stream = nullptr;
1766 std::unique_ptr<test::VideoRenderer> local_preview; 1780 std::unique_ptr<test::VideoRenderer> local_preview;
1767 std::unique_ptr<test::VideoRenderer> loopback_video; 1781 std::unique_ptr<test::VideoRenderer> loopback_video;
1768 if (params_.video.enabled) { 1782 if (params_.video.enabled) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 if (!params_.video.encoded_frame_base_path.empty()) { 1898 if (!params_.video.encoded_frame_base_path.empty()) {
1885 std::ostringstream str; 1899 std::ostringstream str;
1886 str << receive_logs_++; 1900 str << receive_logs_++;
1887 std::string path = 1901 std::string path =
1888 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 1902 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
1889 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 1903 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
1890 10000000); 1904 10000000);
1891 } 1905 }
1892 } 1906 }
1893 } // namespace webrtc 1907 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698