Index: webrtc/video/video_quality_test.cc |
diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc |
index aa1c9b17289df15cd9d698ea130bc494fdd20289..b76b977ef38c08dc891cbe11554541a361c0194c 100644 |
--- a/webrtc/video/video_quality_test.cc |
+++ b/webrtc/video/video_quality_test.cc |
@@ -22,6 +22,7 @@ |
#include "webrtc/base/event.h" |
#include "webrtc/base/format_macros.h" |
#include "webrtc/base/optional.h" |
+#include "webrtc/base/platform_file.h" |
#include "webrtc/base/timeutils.h" |
#include "webrtc/call.h" |
#include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
@@ -37,6 +38,12 @@ |
#include "webrtc/voice_engine/include/voe_base.h" |
#include "webrtc/voice_engine/include/voe_codec.h" |
+#if defined(WEBRTC_WIN) |
+#include "webrtc/base/win32.h" |
+#else |
+#include <fcntl.h> |
+#endif |
+ |
namespace { |
constexpr int kSendStatsPollingIntervalMs = 1000; |
@@ -745,7 +752,8 @@ class VideoAnalyzer : public PacketReceiver, |
rtc::Event done_; |
}; |
-VideoQualityTest::VideoQualityTest() : clock_(Clock::GetRealTimeClock()) {} |
+VideoQualityTest::VideoQualityTest() |
+ : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {} |
void VideoQualityTest::TestBody() {} |
@@ -1132,6 +1140,8 @@ void VideoQualityTest::RunWithAnalyzer(const Params& params) { |
CreateCapturer(&analyzer); |
+ StartEncodedFrameLogs(video_send_stream_); |
+ StartEncodedFrameLogs(video_receive_streams_[0]); |
video_send_stream_->Start(); |
for (VideoReceiveStream* receive_stream : video_receive_streams_) |
receive_stream->Start(); |
@@ -1254,12 +1264,15 @@ void VideoQualityTest::RunWithRenderers(const Params& params) { |
if (params_.audio_video_sync) |
audio_config.sync_group = kSyncGroup; |
- audio_receive_stream =call->CreateAudioReceiveStream(audio_config); |
+ audio_receive_stream = call->CreateAudioReceiveStream(audio_config); |
const CodecInst kOpusInst = {120, "OPUS", 48000, 960, 2, 64000}; |
EXPECT_EQ(0, voe.codec->SetSendCodec(voe.send_channel_id, kOpusInst)); |
} |
+ StartEncodedFrameLogs(video_receive_stream); |
+ StartEncodedFrameLogs(video_send_stream_); |
+ |
// Start sending and receiving video. |
video_receive_stream->Start(); |
video_send_stream_->Start(); |
@@ -1307,4 +1320,36 @@ void VideoQualityTest::RunWithRenderers(const Params& params) { |
DestroyVoiceEngine(&voe); |
} |
+rtc::PlatformFile CreateFile(const std::string& path) { |
+#if defined(WEBRTC_WIN) |
+ return ::CreateFile(rtc::ToUtf16(path).c_str(), GENERIC_READ | GENERIC_WRITE, |
+ 0, nullptr, OPEN_ALWAYS, 0, nullptr); |
+#else |
+ return ::open(path.c_str(), O_CREAT | O_TRUNC | O_RDWR, S_IRUSR | S_IWUSR); |
+#endif |
stefan-webrtc
2016/09/13 10:53:17
Break out to platform independent function or clas
palmkvist
2016/09/13 11:59:37
Also intended to be put in base, but in a separate
|
+} |
+ |
+void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) { |
+ if (!params_.common.encoded_frame_base_path.empty()) { |
+ std::ostringstream str; |
+ str << send_logs_++; |
+ std::string prefix = |
+ params_.common.encoded_frame_base_path + "." + str.str() + ".send."; |
+ stream->EnableEncodedFrameRecording( |
+ std::vector<rtc::PlatformFile>({CreateFile(prefix + "1.ivf"), |
+ CreateFile(prefix + "2.ivf"), |
+ CreateFile(prefix + "3.ivf")}), |
+ 10000000); |
+ } |
+} |
+void VideoQualityTest::StartEncodedFrameLogs(VideoReceiveStream* stream) { |
+ if (!params_.common.encoded_frame_base_path.empty()) { |
+ std::ostringstream str; |
+ str << receive_logs_++; |
+ std::string path = |
+ params_.common.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
+ stream->EnableEncodedFrameRecording(CreateFile(path), 10000000); |
+ } |
+} |
+ |
} // namespace webrtc |