Internal change

PiperOrigin-RevId: 523339435
This commit is contained in:
MediaPipe Team 2023-04-11 02:09:03 -07:00 committed by Copybara-Service
parent b8ebbbea0b
commit de7560c825
2 changed files with 4 additions and 4 deletions

View File

@ -149,7 +149,7 @@ absl::StatusOr<std::vector<AudioClassifierResult>> AudioClassifier::Classify(
absl::Status AudioClassifier::ClassifyAsync(Matrix audio_block, absl::Status AudioClassifier::ClassifyAsync(Matrix audio_block,
double audio_sample_rate, double audio_sample_rate,
int64 timestamp_ms) { int64_t timestamp_ms) {
MP_RETURN_IF_ERROR(CheckOrSetSampleRate(kSampleRateName, audio_sample_rate)); MP_RETURN_IF_ERROR(CheckOrSetSampleRate(kSampleRateName, audio_sample_rate));
return SendAudioStreamData( return SendAudioStreamData(
{{kAudioStreamName, {{kAudioStreamName,

View File

@ -77,7 +77,7 @@ void CheckSpeechResult(const std::vector<AudioClassifierResult>& result,
EXPECT_EQ(result.size(), 5); EXPECT_EQ(result.size(), 5);
// Ignore last result, which operates on a too small chunk to return relevant // Ignore last result, which operates on a too small chunk to return relevant
// results. // results.
std::vector<int64> timestamps_ms = {0, 975, 1950, 2925}; std::vector<int64_t> timestamps_ms = {0, 975, 1950, 2925};
for (int i = 0; i < timestamps_ms.size(); i++) { for (int i = 0; i < timestamps_ms.size(); i++) {
EXPECT_EQ(result[i].timestamp_ms, timestamps_ms[i]); EXPECT_EQ(result[i].timestamp_ms, timestamps_ms[i]);
EXPECT_EQ(result[i].classifications.size(), 1); EXPECT_EQ(result[i].classifications.size(), 1);
@ -143,7 +143,7 @@ void CheckStreamingModeResults(std::vector<AudioClassifierResult> outputs) {
EXPECT_EQ(outputs.size(), 5); EXPECT_EQ(outputs.size(), 5);
// Ignore last result, which operates on a too small chunk to return relevant // Ignore last result, which operates on a too small chunk to return relevant
// results. // results.
std::vector<int64> timestamps_ms = {0, 975, 1950, 2925}; std::vector<int64_t> timestamps_ms = {0, 975, 1950, 2925};
for (int i = 0; i < outputs.size() - 1; i++) { for (int i = 0; i < outputs.size() - 1; i++) {
EXPECT_EQ(outputs[i].timestamp_ms.value(), timestamps_ms[i]); EXPECT_EQ(outputs[i].timestamp_ms.value(), timestamps_ms[i]);
EXPECT_EQ(outputs[i].classifications.size(), 1); EXPECT_EQ(outputs[i].classifications.size(), 1);
@ -456,7 +456,7 @@ TEST_F(ClassifyTest, SucceedsWithCategoryDenylist) {
/*audio_sample_rate=*/48000)); /*audio_sample_rate=*/48000));
MP_ASSERT_OK(audio_classifier->Close()); MP_ASSERT_OK(audio_classifier->Close());
// All categories with the "Speech" label are filtered out. // All categories with the "Speech" label are filtered out.
std::vector<int64> timestamps_ms = {0, 975, 1950, 2925}; std::vector<int64_t> timestamps_ms = {0, 975, 1950, 2925};
for (int i = 0; i < timestamps_ms.size(); i++) { for (int i = 0; i < timestamps_ms.size(); i++) {
EXPECT_EQ(result[i].timestamp_ms, timestamps_ms[i]); EXPECT_EQ(result[i].timestamp_ms, timestamps_ms[i]);
EXPECT_EQ(result[i].classifications.size(), 1); EXPECT_EQ(result[i].classifications.size(), 1);