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
This commit is contained in:
parent
ebc6d8f172
commit
a4b58860b7
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user