Skip to content

Commit

Permalink
[src] Fix rare case when segment end rounding overshoots file end in …
Browse files Browse the repository at this point in the history
…extract-segments (#3331)
  • Loading branch information
alumae authored and danpovey committed May 17, 2019
1 parent c8b93bc commit 528e072
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/featbin/extract-segments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ int main(int argc, char *argv[]) {
// conversion requires a proper rounding.
int32 start_samp = static_cast<int32>(start * samp_freq + 0.5f),
end_samp = static_cast<int32>(end * samp_freq + 0.5f);


if (end_samp > num_samp)
end_samp = num_samp;

// Get the range of data from the orignial wave_data matrix.
SubMatrix<BaseFloat> segment_matrix(wave_data, channel, 1,
start_samp, end_samp - start_samp);
Expand Down

0 comments on commit 528e072

Please sign in to comment.