Skip to content

Commit

Permalink
[fbsync] Fixed comparison warnings in audio_stream and video_stream (#…
Browse files Browse the repository at this point in the history
…4007)

Summary:
* Fixed comparison warnings in audio_stream and video_stream

* Fixed clang error

Reviewed By: fmassa

Differential Revision: D29097721

fbshipit-source-id: c3c11eab92bfcc7c67a9111a75b4a87041bfc655
  • Loading branch information
NicolasHug authored and facebook-github-bot committed Jun 14, 2021
1 parent 08630d9 commit bf6c5e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions torchvision/csrc/io/decoder/audio_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ namespace ffmpeg {

namespace {
bool operator==(const AudioFormat& x, const AVFrame& y) {
return x.samples == y.sample_rate && x.channels == y.channels &&
x.format == y.format;
return x.samples == static_cast<size_t>(y.sample_rate) &&
x.channels == static_cast<size_t>(y.channels) && x.format == y.format;
}

bool operator==(const AudioFormat& x, const AVCodecContext& y) {
return x.samples == y.sample_rate && x.channels == y.channels &&
x.format == y.sample_fmt;
return x.samples == static_cast<size_t>(y.sample_rate) &&
x.channels == static_cast<size_t>(y.channels) && x.format == y.sample_fmt;
}

AudioFormat& toAudioFormat(AudioFormat& x, const AVFrame& y) {
Expand Down
6 changes: 4 additions & 2 deletions torchvision/csrc/io/decoder/video_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ namespace ffmpeg {

namespace {
bool operator==(const VideoFormat& x, const AVFrame& y) {
return x.width == y.width && x.height == y.height && x.format == y.format;
return x.width == static_cast<size_t>(y.width) &&
x.height == static_cast<size_t>(y.height) && x.format == y.format;
}

bool operator==(const VideoFormat& x, const AVCodecContext& y) {
return x.width == y.width && x.height == y.height && x.format == y.pix_fmt;
return x.width == static_cast<size_t>(y.width) &&
x.height == static_cast<size_t>(y.height) && x.format == y.pix_fmt;
}

VideoFormat& toVideoFormat(VideoFormat& x, const AVFrame& y) {
Expand Down

0 comments on commit bf6c5e9

Please sign in to comment.