File tree Expand file tree Collapse file tree 2 files changed +3
-23
lines changed
Expand file tree Collapse file tree 2 files changed +3
-23
lines changed Original file line number Diff line number Diff line change @@ -555,18 +555,10 @@ TensorFormat analyzeTensorFormat(const torch::Tensor& frames) {
555555} // namespace
556556
557557VideoEncoder::~VideoEncoder () {
558- close_avio ();
559- }
560-
561- void VideoEncoder::close_avio () {
562558 if (avFormatContext_ && avFormatContext_->pb ) {
563559 avio_flush (avFormatContext_->pb );
564-
565- if (!avioContextHolder_) {
566- avio_close (avFormatContext_->pb );
567- // avoids closing again in destructor, which would segfault.
568- avFormatContext_->pb = nullptr ;
569- }
560+ avio_close (avFormatContext_->pb );
561+ avFormatContext_->pb = nullptr ;
570562 }
571563}
572564
@@ -779,7 +771,7 @@ void VideoEncoder::encode() {
779771 " Error in av_write_trailer: " ,
780772 getFFMPEGErrorStringFromErrorCode (status));
781773
782- close_avio ();
774+ // close_avio();
783775}
784776
785777void VideoEncoder::encodeFrame (
Original file line number Diff line number Diff line change @@ -68,17 +68,8 @@ class VideoEncoder {
6868 std::string_view fileName,
6969 const VideoStreamOptions& videoStreamOptions);
7070
71- VideoEncoder (
72- const torch::Tensor& frames,
73- int frameRate,
74- std::string_view formatName,
75- std::unique_ptr<AVIOContextHolder> avioContextHolder,
76- const VideoStreamOptions& videoStreamOptions);
77-
7871 void encode ();
7972
80- torch::Tensor encodeToTensor ();
81-
8273 private:
8374 void initializeEncoder (const VideoStreamOptions& videoStreamOptions);
8475 UniqueAVFrame convertTensorToAVFrame (
@@ -105,10 +96,7 @@ class VideoEncoder {
10596 int outHeight_ = -1 ;
10697 AVPixelFormat outPixelFormat_ = AV_PIX_FMT_NONE;
10798
108- std::unique_ptr<AVIOContextHolder> avioContextHolder_;
109-
11099 bool encodeWasCalled_ = false ;
111- int64_t lastEncodedAVFramePts_ = 0 ;
112100};
113101} // namespace facebook::torchcodec
114102
You can’t perform that action at this time.
0 commit comments