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

Unified Diff: webrtc/video/video_quality_test.cc

Issue 2990563002: Add Jpeg frame writer for test support. (Closed)
Patch Set: Fix memory issues Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_quality_test.cc
diff --git a/webrtc/video/video_quality_test.cc b/webrtc/video/video_quality_test.cc
index aa5ff7121d9359e378cace1941a080e480a6a2d1..cde4b91ffc303d25e1a89a0e745b408e99fc2559 100644
--- a/webrtc/video/video_quality_test.cc
+++ b/webrtc/video/video_quality_test.cc
@@ -36,6 +36,7 @@
#include "webrtc/rtc_base/format_macros.h"
#include "webrtc/rtc_base/memory_usage.h"
#include "webrtc/rtc_base/optional.h"
+#include "webrtc/rtc_base/pathutils.h"
#include "webrtc/rtc_base/platform_file.h"
#include "webrtc/rtc_base/timeutils.h"
#include "webrtc/system_wrappers/include/cpu_info.h"
@@ -46,6 +47,7 @@
#include "webrtc/test/statistics.h"
#include "webrtc/test/testsupport/fileutils.h"
#include "webrtc/test/testsupport/frame_writer.h"
+#include "webrtc/test/testsupport/test_output.h"
#include "webrtc/test/vcm_capturer.h"
#include "webrtc/test/video_renderer.h"
#include "webrtc/voice_engine/include/voe_base.h"
@@ -824,27 +826,21 @@ class VideoAnalyzer : public PacketReceiver,
// will be flaky.
PrintResult("memory_usage", memory_usage_, " bytes");
#endif
- // TODO(ilnik): enable frame writing for android, once jpeg frame writer
pbos-webrtc 2017/07/25 18:10:28 Shouldn't this be lossless to actually show what i
ilnik 2017/07/25 19:05:54 Space is probably the most concern here, as these
- // is implemented.
-#if !defined(WEBRTC_ANDROID)
+ // LibJpeg is not available on iOS.
+#if !defined(WEBRTC_IOS)
if (worst_frame_) {
- test::Y4mFrameWriterImpl frame_writer(test_label_ + ".y4m",
- worst_frame_->frame.width(),
- worst_frame_->frame.height(), 1);
- bool res = frame_writer.Init();
- RTC_DCHECK(res);
- size_t length =
- CalcBufferSize(VideoType::kI420, worst_frame_->frame.width(),
- worst_frame_->frame.height());
- rtc::Buffer extracted_buffer(length);
- size_t extracted_length =
- ExtractBuffer(worst_frame_->frame.video_frame_buffer()->ToI420(),
- length, extracted_buffer.data());
- RTC_DCHECK_EQ(extracted_length, frame_writer.FrameLength());
- res = frame_writer.WriteFrame(extracted_buffer.data());
+ std::string output_dir;
+ bool res = test::GetTestOutputDir(&output_dir);
+ if (!res) {
+ output_dir = "";
+ }
+ std::string output_path =
+ rtc::Pathname(output_dir, test_label_ + ".jpg").pathname();
+ fprintf(stderr, "Saving worst frame to %s\n", output_path.c_str());
+ test::JpegFrameWriter frame_writer(output_path);
+ res = frame_writer.WriteFrame(worst_frame_->frame, 90 /*quality*/);
pbos-webrtc 2017/07/25 18:10:28 90 is definitely nowhere near lossless? Are sizes
ilnik 2017/07/25 19:05:54 We are saving one for each of ~30 testcases each r
RTC_DCHECK(res);
- frame_writer.Close();
}
#endif
« no previous file with comments | « webrtc/video/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698