From 4155d1c4ac9eb91393d84765c472796ea16b6ad5 Mon Sep 17 00:00:00 2001 From: xtne6f Date: Sat, 4 Jun 2022 13:40:22 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=97=E3=83=A9=E3=82=B0=E3=82=A4=E3=83=B3?= =?UTF-8?q?=E6=9C=89=E5=8A=B9=E3=81=8B=E3=82=89WebView2=E8=B5=B7=E5=8B=95?= =?UTF-8?q?=E5=AE=8C=E4=BA=86=E3=81=BE=E3=81=A7=E3=81=AE=E9=96=93=E3=81=AE?= =?UTF-8?q?=E3=82=AD=E3=83=A5=E3=83=BC=E3=82=82=E5=88=A9=E7=94=A8=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TVTDataBroadcastingWV2.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/TVTDataBroadcastingWV2/TVTDataBroadcastingWV2.cpp b/TVTDataBroadcastingWV2/TVTDataBroadcastingWV2.cpp index 0d6378b..7f24785 100644 --- a/TVTDataBroadcastingWV2/TVTDataBroadcastingWV2.cpp +++ b/TVTDataBroadcastingWV2/TVTDataBroadcastingWV2.cpp @@ -318,10 +318,6 @@ bool CDataBroadcastingWV2::GetPluginInfo(TVTest::PluginInfo* pInfo) BOOL CALLBACK CDataBroadcastingWV2::StreamCallback(BYTE* pData, void* pClientData) { auto pThis = (CDataBroadcastingWV2*)pClientData; - if (!pThis->webViewLoaded) - { - return TRUE; - } if (pThis->packetQueue.enqueuePacket(pData)) { PostMessageW(pThis->hMessageWnd, WM_APP_PACKET, 0, 0); @@ -364,6 +360,8 @@ bool CDataBroadcastingWV2::OnServiceUpdate() } // 動画、音声のPESは不要なので削っておく this->packetQueue.setPIDsToExclude(std::move(pesPIDList)); + + this->packetQueue.clear(); Tune(); return true; } @@ -593,6 +591,11 @@ LRESULT CALLBACK CDataBroadcastingWV2::MessageWndProc(HWND hWnd, UINT uMsg, WPAR } case WM_APP_PACKET: { + if (!pThis->webView || !pThis->webViewLoaded) + { + // キューを消費しない + break; + } // スレッドが失速して回復したときなどに応答を維持するためメッセージごとの処理数を制限 for (int popCount = 0; popCount < 5; popCount++) { @@ -601,10 +604,6 @@ LRESULT CALLBACK CDataBroadcastingWV2::MessageWndProc(HWND hWnd, UINT uMsg, WPAR { break; } - if (!pThis->webView) - { - continue; - } WCHAR head[] = LR"({"type":"streamBase64","data":")"; WCHAR tail[] = LR"("})"; auto packetBlockSize = packets.value().size(); @@ -1538,7 +1537,6 @@ void CDataBroadcastingWV2::Tune() if (_wcsicmp(source.get(), baseUrl.c_str())) { this->RestoreVideoWindow(); - this->packetQueue.clear(); this->webView->Navigate(baseUrl.c_str()); this->usedKey.basic = true; this->usedKey.dataButton = true;