Skip to content

Commit 75230d9

Browse files
committed
AMD-AMF エンコーダー/デコーダーの終了処理を改善する
Drain() に加えて Flush() を呼び出し、polling_thread の終了を確実にする。 polling_thread_.reset() を join() の直後に移動し、競合状態を回避する。
1 parent 9be3977 commit 75230d9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/hwenc_amf/amf_video_decoder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,13 @@ AMF_RESULT AMFVideoDecoderImpl::InitAMF() {
331331
void AMFVideoDecoderImpl::ReleaseAMF() {
332332
if (decoder_ != nullptr) {
333333
decoder_->Drain();
334+
decoder_->Flush();
334335
}
335336
if (polling_thread_ != nullptr) {
336337
polling_thread_->join();
338+
polling_thread_.reset();
337339
}
338340
decoder_ = nullptr;
339-
polling_thread_.reset();
340341
}
341342

342343
std::unique_ptr<AMFVideoDecoder> AMFVideoDecoder::Create(

src/hwenc_amf/amf_video_encoder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,14 @@ AMF_RESULT AMFVideoEncoderImpl::InitAMF() {
418418
AMF_RESULT AMFVideoEncoderImpl::ReleaseAMF() {
419419
if (encoder_ != nullptr) {
420420
encoder_->Drain();
421+
encoder_->Flush();
421422
}
422423
if (polling_thread_ != nullptr) {
423424
polling_thread_->join();
425+
polling_thread_.reset();
424426
}
425427

426428
encoder_ = nullptr;
427-
polling_thread_.reset();
428429

429430
return AMF_OK;
430431
}

0 commit comments

Comments
 (0)