Skip to content

Commit

Permalink
プラグイン有効からWebView2起動完了までの間のキューも利用する
Browse files Browse the repository at this point in the history
  • Loading branch information
xtne6f committed Jun 4, 2022
1 parent 0e819fe commit 4155d1c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions TVTDataBroadcastingWV2/TVTDataBroadcastingWV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -364,6 +360,8 @@ bool CDataBroadcastingWV2::OnServiceUpdate()
}
// 動画、音声のPESは不要なので削っておく
this->packetQueue.setPIDsToExclude(std::move(pesPIDList));

this->packetQueue.clear();
Tune();
return true;
}
Expand Down Expand Up @@ -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++)
{
Expand All @@ -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();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4155d1c

Please sign in to comment.