UnigramDev/Unigram/develop • a9bef41 • 9 files, +452/-559
Rewrite the loopback capture as VoipLoopbackCapture
It was a near-verbatim copy of the Microsoft ApplicationLoopbackAudio sample and
the one piece of this project still on WRL and WIL. Now on C++/WinRT: implements
instead of RuntimeClass, which brings agility so FtmBase goes too, and com_ptr,
handle and slim_mutex in place of the wil types.
The METHODASYNCCALLBACK macro and its four offsetof-derived callbacks are gone.
Only the sample pump needs the MMCSS work queue, so start, stop and finish are
direct calls now and one IMFAsyncCallback is left. That also removes the
unbounded wait on m_hCaptureStopped: Stop takes the lock the sample callback
holds, so it waits for a packet read at most.
Three bugs in the packet loop came out with it. The copy length was taken from
GetNextPacketSize but used after GetBuffer, which may report fewer frames.
AUDCLNT_BUFFERFLAGS_SILENT was ignored, and a silent buffer's contents are
undefined, so silence went out as whatever was in memory. The samples handler
was called without checking it was set; it is a constructor argument now.
CLSID_YUV420Effect was being defined by whichever translation unit happened to
reach the initguid.h that LoopbackCapture.h dragged in. VoipVideoOutputSink.cpp
includes it deliberately now.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
UnigramDev/Unigram/develop • ea548fe • 1 files, +12/-5
Fix crash when searching while no tab is selected (#3325)
Keep SelectedTab in range instead of guarding its readers
Per review: nothing deselects a tab, so the question was where -1 comes from.
TopNavView.SelectedIndex is bound TwoWay, and a selector reports -1 whenever it
holds no selection — which it does while its ItemsSource is being attached.
BindableBase.Set stores the value and raises the notification before returning,
so the existing guard, which ran after Set and only checked the upper bound,
had already let -1 into the field. Tabs[value] on the next line was reading at
-1 too; the reported crash simply landed later, in Query, on the next
keystroke.
Validating before the value is committed keeps the field in range for every
reader — Query, ItemsView, IsTopChatsVisible and the setter itself — so the
guard added to Query in the first commit is no longer needed and is reverted.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
#unigram
Post #20572
53