From a4b58860b72f8301851b84c84dfc43671360374a Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Thu, 17 Jan 2013 09:27:17 +0000 Subject: [PATCH] Add a counter to the video rtp play output filename. Review URL: https://webrtc-codereview.appspot.com/1040004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3379 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../video_coding/main/test/receiver_tests.h | 11 +++-- .../video_coding/main/test/video_rtp_play.cc | 41 ++++++++++--------- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/webrtc/modules/video_coding/main/test/receiver_tests.h b/webrtc/modules/video_coding/main/test/receiver_tests.h index a07aca362..7ecc28dcb 100644 --- a/webrtc/modules/video_coding/main/test/receiver_tests.h +++ b/webrtc/modules/video_coding/main/test/receiver_tests.h @@ -43,7 +43,8 @@ public: _outFile(NULL), _timingFile(NULL), width_(0), - height_(0) {} + height_(0), + count_(0) {} virtual ~FrameReceiveCallback(); @@ -52,14 +53,16 @@ public: private: static void SplitFilename(std::string filename, std::string* basename, std::string* ending); - static std::string AppendWidthAndHeight(std::string basename, - unsigned int width, - unsigned int height); + static std::string AppendWidthHeightAndCount(std::string basename, + unsigned int width, + unsigned int height, + int count); std::string _outFilename; FILE* _outFile; FILE* _timingFile; unsigned int width_; unsigned int height_; + int count_; }; class SharedState diff --git a/webrtc/modules/video_coding/main/test/video_rtp_play.cc b/webrtc/modules/video_coding/main/test/video_rtp_play.cc index 8a45f392a..49b7f73c2 100644 --- a/webrtc/modules/video_coding/main/test/video_rtp_play.cc +++ b/webrtc/modules/video_coding/main/test/video_rtp_play.cc @@ -67,8 +67,9 @@ FrameReceiveCallback::FrameToRender(I420VideoFrame& videoFrame) printf("New size: %ux%u\n", videoFrame.width(), videoFrame.height()); width_ = videoFrame.width(); height_ = videoFrame.height(); - std::string filename_with_width_height = AppendWidthAndHeight( - _outFilename, width_, height_); + std::string filename_with_width_height = AppendWidthHeightAndCount( + _outFilename, width_, height_, count_); + ++count_; _outFile = fopen(filename_with_width_height.c_str(), "wb"); if (_outFile == NULL) { @@ -98,13 +99,14 @@ void FrameReceiveCallback::SplitFilename(std::string filename, *ending = ""; } } -std::string FrameReceiveCallback::AppendWidthAndHeight( - std::string filename, unsigned int width, unsigned int height) { +std::string FrameReceiveCallback::AppendWidthHeightAndCount( + std::string filename, unsigned int width, unsigned int height, int count) { std::string basename; std::string ending; SplitFilename(filename, &basename, &ending); std::stringstream ss; - ss << basename << "." << width << "_" << height << "." << ending; + ss << basename << "_" << count << "." << width << "_" << height << "." << + ending; return ss.str(); } @@ -220,21 +222,6 @@ int RtpPlay(CmdArgs& args) clock.IncrementDebugClock(1); } - switch (ret) - { - case 1: - printf("Success\n"); - break; - case -1: - printf("Failed\n"); - break; - case 0: - printf("Timeout\n"); - break; - } - - rtpStream.Print(); - // Tear down while (!payloadTypes.empty()) { @@ -243,6 +230,20 @@ int RtpPlay(CmdArgs& args) } delete vcm; vcm = NULL; + rtpStream.Print(); Trace::ReturnTrace(); + + switch (ret) + { + case 1: + printf("Success\n"); + return 0; + case -1: + printf("Failed\n"); + return -1; + case 0: + printf("Timeout\n"); + return -1; + } return 0; }