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),
|
_outFile(NULL),
|
||||||
_timingFile(NULL),
|
_timingFile(NULL),
|
||||||
width_(0),
|
width_(0),
|
||||||
height_(0) {}
|
height_(0),
|
||||||
|
count_(0) {}
|
||||||
|
|
||||||
virtual ~FrameReceiveCallback();
|
virtual ~FrameReceiveCallback();
|
||||||
|
|
||||||
@ -52,14 +53,16 @@ public:
|
|||||||
private:
|
private:
|
||||||
static void SplitFilename(std::string filename, std::string* basename,
|
static void SplitFilename(std::string filename, std::string* basename,
|
||||||
std::string* ending);
|
std::string* ending);
|
||||||
static std::string AppendWidthAndHeight(std::string basename,
|
static std::string AppendWidthHeightAndCount(std::string basename,
|
||||||
unsigned int width,
|
unsigned int width,
|
||||||
unsigned int height);
|
unsigned int height,
|
||||||
|
int count);
|
||||||
std::string _outFilename;
|
std::string _outFilename;
|
||||||
FILE* _outFile;
|
FILE* _outFile;
|
||||||
FILE* _timingFile;
|
FILE* _timingFile;
|
||||||
unsigned int width_;
|
unsigned int width_;
|
||||||
unsigned int height_;
|
unsigned int height_;
|
||||||
|
int count_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SharedState
|
class SharedState
|
||||||
|
@ -67,8 +67,9 @@ FrameReceiveCallback::FrameToRender(I420VideoFrame& videoFrame)
|
|||||||
printf("New size: %ux%u\n", videoFrame.width(), videoFrame.height());
|
printf("New size: %ux%u\n", videoFrame.width(), videoFrame.height());
|
||||||
width_ = videoFrame.width();
|
width_ = videoFrame.width();
|
||||||
height_ = videoFrame.height();
|
height_ = videoFrame.height();
|
||||||
std::string filename_with_width_height = AppendWidthAndHeight(
|
std::string filename_with_width_height = AppendWidthHeightAndCount(
|
||||||
_outFilename, width_, height_);
|
_outFilename, width_, height_, count_);
|
||||||
|
++count_;
|
||||||
_outFile = fopen(filename_with_width_height.c_str(), "wb");
|
_outFile = fopen(filename_with_width_height.c_str(), "wb");
|
||||||
if (_outFile == NULL)
|
if (_outFile == NULL)
|
||||||
{
|
{
|
||||||
@ -98,13 +99,14 @@ void FrameReceiveCallback::SplitFilename(std::string filename,
|
|||||||
*ending = "";
|
*ending = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string FrameReceiveCallback::AppendWidthAndHeight(
|
std::string FrameReceiveCallback::AppendWidthHeightAndCount(
|
||||||
std::string filename, unsigned int width, unsigned int height) {
|
std::string filename, unsigned int width, unsigned int height, int count) {
|
||||||
std::string basename;
|
std::string basename;
|
||||||
std::string ending;
|
std::string ending;
|
||||||
SplitFilename(filename, &basename, &ending);
|
SplitFilename(filename, &basename, &ending);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << basename << "." << width << "_" << height << "." << ending;
|
ss << basename << "_" << count << "." << width << "_" << height << "." <<
|
||||||
|
ending;
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,21 +222,6 @@ int RtpPlay(CmdArgs& args)
|
|||||||
clock.IncrementDebugClock(1);
|
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
|
// Tear down
|
||||||
while (!payloadTypes.empty())
|
while (!payloadTypes.empty())
|
||||||
{
|
{
|
||||||
@ -243,6 +230,20 @@ int RtpPlay(CmdArgs& args)
|
|||||||
}
|
}
|
||||||
delete vcm;
|
delete vcm;
|
||||||
vcm = NULL;
|
vcm = NULL;
|
||||||
|
rtpStream.Print();
|
||||||
Trace::ReturnTrace();
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user