@@ -144,14 +144,14 @@ struct Dim {
144
144
};
145
145
146
146
struct NvDecoderImpl {
147
- bool m_bReconfigExternal = false , m_bReconfigExtPPChange = false ,
148
- eos_set = false , decoder_recon = false ;
147
+ bool m_bReconfigExternal = false , m_bReconfigExtPPChange = false , eos_set = false ;
148
+
149
149
150
150
unsigned int m_nWidth = 0U , m_nLumaHeight = 0U , m_nChromaHeight = 0U ,
151
151
m_nNumChromaPlanes = 0U , m_nMaxWidth = 0U , m_nMaxHeight = 0U ;
152
152
153
153
int m_nSurfaceHeight = 0 , m_nSurfaceWidth = 0 , m_nBitDepthMinus8 = 0 ,
154
- m_nFrameAlloc = 0 , m_nBPP = 1 , m_nDecodedFrame = 0 , m_nDecodePicCnt = 0 ,
154
+ m_nFrameAlloc = 0 , m_nBPP = 1 , m_nDecodePicCnt = 0 ,
155
155
m_nPicNumInDecodeOrder[32 ] = {0 };
156
156
157
157
Rect m_displayRect = {}, m_cropRect = {};
@@ -181,6 +181,8 @@ struct NvDecoderImpl {
181
181
182
182
atomic<int > decode_error;
183
183
atomic<int > parser_error;
184
+ atomic<int > decoder_recon;
185
+ atomic<int > m_nDecodedFrame;
184
186
atomic<unsigned int > bit_stream_len;
185
187
};
186
188
@@ -195,7 +197,7 @@ cudaVideoCodec NvDecoder::GetCodec() const { return p_impl->m_eCodec; }
195
197
int NvDecoder::HandleVideoSequence (CUVIDEOFORMAT* pVideoFormat) noexcept
196
198
{
197
199
try {
198
- p_impl->decoder_recon = true ;
200
+ p_impl->decoder_recon ++ ;
199
201
CudaCtxPush ctxPush (p_impl->m_cuContext );
200
202
CudaStrSync strSync (p_impl->m_cuvidStream );
201
203
@@ -775,8 +777,8 @@ bool NvDecoder::DecodeLockSurface(Buffer const* encFrame,
775
777
/* In case decoder was reconfigured by cuvidParseVideoData() call made above,
776
778
* some previously decoded frames could have been pushed to decoded frames
777
779
* queue. Need to clean them up; */
778
- if (p_impl->decoder_recon ) {
779
- p_impl->decoder_recon = false ;
780
+ if (p_impl->decoder_recon > 1 ) {
781
+ p_impl->decoder_recon -- ;
780
782
while (!p_impl->m_DecFramesCtxQueue .empty ()) {
781
783
p_impl->m_DecFramesCtxQueue .pop ();
782
784
}
0 commit comments