Check input file extension is not wav
This is an usual error while using neteq_quality_test. This tool does not support wav files as input. Adding a validation. Bug: webrtc:10690 Change-Id: I18ed308d2f688106728df5df25e0a58c7170f411 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/139104 Commit-Queue: Pablo Barrera González <barrerap@webrtc.org> Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#28141}
This commit is contained in:
committed by
Commit Bot
parent
102b7289a9
commit
4e34c18c4b
@ -38,8 +38,13 @@ const std::string& DefaultOutFilename() {
|
||||
}
|
||||
|
||||
// Common validator for file names.
|
||||
static bool ValidateFilename(const std::string& value, bool write) {
|
||||
FILE* fid = write ? fopen(value.c_str(), "wb") : fopen(value.c_str(), "rb");
|
||||
static bool ValidateFilename(const std::string& value, bool is_output) {
|
||||
if (!is_output) {
|
||||
RTC_CHECK_NE(value.substr(value.find_last_of(".") + 1), "wav")
|
||||
<< "WAV file input is not supported";
|
||||
}
|
||||
FILE* fid =
|
||||
is_output ? fopen(value.c_str(), "wb") : fopen(value.c_str(), "rb");
|
||||
if (fid == nullptr)
|
||||
return false;
|
||||
fclose(fid);
|
||||
|
||||
Reference in New Issue
Block a user