Yabin Li
2023-05-08 8a08405b668e06c4670b4c13f6793e193f21a21d
funasr/runtime/onnxruntime/src/audio.cpp
@@ -247,6 +247,15 @@
        return false;
    }
    
    if (!header.Validate()) {
        return false;
    }
    header.SeekToDataChunk(is);
    if (!is) {
        return false;
    }
    *sampling_rate = header.sample_rate;
    // header.subchunk2_size contains the number of bytes in the data.
    // As we assume each sample contains two bytes, so it is divided by 2 here
@@ -389,8 +398,10 @@
    FILE* fp;
    fp = fopen(filename, "rb");
    if (fp == nullptr)
   {
        LOG(ERROR) << "Failed to read " << filename;
        return false;
   }
    fseek(fp, 0, SEEK_END);
    uint32_t n_file_len = ftell(fp);
    fseek(fp, 0, SEEK_SET);