Extend WavReader and WavWriter API.

Add ability to read and write wav files using rtc::PlatformFile instead
of file name.

Bug: webrtc:8946
Change-Id: If18d9465f2155a33547f800edbdac45971a0e878
Reviewed-on: https://webrtc-review.googlesource.com/61424
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22497}
This commit is contained in:
Artem Titov
2018-03-19 15:40:00 +01:00
committed by Commit Bot
parent 451dfdf6db
commit e62f600c42
11 changed files with 249 additions and 16 deletions

View File

@ -127,6 +127,19 @@ TEST_F(FileUtilsTest, TempFilename) {
remove(temp_filename.c_str());
}
TEST_F(FileUtilsTest, GenerateTempFilename) {
std::string temp_filename = webrtc::test::GenerateTempFilename(
webrtc::test::OutputPath(), "TempFilenameTest");
ASSERT_FALSE(webrtc::test::FileExists(temp_filename))
<< "File exists: " << temp_filename;
FILE* file = fopen(temp_filename.c_str(), "wb");
ASSERT_TRUE(file != NULL) << "Failed to open file: " << temp_filename;
ASSERT_GT(fprintf(file, "%s", "Dummy data"), 0)
<< "Failed to write to file: " << temp_filename;
fclose(file);
remove(temp_filename.c_str());
}
// Only tests that the code executes
#if defined(WEBRTC_IOS)
#define MAYBE_CreateDir DISABLED_CreateDir