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 {
8
8
9
9
namespace {
10
10
11
- torch::Tensor validateSamples (torch::Tensor samples) {
11
+ torch::Tensor validateSamples (const torch::Tensor& samples) {
12
12
TORCH_CHECK (
13
13
samples.dtype () == torch::kFloat32 ,
14
14
" samples must have float32 dtype, got " ,
@@ -101,7 +101,7 @@ AVSampleFormat findBestOutputSampleFormat(const AVCodec& avCodec) {
101
101
AudioEncoder::~AudioEncoder () {}
102
102
103
103
AudioEncoder::AudioEncoder (
104
- const torch::Tensor samples,
104
+ const torch::Tensor& samples,
105
105
int sampleRate,
106
106
std::string_view fileName,
107
107
const AudioStreamOptions& audioStreamOptions)
@@ -132,7 +132,7 @@ AudioEncoder::AudioEncoder(
132
132
}
133
133
134
134
AudioEncoder::AudioEncoder (
135
- const torch::Tensor samples,
135
+ const torch::Tensor& samples,
136
136
int sampleRate,
137
137
std::string_view formatName,
138
138
std::unique_ptr<AVIOToTensorContext> avioContextHolder,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ class AudioEncoder {
15
15
// Passing 44_100 could result in output being 44000 if only 44000 is
16
16
// supported.
17
17
AudioEncoder (
18
- const torch::Tensor samples,
18
+ const torch::Tensor& samples,
19
19
// TODO-ENCODING: update this comment when we support an output sample
20
20
// rate. This will become the input sample rate.
21
21
// The *output* sample rate. We can't really decide for the user what it
@@ -26,7 +26,7 @@ class AudioEncoder {
26
26
std::string_view fileName,
27
27
const AudioStreamOptions& audioStreamOptions);
28
28
AudioEncoder (
29
- const torch::Tensor samples,
29
+ const torch::Tensor& samples,
30
30
int sampleRate,
31
31
std::string_view formatName,
32
32
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(
388
388
}
389
389
390
390
void encode_audio_to_file (
391
- const at::Tensor samples,
391
+ const at::Tensor& samples,
392
392
int64_t sample_rate,
393
393
std::string_view file_name,
394
394
std::optional<int64_t > bit_rate = std::nullopt,
@@ -404,7 +404,7 @@ void encode_audio_to_file(
404
404
}
405
405
406
406
at::Tensor encode_audio_to_tensor (
407
- const at::Tensor samples,
407
+ const at::Tensor& samples,
408
408
int64_t sample_rate,
409
409
std::string_view format,
410
410
std::optional<int64_t > bit_rate = std::nullopt,
You can’t perform that action at this time.
0 commit comments