File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ namespace facebook::torchcodec {
88
99namespace {
1010
11- torch::Tensor validateSamples (torch::Tensor samples) {
11+ torch::Tensor validateSamples (const torch::Tensor& samples) {
1212 TORCH_CHECK (
1313 samples.dtype () == torch::kFloat32 ,
1414 " samples must have float32 dtype, got " ,
@@ -101,7 +101,7 @@ AVSampleFormat findBestOutputSampleFormat(const AVCodec& avCodec) {
101101AudioEncoder::~AudioEncoder () {}
102102
103103AudioEncoder::AudioEncoder (
104- const torch::Tensor samples,
104+ const torch::Tensor& samples,
105105 int sampleRate,
106106 std::string_view fileName,
107107 const AudioStreamOptions& audioStreamOptions)
@@ -132,7 +132,7 @@ AudioEncoder::AudioEncoder(
132132}
133133
134134AudioEncoder::AudioEncoder (
135- const torch::Tensor samples,
135+ const torch::Tensor& samples,
136136 int sampleRate,
137137 std::string_view formatName,
138138 std::unique_ptr<AVIOToTensorContext> avioContextHolder,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class AudioEncoder {
1515 // Passing 44_100 could result in output being 44000 if only 44000 is
1616 // supported.
1717 AudioEncoder (
18- const torch::Tensor samples,
18+ const torch::Tensor& samples,
1919 // TODO-ENCODING: update this comment when we support an output sample
2020 // rate. This will become the input sample rate.
2121 // The *output* sample rate. We can't really decide for the user what it
@@ -26,7 +26,7 @@ class AudioEncoder {
2626 std::string_view fileName,
2727 const AudioStreamOptions& audioStreamOptions);
2828 AudioEncoder (
29- const torch::Tensor samples,
29+ const torch::Tensor& samples,
3030 int sampleRate,
3131 std::string_view formatName,
3232 std::unique_ptr<AVIOToTensorContext> avioContextHolder,
Original file line number Diff line number Diff line change @@ -388,7 +388,7 @@ OpsAudioFramesOutput get_frames_by_pts_in_range_audio(
388388}
389389
390390void encode_audio_to_file (
391- const at::Tensor samples,
391+ const at::Tensor& samples,
392392 int64_t sample_rate,
393393 std::string_view file_name,
394394 std::optional<int64_t > bit_rate = std::nullopt ,
@@ -404,7 +404,7 @@ void encode_audio_to_file(
404404}
405405
406406at::Tensor encode_audio_to_tensor (
407- const at::Tensor samples,
407+ const at::Tensor& samples,
408408 int64_t sample_rate,
409409 std::string_view format,
410410 std::optional<int64_t > bit_rate = std::nullopt ,
You can’t perform that action at this time.
0 commit comments