Skip to content

Commit c8da6be

Browse files
committed
Use stringstream
1 parent f2e1b0d commit c8da6be

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/torchcodec/_core/Encoder.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <sstream>
2+
13
#include "src/torchcodec/_core/Encoder.h"
24
#include "torch/types.h"
35

@@ -15,20 +17,20 @@ void validateSampleRate(const AVCodec& avCodec, int sampleRate) {
1517
return;
1618
}
1719
}
18-
std::string supportedRates;
20+
std::stringstream supportedRates;
1921
for (auto i = 0; avCodec.supported_samplerates[i] != 0; ++i) {
2022
if (i > 0) {
21-
supportedRates += ", ";
23+
supportedRates << ", ";
2224
}
23-
supportedRates += std::to_string(avCodec.supported_samplerates[i]);
25+
supportedRates << avCodec.supported_samplerates[i];
2426
}
2527

2628
TORCH_CHECK(
2729
false,
2830
"invalid sample rate=",
2931
sampleRate,
3032
". Supported sample rate values are: ",
31-
supportedRates);
33+
supportedRates.str());
3234
}
3335

3436
} // namespace

0 commit comments

Comments
 (0)