Avoids creating empty call_order file when no call order data is written
This CL avoids that unpack_aecdump produces an empty callorder.char file regardless of it not writing any data to that file Bug: webrtc:5298 Change-Id: I15b01764a0dc16045346dd680e9bd4c1869c0d2c Reviewed-on: https://webrtc-review.googlesource.com/c/98340 Reviewed-by: Oleh Prypin <oprypin@webrtc.org> Reviewed-by: Sam Zackrisson <saza@webrtc.org> Commit-Queue: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25214}
This commit is contained in:
@ -87,6 +87,10 @@ void WriteCallOrderData(const bool render_call,
|
|||||||
WriteData(&call_type, sizeof(call_type), file, filename.c_str());
|
WriteData(&call_type, sizeof(call_type), file, filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WritingCallOrderFile() {
|
||||||
|
return FLAG_full;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
int do_main(int argc, char* argv[]) {
|
int do_main(int argc, char* argv[]) {
|
||||||
@ -125,7 +129,9 @@ int do_main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
rtc::StringBuilder callorder_raw_name;
|
rtc::StringBuilder callorder_raw_name;
|
||||||
callorder_raw_name << FLAG_callorder_file << ".char";
|
callorder_raw_name << FLAG_callorder_file << ".char";
|
||||||
FILE* callorder_char_file = OpenFile(callorder_raw_name.str(), "wb");
|
FILE* callorder_char_file = WritingCallOrderFile()
|
||||||
|
? OpenFile(callorder_raw_name.str(), "wb")
|
||||||
|
: nullptr;
|
||||||
FILE* settings_file = OpenFile(FLAG_settings_file, "wb");
|
FILE* settings_file = OpenFile(FLAG_settings_file, "wb");
|
||||||
|
|
||||||
while (ReadMessageFromFile(debug_file, &event_msg)) {
|
while (ReadMessageFromFile(debug_file, &event_msg)) {
|
||||||
@ -163,9 +169,11 @@ int do_main(int argc, char* argv[]) {
|
|||||||
reverse_raw_file.get());
|
reverse_raw_file.get());
|
||||||
}
|
}
|
||||||
if (FLAG_full) {
|
if (FLAG_full) {
|
||||||
|
if (WritingCallOrderFile()) {
|
||||||
WriteCallOrderData(true /* render_call */, callorder_char_file,
|
WriteCallOrderData(true /* render_call */, callorder_char_file,
|
||||||
FLAG_callorder_file);
|
FLAG_callorder_file);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (event_msg.type() == Event::STREAM) {
|
} else if (event_msg.type() == Event::STREAM) {
|
||||||
frame_count++;
|
frame_count++;
|
||||||
if (!event_msg.has_stream()) {
|
if (!event_msg.has_stream()) {
|
||||||
@ -222,8 +230,10 @@ int do_main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (FLAG_full) {
|
if (FLAG_full) {
|
||||||
|
if (WritingCallOrderFile()) {
|
||||||
WriteCallOrderData(false /* render_call */, callorder_char_file,
|
WriteCallOrderData(false /* render_call */, callorder_char_file,
|
||||||
FLAG_callorder_file);
|
FLAG_callorder_file);
|
||||||
|
}
|
||||||
if (msg.has_delay()) {
|
if (msg.has_delay()) {
|
||||||
static FILE* delay_file = OpenFile(FLAG_delay_file, "wb");
|
static FILE* delay_file = OpenFile(FLAG_delay_file, "wb");
|
||||||
int32_t delay = msg.delay();
|
int32_t delay = msg.delay();
|
||||||
@ -359,12 +369,14 @@ int do_main(int argc, char* argv[]) {
|
|||||||
output_wav_file.reset(new WavWriter(
|
output_wav_file.reset(new WavWriter(
|
||||||
output_name.str(), output_sample_rate, num_output_channels));
|
output_name.str(), output_sample_rate, num_output_channels));
|
||||||
|
|
||||||
|
if (WritingCallOrderFile()) {
|
||||||
rtc::StringBuilder callorder_name;
|
rtc::StringBuilder callorder_name;
|
||||||
callorder_name << FLAG_callorder_file << frame_count << ".char";
|
callorder_name << FLAG_callorder_file << frame_count << ".char";
|
||||||
callorder_char_file = OpenFile(callorder_name.str(), "wb");
|
callorder_char_file = OpenFile(callorder_name.str(), "wb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user