Skip to content

Commit de350bc

Browse files
YosuaMichaelChen Liu
andauthored
Set pytorch vision decoder probesize for getting stream info based on the value from decode setting (#6900) (#6950)
Summary: Pull Request resolved: #6900 1. Pass along the value of probesize from decode setting. 2. allow pytorch vision decoder to set the probesize for getting stream info Reviewed By: jdsgomes Differential Revision: D40967782 fbshipit-source-id: 642ae3b67c50b1fdafc20f9814a52fdf5db527d7 Co-authored-by: Chen Liu <cliu7@meta.com>
1 parent c595886 commit de350bc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

torchvision/csrc/io/decoder/decoder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ bool Decoder::init(
312312
}
313313
}
314314

315+
av_dict_set_int(&options, "probesize", params_.probeSize, 0);
316+
315317
interrupted_ = false;
316318

317319
// ffmpeg avformat_open_input call can hang if media source doesn't respond

torchvision/csrc/io/decoder/defs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ struct DecoderParameters {
213213

214214
// Skip packets that fail with EPERM errors and continue decoding.
215215
bool skipOperationNotPermittedPackets{false};
216+
217+
// probing size in bytes, i.e. the size of the data to analyze to get stream
218+
// information. A higher value will enable detecting more information in case
219+
// it is dispersed into the stream, but will increase latency. Must be an
220+
// integer not lesser than 32. It is 5000000 by default.
221+
int64_t probeSize{5000000};
216222
};
217223

218224
struct DecoderHeader {

0 commit comments

Comments
 (0)