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

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

Issue 2794243002: Making FakeNetworkPipe demux audio and video packets. (Closed)
Patch Set: further fixing 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 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_); 1717 audio_send_stream_ = call->CreateAudioSendStream(audio_send_config_);
1718 1718
1719 AudioReceiveStream::Config audio_config; 1719 AudioReceiveStream::Config audio_config;
1720 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc; 1720 audio_config.rtp.local_ssrc = kReceiverLocalAudioSsrc;
1721 audio_config.rtcp_send_transport = transport; 1721 audio_config.rtcp_send_transport = transport;
1722 audio_config.voe_channel_id = receive_channel_id; 1722 audio_config.voe_channel_id = receive_channel_id;
1723 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc; 1723 audio_config.rtp.remote_ssrc = audio_send_config_.rtp.ssrc;
1724 audio_config.rtp.transport_cc = params_.call.send_side_bwe; 1724 audio_config.rtp.transport_cc = params_.call.send_side_bwe;
1725 audio_config.rtp.extensions = audio_send_config_.rtp.extensions; 1725 audio_config.rtp.extensions = audio_send_config_.rtp.extensions;
1726 audio_config.decoder_factory = decoder_factory_; 1726 audio_config.decoder_factory = decoder_factory_;
1727 audio_config.decoder_map = {{120, {"opus", 48000, 2}}};
1727 if (params_.video.enabled && params_.audio.sync_video) 1728 if (params_.video.enabled && params_.audio.sync_video)
1728 audio_config.sync_group = kSyncGroup; 1729 audio_config.sync_group = kSyncGroup;
1729 1730
1730 *audio_receive_stream = call->CreateAudioReceiveStream(audio_config); 1731 *audio_receive_stream = call->CreateAudioReceiveStream(audio_config);
1731 } 1732 }
1732 1733
1733 void VideoQualityTest::RunWithRenderers(const Params& params) { 1734 void VideoQualityTest::RunWithRenderers(const Params& params) {
1734 params_ = params; 1735 params_ = params;
1735 CheckParams(); 1736 CheckParams();
1736 1737
1737 // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to 1738 // TODO(ivica): Remove bitrate_config and use the default Call::Config(), to
1738 // match the full stack tests. 1739 // match the full stack tests.
1739 webrtc::RtcEventLogNullImpl event_log; 1740 webrtc::RtcEventLogNullImpl event_log;
1740 Call::Config call_config(&event_log_); 1741 Call::Config call_config(&event_log_);
1741 call_config.bitrate_config = params_.call.call_bitrate_config; 1742 call_config.bitrate_config = params_.call.call_bitrate_config;
1742 1743
1743 ::VoiceEngineState voe; 1744 ::VoiceEngineState voe;
1744 if (params_.audio.enabled) { 1745 if (params_.audio.enabled) {
1745 CreateVoiceEngine(&voe, decoder_factory_); 1746 CreateVoiceEngine(&voe, decoder_factory_);
1746 AudioState::Config audio_state_config; 1747 AudioState::Config audio_state_config;
1747 audio_state_config.voice_engine = voe.voice_engine; 1748 audio_state_config.voice_engine = voe.voice_engine;
1748 audio_state_config.audio_mixer = AudioMixerImpl::Create(); 1749 audio_state_config.audio_mixer = AudioMixerImpl::Create();
1749 call_config.audio_state = AudioState::Create(audio_state_config); 1750 call_config.audio_state = AudioState::Create(audio_state_config);
1750 } 1751 }
1751 1752
1752 std::unique_ptr<Call> call(Call::Create(call_config)); 1753 std::unique_ptr<Call> call(Call::Create(call_config));
1753 1754
1754 // TODO(minyue): consider if this is a good transport even for audio only 1755 test::LayerFilteringTransport video_transport(
1755 // calls.
1756 test::LayerFilteringTransport transport(
1757 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9, 1756 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9,
1758 params.video.selected_tl, params_.ss.selected_sl); 1757 params.video.selected_tl, params_.ss.selected_sl);
1758 MediaTypePacketReceiver video_receiver(call->Receiver(), MediaType::VIDEO);
1759
1759 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at 1760 // 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 1761 // least share as much code as possible. That way this test would also match
1761 // the full stack tests better. 1762 // the full stack tests better.
1762 transport.SetReceiver(call->Receiver()); 1763 video_transport.SetReceiver(&video_receiver);
1764
1765 test::DirectTransport audio_transport(params.pipe, call.get(),
1766 MediaType::AUDIO);
1767 MediaTypePacketReceiver audio_receiver(call->Receiver(), MediaType::AUDIO);
nisse-webrtc 2017/04/04 09:57:27 If it's ok to use two separate transports in this
stefan-webrtc 2017/04/05 08:52:17 Let's not introduce an additional transport. We wa
1768 audio_transport.SetReceiver(&audio_receiver);
1763 1769
1764 VideoReceiveStream* video_receive_stream = nullptr; 1770 VideoReceiveStream* video_receive_stream = nullptr;
1765 FlexfecReceiveStream* flexfec_receive_stream = nullptr; 1771 FlexfecReceiveStream* flexfec_receive_stream = nullptr;
1766 std::unique_ptr<test::VideoRenderer> local_preview; 1772 std::unique_ptr<test::VideoRenderer> local_preview;
1767 std::unique_ptr<test::VideoRenderer> loopback_video; 1773 std::unique_ptr<test::VideoRenderer> loopback_video;
1768 if (params_.video.enabled) { 1774 if (params_.video.enabled) {
1769 // Create video renderers. 1775 // Create video renderers.
1770 local_preview.reset(test::VideoRenderer::Create( 1776 local_preview.reset(test::VideoRenderer::Create(
1771 "Local Preview", params_.video.width, params_.video.height)); 1777 "Local Preview", params_.video.width, params_.video.height));
1772 1778
1773 size_t stream_id = params_.ss.selected_stream; 1779 size_t stream_id = params_.ss.selected_stream;
1774 std::string title = "Loopback Video"; 1780 std::string title = "Loopback Video";
1775 if (params_.ss.streams.size() > 1) { 1781 if (params_.ss.streams.size() > 1) {
1776 std::ostringstream s; 1782 std::ostringstream s;
1777 s << stream_id; 1783 s << stream_id;
1778 title += " - Stream #" + s.str(); 1784 title += " - Stream #" + s.str();
1779 } 1785 }
1780 1786
1781 loopback_video.reset(test::VideoRenderer::Create( 1787 loopback_video.reset(test::VideoRenderer::Create(
1782 title.c_str(), params_.ss.streams[stream_id].width, 1788 title.c_str(), params_.ss.streams[stream_id].width,
1783 params_.ss.streams[stream_id].height)); 1789 params_.ss.streams[stream_id].height));
1784 1790
1785 SetupVideo(&transport, &transport); 1791 SetupVideo(&video_transport, &video_transport);
1786 video_send_config_.pre_encode_callback = local_preview.get(); 1792 video_send_config_.pre_encode_callback = local_preview.get();
1787 video_receive_configs_[stream_id].renderer = loopback_video.get(); 1793 video_receive_configs_[stream_id].renderer = loopback_video.get();
1788 if (params_.audio.enabled && params_.audio.sync_video) 1794 if (params_.audio.enabled && params_.audio.sync_video)
1789 video_receive_configs_[stream_id].sync_group = kSyncGroup; 1795 video_receive_configs_[stream_id].sync_group = kSyncGroup;
1790 1796
1791 if (params_.screenshare.enabled) 1797 if (params_.screenshare.enabled)
1792 SetupScreenshareOrSVC(); 1798 SetupScreenshareOrSVC();
1793 1799
1794 video_send_stream_ = call->CreateVideoSendStream( 1800 video_send_stream_ = call->CreateVideoSendStream(
1795 video_send_config_.Copy(), video_encoder_config_.Copy()); 1801 video_send_config_.Copy(), video_encoder_config_.Copy());
1796 if (params_.video.flexfec) { 1802 if (params_.video.flexfec) {
1797 RTC_DCHECK(!flexfec_receive_configs_.empty()); 1803 RTC_DCHECK(!flexfec_receive_configs_.empty());
1798 flexfec_receive_stream = 1804 flexfec_receive_stream =
1799 call->CreateFlexfecReceiveStream(flexfec_receive_configs_[0]); 1805 call->CreateFlexfecReceiveStream(flexfec_receive_configs_[0]);
1800 } 1806 }
1801 video_receive_stream = call->CreateVideoReceiveStream( 1807 video_receive_stream = call->CreateVideoReceiveStream(
1802 video_receive_configs_[stream_id].Copy()); 1808 video_receive_configs_[stream_id].Copy());
1803 CreateCapturer(); 1809 CreateCapturer();
1804 video_send_stream_->SetSource(video_capturer_.get(), 1810 video_send_stream_->SetSource(video_capturer_.get(),
1805 degradation_preference_); 1811 degradation_preference_);
1806 } 1812 }
1807 1813
1808 AudioReceiveStream* audio_receive_stream = nullptr; 1814 AudioReceiveStream* audio_receive_stream = nullptr;
1809 if (params_.audio.enabled) { 1815 if (params_.audio.enabled) {
1810 SetupAudio(voe.send_channel_id, voe.receive_channel_id, call.get(), 1816 SetupAudio(voe.send_channel_id, voe.receive_channel_id, call.get(),
1811 &transport, &audio_receive_stream); 1817 &audio_transport, &audio_receive_stream);
1812 } 1818 }
1813 1819
1814 StartEncodedFrameLogs(video_receive_stream); 1820 StartEncodedFrameLogs(video_receive_stream);
1815 StartEncodedFrameLogs(video_send_stream_); 1821 StartEncodedFrameLogs(video_send_stream_);
1816 1822
1817 // Start sending and receiving video. 1823 // Start sending and receiving video.
1818 if (params_.video.enabled) { 1824 if (params_.video.enabled) {
1819 if (flexfec_receive_stream) 1825 if (flexfec_receive_stream)
1820 flexfec_receive_stream->Start(); 1826 flexfec_receive_stream->Start();
1821 video_receive_stream->Start(); 1827 video_receive_stream->Start();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 video_send_stream_->Stop(); 1859 video_send_stream_->Stop();
1854 video_receive_stream->Stop(); 1860 video_receive_stream->Stop();
1855 if (flexfec_receive_stream) { 1861 if (flexfec_receive_stream) {
1856 flexfec_receive_stream->Stop(); 1862 flexfec_receive_stream->Stop();
1857 call->DestroyFlexfecReceiveStream(flexfec_receive_stream); 1863 call->DestroyFlexfecReceiveStream(flexfec_receive_stream);
1858 } 1864 }
1859 call->DestroyVideoReceiveStream(video_receive_stream); 1865 call->DestroyVideoReceiveStream(video_receive_stream);
1860 call->DestroyVideoSendStream(video_send_stream_); 1866 call->DestroyVideoSendStream(video_send_stream_);
1861 } 1867 }
1862 1868
1863 transport.StopSending(); 1869 audio_transport.StopSending();
1870 video_transport.StopSending();
1864 if (params_.audio.enabled) 1871 if (params_.audio.enabled)
1865 DestroyVoiceEngine(&voe); 1872 DestroyVoiceEngine(&voe);
1866 } 1873 }
1867 1874
1868 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) { 1875 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) {
1869 if (!params_.video.encoded_frame_base_path.empty()) { 1876 if (!params_.video.encoded_frame_base_path.empty()) {
1870 std::ostringstream str; 1877 std::ostringstream str;
1871 str << send_logs_++; 1878 str << send_logs_++;
1872 std::string prefix = 1879 std::string prefix =
1873 params_.video.encoded_frame_base_path + "." + str.str() + ".send."; 1880 params_.video.encoded_frame_base_path + "." + str.str() + ".send.";
(...skipping 10 matching lines...) Expand all
1884 if (!params_.video.encoded_frame_base_path.empty()) { 1891 if (!params_.video.encoded_frame_base_path.empty()) {
1885 std::ostringstream str; 1892 std::ostringstream str;
1886 str << receive_logs_++; 1893 str << receive_logs_++;
1887 std::string path = 1894 std::string path =
1888 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 1895 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
1889 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 1896 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
1890 10000000); 1897 10000000);
1891 } 1898 }
1892 } 1899 }
1893 } // namespace webrtc 1900 } // namespace webrtc
OLDNEW
« webrtc/video/video_quality_test.h ('K') | « webrtc/video/video_quality_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698