Add a keypress field to the audioproc debug proto.

Log the value in AudioProcessing, and unpack it to a new file in the
unpacking tool.

TESTED=
- The new tool can unpack old dumps.
- The old tool can unpack new dumps (without keypress.bool).
- Unpacking a new dump from voe_cmd_test produces a keypress.bool that
appears correct when examined.

R=aluebs@webrtc.org, bjornv@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/8509005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5535 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2014-02-12 15:28:30 +00:00
parent 8118f1861f
commit ce8e077cf0
3 changed files with 17 additions and 0 deletions
webrtc/modules/audio_processing

View File

@ -365,6 +365,7 @@ int AudioProcessingImpl::ProcessStream(AudioFrame* frame) {
msg->set_delay(stream_delay_ms_);
msg->set_drift(echo_cancellation_->stream_drift_samples());
msg->set_level(gain_control_->stream_analog_level());
msg->set_keypress(key_pressed_);
}
#endif

View File

@ -20,6 +20,7 @@ message Stream {
optional int32 delay = 3;
optional sint32 drift = 4;
optional int32 level = 5;
optional bool keypress = 6;
}
message Event {

View File

@ -36,6 +36,7 @@ DEFINE_string(reverse_file, "reverse.pcm",
DEFINE_string(delay_file, "delay.int32", "The name of the delay file.");
DEFINE_string(drift_file, "drift.int32", "The name of the drift file.");
DEFINE_string(level_file, "level.int32", "The name of the level file.");
DEFINE_string(keypress_file, "keypress.bool", "The name of the keypress file.");
DEFINE_string(settings_file, "settings.txt", "The name of the settings file.");
DEFINE_bool(full, false,
"Unpack the full set of files (normally not needed).");
@ -105,6 +106,7 @@ int main(int argc, char* argv[]) {
FILE* delay_file = NULL;
FILE* drift_file = NULL;
FILE* level_file = NULL;
FILE* keypress_file = NULL;
if (FLAGS_full) {
delay_file = fopen(FLAGS_delay_file.c_str(), "wb");
if (delay_file == NULL) {
@ -121,6 +123,11 @@ int main(int argc, char* argv[]) {
printf("Unable to open %s\n", FLAGS_level_file.c_str());
return 1;
}
keypress_file = fopen(FLAGS_keypress_file.c_str(), "wb");
if (keypress_file == NULL) {
printf("Unable to open %s\n", FLAGS_keypress_file.c_str());
return 1;
}
}
Event event_msg;
@ -188,6 +195,14 @@ int main(int argc, char* argv[]) {
return 1;
}
}
if (msg.has_keypress()) {
bool keypress = msg.keypress();
if (fwrite(&keypress, sizeof(bool), 1, keypress_file) != 1) {
printf("Error when writing to %s\n", FLAGS_keypress_file.c_str());
return 1;
}
}
}
} else if (event_msg.type() == Event::INIT) {
if (!event_msg.has_init()) {