From 72d7141f7ef46aa5d96eaa7d6767a806187c2884 Mon Sep 17 00:00:00 2001 From: sbd021 Date: Fri, 10 Apr 2020 23:09:30 +0800 Subject: [PATCH] update AgoraMediaSource --- .../AgoraMediaSource/bak/AGAudioCapture.cpp | 58 -- .../AgoraMediaSource/bak/AGAudioCapture.h | 22 - .../bak/AGDShowAudioCapture.cpp | 587 ----------------- .../bak/AGDShowAudioCapture.h | 63 -- ...deoCapture - \345\211\257\346\234\254.cpp" | 602 ------------------ ...VideoCapture - \345\211\257\346\234\254.h" | 66 -- .../AgoraMediaSource/bak/AGVideoCapture.cpp | 91 --- .../AgoraMediaSource/bak/AGVideoCapture.h | 33 - .../bak/AudioCapturePackageQueue.cpp | 95 --- .../bak/AudioCapturePackageQueue.h | 33 - .../bak/AudioPlayPackageQueue.cpp | 95 --- .../bak/AudioPlayPackageQueue.h | 33 - .../AgoraMediaSource/bak/BufferQueue.cpp | 175 ----- .../AgoraMediaSource/bak/BufferQueue.h | 40 -- .../AgoraMediaSource/bak/DShowPinHelper.cpp | 204 ------ .../AgoraMediaSource/bak/DShowPinHelper.h | 27 - .../bak/ExtendAudioFrameObserver.cpp | 38 -- .../bak/ExtendAudioFrameObserver.h | 20 - .../bak/VideoPackageQueue.cpp | 88 --- .../AgoraMediaSource/bak/VideoPackageQueue.h | 33 - .../AgoraMediaSource/bak/YUVTrans.cpp | 175 ----- .../AgoraMediaSource/bak/YUVTrans.h | 28 - .../release_vs2013.bat | 25 - .../cicd/templates/build-Windows-Extend.yml | 81 --- azure-pipelines.yml | 97 ++- 25 files changed, 90 insertions(+), 2719 deletions(-) delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGAudioCapture.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGAudioCapture.h delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowAudioCapture.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowAudioCapture.h delete mode 100644 "Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowVideoCapture - \345\211\257\346\234\254.cpp" delete mode 100644 "Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowVideoCapture - \345\211\257\346\234\254.h" delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGVideoCapture.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGVideoCapture.h delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioCapturePackageQueue.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioCapturePackageQueue.h delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioPlayPackageQueue.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioPlayPackageQueue.h delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/BufferQueue.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/BufferQueue.h delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/DShowPinHelper.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/DShowPinHelper.h delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/ExtendAudioFrameObserver.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/ExtendAudioFrameObserver.h delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/VideoPackageQueue.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/VideoPackageQueue.h delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/YUVTrans.cpp delete mode 100644 Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/YUVTrans.h delete mode 100644 Windows/Agora-Media-Source-Windows/release_vs2013.bat delete mode 100644 Windows/cicd/templates/build-Windows-Extend.yml diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGAudioCapture.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGAudioCapture.cpp deleted file mode 100644 index 7d97b00..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGAudioCapture.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "stdafx.h" -#include "AGAudioCapture.h" -#include "AudioCapturePackageQueue.h" - - -CAGAudioCapture::CAGAudioCapture() - : m_nTimeStamp(0) - , m_nRef(0) -{ -} - - -CAGAudioCapture::~CAGAudioCapture() -{ -} - - -STDMETHODIMP_(ULONG) CAGAudioCapture::AddRef() -{ - m_nRef++; - - return m_nRef; -} - -STDMETHODIMP_(ULONG) CAGAudioCapture::Release() -{ - m_nRef--; - - return m_nRef; -} - -STDMETHODIMP CAGAudioCapture::QueryInterface(REFIID riid, void ** ppv) -{ - if (riid == IID_ISampleGrabberCB || riid == IID_IUnknown) - { - *ppv = (void *) static_cast (this); - return NOERROR; - } - - return E_NOINTERFACE; -} - -STDMETHODIMP CAGAudioCapture::SampleCB(double SampleTime, IMediaSample* pSample) -{ - return S_OK; -} - -STDMETHODIMP CAGAudioCapture::BufferCB(double dblSampleTime, BYTE *pBuffer, long lBufferSize) -{ - CAudioCapturePackageQueue *lpPackageQueue = CAudioCapturePackageQueue::GetInstance(); - - if (lpPackageQueue->GetAudioPackageSize() < lBufferSize) - return E_OUTOFMEMORY; - - lpPackageQueue->PushAudioPackage(pBuffer, lBufferSize); - - return S_OK; -} \ No newline at end of file diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGAudioCapture.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGAudioCapture.h deleted file mode 100644 index 1d3ef46..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGAudioCapture.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - - -class CAGAudioCapture : - public ISampleGrabberCB -{ -public: - CAGAudioCapture(); - ~CAGAudioCapture(); - - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - STDMETHODIMP QueryInterface(REFIID riid, void** ppv); - STDMETHODIMP SampleCB(double SampleTime, IMediaSample* pSample); - STDMETHODIMP BufferCB(double dblSampleTime, BYTE* pBuffer, long lBufferSize); - -private: - UINT m_nTimeStamp; - - ULONG m_nRef; -}; - diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowAudioCapture.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowAudioCapture.cpp deleted file mode 100644 index 747aa14..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowAudioCapture.cpp +++ /dev/null @@ -1,587 +0,0 @@ -#include "stdafx.h" -#include "AGDShowAudioCapture.h" -#include "AudioCapturePackageQueue.h" -#include "DShowPinHelper.h" - - -CAGDShowAudioCapture::CAGDShowAudioCapture() - : m_ptrGraphBuilder(NULL) - , m_ptrSampleGrabber(NULL) - , m_ptrCaptureGraphBuilder2(NULL) - , m_lpSampleGrabberCB(NULL) - , m_nCapSelected(-1) -{ - memset(m_szActiveDeviceID, 0, MAX_PATH*sizeof(TCHAR)); -} - - -CAGDShowAudioCapture::~CAGDShowAudioCapture() -{ - Close(); -} - -BOOL CAGDShowAudioCapture::Create() -{ - HRESULT hResult = S_OK; - - do { - hResult = m_ptrGraphBuilder.CoCreateInstance(CLSID_FilterGraph); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - break; - - hResult = m_ptrSampleGrabber.CoCreateInstance(CLSID_SampleGrabber); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - break; - - hResult = m_ptrCaptureGraphBuilder2.CoCreateInstance(CLSID_CaptureGraphBuilder2); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - break; - - hResult = m_ptrCaptureGraphBuilder2->SetFiltergraph(m_ptrGraphBuilder); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - break; - - hResult = m_ptrSampleGrabber->SetBufferSamples(TRUE); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - break; - - hResult = m_ptrSampleGrabber->SetOneShot(FALSE); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - break; - - CComQIPtr ptrGrabberFilter(m_ptrSampleGrabber); - hResult = m_ptrGraphBuilder->AddFilter(ptrGrabberFilter, L"Grabber"); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - break; - - return TRUE; - - } while (FALSE); - - m_ptrGraphBuilder = NULL; - m_ptrSampleGrabber = NULL; - m_ptrCaptureGraphBuilder2 = NULL; - - return FALSE; -} - -void CAGDShowAudioCapture::Close() -{ - CloseDevice(); - - m_ptrGraphBuilder = NULL; - m_ptrSampleGrabber = NULL; - m_ptrCaptureGraphBuilder2 = NULL; -} - -BOOL CAGDShowAudioCapture::EnumDeviceList() -{ - HRESULT hResult = S_OK; - - CComVariant var; - WCHAR *wszDevicePath = NULL; - - CComPtr ptrCreateDevEnum = NULL; - CComPtr ptrEnumMoniker = NULL; - CComPtr ptrMoniker = NULL; - CComPtr ptrPropertyBag = NULL; - - AGORA_DEVICE_INFO agDeviceInfo; - - hResult = ptrCreateDevEnum.CoCreateInstance(CLSID_SystemDeviceEnum); - if (FAILED(hResult)) - return FALSE; - - hResult = ptrCreateDevEnum->CreateClassEnumerator(CLSID_AudioInputDeviceCategory, &ptrEnumMoniker, 0); - if (FAILED(hResult)) - return FALSE; - - m_listDeviceInfo.RemoveAll(); - - do { - ptrMoniker = NULL; - hResult = ptrEnumMoniker->Next(1, &ptrMoniker, NULL); - if (hResult != S_OK) - break; - - ptrPropertyBag = NULL; - hResult = ptrMoniker->BindToStorage(NULL, NULL, IID_IPropertyBag, (void**)(&ptrPropertyBag)); - if (hResult != S_OK) - break; - - memset(&agDeviceInfo, 0, sizeof(AGORA_DEVICE_INFO)); - - var.Clear(); - hResult = ptrPropertyBag->Read(L"FriendlyName", &var, NULL); - if (SUCCEEDED(hResult)){ -#ifdef UNICODE - _tcscpy_s(agDeviceInfo.szDeviceName, var.bstrVal); -#else - ::WideCharToMultiByte(CP_ACP, 0, var.bstrVal, -1, agDeviceInfo.szDeviceName, MAX_PATH, NULL, NULL); -#endif - } - - hResult = ptrMoniker->GetDisplayName(NULL, NULL, &wszDevicePath); - if (SUCCEEDED(hResult)){ -#ifdef UNICODE - _tcscpy_s(agDeviceInfo.szDevicePath, wszDevicePath); -#else - ::WideCharToMultiByte(CP_ACP, 0, wszDevicePath, -1, agDeviceInfo.szDevicePath, MAX_PATH, NULL, NULL); -#endif - ::CoTaskMemFree(wszDevicePath); - } - - m_listDeviceInfo.AddTail(agDeviceInfo); - - } while (TRUE); - - return TRUE; -} - -BOOL CAGDShowAudioCapture::GetDeviceInfo(int nIndex, LPAGORA_DEVICE_INFO lpDeviceInfo) -{ - ATLASSERT(lpDeviceInfo != NULL); - ATLASSERT(nIndex >= 0 && nIndex < static_cast(m_listDeviceInfo.GetCount())); - - POSITION pos = m_listDeviceInfo.FindIndex(nIndex); - if (pos == NULL) - return FALSE; - - AGORA_DEVICE_INFO &agDeviceInfo = m_listDeviceInfo.GetAt(pos); - memcpy(lpDeviceInfo, &agDeviceInfo, sizeof(AGORA_DEVICE_INFO)); - - return TRUE; -} - -BOOL CAGDShowAudioCapture::OpenDevice(int nIndex) -{ - ATLASSERT(nIndex >= 0 && nIndex < static_cast(m_listDeviceInfo.GetCount())); - - m_nCapSelected = -1; - POSITION pos = m_listDeviceInfo.FindIndex(nIndex); - if (pos == NULL) - return FALSE; - - LPCTSTR lpDevicePath = m_listDeviceInfo.GetAt(pos).szDevicePath; - - return OpenDevice(lpDevicePath); -} - -BOOL CAGDShowAudioCapture::OpenDevice(LPCTSTR lpDevicePath) -{ - ULONG ulEaten = 0; - HRESULT hResult = S_OK; - - CComPtr lpBindCtx = NULL; - CComPtr ptrMoniker = NULL; - CComPtr ptrSourceFilter = NULL; - - m_nCapSelected = -1; - - ATLASSERT(_tcslen(m_szActiveDeviceID) == 0); - - hResult = ::CreateBindCtx(0, &lpBindCtx); - if (hResult != S_OK) - return FALSE; - -#ifdef UNICODE - hResult = ::MkParseDisplayName(lpBindCtx, lpDevicePath, &ulEaten, &ptrMoniker); -#else - WCHAR wszDeviceID[128]; - memset(wszDeviceID, 0, 128 * sizeof(WCHAR)); - ::MultiByteToWideChar(CP_ACP, 0, lpDevicePath, -1, wszDeviceID, 128); - hResult = ::MkParseDisplayName(lpBindCtx, wszDeviceID, &ulEaten, &ptrMoniker); -#endif - - if (hResult != S_OK) - return FALSE; - - hResult = ptrMoniker->BindToObject(0, 0, IID_IBaseFilter, (void **)&ptrSourceFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - hResult = m_ptrGraphBuilder->AddFilter(ptrSourceFilter, L"Source"); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - _tcscpy_s(m_szActiveDeviceID, MAX_PATH, lpDevicePath); - SelectMediaCap(0); - - return TRUE; -} - -BOOL CAGDShowAudioCapture::GetCurrentDevice(LPTSTR lpDevicePath, SIZE_T *nDevicePathLen) -{ - int nDeviceLen = _tcslen(m_szActiveDeviceID); - if (nDeviceLen >= static_cast(*nDevicePathLen)) { - *nDevicePathLen = nDeviceLen + 1; - return FALSE; - } - - if (nDeviceLen == 0) - return FALSE; - - _tcscpy_s(lpDevicePath, *nDevicePathLen, m_szActiveDeviceID); - *nDevicePathLen = nDeviceLen + 1; - - return TRUE; -} - -void CAGDShowAudioCapture::CloseDevice() -{ - CComPtr ptrSourceFilter = NULL; - - CaptureControl(DEVICE_STOP); - HRESULT hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrSourceFilter); - - if (SUCCEEDED(hResult)) { - m_ptrGraphBuilder->RemoveFilter(ptrSourceFilter); - m_nCapSelected = -1; - } - - memset(m_szActiveDeviceID, 0, MAX_PATH*sizeof(TCHAR)); -} - -BOOL CAGDShowAudioCapture::SetGrabberCallback(ISampleGrabberCB *lpGrabber, long lSampleType) -{ - HRESULT hResult = m_ptrSampleGrabber->SetCallback(lpGrabber, lSampleType); - - return SUCCEEDED(hResult); -} - -int CAGDShowAudioCapture::GetMediaCapCount() -{ - int nCount = 0; - int nSize = 0; - HRESULT hResult = S_OK; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrStreamConfig = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return 0; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, ptrCaptureFilter, IID_IAMStreamConfig, (void**)&ptrStreamConfig); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return 0; - - hResult = ptrStreamConfig->GetNumberOfCapabilities(&nCount, &nSize); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return 0; - - return nCount; -} - -BOOL CAGDShowAudioCapture::GetMediaCap(int nIndex, AM_MEDIA_TYPE **ppMediaType, LPVOID lpMediaStreamConfigCaps, SIZE_T nSize) -{ - int nCount = 0; - int nCapSize = 0; - HRESULT hResult = S_OK; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrStreamConfig = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, ptrCaptureFilter, IID_IAMStreamConfig, (void**)&ptrStreamConfig); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = ptrStreamConfig->GetNumberOfCapabilities(&nCount, &nCapSize); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - ATLASSERT(nCapSize <= static_cast(nSize)); - if (nCapSize > static_cast(nSize)) - return FALSE; - - hResult = ptrStreamConfig->GetStreamCaps(nIndex, ppMediaType, reinterpret_cast(lpMediaStreamConfigCaps)); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - return TRUE; -} - -BOOL CAGDShowAudioCapture::GetAudioCap(int nIndex, WAVEFORMATEX *lpWaveInfo) -{ - int nCount = 0; - int nSize = 0; - - AM_MEDIA_TYPE *lpAMMediaType = NULL; - AUDIO_STREAM_CONFIG_CAPS audioStreamCfgCaps; - - BOOL bSuccess = GetMediaCap(nIndex, &lpAMMediaType, &audioStreamCfgCaps, sizeof(AUDIO_STREAM_CONFIG_CAPS)); - - if (bSuccess && lpAMMediaType->formattype == FORMAT_WaveFormatEx) { - WAVEFORMATEX* pWavInfo = reinterpret_cast(lpAMMediaType->pbFormat); - memcpy_s(lpWaveInfo, sizeof(WAVEFORMATEX), pWavInfo, sizeof(WAVEFORMATEX)); - } - else - bSuccess = FALSE; - - FreeMediaType(lpAMMediaType); - - return bSuccess; -} - -BOOL CAGDShowAudioCapture::GetCurrentAudioCap(WAVEFORMATEX *lpWaveInfo) -{ - BOOL bSuccess = FALSE; - HRESULT hResult = S_OK; - AM_MEDIA_TYPE *lpAMMediaType = NULL; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrStreamConfig = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, ptrCaptureFilter, IID_IAMStreamConfig, (void**)&ptrStreamConfig); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = ptrStreamConfig->GetFormat(&lpAMMediaType); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - if (lpAMMediaType->formattype == FORMAT_WaveFormatEx) { - WAVEFORMATEX* pWavInfo = reinterpret_cast(lpAMMediaType->pbFormat); - memcpy_s(lpWaveInfo, sizeof(WAVEFORMATEX), pWavInfo, sizeof(WAVEFORMATEX)); - - bSuccess = TRUE; - } - else - bSuccess = FALSE; - - FreeMediaType(lpAMMediaType); - - return bSuccess; -} - -BOOL CAGDShowAudioCapture::SelectMediaCap(int nIndex) -{ - int nCount = 0; - int nSize = 0; - HRESULT hResult = S_OK; - - AM_MEDIA_TYPE *lpMediaType = NULL; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrStreamConfig = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, ptrCaptureFilter, IID_IAMStreamConfig, (void**)&ptrStreamConfig); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = ptrStreamConfig->GetNumberOfCapabilities(&nCount, &nSize); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - ATLASSERT(nIndex >= 0 && nIndex < nCount); - if (nIndex < 0 || nIndex >= nCount) - nIndex = 0; - - ATLASSERT(nSize <= sizeof(AUDIO_STREAM_CONFIG_CAPS)); - - do { - hResult = ptrStreamConfig->GetStreamCaps(nIndex, &lpMediaType, reinterpret_cast(&m_ascStreamCfgCaps)); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - break; - - hResult = ptrStreamConfig->SetFormat(lpMediaType); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - break; - - hResult = m_ptrSampleGrabber->SetMediaType(lpMediaType); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - break; - - m_nCapSelected = nIndex; - - } while (FALSE); - - FreeMediaType(lpMediaType); - - return SUCCEEDED(hResult); -} - -BOOL CAGDShowAudioCapture::FindPin(IPin **ppInputPin, IPin **ppOutputPin) -{ - HRESULT hResult = S_OK; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrSourceFilter = NULL; - CDShowPinHelper pinHelper; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Grabber", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrSourceFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - if (pinHelper.Open(ptrSourceFilter)) { - pinHelper.FindUnconnectedPin(PIN_DIRECTION::PINDIR_OUTPUT, ppOutputPin); - pinHelper.Close(); - } - - if (pinHelper.Open(ptrCaptureFilter)) { - pinHelper.FindUnconnectedPin(PIN_DIRECTION::PINDIR_INPUT, ppInputPin); - pinHelper.Close(); - } - - return TRUE; -} - -void CAGDShowAudioCapture::FreeMediaType(AM_MEDIA_TYPE *lpAMMediaType) -{ - if (lpAMMediaType == NULL) - return; - - if (lpAMMediaType->cbFormat != 0) { - ::CoTaskMemFree((PVOID)lpAMMediaType->pbFormat); - lpAMMediaType->cbFormat = 0; - lpAMMediaType->pbFormat = NULL; - } - - if (lpAMMediaType->pUnk != NULL) { - lpAMMediaType->pUnk->Release(); - lpAMMediaType->pUnk = NULL; - } - - ::CoTaskMemFree(lpAMMediaType); -} - -BOOL CAGDShowAudioCapture::GetCaptureBuffer(SIZE_T *nBlockSize, SIZE_T *nBlockCount, SIZE_T *nAlign) -{ - HRESULT hResult = S_OK; - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrBufferNegotiation = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, ptrCaptureFilter, IID_IAMBufferNegotiation, (void**)&ptrBufferNegotiation); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - ALLOCATOR_PROPERTIES alcProper; - - memset(&alcProper, 0, sizeof(ALLOCATOR_PROPERTIES)); - hResult = ptrBufferNegotiation->GetAllocatorProperties(&alcProper); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - *nBlockSize = alcProper.cbBuffer; - *nBlockCount = alcProper.cBuffers; - *nAlign = alcProper.cbAlign; - - return TRUE; -} - -BOOL CAGDShowAudioCapture::SetCaptureBuffer(SIZE_T nBlockSize, SIZE_T nBlockCount, SIZE_T nAlign) -{ - HRESULT hResult = S_OK; - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrBufferNegotiation = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Audio, ptrCaptureFilter, IID_IAMBufferNegotiation, (void**)&ptrBufferNegotiation); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - ALLOCATOR_PROPERTIES alcProper; - - alcProper.cbBuffer = nBlockSize; - alcProper.cBuffers = nBlockCount; - alcProper.cbAlign = nAlign; - alcProper.cbPrefix = 0; - - hResult = ptrBufferNegotiation->SuggestAllocatorProperties(&alcProper); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - return TRUE; -} - -BOOL CAGDShowAudioCapture::CaptureControl(int nControlCode) -{ - CComPtr ptrInputPin = NULL; - CComPtr ptrOutputPin = NULL; - - CComQIPtr ptrControl(m_ptrGraphBuilder); - - FindPin(&ptrInputPin, &ptrOutputPin); - - HRESULT hResult = S_OK; - - switch (nControlCode) - { - case DEVICE_START: - m_ptrGraphBuilder->Connect(ptrInputPin, ptrOutputPin); - hResult = ptrControl->Run(); - break; - case DEVICE_STOP: - hResult = ptrControl->Stop(); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrGraphBuilder->Disconnect(ptrInputPin); - hResult = m_ptrGraphBuilder->Disconnect(ptrOutputPin); - break; - default: - ATLASSERT(FALSE); - break; - } - - ATLASSERT(SUCCEEDED(hResult)); - - return hResult == S_OK ? TRUE : FALSE; -} \ No newline at end of file diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowAudioCapture.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowAudioCapture.h deleted file mode 100644 index 049f9ec..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowAudioCapture.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once -#include -#include - -#include - - -#include "IAGDShowDevice.h" - -class CAGDShowAudioCapture - : public IDShowCaptureDevice -{ -public: - - CAGDShowAudioCapture(); - ~CAGDShowAudioCapture(); - - virtual BOOL Create(); - virtual void Close(); - - virtual BOOL EnumDeviceList(); - virtual int GetDeviceCount(){ return m_listDeviceInfo.GetCount(); }; - virtual BOOL GetDeviceInfo(int nIndex, LPAGORA_DEVICE_INFO lpDeviceInfo); - - virtual BOOL OpenDevice(int nIndex); - virtual BOOL OpenDevice(LPCTSTR lpDevicePath); - virtual BOOL GetCurrentDevice(LPTSTR lpDevicePath, SIZE_T *nDevicePathLen); - virtual void CloseDevice(); - - virtual int GetMediaCapCount(); - virtual BOOL GetMediaCap(int nIndex, AM_MEDIA_TYPE **ppMediaType, LPVOID lpMediaStreamConfigCaps, SIZE_T nSize); - virtual BOOL SelectMediaCap(int nIndex); - virtual int GetSelectedMediaCap() { return m_nCapSelected; }; - - virtual BOOL GetCaptureBuffer(SIZE_T *nBlockSize, SIZE_T *nBlockCount, SIZE_T *nAlign); - virtual BOOL SetCaptureBuffer(SIZE_T nBlockSize, SIZE_T nBlockCount, SIZE_T nAlign); - - virtual BOOL CaptureControl(int nControlCode = DEVICE_START); - virtual BOOL SetGrabberCallback(ISampleGrabberCB *lpGrabber, long lSampleType); - - BOOL GetAudioCap(int nIndex, WAVEFORMATEX *lpWaveInfo); - BOOL GetCurrentAudioCap(WAVEFORMATEX *lpWaveInfo); - - static void FreeMediaType(AM_MEDIA_TYPE *lpAMMediaType); - -protected: - BOOL FindPin(IPin **ppInputPin, IPin **ppOutputPin); - -private: - TCHAR m_szActiveDeviceID[MAX_PATH]; - CAtlList m_listDeviceInfo; - - AUDIO_STREAM_CONFIG_CAPS m_ascStreamCfgCaps; - int m_nCapSelected; - - // private dshow object -private: - ISampleGrabberCB *m_lpSampleGrabberCB; - - CComPtr m_ptrGraphBuilder; - CComPtr m_ptrSampleGrabber; - CComPtr m_ptrCaptureGraphBuilder2; -}; diff --git "a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowVideoCapture - \345\211\257\346\234\254.cpp" "b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowVideoCapture - \345\211\257\346\234\254.cpp" deleted file mode 100644 index f5b7024..0000000 --- "a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowVideoCapture - \345\211\257\346\234\254.cpp" +++ /dev/null @@ -1,602 +0,0 @@ -#include "stdafx.h" -#include "AGDShowVideoCapture.h" -#include "DShowPinHelper.h" - -CAGDShowVideoCapture::CAGDShowVideoCapture() - : m_ptrGraphBuilder(NULL) - , m_ptrSampleGrabber(NULL) - , m_ptrCaptureGraphBuilder2(NULL) - , m_lpSampleGrabberCB(NULL) - , m_nCapSelected(-1) -{ - memset(m_szActiveDeviceID, 0, MAX_PATH*sizeof(TCHAR)); -} - - -CAGDShowVideoCapture::~CAGDShowVideoCapture() -{ - Close(); -} - -BOOL CAGDShowVideoCapture::Create() -{ - HRESULT hResult = S_OK; - - hResult = m_ptrGraphBuilder.CoCreateInstance(CLSID_FilterGraph); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - hResult = m_ptrSampleGrabber.CoCreateInstance(CLSID_SampleGrabber); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2.CoCreateInstance(CLSID_CaptureGraphBuilder2); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->SetFiltergraph(m_ptrGraphBuilder); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrSampleGrabber->SetBufferSamples(TRUE); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - hResult = m_ptrSampleGrabber->SetOneShot(FALSE); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - CComQIPtr ptrGrabberFilter(m_ptrSampleGrabber); - hResult = m_ptrGraphBuilder->AddFilter(ptrGrabberFilter, L"Grabber"); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - return TRUE; -} - -void CAGDShowVideoCapture::Close() -{ - CloseDevice(); - - m_ptrGraphBuilder = NULL; - m_ptrSampleGrabber = NULL; - m_ptrCaptureGraphBuilder2 = NULL; -} - -BOOL CAGDShowVideoCapture::EnumDeviceList() -{ - HRESULT hResult = S_OK; - - CComVariant var; - WCHAR *wszDevicePath = NULL; - - CComPtr ptrCreateDevEnum = NULL; - CComPtr ptrEnumMoniker = NULL; - CComPtr ptrMoniker = NULL; - CComPtr ptrPropertyBag = NULL; - - AGORA_DEVICE_INFO agDeviceInfo; - - hResult = ptrCreateDevEnum.CoCreateInstance(CLSID_SystemDeviceEnum); - if (FAILED(hResult)) - return FALSE; - - hResult = ptrCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &ptrEnumMoniker, 0); - if (FAILED(hResult)) - return FALSE; - - m_listDeviceInfo.RemoveAll(); - - do { - ptrMoniker = NULL; - hResult = ptrEnumMoniker->Next(1, &ptrMoniker, NULL); - if (hResult != S_OK) - break; - - ptrPropertyBag = NULL; - hResult = ptrMoniker->BindToStorage(NULL, NULL, IID_IPropertyBag, (void**)(&ptrPropertyBag)); - if (hResult != S_OK) - break; - - memset(&agDeviceInfo, 0, sizeof(AGORA_DEVICE_INFO)); - - var.Clear(); - hResult = ptrPropertyBag->Read(L"FriendlyName", &var, NULL); - if (SUCCEEDED(hResult)){ -#ifdef UNICODE - _tcscpy_s(agDeviceInfo.szDeviceName, var.bstrVal); -#else - ::WideCharToMultiByte(CP_ACP, 0, var.bstrVal, -1, agDeviceInfo.szDeviceName, MAX_PATH, NULL, NULL); -#endif - } - - hResult = ptrMoniker->GetDisplayName(NULL, NULL, &wszDevicePath); - if (SUCCEEDED(hResult)){ -#ifdef UNICODE - _tcscpy_s(agDeviceInfo.szDevicePath, wszDevicePath); -#else - ::WideCharToMultiByte(CP_ACP, 0, wszDevicePath, -1, agDeviceInfo.szDevicePath, MAX_PATH, NULL, NULL); -#endif - ::CoTaskMemFree(wszDevicePath); - } - - m_listDeviceInfo.AddTail(agDeviceInfo); - - } while (TRUE); - - return TRUE; -} - -BOOL CAGDShowVideoCapture::GetDeviceInfo(int nIndex, LPAGORA_DEVICE_INFO lpDeviceInfo) -{ - ATLASSERT(lpDeviceInfo != NULL); - ATLASSERT(nIndex >= 0 && nIndex < static_cast(m_listDeviceInfo.GetCount())); - - POSITION pos = m_listDeviceInfo.FindIndex(nIndex); - if (pos == NULL) - return FALSE; - - AGORA_DEVICE_INFO &agDeviceInfo = m_listDeviceInfo.GetAt(pos); - memcpy(lpDeviceInfo, &agDeviceInfo, sizeof(AGORA_DEVICE_INFO)); - - return TRUE; -} - -BOOL CAGDShowVideoCapture::OpenDevice(int nIndex) -{ - ATLASSERT(nIndex >= 0 && nIndex < static_cast(m_listDeviceInfo.GetCount()) ); - - m_nCapSelected = -1; - POSITION pos = m_listDeviceInfo.FindIndex(nIndex); - if (pos == NULL) - return FALSE; - - LPCTSTR lpDevicePath = m_listDeviceInfo.GetAt(pos).szDevicePath; - - return OpenDevice(lpDevicePath); -} - -BOOL CAGDShowVideoCapture::OpenDevice(LPCTSTR lpDevicePath) -{ - ULONG ulEaten = 0; - HRESULT hResult = S_OK; - - CComPtr lpBindCtx = NULL; - CComPtr ptrMoniker = NULL; - CComPtr ptrSourceFilter = NULL; - - m_nCapSelected = -1; - ATLASSERT(_tcslen(m_szActiveDeviceID) == 0); - - hResult = ::CreateBindCtx(0, &lpBindCtx); - if (hResult != S_OK) - return FALSE; - -#ifdef UNICODE - hResult = ::MkParseDisplayName(lpBindCtx, lpDevicePath, &ulEaten, &ptrMoniker); -#else - WCHAR wszDeviceID[128]; - memset(wszDeviceID, 0, 128 * sizeof(WCHAR)); - ::MultiByteToWideChar(CP_ACP, 0, lpDevicePath, -1, wszDeviceID, 128); - hResult = ::MkParseDisplayName(lpBindCtx, wszDeviceID, &ulEaten, &ptrMoniker); -#endif - - if (hResult != S_OK) - return FALSE; - - hResult = ptrMoniker->BindToObject(0, 0, IID_IBaseFilter, (void **)&ptrSourceFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - hResult = m_ptrGraphBuilder->AddFilter(ptrSourceFilter, L"Source"); - ATLASSERT(SUCCEEDED(hResult)); - if (hResult != S_OK) - return FALSE; - - _tcscpy_s(m_szActiveDeviceID, MAX_PATH, lpDevicePath); - - SelectMediaCap(0); - - return TRUE; -} - -BOOL CAGDShowVideoCapture::GetCurrentDevice(LPTSTR lpDevicePath, SIZE_T *nDevicePathLen) -{ - int nDeviceLen = _tcslen(m_szActiveDeviceID); - if (nDeviceLen >= static_cast(*nDevicePathLen)) { - *nDevicePathLen = nDeviceLen+1; - return FALSE; - } - - if (nDeviceLen == 0) - return FALSE; - - _tcscpy_s(lpDevicePath, *nDevicePathLen, m_szActiveDeviceID); - *nDevicePathLen = nDeviceLen + 1; - - return TRUE; -} - -void CAGDShowVideoCapture::CloseDevice() -{ - CComPtr ptrSourceFilter = NULL; - - ATLASSERT(_tcslen(m_szActiveDeviceID) > 0); - if (_tcslen(m_szActiveDeviceID) == 0) - return; - - CaptureControl(DEVICE_STOP); - HRESULT hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrSourceFilter); - - if (SUCCEEDED(hResult)) { - m_ptrGraphBuilder->RemoveFilter(ptrSourceFilter); - m_nCapSelected = -1; - } - - memset(m_szActiveDeviceID, 0, MAX_PATH*sizeof(TCHAR)); -} - -BOOL CAGDShowVideoCapture::SetGrabberCallback(ISampleGrabberCB *lpGrabber, long lSampleType) -{ - HRESULT hResult = m_ptrSampleGrabber->SetCallback(lpGrabber, lSampleType); - - return SUCCEEDED(hResult); -} - -int CAGDShowVideoCapture::GetMediaCapCount() -{ - int nCount = 0; - int nSize = 0; - HRESULT hResult = S_OK; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrStreamConfig = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return 0; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, ptrCaptureFilter, IID_IAMStreamConfig, (void**)&ptrStreamConfig); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return 0; - - hResult = ptrStreamConfig->GetNumberOfCapabilities(&nCount, &nSize); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return 0; - - return nCount; -} - -BOOL CAGDShowVideoCapture::GetMediaCap(int nIndex, AM_MEDIA_TYPE **ppMediaType, LPVOID lpMediaStreamConfigCaps, SIZE_T nSize) -{ - int nCount = 0; - int nCapSize = 0; - HRESULT hResult = S_OK; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrStreamConfig = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, ptrCaptureFilter, IID_IAMStreamConfig, (void**)&ptrStreamConfig); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = ptrStreamConfig->GetNumberOfCapabilities(&nCount, &nCapSize); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - ATLASSERT(nCapSize <= static_cast(nSize)); - if (nCapSize > static_cast(nSize)) - return FALSE; - - hResult = ptrStreamConfig->GetStreamCaps(nIndex, ppMediaType, reinterpret_cast(lpMediaStreamConfigCaps)); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - return TRUE; -} - -BOOL CAGDShowVideoCapture::GetVideoCap(int nIndex, VIDEOINFOHEADER *lpVideoInfo) -{ - int nCount = 0; - int nSize = 0; - - AM_MEDIA_TYPE *lpAMMediaType = NULL; - VIDEO_STREAM_CONFIG_CAPS videoStreamCfgCaps; - - BOOL bSuccess = GetMediaCap(nIndex, &lpAMMediaType, &videoStreamCfgCaps, sizeof(VIDEO_STREAM_CONFIG_CAPS)); - - if (lpAMMediaType->formattype == FORMAT_VideoInfo) { - VIDEOINFOHEADER* pVideoInfo = reinterpret_cast(lpAMMediaType->pbFormat); - memcpy_s(lpVideoInfo, sizeof(VIDEOINFOHEADER), pVideoInfo, sizeof(VIDEOINFOHEADER)); - - bSuccess = TRUE; - } - else if (lpAMMediaType->formattype == FORMAT_VideoInfo2) { - VIDEOINFOHEADER2* pVideoInfo2 = reinterpret_cast< VIDEOINFOHEADER2*>(lpAMMediaType->pbFormat); - memcpy_s(&lpVideoInfo->bmiHeader, sizeof(BITMAPINFOHEADER), &pVideoInfo2->bmiHeader, sizeof(BITMAPINFOHEADER)); - lpVideoInfo->AvgTimePerFrame = pVideoInfo2->AvgTimePerFrame; - lpVideoInfo->dwBitErrorRate = pVideoInfo2->dwBitErrorRate; - lpVideoInfo->dwBitRate = pVideoInfo2->dwBitRate; - bSuccess = TRUE; - } - else - bSuccess = FALSE; - - FreeMediaType(lpAMMediaType); - - return bSuccess; -} - -BOOL CAGDShowVideoCapture::GetCurrentVideoCap(VIDEOINFOHEADER *lpVideoInfo) -{ - BOOL bSuccess = FALSE; - HRESULT hResult = S_OK; - AM_MEDIA_TYPE *lpAMMediaType = NULL; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrStreamConfig = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, ptrCaptureFilter, IID_IAMStreamConfig, (void**)&ptrStreamConfig); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = ptrStreamConfig->GetFormat(&lpAMMediaType); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - if (lpAMMediaType->formattype == FORMAT_VideoInfo) { - VIDEOINFOHEADER* pVideoInfo = reinterpret_cast(lpAMMediaType->pbFormat); - memcpy_s(lpVideoInfo, sizeof(VIDEOINFOHEADER), pVideoInfo, sizeof(VIDEOINFOHEADER)); - - bSuccess = TRUE; - } - else if (lpAMMediaType->formattype == FORMAT_VideoInfo2) { - VIDEOINFOHEADER2* pVideoInfo2 = reinterpret_cast< VIDEOINFOHEADER2*>(lpAMMediaType->pbFormat); - memcpy_s(&lpVideoInfo->bmiHeader, sizeof(BITMAPINFOHEADER), &pVideoInfo2->bmiHeader, sizeof(BITMAPINFOHEADER)); - lpVideoInfo->AvgTimePerFrame = pVideoInfo2->AvgTimePerFrame; - lpVideoInfo->dwBitErrorRate = pVideoInfo2->dwBitErrorRate; - lpVideoInfo->dwBitRate = pVideoInfo2->dwBitRate; - bSuccess = TRUE; - } - else - bSuccess = FALSE; - - FreeMediaType(lpAMMediaType); - - return bSuccess; -} - -BOOL CAGDShowVideoCapture::SelectMediaCap(int nIndex) -{ - int nCount = 0; - int nSize = 0; - HRESULT hResult = S_OK; - - AM_MEDIA_TYPE *lpMediaType = NULL; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrStreamConfig = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, ptrCaptureFilter, IID_IAMStreamConfig, (void**)&ptrStreamConfig); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = ptrStreamConfig->GetNumberOfCapabilities(&nCount, &nSize); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - ATLASSERT(nIndex >= 0 && nIndex < nCount); - if (nIndex < 0 || nIndex >= nCount) - nIndex = 0; - - ATLASSERT(nSize <= sizeof(VIDEO_STREAM_CONFIG_CAPS)); - - do { - hResult = ptrStreamConfig->GetStreamCaps(nIndex, &lpMediaType, reinterpret_cast(&m_vscStreamCfgCaps)); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - break; - - hResult = ptrStreamConfig->SetFormat(lpMediaType); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - break; - - hResult = m_ptrSampleGrabber->SetMediaType(lpMediaType); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - break; - - m_nCapSelected = nIndex; - - } while (FALSE); - - FreeMediaType(lpMediaType); - - return SUCCEEDED(hResult); -} - -BOOL CAGDShowVideoCapture::GetCaptureBuffer(SIZE_T *nBlockSize, SIZE_T *nBlockCount, SIZE_T *nAlign) -{ - HRESULT hResult = S_OK; - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrBufferNegotiation = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, ptrCaptureFilter, IID_IAMBufferNegotiation, (void**)&ptrBufferNegotiation); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - ALLOCATOR_PROPERTIES alcProper; - - memset(&alcProper, 0, sizeof(ALLOCATOR_PROPERTIES)); - hResult = ptrBufferNegotiation->GetAllocatorProperties(&alcProper); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - *nBlockSize = alcProper.cbBuffer; - *nBlockCount = alcProper.cBuffers; - *nAlign = alcProper.cbAlign; - - return TRUE; -} - -BOOL CAGDShowVideoCapture::SetCaptureBuffer(SIZE_T nBlockSize, SIZE_T nBlockCount, SIZE_T nAlign) -{ - HRESULT hResult = S_OK; - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrBufferNegotiation = NULL; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrCaptureGraphBuilder2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, ptrCaptureFilter, IID_IAMBufferNegotiation, (void**)&ptrBufferNegotiation); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - ALLOCATOR_PROPERTIES alcProper; - - alcProper.cbBuffer = nBlockSize; - alcProper.cBuffers = nBlockCount; - alcProper.cbAlign = nAlign; - alcProper.cbPrefix = 0; - - hResult = ptrBufferNegotiation->SuggestAllocatorProperties(&alcProper); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - return TRUE; -} - -BOOL CAGDShowVideoCapture::CaptureControl(int nControlCode) -{ - CComPtr ptrInputPin = NULL; - CComPtr ptrOutputPin = NULL; - - CComQIPtr ptrControl(m_ptrGraphBuilder); - - FindPin(&ptrInputPin, &ptrOutputPin); - - HRESULT hResult = S_OK; - - switch (nControlCode) - { - case DEVICE_START: - hResult = m_ptrGraphBuilder->Connect(ptrInputPin, ptrOutputPin); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = ptrControl->Run(); - break; - case DEVICE_STOP: - hResult = ptrControl->Stop(); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrGraphBuilder->Disconnect(ptrInputPin); - hResult = m_ptrGraphBuilder->Disconnect(ptrOutputPin); - break; - default: - ATLASSERT(FALSE); - break; - } - - ATLASSERT(SUCCEEDED(hResult)); - - return hResult == S_OK ? TRUE : FALSE; -} - -BOOL CAGDShowVideoCapture::FindPin(IPin **ppInputPin, IPin **ppOutputPin) -{ - HRESULT hResult = S_OK; - - CComPtr ptrCaptureFilter = NULL; - CComPtr ptrSourceFilter = NULL; - CDShowPinHelper pinHelper; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Grabber", &ptrCaptureFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - hResult = m_ptrGraphBuilder->FindFilterByName(L"Source", &ptrSourceFilter); - ATLASSERT(SUCCEEDED(hResult)); - if (FAILED(hResult)) - return FALSE; - - if (pinHelper.Open(ptrSourceFilter)) { - pinHelper.FindUnconnectedPin(PIN_DIRECTION::PINDIR_OUTPUT, ppOutputPin); - pinHelper.Close(); - } - - if (pinHelper.Open(ptrCaptureFilter)) { - pinHelper.FindUnconnectedPin(PIN_DIRECTION::PINDIR_INPUT, ppInputPin); - pinHelper.Close(); - } - - return TRUE; -} - -void CAGDShowVideoCapture::FreeMediaType(AM_MEDIA_TYPE *lpAMMediaType) -{ - if (lpAMMediaType == NULL) - return; - - if (lpAMMediaType->cbFormat != 0) { - ::CoTaskMemFree((PVOID)lpAMMediaType->pbFormat); - lpAMMediaType->cbFormat = 0; - lpAMMediaType->pbFormat = NULL; - } - - if (lpAMMediaType->pUnk != NULL) { - lpAMMediaType->pUnk->Release(); - lpAMMediaType->pUnk = NULL; - } - - ::CoTaskMemFree(lpAMMediaType); -} diff --git "a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowVideoCapture - \345\211\257\346\234\254.h" "b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowVideoCapture - \345\211\257\346\234\254.h" deleted file mode 100644 index d5102c2..0000000 --- "a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGDShowVideoCapture - \345\211\257\346\234\254.h" +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - - - -#include "IAGDShowDevice.h" - - -class CAGDShowVideoCapture - : public IDShowCaptureDevice -{ -public: - CAGDShowVideoCapture(); - ~CAGDShowVideoCapture(); - - virtual BOOL Create(); - virtual void Close(); - - virtual BOOL EnumDeviceList(); - virtual int GetDeviceCount() { return m_listDeviceInfo.GetCount(); }; - virtual BOOL GetDeviceInfo(int nIndex, LPAGORA_DEVICE_INFO lpDeviceInfo); - - virtual BOOL OpenDevice(int nIndex); - virtual BOOL OpenDevice(LPCTSTR lpDevicePath); - virtual BOOL GetCurrentDevice(LPTSTR lpDevicePath, SIZE_T *nDevicePathLen); - virtual void CloseDevice(); - - virtual int GetMediaCapCount(); - virtual BOOL GetMediaCap(int nIndex, AM_MEDIA_TYPE **ppMediaType, LPVOID lpMediaStreamConfigCaps, SIZE_T nSize); - virtual BOOL SelectMediaCap(int nIndex); - virtual int GetSelectedMediaCap() { return m_nCapSelected; }; - - virtual BOOL GetCaptureBuffer(SIZE_T *nBlockSize, SIZE_T *nBlockCount, SIZE_T *nAlign); - virtual BOOL SetCaptureBuffer(SIZE_T nBlockSize, SIZE_T nBlockCount, SIZE_T nAlign); - - virtual BOOL CaptureControl(int nControlCode = DEVICE_START); - virtual BOOL SetGrabberCallback(ISampleGrabberCB *lpGrabber, long lSampleType); - - BOOL GetVideoCap(int nIndex, VIDEOINFOHEADER *lpVideoInfo); - BOOL GetCurrentVideoCap(VIDEOINFOHEADER *lpVideoInfo); - - static void FreeMediaType(AM_MEDIA_TYPE *lpAMMediaType); - -protected: - BOOL FindPin(IPin **ppInputPin, IPin **ppOutputPin); - -private: - TCHAR m_szActiveDeviceID[MAX_PATH]; - CAtlList m_listDeviceInfo; - - VIDEO_STREAM_CONFIG_CAPS m_vscStreamCfgCaps; - int m_nCapSelected; - -private: - ISampleGrabberCB *m_lpSampleGrabberCB; - - CComPtr m_ptrGraphBuilder; - CComPtr m_ptrSampleGrabber; - CComPtr m_ptrCaptureGraphBuilder2; -}; - diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGVideoCapture.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGVideoCapture.cpp deleted file mode 100644 index a0be5ab..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGVideoCapture.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "stdafx.h" -#include "AGVideoCapture.h" -#include "VideoPackageQueue.h" -#include "YUVTrans.h" - - -CAGVideoCapture::CAGVideoCapture() - : m_nTimeStamp(0) - , m_nRef(0) -{ - m_lpYUVBuffer = new BYTE[0x800000]; -} - - -CAGVideoCapture::~CAGVideoCapture() -{ - delete[] m_lpYUVBuffer; -} - -STDMETHODIMP_(ULONG) CAGVideoCapture::AddRef() -{ - m_nRef++; - - return m_nRef; -} - -STDMETHODIMP_(ULONG) CAGVideoCapture::Release() -{ - m_nRef--; - - return m_nRef; -} - -STDMETHODIMP CAGVideoCapture::QueryInterface(REFIID riid, void ** ppv) -{ - if (riid == IID_ISampleGrabberCB || riid == IID_IUnknown) - { - *ppv = (void *) static_cast (this); - return NOERROR; - } - - return E_NOINTERFACE; -} - -STDMETHODIMP CAGVideoCapture::SampleCB(double SampleTime, IMediaSample* pSample) -{ - return S_OK; -} - -STDMETHODIMP CAGVideoCapture::BufferCB(double dblSampleTime, BYTE *pBuffer, long lBufferSize) -{ - CVideoPackageQueue *lpPackageQueue = CVideoPackageQueue::GetInstance(); - BITMAPINFOHEADER bmiHeader; - - if (lpPackageQueue->GetBufferSize() < static_cast(lBufferSize)) - return E_OUTOFMEMORY; - - lpPackageQueue->GetVideoFormat(&bmiHeader); - - m_lpY = m_lpYUVBuffer; - m_lpU = m_lpY + bmiHeader.biWidth*bmiHeader.biHeight; - m_lpV = m_lpU + bmiHeader.biWidth*bmiHeader.biHeight / 4; - SIZE_T nYUVSize = bmiHeader.biWidth*bmiHeader.biHeight * 3 / 2; - - switch (bmiHeader.biCompression) - { - case 0x00000000: // RGB24 - - CYUVTrans::RGB24ToI420(pBuffer, m_lpYUVBuffer, 0x800000, bmiHeader.biWidth, bmiHeader.biHeight); - break; - case MAKEFOURCC('I', '4', '2', '0'): // I420 - memcpy_s(m_lpYUVBuffer, 0x800000, pBuffer, lBufferSize); - break; - case MAKEFOURCC('Y', 'U', 'Y', '2'): // YUY2 - CYUVTrans::YUY2ToI420(pBuffer, m_lpYUVBuffer, 0x800000, bmiHeader.biWidth, bmiHeader.biHeight); - break; - case MAKEFOURCC('M', 'J', 'P', 'G'): // MJPEG NOT SUPPORTED!!!!! - VERIFY(FALSE); - break; - case MAKEFOURCC('U', 'Y', 'V', 'Y'): // UYVY - CYUVTrans::UYVYToI420(pBuffer, m_lpYUVBuffer, 0x800000, bmiHeader.biWidth, bmiHeader.biHeight); - break; - default: - ATLASSERT(FALSE); - break; - } - - lpPackageQueue->PushVideoPackage(m_lpYUVBuffer, nYUVSize); - - return S_OK; -} \ No newline at end of file diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGVideoCapture.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGVideoCapture.h deleted file mode 100644 index f91db68..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AGVideoCapture.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -#include - - - -class CAGVideoCapture : - public ISampleGrabberCB -{ -public: - CAGVideoCapture(); - ~CAGVideoCapture(); - - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - STDMETHODIMP QueryInterface(REFIID riid, void** ppv); - STDMETHODIMP SampleCB(double SampleTime, IMediaSample* pSample); - STDMETHODIMP BufferCB(double dblSampleTime, BYTE* pBuffer, long lBufferSize); - -// BOOL SetVideoInfo(const VIDEOINFOHEADER *lpVideoInfo); - -private: - UINT m_nTimeStamp; - UINT m_nFPS; - - ULONG m_nRef; - - LPBYTE m_lpYUVBuffer; - LPBYTE m_lpY; - LPBYTE m_lpU; - LPBYTE m_lpV; - -}; - diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioCapturePackageQueue.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioCapturePackageQueue.cpp deleted file mode 100644 index a823ca0..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioCapturePackageQueue.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "stdafx.h" -#include "AudioCapturePackageQueue.h" - - -CAudioCapturePackageQueue *CAudioCapturePackageQueue::m_lpAudioPackageQueue = NULL; - -// -CAudioCapturePackageQueue::CAudioCapturePackageQueue() -{ - m_bufQueue.Create(32, 8192); - m_nPackageSize = 8192; -} - - -CAudioCapturePackageQueue::~CAudioCapturePackageQueue() -{ - m_bufQueue.FreeAllBusyBlock(); - m_bufQueue.Close(); -} - -CAudioCapturePackageQueue *CAudioCapturePackageQueue::GetInstance() -{ - if (m_lpAudioPackageQueue == NULL) - m_lpAudioPackageQueue = new CAudioCapturePackageQueue(); - - return m_lpAudioPackageQueue; -} - -void CAudioCapturePackageQueue::CloseInstance() -{ - if (m_lpAudioPackageQueue == NULL) - return; - - delete m_lpAudioPackageQueue; - m_lpAudioPackageQueue = NULL; -} - -void CAudioCapturePackageQueue::SetAudioPackageSize(SIZE_T nPackageSize) -{ - _ASSERT(nPackageSize > 0 && nPackageSize <= m_bufQueue.GetBytesPreUnit()); - - if (nPackageSize == 0 || nPackageSize > m_bufQueue.GetBytesPreUnit()) - return; - - m_nPackageSize = nPackageSize; -} - -void CAudioCapturePackageQueue::SetAudioFormat(const WAVEFORMATEX *lpWaveInfo) -{ - memcpy_s(&m_waveFormat, sizeof(WAVEFORMATEX), lpWaveInfo, sizeof(WAVEFORMATEX)); -} - -void CAudioCapturePackageQueue::GetAudioFormat(WAVEFORMATEX *lpWaveInfo) -{ - memcpy_s(lpWaveInfo, sizeof(WAVEFORMATEX), &m_waveFormat, sizeof(WAVEFORMATEX)); -} - -BOOL CAudioCapturePackageQueue::PushAudioPackage(LPCVOID lpAudioPackage, SIZE_T nPackageSize) -{ - if (m_bufQueue.GetFreeCount() == 0) - m_bufQueue.FreeBusyHead(); - - LPVOID lpBuffer = m_bufQueue.AllocBuffer(FALSE); - if (lpBuffer == NULL) - return FALSE; - - _ASSERT(m_bufQueue.GetBytesPreUnit() >= nPackageSize); - - memcpy_s(lpBuffer, m_bufQueue.GetBytesPreUnit(), lpAudioPackage, nPackageSize); - - return TRUE; -} - -BOOL CAudioCapturePackageQueue::PopAudioPackage(LPVOID lpAudioPackage, SIZE_T *nPackageSize) -{ - _ASSERT(nPackageSize != NULL); - - if (nPackageSize == NULL) - return FALSE; - - if (m_bufQueue.GetFreeCount() == 0) - return FALSE; - - if (*nPackageSize < m_nPackageSize) { - *nPackageSize = m_nPackageSize; - return FALSE; - } - - LPVOID lpBuffer = m_bufQueue.GetBusyHead(); - memcpy_s(lpAudioPackage, *nPackageSize, lpBuffer, m_nPackageSize); - *nPackageSize = m_nPackageSize; - m_bufQueue.FreeBusyHead(); - - return TRUE; -} \ No newline at end of file diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioCapturePackageQueue.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioCapturePackageQueue.h deleted file mode 100644 index 19acd03..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioCapturePackageQueue.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -#include - -#include "BufferQueue.h" - - -class CAudioCapturePackageQueue -{ -protected: - CAudioCapturePackageQueue(); - ~CAudioCapturePackageQueue(); - -public: - static CAudioCapturePackageQueue *GetInstance(); - static void CloseInstance(); - - void SetAudioPackageSize(SIZE_T nPackageSize); - SIZE_T GetAudioPackageSize() const { return m_nPackageSize; }; - - void SetAudioFormat(const WAVEFORMATEX *lpWaveInfo); - void GetAudioFormat(WAVEFORMATEX *lpWaveInfo); - - BOOL PushAudioPackage(LPCVOID lpAudioPackage, SIZE_T nPackageSize); - BOOL PopAudioPackage(LPVOID lpAudioPackage, SIZE_T *nPackageSize); - -private: - CBufferQueue m_bufQueue; - WAVEFORMATEX m_waveFormat; - SIZE_T m_nPackageSize; - - static CAudioCapturePackageQueue *m_lpAudioPackageQueue; -}; - diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioPlayPackageQueue.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioPlayPackageQueue.cpp deleted file mode 100644 index cb6e0fd..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioPlayPackageQueue.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "stdafx.h" -#include "AudioPlayPackageQueue.h" - - -CAudioPlayPackageQueue *CAudioPlayPackageQueue::m_lpAudioPackageQueue = NULL; - -// -CAudioPlayPackageQueue::CAudioPlayPackageQueue() -{ - m_bufQueue.Create(32, 8192); - m_nPackageSize = 8192; -} - - -CAudioPlayPackageQueue::~CAudioPlayPackageQueue() -{ - m_bufQueue.FreeAllBusyBlock(); - m_bufQueue.Close(); -} - -CAudioPlayPackageQueue *CAudioPlayPackageQueue::GetInstance() -{ - if (m_lpAudioPackageQueue == NULL) - m_lpAudioPackageQueue = new CAudioPlayPackageQueue(); - - return m_lpAudioPackageQueue; -} - -void CAudioPlayPackageQueue::CloseInstance() -{ - if (m_lpAudioPackageQueue == NULL) - return; - - delete m_lpAudioPackageQueue; - m_lpAudioPackageQueue = NULL; -} - -void CAudioPlayPackageQueue::SetAudioPackageSize(SIZE_T nPackageSize) -{ - _ASSERT(nPackageSize > 0 && nPackageSize <= m_bufQueue.GetBytesPreUnit()); - - if (nPackageSize == 0 || nPackageSize > m_bufQueue.GetBytesPreUnit()) - return; - - m_nPackageSize = nPackageSize; -} - -void CAudioPlayPackageQueue::SetAudioFormat(const WAVEFORMATEX *lpWaveInfo) -{ - memcpy_s(&m_waveFormat, sizeof(WAVEFORMATEX), lpWaveInfo, sizeof(WAVEFORMATEX)); -} - -void CAudioPlayPackageQueue::GetAudioFormat(WAVEFORMATEX *lpWaveInfo) -{ - memcpy_s(lpWaveInfo, sizeof(WAVEFORMATEX), &m_waveFormat, sizeof(WAVEFORMATEX)); -} - -BOOL CAudioPlayPackageQueue::PushAudioPackage(LPCVOID lpAudioPackage, SIZE_T nPackageSize) -{ - if (m_bufQueue.GetFreeCount() == 0) - m_bufQueue.FreeBusyHead(); - - LPVOID lpBuffer = m_bufQueue.AllocBuffer(FALSE); - if (lpBuffer == NULL) - return FALSE; - - _ASSERT(m_bufQueue.GetBytesPreUnit() >= nPackageSize); - - memcpy_s(lpBuffer, m_bufQueue.GetBytesPreUnit(), lpAudioPackage, nPackageSize); - - return TRUE; -} - -BOOL CAudioPlayPackageQueue::PopAudioPackage(LPVOID lpAudioPackage, SIZE_T *nPackageSize) -{ - _ASSERT(nPackageSize != NULL); - - if (nPackageSize == NULL) - return FALSE; - - if (m_bufQueue.GetFreeCount() == 0) - return FALSE; - - if (*nPackageSize < m_nPackageSize) { - *nPackageSize = m_nPackageSize; - return FALSE; - } - - LPVOID lpBuffer = m_bufQueue.GetBusyHead(); - memcpy_s(lpAudioPackage, *nPackageSize, lpAudioPackage, m_nPackageSize); - *nPackageSize = m_nPackageSize; - m_bufQueue.FreeBusyHead(); - - return TRUE; -} \ No newline at end of file diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioPlayPackageQueue.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioPlayPackageQueue.h deleted file mode 100644 index 0fbc59e..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/AudioPlayPackageQueue.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -#include - -#include "BufferQueue.h" - - -class CAudioPlayPackageQueue -{ -protected: - CAudioPlayPackageQueue(); - ~CAudioPlayPackageQueue(); - -public: - static CAudioPlayPackageQueue *GetInstance(); - static void CloseInstance(); - - void SetAudioPackageSize(SIZE_T nPackageSize); - SIZE_T GetAudioPackageSize() const { return m_nPackageSize; }; - - void SetAudioFormat(const WAVEFORMATEX *lpWaveInfo); - void GetAudioFormat(WAVEFORMATEX *lpWaveInfo); - - BOOL PushAudioPackage(LPCVOID lpAudioPackage, SIZE_T nPackageSize); - BOOL PopAudioPackage(LPVOID lpAudioPackage, SIZE_T *nPackageSize); - -private: - CBufferQueue m_bufQueue; - WAVEFORMATEX m_waveFormat; - SIZE_T m_nPackageSize; - - static CAudioPlayPackageQueue *m_lpAudioPackageQueue; -}; - diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/BufferQueue.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/BufferQueue.cpp deleted file mode 100644 index eb3fb46..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/BufferQueue.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include "stdafx.h" -#include "BufferQueue.h" - - -CBufferQueue::CBufferQueue() -{ - ::InitializeCriticalSection(&m_csAllocLock); - ::InitializeCriticalSection(&m_csFreeLock); - ::InitializeCriticalSection(&m_csBusyLock); -} - - -CBufferQueue::~CBufferQueue() -{ - ::DeleteCriticalSection(&m_csAllocLock); - ::DeleteCriticalSection(&m_csFreeLock); - ::DeleteCriticalSection(&m_csBusyLock); -} - - -BOOL CBufferQueue::Create(int nUnitCount, SIZE_T nBytesPreUnit) -{ - _ASSERT(m_listFreeUnit.IsEmpty()); - - if (nUnitCount < 0 || nBytesPreUnit == 0) - return FALSE; - - // 已经分配过了 - if (!m_listFreeUnit.IsEmpty()) - return TRUE; - - LPBYTE lpBuffer = NULL; - - ::EnterCriticalSection(&m_csFreeLock); - - // 初始化内存池 - for (int nIndex = 0; nIndex < nUnitCount; nIndex++){ - lpBuffer = new BYTE[nBytesPreUnit]; - m_listFreeUnit.AddTail(lpBuffer); - } - - ::LeaveCriticalSection(&m_csFreeLock); - - m_nUnitCount = nUnitCount; - m_nCurrentCount = nUnitCount; - m_nBytesPreUnit = nBytesPreUnit; - - return TRUE; -} - -BOOL CBufferQueue::Close() -{ - LPBYTE lpBuffer = NULL; - - _ASSERT(m_nUnitCount > 0 && m_nBytesPreUnit > 0); - - ::EnterCriticalSection(&m_csAllocLock); // 进入分配临界,防止再分配 - ::EnterCriticalSection(&m_csFreeLock); - ::EnterCriticalSection(&m_csBusyLock); // 进入映射临界,检查是否有忙块 - - if (m_listBusyUnit.GetCount() != 0){ // 还有忙块,禁止释放 - ::LeaveCriticalSection(&m_csBusyLock); - ::LeaveCriticalSection(&m_csFreeLock); - ::LeaveCriticalSection(&m_csAllocLock); - - return FALSE; - } - - ::LeaveCriticalSection(&m_csBusyLock); // 检查映射完毕,退出临界 - - while (m_listFreeUnit.GetCount() > 0){ - lpBuffer = m_listFreeUnit.RemoveHead(); - delete[] lpBuffer; - } - - m_nBytesPreUnit = 0; - m_nUnitCount = 0; - m_nCurrentCount = 0; - - ::LeaveCriticalSection(&m_csFreeLock); - ::LeaveCriticalSection(&m_csAllocLock); // 池内缓冲全部销毁完毕,退出临界 - - return TRUE; -} - -int CBufferQueue::GetFreeCount() const -{ - return (int)m_listFreeUnit.GetCount(); -} - -int CBufferQueue::GetBusyCount() const -{ - return (int)m_listBusyUnit.GetCount(); -} - -LPVOID CBufferQueue::AllocBuffer(BOOL bForceAlloc) -{ - LPBYTE lpBuffer = NULL; // 缓冲区 - POSITION posHead = NULL; // 链表头 - POSITION posTail = NULL; // 链表尾 - - _ASSERT(m_nUnitCount > 0 && m_nBytesPreUnit > 0); - - ::EnterCriticalSection(&m_csAllocLock); // 进入分配临界 - posHead = m_listFreeUnit.GetHeadPosition(); // 检查链表是否为空 - posTail = m_listFreeUnit.GetTailPosition(); // 链表尾也要检查 - - if (posHead != NULL && posHead != posTail) // 链表非空且头尾不同 - lpBuffer = m_listFreeUnit.RemoveHead(); - else if (posHead != NULL && posHead == posTail){ // 只有一个空闲 - ::EnterCriticalSection(&m_csFreeLock); - lpBuffer = m_listFreeUnit.RemoveHead(); - ::LeaveCriticalSection(&m_csFreeLock); - } - else{ // 链表无空闲 - if (bForceAlloc){ // 允许强制分配 - lpBuffer = new BYTE[m_nBytesPreUnit]; - m_nCurrentCount++; - } - else - lpBuffer = NULL; - } - ::LeaveCriticalSection(&m_csAllocLock); // 退出分配临界 - - if (lpBuffer == NULL) - return NULL; - - ::EnterCriticalSection(&m_csBusyLock); - m_listBusyUnit.AddTail(lpBuffer); - ::LeaveCriticalSection(&m_csBusyLock); - - return lpBuffer; -} - -LPVOID CBufferQueue::GetBusyHead() -{ - LPBYTE lpBuffer = NULL; - - ::EnterCriticalSection(&m_csBusyLock); - if (!m_listBusyUnit.IsEmpty()) - lpBuffer = m_listBusyUnit.GetHead(); - ::LeaveCriticalSection(&m_csBusyLock); - - return lpBuffer; -} - -BOOL CBufferQueue::FreeBusyHead() -{ - BOOL bRet = FALSE; - LPBYTE lpBuffer = NULL; - - _ASSERT(m_nUnitCount > 0 && m_nBytesPreUnit > 0); - - ::EnterCriticalSection(&m_csBusyLock); - if (!m_listBusyUnit.IsEmpty()) - lpBuffer = m_listBusyUnit.RemoveHead(); - ::LeaveCriticalSection(&m_csBusyLock); - - if (lpBuffer != NULL) { - ::EnterCriticalSection(&m_csFreeLock); - m_listFreeUnit.AddTail(lpBuffer); - ::LeaveCriticalSection(&m_csFreeLock); - } - - return lpBuffer != NULL ? TRUE : FALSE; -} - -void CBufferQueue::FreeAllBusyBlock() -{ - BOOL bRet = TRUE; - - do { - bRet = FreeBusyHead(); - } while (!bRet); -} \ No newline at end of file diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/BufferQueue.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/BufferQueue.h deleted file mode 100644 index bad27f7..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/BufferQueue.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once - -#include - -class CBufferQueue -{ -public: - CBufferQueue(); - ~CBufferQueue(); - - BOOL Create(int nUnitCount, SIZE_T nBytesPreUnit); - BOOL Close(); - - SIZE_T GetBytesPreUnit() const { return m_nBytesPreUnit; }; - int GetUnitCount() const { return m_nUnitCount; }; - int GetCurrentCount() const { return m_nCurrentCount; }; - - int GetFreeCount() const; - int GetBusyCount() const; - - LPVOID AllocBuffer(BOOL bForceAlloc = FALSE); - - LPVOID GetBusyHead(); - - BOOL FreeBusyHead(); - void FreeAllBusyBlock(); - -private: - int m_nUnitCount; // 单元初始值 - int m_nCurrentCount; // 当前块数目 - SIZE_T m_nBytesPreUnit; - - CAtlList m_listFreeUnit; // 闲置单元 - CRITICAL_SECTION m_csAllocLock; // 内存块分配锁 - CRITICAL_SECTION m_csFreeLock; // 内存块释放锁 - - CAtlList m_listBusyUnit; // 非闲置单元 - CRITICAL_SECTION m_csBusyLock; // 忙表锁 -}; - diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/DShowPinHelper.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/DShowPinHelper.cpp deleted file mode 100644 index 98bda77..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/DShowPinHelper.cpp +++ /dev/null @@ -1,204 +0,0 @@ -#include "stdafx.h" -#include "DShowPinHelper.h" - -CDShowPinHelper::CDShowPinHelper() - : m_ptrFilter(NULL) -{ - -} - -CDShowPinHelper::~CDShowPinHelper() -{ - Close(); -} - -BOOL CDShowPinHelper::Open(IBaseFilter* ptrFilter) -{ - ATLASSERT(ptrFilter != NULL); - - HRESULT hResult = S_OK; - CComPtr ptrEnumPins = NULL; - CComPtr ptrPin = NULL; - - m_ptrFilter = ptrFilter; - return TRUE; -} - -void CDShowPinHelper::Close() -{ - m_ptrFilter = NULL; -} - -int CDShowPinHelper::GetPinCount() -{ - ATLASSERT(m_ptrFilter != NULL); - - if (m_ptrFilter == NULL) - return 0; - - HRESULT hResult = S_OK; - CComPtr ptrEnumPins = NULL; - CComPtr ptrPin = NULL; - int nPinCount = 0; - - hResult = m_ptrFilter->EnumPins(&ptrEnumPins); - if (hResult != S_OK) - return 0; - - while (TRUE) { - ptrPin = NULL; - hResult = ptrEnumPins->Next(1, &ptrPin, NULL); - if (hResult != S_OK) - break; - - nPinCount++; - } - - return nPinCount; -} - -BOOL CDShowPinHelper::GetPinDirection(int nIndex, PIN_DIRECTION *pDirection) -{ - ATLASSERT(pDirection != NULL); - ATLASSERT(m_ptrFilter != NULL); - - if (pDirection == NULL || m_ptrFilter == NULL) - return FALSE; - - HRESULT hResult = S_OK; - CComPtr ptrEnumPins = NULL; - CComPtr ptrPin = NULL; - int nCount = 0; - - hResult = m_ptrFilter->EnumPins(&ptrEnumPins); - if (hResult != S_OK) - return FALSE; - - while (TRUE) { - ptrPin = NULL; - hResult = ptrEnumPins->Next(1, &ptrPin, NULL); - if (hResult != S_OK) - break; - - if (nIndex == nCount) { - hResult = ptrPin->QueryDirection(pDirection); - return hResult == S_OK ? TRUE : FALSE; - } - - nCount++; - } - - return FALSE; -} - -BOOL CDShowPinHelper::GetPin(int nIndex, IPin **pptrPin) -{ - ATLASSERT(m_ptrFilter != NULL); - - if (m_ptrFilter == NULL) - return FALSE; - - HRESULT hResult = S_OK; - CComPtr ptrEnumPins = NULL; - CComPtr ptrPin = NULL; - int nCount = 0; - - hResult = m_ptrFilter->EnumPins(&ptrEnumPins); - if (hResult != S_OK) - return FALSE; - - while (TRUE) { - ptrPin = NULL; - hResult = ptrEnumPins->Next(1, &ptrPin, NULL); - if (hResult != S_OK) - break; - - if (nIndex == nCount) { - hResult = ptrPin.CopyTo(pptrPin); - return hResult == S_OK ? TRUE : FALSE; - } - - nCount++; - } - - return FALSE; -} - -BOOL CDShowPinHelper::FindUnconnectedPin(PIN_DIRECTION PinDir, IPin **pptrPin) -{ - HRESULT hResult = S_OK; - CComPtr ptrEnumPins = NULL; - CComPtr ptrPin = NULL; - BOOL bMatch = FALSE; - - hResult = m_ptrFilter->EnumPins(&ptrEnumPins); - if (hResult != S_OK) - return FALSE; - - while (TRUE) { - ptrPin = NULL; - hResult = ptrEnumPins->Next(1, &ptrPin, NULL); - if (hResult != S_OK) - return FALSE; - - if (!CDShowPinHelper::MatchPin(ptrPin, PinDir, FALSE, &bMatch)) - return FALSE; - - if (bMatch) { - hResult = ptrPin.CopyTo(pptrPin); - return TRUE; - } - } - - return FALSE; -} - -BOOL CDShowPinHelper::IsPinConnected(IPin *pPin, BOOL *pIsConnected) -{ - CComPtr ptrTmpPin = NULL; - BOOL bConnected = FALSE; - - HRESULT hResult = pPin->ConnectedTo(&ptrTmpPin); - if (SUCCEEDED(hResult)) { - *pIsConnected = TRUE; - return TRUE; - } - else if (hResult == VFW_E_NOT_CONNECTED) { - *pIsConnected = FALSE; - return TRUE; - } - - return FALSE; -} - -BOOL CDShowPinHelper::MatchPin(IPin *pPin, PIN_DIRECTION direction, BOOL bIsConnected, BOOL *pMatch) -{ - ATLASSERT(pPin != NULL); - - BOOL bMatch = FALSE; - - BOOL bSuccess = CDShowPinHelper::IsPinConnected(pPin, &bIsConnected); - if (!bSuccess) - return FALSE; - - if (bIsConnected == bIsConnected) - bSuccess = IsPinDirection(pPin, direction, &bMatch); - - if (bSuccess) - *pMatch = bMatch; - - return bSuccess; -} - -BOOL CDShowPinHelper::IsPinDirection(IPin *pPin, PIN_DIRECTION dir, BOOL *pMatch) -{ - PIN_DIRECTION pinDir; - HRESULT hResult = pPin->QueryDirection(&pinDir); - - if (SUCCEEDED(hResult)) { - *pMatch = (pinDir == dir); - return TRUE; - } - - return FALSE; -} \ No newline at end of file diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/DShowPinHelper.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/DShowPinHelper.h deleted file mode 100644 index 872276d..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/DShowPinHelper.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include -#include - -#include - -class CDShowPinHelper -{ -public: - CDShowPinHelper(); - ~CDShowPinHelper(); - - BOOL Open(IBaseFilter* ptrFilter); - void Close(); - - int GetPinCount(); - - BOOL GetPinDirection(int nIndex, PIN_DIRECTION *pDirection); - BOOL GetPin(int nIndex, IPin **pptrPin); - BOOL FindUnconnectedPin(PIN_DIRECTION PinDir, IPin **pptrPin); - - static BOOL IsPinConnected(IPin *pPin, BOOL *pIsConnected); - static BOOL MatchPin(IPin *pPin, PIN_DIRECTION direction, BOOL bIsConnected, BOOL *pMatch); - static BOOL IsPinDirection(IPin *pPin, PIN_DIRECTION dir, BOOL *pMatch); -private: - CComPtr m_ptrFilter; -}; diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/ExtendAudioFrameObserver.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/ExtendAudioFrameObserver.cpp deleted file mode 100644 index ef9c6e5..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/ExtendAudioFrameObserver.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "stdafx.h" -#include "ExtendAudioFrameObserver.h" - - -CExtendAudioFrameObserver::CExtendAudioFrameObserver() -{ -} - - -CExtendAudioFrameObserver::~CExtendAudioFrameObserver() -{ -} - -bool CExtendAudioFrameObserver::onRecordAudioFrame(AudioFrame& audioFrame) -{ - SIZE_T nSize = audioFrame.channels*audioFrame.samples * 2; - CAudioCapturePackageQueue::GetInstance()->PopAudioPackage(audioFrame.buffer, &nSize); - - return true; -} - -bool CExtendAudioFrameObserver::onPlaybackAudioFrame(AudioFrame& audioFrame) -{ - SIZE_T nSize = audioFrame.channels*audioFrame.samples * 2; - CAudioPlayPackageQueue::GetInstance()->PushAudioPackage(audioFrame.buffer, nSize); - - return true; -} - -bool CExtendAudioFrameObserver::onMixedAudioFrame(AudioFrame& audioFrame) -{ - return true; -} - -bool CExtendAudioFrameObserver::onPlaybackAudioFrameBeforeMixing(unsigned int uid, AudioFrame& audioFrame) -{ - return true; -} diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/ExtendAudioFrameObserver.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/ExtendAudioFrameObserver.h deleted file mode 100644 index 00d379c..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/ExtendAudioFrameObserver.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once -#include "../SDK/include/IAgoraMediaEngine.h" - -#include "AudioCapturePackageQueue.h" -#include "AudioPlayPackageQueue.h" - - -class CExtendAudioFrameObserver : - public agora::media::IAudioFrameObserver -{ -public: - CExtendAudioFrameObserver(); - ~CExtendAudioFrameObserver(); - - virtual bool onRecordAudioFrame(AudioFrame& audioFrame); - virtual bool onPlaybackAudioFrame(AudioFrame& audioFrame); - virtual bool onMixedAudioFrame(AudioFrame& audioFrame); - virtual bool onPlaybackAudioFrameBeforeMixing(unsigned int uid, AudioFrame& audioFrame); -}; - diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/VideoPackageQueue.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/VideoPackageQueue.cpp deleted file mode 100644 index e3a33ab..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/VideoPackageQueue.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "stdafx.h" -#include "VideoPackageQueue.h" - - -CVideoPackageQueue *CVideoPackageQueue::m_lpVideoPackageQueue = NULL; - -CVideoPackageQueue::CVideoPackageQueue() -{ - m_nPackageSize = 0; - m_nBufferSize = 0x800000; - m_bufQueue.Create(32, 0x800000); -} - - -CVideoPackageQueue::~CVideoPackageQueue() -{ - m_bufQueue.FreeAllBusyBlock(); - m_bufQueue.Close(); -} - -CVideoPackageQueue *CVideoPackageQueue::GetInstance() -{ - if (m_lpVideoPackageQueue == NULL) - m_lpVideoPackageQueue = new CVideoPackageQueue(); - - return m_lpVideoPackageQueue; -} - -void CVideoPackageQueue::CloseInstance() -{ - if (m_lpVideoPackageQueue == NULL) - return; - - delete m_lpVideoPackageQueue; - m_lpVideoPackageQueue = NULL; -} - -void CVideoPackageQueue::SetVideoFormat(const BITMAPINFOHEADER *lpInfoHeader) -{ - memcpy_s(&m_bmiHeader, sizeof(BITMAPINFOHEADER), lpInfoHeader, sizeof(BITMAPINFOHEADER)); - - m_nPackageSize = m_bmiHeader.biWidth*m_bmiHeader.biWidth * 3 / 2; - _ASSERT(m_nPackageSize <= m_nBufferSize); -} - -void CVideoPackageQueue::GetVideoFormat(BITMAPINFOHEADER *lpInfoHeader) -{ - memcpy_s(lpInfoHeader, sizeof(BITMAPINFOHEADER), &m_bmiHeader, sizeof(BITMAPINFOHEADER)); -} - -BOOL CVideoPackageQueue::PushVideoPackage(LPCVOID lpVideoPackage, SIZE_T nPackageLen) -{ - if (m_bufQueue.GetFreeCount() == 0) - m_bufQueue.FreeBusyHead(); - - LPVOID lpBuffer = m_bufQueue.AllocBuffer(FALSE); - if (lpBuffer == NULL) - return FALSE; - - _ASSERT(m_bufQueue.GetBytesPreUnit() >= nPackageLen); - - memcpy_s(lpBuffer, m_bufQueue.GetBytesPreUnit(), lpVideoPackage, nPackageLen); - - return TRUE; -} - -BOOL CVideoPackageQueue::PopVideoPackage(LPVOID lpVideoPackage, SIZE_T *nPackageSize) -{ - _ASSERT(nPackageSize != NULL); - - if (nPackageSize == 0) - return FALSE; - - if (m_bufQueue.GetBusyCount() == 0) - return FALSE; - - if (*nPackageSize < m_nPackageSize) { - *nPackageSize = m_nPackageSize; - return FALSE; - } - - LPVOID lpBuffer = m_bufQueue.GetBusyHead(); - memcpy_s(lpVideoPackage, *nPackageSize, lpBuffer, m_nPackageSize); - *nPackageSize = m_nPackageSize; - m_bufQueue.FreeBusyHead(); - - return TRUE; -} \ No newline at end of file diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/VideoPackageQueue.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/VideoPackageQueue.h deleted file mode 100644 index 00c3378..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/VideoPackageQueue.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include "BufferQueue.h" - -class CVideoPackageQueue -{ -protected: - CVideoPackageQueue(); - ~CVideoPackageQueue(); - -public: - static CVideoPackageQueue *GetInstance(); - static void CloseInstance(); - - void SetVideoFormat(const BITMAPINFOHEADER *lpInfoHeader); - void GetVideoFormat(BITMAPINFOHEADER *lpInfoHeader); - - BOOL PushVideoPackage(LPCVOID lpAudioPackage, SIZE_T nPackageLen); - BOOL PopVideoPackage(LPVOID lpVideoPackage, SIZE_T *nPackageSize); - - SIZE_T GetVideoPackageSize() const { return m_nPackageSize; }; - SIZE_T GetBufferSize() const { return m_nBufferSize; }; - -private: - CBufferQueue m_bufQueue; - BITMAPINFOHEADER m_bmiHeader; - SIZE_T m_nPackageSize; - SIZE_T m_nBufferSize; - - static CVideoPackageQueue *m_lpVideoPackageQueue; -}; - - diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/YUVTrans.cpp b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/YUVTrans.cpp deleted file mode 100644 index cc130b8..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/YUVTrans.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include "stdafx.h" -#include "YUVTrans.h" - -const int CYUVTrans::m_nfv1Table[256] = { -180, -179, -177, -176, -174, -173, -172, -170, -169, -167, -166, -165, -163, -162, -160, -159, -158, -156, -155, -153, -152, -151, -149, -148, -146, -145, -144, -142, -141, -139, -138, -137, -135, -134, -132, -131, -130, -128, -127, -125, -124, -123, -121, -120, -118, -117, -115, -114, -113, -111, -110, -108, -107, -106, -104, -103, -101, -100, -99, -97, -96, -94, -93, -92, -90, -89, -87, -86, -85, -83, -82, -80, -79, -78, -76, -75, -73, -72, -71, -69, -68, -66, -65, -64, -62, -61, -59, -58, -57, -55, -54, -52, -51, -50, -48, -47, -45, -44, -43, -41, -40, -38, -37, -36, -34, -33, -31, -30, -29, -27, -26, -24, -23, -22, -20, -19, -17, -16, -15, -13, -12, -10, -9, -8, -6, -5, -3, -2, 0, 1, 2, 4, 5, 7, 8, 9, 11, 12, 14, 15, 16, 18, 19, 21, 22, 23, 25, 26, 28, 29, 30, 32, 33, 35, 36, 37, 39, 40, 42, 43, 44, 46, 47, 49, 50, 51, 53, 54, 56, 57, 58, 60, 61, 63, 64, 65, 67, 68, 70, 71, 72, 74, 75, 77, 78, 79, 81, 82, 84, 85, 86, 88, 89, 91, 92, 93, 95, 96, 98, 99, 100, 102, 103, 105, 106, 107, 109, 110, 112, 113, 114, 116, 117, 119, 120, 122, 123, 124, 126, 127, 129, 130, 131, 133, 134, 136, 137, 138, 140, 141, 143, 144, 145, 147, 148, 150, 151, 152, 154, 155, 157, 158, 159, 161, 162, 164, 165, 166, 168, 169, 171, 172, 173, 175, 176, 178 }; -const int CYUVTrans::m_nfv2Table[256] = { -92, -91, -91, -90, -89, -88, -88, -87, -86, -86, -85, -84, -83, -83, -82, -81, -81, -80, -79, -78, -78, -77, -76, -76, -75, -74, -73, -73, -72, -71, -71, -70, -69, -68, -68, -67, -66, -66, -65, -64, -63, -63, -62, -61, -61, -60, -59, -58, -58, -57, -56, -56, -55, -54, -53, -53, -52, -51, -51, -50, -49, -48, -48, -47, -46, -46, -45, -44, -43, -43, -42, -41, -41, -40, -39, -38, -38, -37, -36, -36, -35, -34, -33, -33, -32, -31, -31, -30, -29, -28, -28, -27, -26, -26, -25, -24, -23, -23, -22, -21, -21, -20, -19, -18, -18, -17, -16, -16, -15, -14, -13, -13, -12, -11, -11, -10, -9, -8, -8, -7, -6, -6, -5, -4, -3, -3, -2, -1, 0, 0, 1, 2, 2, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 12, 13, 14, 15, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, 24, 25, 25, 26, 27, 27, 28, 29, 30, 30, 31, 32, 32, 33, 34, 35, 35, 36, 37, 37, 38, 39, 40, 40, 41, 42, 42, 43, 44, 45, 45, 46, 47, 47, 48, 49, 50, 50, 51, 52, 52, 53, 54, 55, 55, 56, 57, 57, 58, 59, 60, 60, 61, 62, 62, 63, 64, 65, 65, 66, 67, 67, 68, 69, 70, 70, 71, 72, 72, 73, 74, 75, 75, 76, 77, 77, 78, 79, 80, 80, 81, 82, 82, 83, 84, 85, 85, 86, 87, 87, 88, 89, 90, 90 }; -const int CYUVTrans::m_nfu1Table[256] = { -44, -44, -44, -43, -43, -43, -42, -42, -42, -41, -41, -41, -40, -40, -40, -39, -39, -39, -38, -38, -38, -37, -37, -37, -36, -36, -36, -35, -35, -35, -34, -34, -33, -33, -33, -32, -32, -32, -31, -31, -31, -30, -30, -30, -29, -29, -29, -28, -28, -28, -27, -27, -27, -26, -26, -26, -25, -25, -25, -24, -24, -24, -23, -23, -22, -22, -22, -21, -21, -21, -20, -20, -20, -19, -19, -19, -18, -18, -18, -17, -17, -17, -16, -16, -16, -15, -15, -15, -14, -14, -14, -13, -13, -13, -12, -12, -11, -11, -11, -10, -10, -10, -9, -9, -9, -8, -8, -8, -7, -7, -7, -6, -6, -6, -5, -5, -5, -4, -4, -4, -3, -3, -3, -2, -2, -2, -1, -1, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43 }; -const int CYUVTrans::m_nfu2Table[256] = { -227, -226, -224, -222, -220, -219, -217, -215, -213, -212, -210, -208, -206, -204, -203, -201, -199, -197, -196, -194, -192, -190, -188, -187, -185, -183, -181, -180, -178, -176, -174, -173, -171, -169, -167, -165, -164, -162, -160, -158, -157, -155, -153, -151, -149, -148, -146, -144, -142, -141, -139, -137, -135, -134, -132, -130, -128, -126, -125, -123, -121, -119, -118, -116, -114, -112, -110, -109, -107, -105, -103, -102, -100, -98, -96, -94, -93, -91, -89, -87, -86, -84, -82, -80, -79, -77, -75, -73, -71, -70, -68, -66, -64, -63, -61, -59, -57, -55, -54, -52, -50, -48, -47, -45, -43, -41, -40, -38, -36, -34, -32, -31, -29, -27, -25, -24, -22, -20, -18, -16, -15, -13, -11, -9, -8, -6, -4, -2, 0, 1, 3, 5, 7, 8, 10, 12, 14, 15, 17, 19, 21, 23, 24, 26, 28, 30, 31, 33, 35, 37, 39, 40, 42, 44, 46, 47, 49, 51, 53, 54, 56, 58, 60, 62, 63, 65, 67, 69, 70, 72, 74, 76, 78, 79, 81, 83, 85, 86, 88, 90, 92, 93, 95, 97, 99, 101, 102, 104, 106, 108, 109, 111, 113, 115, 117, 118, 120, 122, 124, 125, 127, 129, 131, 133, 134, 136, 138, 140, 141, 143, 145, 147, 148, 150, 152, 154, 156, 157, 159, 161, 163, 164, 166, 168, 170, 172, 173, 175, 177, 179, 180, 182, 184, 186, 187, 189, 191, 193, 195, 196, 198, 200, 202, 203, 205, 207, 209, 211, 212, 214, 216, 218, 219, 221, 223, 225 }; - -CYUVTrans::CYUVTrans() -{ -} - - -CYUVTrans::~CYUVTrans() -{ -} - - -BOOL CYUVTrans::I420ToRGB24(const LPBYTE lpYUVBuffer, LPBYTE lpBGR24Buffer, SIZE_T nRGBBufSize, int nWidth, int nHeight) -{ - if (nRGBBufSize < nWidth*nHeight * 3) - return FALSE; - - DWORD dwPixelSize = nWidth * nHeight; - unsigned char* yData = const_cast(lpYUVBuffer); - unsigned char* vData = &yData[dwPixelSize]; - unsigned char* uData = &vData[dwPixelSize >> 2]; - - int bgr[3]; - int yIdx, uIdx, vIdx, idx; - int rdif, invgdif, bdif; - for (int i = 0; i < nHeight; i++){ - for (int j = 0; j < nWidth; j++){ - yIdx = i * nWidth + j; - vIdx = (i / 2) * (nWidth / 2) + (j / 2); - uIdx = vIdx; - - rdif = m_nfv1Table[vData[vIdx]]; - invgdif = m_nfu1Table[uData[uIdx]] + m_nfv2Table[vData[vIdx]]; - bdif = m_nfu2Table[uData[uIdx]]; - - /* YUV420 to BGR24 */ - bgr[0] = yData[yIdx] + rdif; //R - bgr[1] = yData[yIdx] - invgdif; //G - bgr[2] = yData[yIdx] + bdif; //B - - for (int k = 0; k < 3; k++){ - idx = (i * nWidth + j) * 3 + k; - if (bgr[k] >= 0 && bgr[k] <= 255) - lpBGR24Buffer[idx] = bgr[k]; - else - lpBGR24Buffer[idx] = (bgr[k] < 0) ? 0 : 255; - } - } - } - - return TRUE; -} - -BOOL CYUVTrans::RGB24ToI420(const LPBYTE lpBGR24Buffer, LPBYTE lpYUVBuffer, SIZE_T nYUVBufSize, int nWidth, int nHeight) -{ - if (nYUVBufSize < nWidth*nHeight * 3 / 2) - return FALSE; - - LPBYTE lpBufRGB = NULL; - LPBYTE lpBufYUV = NULL; - - LPBYTE lpBufY = lpYUVBuffer; - LPBYTE lpBufV = lpYUVBuffer + nWidth * nHeight; - LPBYTE lpBufU = lpBufV + (nWidth * nHeight * 1 / 4); - - unsigned int ylen = nWidth * nHeight; - unsigned int ulen = (nWidth * nHeight) / 4; - unsigned int vlen = (nWidth * nHeight) / 4; - - for (int j = 0; j > 8) + 16; - BYTE u = (BYTE)((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128; - BYTE v = (BYTE)((112 * r - 94 * g - 18 * b + 128) >> 8) + 128; - - *(lpBufY++) = max(0, min(y, 255)); // Y - - if (j % 2 == 0 && i % 2 == 0) { - if (u>255) - u = 255; - - if (u<0) - u = 0; - - *(lpBufU++) = u; // U - - } - else { - if (i % 2 == 0) { - if (v>255) - v = 255; - - if (v<0) - v = 0; - - *(lpBufV++) = v; // V - } - } - } - } - - return TRUE; -} - -BOOL CYUVTrans::YUY2ToI420(const LPBYTE lpYUY2Buffer, LPBYTE lpYUVBuffer, SIZE_T nYUVBufSize, int nWidth, int nHeight) -{ - if (nYUVBufSize < nWidth*nHeight * 3 / 2) - return FALSE; - - BYTE *lpUBuf = lpYUVBuffer + (nWidth * nHeight); - BYTE *lpVBuf = lpUBuf + (nWidth * nHeight) / 4; - - for (int i = 0; i < nHeight / 2; i++) - { - - BYTE *lpYUY2Bufl1 = lpYUY2Buffer + nWidth * 2 * 2 * i; - BYTE *lpYUY2Bufl2 = lpYUY2Bufl1 + nWidth * 2; - - BYTE *lpYUVBufl1 = lpYUVBuffer + nWidth * 2 * i; - BYTE *lpYUVBufl2 = lpYUVBufl1 + nWidth; - - for (int j = 0; j < nWidth / 2; j++) - { - *lpYUVBufl1++ = lpYUY2Bufl1[0]; - *lpUBuf++ = lpYUY2Bufl1[1]; - *lpYUVBufl1++ = lpYUY2Bufl1[2]; - *lpVBuf++ = lpYUY2Bufl1[3]; - *lpYUVBufl2++ = lpYUY2Bufl2[0]; - *lpYUVBufl2++ = lpYUY2Bufl2[2]; - lpYUY2Bufl1 += 4; - lpYUY2Bufl2 += 4; - } - } - - return TRUE; -} - -BOOL CYUVTrans::UYVYToI420(const LPBYTE lpUYVYBuffer, LPBYTE lpYUVBuffer, SIZE_T nYUVBufSize, int nWidth, int nHeight) -{ - if (nYUVBufSize < nWidth*nHeight * 3 / 2) - return FALSE; - - BYTE *lpYBuf = lpYUVBuffer; - BYTE *lpUBuf = lpYUVBuffer + (nWidth * nHeight); - BYTE *lpVBuf = lpUBuf + (nWidth * nHeight) / 4; - - BYTE *lpBufUYVY = lpUYVYBuffer; - - for (int i = 0; i < nHeight; i += 1) { - - for (int j = 0; j < nWidth; j += 2) { - - lpYBuf[i*nWidth + j] = lpBufUYVY[1]; - lpYBuf[i*nWidth + j + 1] = lpBufUYVY[3]; - - lpUBuf[i*nWidth / 4 + j / 2] = lpBufUYVY[0]; - lpVBuf[i*nWidth / 4 + j / 2] = lpBufUYVY[2]; - - lpBufUYVY += 4; - } - } - - return TRUE; -} diff --git a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/YUVTrans.h b/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/YUVTrans.h deleted file mode 100644 index 2b4b284..0000000 --- a/Windows/Agora-Media-Source-Windows/AgoraMediaSource/bak/YUVTrans.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -/* -attention:do not use this class in the formal production, it has not been tested! - -walker05 @agora -*/ - -class CYUVTrans -{ -public: - CYUVTrans(); - ~CYUVTrans(); - - static BOOL I420ToRGB24(const LPBYTE lpYUVBuffer, LPBYTE lpBGR24Buffer, SIZE_T nRGBBufSize, int nWidth, int nHeight); - - static BOOL RGB24ToI420(const LPBYTE lpBGR24Buffer, LPBYTE lpYUVBuffer, SIZE_T nYUVBufSize, int nWidth, int nHeight); - - static BOOL YUY2ToI420(const LPBYTE lpYUY2Buffer, LPBYTE lpYUVBuffer, SIZE_T nYUVBufSize, int nWidth, int nHeight); - - static BOOL UYVYToI420(const LPBYTE lpUYVYBuffer, LPBYTE lpYUVBuffer, SIZE_T nYUVBufSize, int nWidth, int nHeight); -private: - static const int m_nfv1Table[256]; - static const int m_nfv2Table[256]; - static const int m_nfu1Table[256]; - static const int m_nfu2Table[256]; -}; - diff --git a/Windows/Agora-Media-Source-Windows/release_vs2013.bat b/Windows/Agora-Media-Source-Windows/release_vs2013.bat deleted file mode 100644 index 2c409e4..0000000 --- a/Windows/Agora-Media-Source-Windows/release_vs2013.bat +++ /dev/null @@ -1,25 +0,0 @@ -pushd Release -pushd Language - -del *.exp -del *.pdb -del *.lib - -popd Language - -del *.pdb -del *.log - -IF NOT EXIST msvcp120.dll ( - copy C:\Windows\SysWOW64\msvcp120.dll -) - -IF NOT EXIST msvcr120.dll ( - copy C:\Windows\SysWOW64\msvcr120.dll -) - -IF NOT EXIST mfc120u.dll ( - copy C:\Windows\SysWOW64\mfc120u.dll -) -popd Release -pause \ No newline at end of file diff --git a/Windows/cicd/templates/build-Windows-Extend.yml b/Windows/cicd/templates/build-Windows-Extend.yml deleted file mode 100644 index ecf2d9b..0000000 --- a/Windows/cicd/templates/build-Windows-Extend.yml +++ /dev/null @@ -1,81 +0,0 @@ -# .NET Desktop -# Build and run tests for .NET Desktop or Windows classic desktop solutions. -# Add steps that publish symbols, save build artifacts, and more: -# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net - -parameters: - displayName: '' - workingDirectory: '' - scheme: '' - sdkurl: '' - solutionName: '' - downloadGithubSDK: HookSDK.zip - userRepository: '' - sdkunzipPath: '' -jobs: - - job: ${{ parameters.displayName }}Build - displayName: ${{ parameters.displayName }} - - pool: - vmImage: 'vs2017-win2016' - - variables: - solution: '${{ parameters.workingDirectory }}/${{ parameters.solutionName }}' - buildPlatform: 'win32' - buildConfiguration: 'Release' - - steps: - - script: echo "${{ parameters.sdkurl }}" && ls - - powershell: Windows/cicd/script/downloadsdk.ps1 "${{ parameters.sdkurl }}" - - task: DownloadGitHubRelease@0 - inputs: - connection: '' - userRepository: ${{ parameters.userRepository }} - defaultVersionType: 'latest' - version: 'hooksdk' - itemPattern: '*${{ parameters.downloadGithubSDK }}*' - downloadPath: ${{ parameters.workingDirectory }} - - - task: ExtractFiles@1 - inputs: - archiveFilePatterns: ${{ parameters.workingDirectory }}/${{ parameters.downloadGithubSDK }} - destinationFolder: ${{ parameters.workingDirectory }}/HookSDK - - - script: cd ${{ parameters.workingDirectory }}/HookSDK && ls - - script: cd ${{ parameters.workingDirectory }}/HookSDK/lib && ls - - - - task: ExtractFiles@1 - inputs: - archiveFilePatterns: 'AgoraSDK.zip' - destinationFolder: 'AgoraSDK' - - - task: CopyFiles@2 - inputs: - sourceFolder: ${{ parameters.sdkunzipPath }}/sdk - targetFolder: ${{ parameters.workingDirectory }}/sdk - - script: cd ${{ parameters.workingDirectory }} && ls - - - task: VSBuild@1 - inputs: - solution: '$(solution)' - platform: '$(buildPlatform)' - configuration: '$(buildConfiguration)' - vsVersion: '15.0' - msbuildArchitecture: 'x86' - - - task: ArchiveFiles@2 - inputs: - rootFolderOrFile: '${{ parameters.workingDirectory }}/Release/' - includeRootFolder: true - archiveType: 'zip' - archiveFile: ${{ parameters.workingDirectory }}/${{ parameters.displayName }}.zip - replaceExistingArchive: true - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: ${{ parameters.workingDirectory }}/${{ parameters.displayName }}.zip - ArtifactName: ${{ parameters.displayName }} - - - diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 569773d..6f70fa8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,9 +4,9 @@ # https://docs.microsoft.com/azure/devops/pipelines/languages/android trigger: -- master -- dev/* -- release/3.0.0 +#- master +#- dev/* +- 3.0.0 pool: vmImage: 'macos-latest' @@ -14,8 +14,93 @@ pool: variables: iOSRTCSDK: 'https://download.agora.io/sdk/release/Agora_Native_SDK_for_iOS_v3_0_0_FULL.zip?_ga=2.79185814.368877217.1583320605-5559409.1503304822' MacRTCSDK: 'https://download.agora.io/sdk/release/Agora_Native_SDK_for_Mac_v3_0_0_FULL.zip?_ga=2.78400662.368877217.1583320605-5559409.1503304822' + WindowsRTCSDK: 'https://download.agora.io/sdk/release/Agora_Native_SDK_for_Windows(x86)_v3_0_0_FULL.zip' + ConnectionName: sbd021 + RepoName: sbd021 + jobs: + +- template: Android/azure-templates/build-android.yml + parameters: + project: 'Android' + module: 'sample-switch-external-video' + name: 'SwitchVideoInputAndroid' + +- template: Android/azure-templates/build-android.yml + parameters: + project: 'Android' + module: 'sample-video-encrypt' + name: 'VideoEncryptionAndroid' + +- template: Android/azure-templates/build-android.yml + parameters: + project: 'Android' + module: 'sample-custom-render' + name: 'CustomRendererAndroid' + +- template: iOS&macOS/build-template/build-ios.yml + parameters: + displayName: 'AgoraCustomMediaDevice' + workingDirectory: 'iOS&macOS/Agora-Custom-Media-Device' + scheme: 'Agora-Custom-Media-Device' + sdkurl: $(iOSRTCSDK) + +- template: iOS&macOS/build-template/build-ios.yml + parameters: + displayName: 'AgoraPluginRawDataAPIiOSObjectiveC' + workingDirectory: 'iOS&macOS/Agora-Plugin-Raw-Data-API-Objective-C' + scheme: 'Agora-Plugin-Raw-Data-API-iOS-Objective-C' + sdkurl: $(iOSRTCSDK) + +- template: iOS&macOS/build-template/build-ios.yml + parameters: + displayName: 'AgoraScreenSharing' + workingDirectory: 'iOS&macOS/Agora-Screen-Sharing' + scheme: 'Agora-Plugin-Raw-Data-API-iOS-Objective-C' + sdkurl: $(iOSRTCSDK) + +- template: iOS&macOS/build-template/build-ios.yml + parameters: + displayName: 'AgoraVideoSource' + workingDirectory: 'iOS&macOS/Agora-Video-Source' + scheme: 'Agora-Screen-Sharing' + sdkurl: $(iOSRTCSDK) + +- template: iOS&macOS/build-template/build-ios.yml + parameters: + displayName: 'AgoraVideoWithARKit' + workingDirectory: 'iOS&macOS/Agora-Video-With-ARKit' + scheme: 'Agora-Video-With-ARKit' + sdkurl: $(iOSRTCSDK) + #Windows Demo +- template: Windows/cicd/templates/build-Windows.yml + parameters: + displayName: 'AgoraStringAccountWindows' + workingDirectory: 'Windows/Agora-String-Account-Windows' + scheme: 'Agora-String-Account-Windows' + sdkurl: $(WindowsRTCSDK) + solutionName: 'OpenLive.sln' + sdkunzipPath: 'AgoraSDK/Agora_Native_SDK_for_Windows_v3.0.0_FULL' + +- template: Windows/cicd/templates/build-Windows.yml + parameters: + displayName: 'LargeGroupVideoChatWindows' + workingDirectory: 'Windows/LargeGroupVideoChat-Windows' + scheme: 'LargeGroupVideoChat-Windowss' + sdkurl: $(WindowsRTCSDK) + solutionName: 'AgoraOpenLive.sln' + sdkunzipPath: 'AgoraSDK/Agora_Native_SDK_for_Windows_v3.0.0_FULL' + +- template: Windows/cicd/templates/build-Windows.yml + parameters: + displayName: 'AgoraScreenSharingWindows' + workingDirectory: 'Windows/Agora-Screen-Sharing-Windows' + scheme: 'Agora-Screen-Sharing-Windows' + sdkurl: $(WindowsRTCSDK) + solutionName: 'OpenLive.sln' + sdkunzipPath: 'AgoraSDK/Agora_Native_SDK_for_Windows_v3.0.0_FULL' + #hook demo - template: Windows/cicd/templates/build-Windows-Hook.yml parameters: @@ -24,7 +109,6 @@ jobs: scheme: 'Agora-RTC-Hooking-API-Windows' sdkurl: $(WindowsRTCSDK) solutionName: 'AgoraHooking.sln' - downloadGithubSDK: HookSDK.zip sdkVersion: '3_0_0' sdkFolderVersion: '3.0.0' Machine: x86 @@ -36,7 +120,6 @@ jobs: scheme: 'Agora-RTC-Hooking-API-Windows-kuwo' sdkurl: $(WindowsRTCSDK) solutionName: 'AgoraHooking.sln' - downloadGithubSDK: HookSDK.zip sdkVersion: '3_0_0' sdkFolderVersion: '3.0.0' Machine: x86 @@ -50,7 +133,7 @@ jobs: solutionName: 'AgoraHooking.sln' sdkVersion: '3_0_0' sdkFolderVersion: '3.0.0' - Machine: x86 + Machine: x86 - template: Windows/cicd/templates/build-Windows-dshow.yml parameters: @@ -61,4 +144,4 @@ jobs: solutionName: 'AgoraMediaSource.sln' sdkVersion: '3_0_0' sdkFolderVersion: '3.0.0' - Machine: x86 + Machine: x86 \ No newline at end of file