Skip to content

Commit 2a128da

Browse files
authored
Merge branch 'main' into fix-docstring-fill-param
2 parents 9ae3db8 + 7a13ad0 commit 2a128da

File tree

3 files changed

+33
-29
lines changed

3 files changed

+33
-29
lines changed

.github/workflows/build-cmake.yml

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,30 +58,30 @@ jobs:
5858
5959
${CONDA_RUN} ./.github/scripts/cmake.sh
6060
61-
windows:
62-
strategy:
63-
matrix:
64-
include:
65-
- runner: windows.4xlarge
66-
gpu-arch-type: cpu
67-
- runner: windows.g5.4xlarge.nvidia.gpu
68-
gpu-arch-type: cuda
69-
gpu-arch-version: "12.6"
70-
fail-fast: false
71-
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
72-
with:
73-
repository: pytorch/vision
74-
runner: ${{ matrix.runner }}
75-
gpu-arch-type: ${{ matrix.gpu-arch-type }}
76-
gpu-arch-version: ${{ matrix.gpu-arch-version }}
77-
test-infra-ref: main
78-
script: |
79-
set -euo pipefail
61+
# windows:
62+
# strategy:
63+
# matrix:
64+
# include:
65+
# - runner: windows.4xlarge
66+
# gpu-arch-type: cpu
67+
# - runner: windows.g5.4xlarge.nvidia.gpu
68+
# gpu-arch-type: cuda
69+
# gpu-arch-version: "12.6"
70+
# fail-fast: false
71+
# uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
72+
# with:
73+
# repository: pytorch/vision
74+
# runner: ${{ matrix.runner }}
75+
# gpu-arch-type: ${{ matrix.gpu-arch-type }}
76+
# gpu-arch-version: ${{ matrix.gpu-arch-version }}
77+
# test-infra-ref: main
78+
# script: |
79+
# set -euo pipefail
8080

81-
export PYTHON_VERSION=3.9
82-
export VC_YEAR=2022
83-
export VSDEVCMD_ARGS=""
84-
export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
85-
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
81+
# export PYTHON_VERSION=3.9
82+
# export VC_YEAR=2022
83+
# export VSDEVCMD_ARGS=""
84+
# export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }}
85+
# export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }}
8686

87-
./.github/scripts/cmake.sh
87+
# ./.github/scripts/cmake.sh

torchvision/csrc/io/decoder/audio_sampler.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ bool AudioSampler::init(const SamplerParameters& params) {
4949
}
5050

5151
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 28, 100)
52-
SwrContext* swrContext_ = NULL;
5352
AVChannelLayout channel_out;
5453
AVChannelLayout channel_in;
5554
av_channel_layout_default(&channel_out, params.out.audio.channels);
5655
av_channel_layout_default(&channel_in, params.in.audio.channels);
57-
swr_alloc_set_opts2(
56+
int ret = swr_alloc_set_opts2(
5857
&swrContext_,
5958
&channel_out,
6059
(AVSampleFormat)params.out.audio.format,
@@ -64,6 +63,10 @@ bool AudioSampler::init(const SamplerParameters& params) {
6463
params.in.audio.samples,
6564
0,
6665
logCtx_);
66+
if (ret < 0 || swrContext_ == nullptr) {
67+
LOG(ERROR) << "Cannot allocate SwrContext";
68+
return false;
69+
}
6770
#else
6871
swrContext_ = swr_alloc_set_opts(
6972
nullptr,
@@ -75,11 +78,11 @@ bool AudioSampler::init(const SamplerParameters& params) {
7578
params.in.audio.samples,
7679
0,
7780
logCtx_);
78-
#endif
7981
if (swrContext_ == nullptr) {
8082
LOG(ERROR) << "Cannot allocate SwrContext";
8183
return false;
8284
}
85+
#endif
8386

8487
int result;
8588
if ((result = swr_init(swrContext_)) < 0) {

torchvision/csrc/io/decoder/decoder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ int Decoder::readFunction(void* opaque, uint8_t* buf, int size) {
154154
if (decoder == nullptr) {
155155
return 0;
156156
}
157-
return decoder->readCallback(buf, size);
157+
int bytesRead = decoder->readCallback(buf, size);
158+
return bytesRead == 0 ? AVERROR_EOF : bytesRead;
158159
}
159160

160161
/* static */

0 commit comments

Comments
 (0)