File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -312,8 +312,10 @@ void BetaCudaDeviceInterface::applyBSF(ReferenceAVPacket& packet) {
312
312
// fields of the filtered packet into the original packet. The filtered packet
313
313
// fields are re-set by av_packet_move_ref, so when it goes out of scope and
314
314
// gets destructed, it's not going to affect the original packet.
315
- av_packet_unref (packet.get ());
316
- av_packet_move_ref (packet.get (), filteredPacket.get ());
315
+ packet.reset (filteredPacket);
316
+ // TODONVDEC P0: consider cleaner ways to do this. Maybe we should let
317
+ // applyBSF return a new packet, and maybe that new packet needs to be a field
318
+ // on the interface to avoid complex lifetime issues.
317
319
}
318
320
319
321
// Parser triggers this callback within cuvidParseVideoData when a frame is
Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ AVPacket* ReferenceAVPacket::operator->() {
33
33
return avPacket_;
34
34
}
35
35
36
+ void ReferenceAVPacket::reset (ReferenceAVPacket& other) {
37
+ if (this != &other) {
38
+ av_packet_unref (avPacket_);
39
+ av_packet_move_ref (avPacket_, other.avPacket_ );
40
+ }
41
+ }
42
+
36
43
AVCodecOnlyUseForCallingAVFindBestStream
37
44
makeAVCodecOnlyUseForCallingAVFindBestStream (const AVCodec* codec) {
38
45
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59, 18, 100)
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ class ReferenceAVPacket {
135
135
~ReferenceAVPacket ();
136
136
AVPacket* get ();
137
137
AVPacket* operator ->();
138
+ void reset (ReferenceAVPacket& other);
138
139
};
139
140
140
141
// av_find_best_stream is not const-correct before commit:
You can’t perform that action at this time.
0 commit comments