Skip to content

Commit f16322b

Browse files
authored
Specify tls cert file to decoder through config (#3289)
Summary: Upgrading service to platform009 enforces tls1.3 authentication. Specify tls cert file to decoder through config. Context: https://fb.workplace.com/groups/2020511478062223 Differential Revision: D26026259 fbshipit-source-id: e89f88ff7e41ec6b6a62e85d9015d78f6377aa65
1 parent 1ebda73 commit f16322b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

torchvision/csrc/io/decoder/decoder.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,12 @@ bool Decoder::init(
316316
av_dict_set_int(&options, "analyzeduration", params_.timeoutMs * 1000, 0);
317317
av_dict_set_int(&options, "stimeout", params_.timeoutMs * 1000, 0);
318318
av_dict_set_int(&options, "rw_timeout", params_.timeoutMs * 1000, 0);
319+
if (!params_.tlsCertFile.empty()) {
320+
av_dict_set(&options, "cert_file", params_.tlsCertFile.data(), 0);
321+
}
322+
if (!params_.tlsKeyFile.empty()) {
323+
av_dict_set(&options, "key_file", params_.tlsCertFile.data(), 0);
324+
}
319325
}
320326

321327
interrupted_ = false;

torchvision/csrc/io/decoder/defs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ struct DecoderParameters {
202202
size_t cacheTimeoutMs{1000}; // timeout on bytes writing
203203
bool enforceCacheSize{false}; // drop output frames if cache is full
204204
bool mergeAudioMessages{false}; // combine collocated audio messages together
205+
206+
std::string tlsCertFile;
207+
std::string tlsKeyFile;
205208
};
206209

207210
struct DecoderHeader {

0 commit comments

Comments
 (0)