Skip to content

Commit

Permalink
Fix issue #19
Browse files Browse the repository at this point in the history
  • Loading branch information
sarandogou committed Feb 2, 2015
1 parent da4acfa commit 26ae452
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 20 deletions.
2 changes: 1 addition & 1 deletion common/_Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# define kPluginVersionMinor 2
#endif
#if !defined(kPluginVersionMicro)
# define kPluginVersionMicro 2
# define kPluginVersionMicro 3
#endif
#if !defined(kPluginVersionString)
# define kPluginVersionString WE_STRING(WE_CAT(kPluginVersionMajor, .)) WE_STRING(WE_CAT(kPluginVersionMinor, .)) WE_STRING(kPluginVersionMicro)
Expand Down
32 changes: 24 additions & 8 deletions common/_RTCDisplay.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ _VideoRenderer::_VideoRenderer(int width, int height, cpp11::function<void()> fn
: m_fnOnStartVideoRenderer(fnOnStartVideoRenderer)
#if WE_UNDER_WINDOWS
, m_Hwnd(NULL)
, m_lpUsrData(NULL)
#elif WE_UNDER_APPLE
, m_layer(NULL)
, m_context(NULL)
Expand Down Expand Up @@ -99,17 +100,20 @@ _VideoRenderer::~_VideoRenderer()
}

#if WE_UNDER_WINDOWS
void _VideoRenderer::SetHwnd(HWND hwnd)
void _VideoRenderer::SetHwnd(HWND hwnd, LONG_PTR lpUsrData)
{
_AutoLock<_VideoRenderer> lock(this);

m_Hwnd = hwnd;
m_lpUsrData = lpUsrData;
if (hwnd)
{
SetWindowLongPtr(hwnd, GWLP_USERDATA, lpUsrData);
}
}

HWND _VideoRenderer::GetHwnd()
{
_AutoLock<_VideoRenderer> lock(this);

return m_Hwnd;
}
#elif WE_UNDER_APPLE
Expand Down Expand Up @@ -241,12 +245,20 @@ size_t _VideoRenderer::CopyFromFrame(void* bufferPtr, size_t bufferSize)
}

#if WE_UNDER_WINDOWS
void _VideoRenderer::SetFnQuerySurfacePresentere(cpp11::function<void(CComPtr<ISurfacePresenter> &spPtr, CComPtr<ID3D10Texture2D> &spText, int &backBuffWidth, int &backBuffHeight)> fnQuerySurfacePresenter)
void _VideoRenderer::SetFnQuerySurfacePresenter(cpp11::function<void(CComPtr<ISurfacePresenter> &spPtr, CComPtr<ID3D10Texture2D> &spText, int &backBuffWidth, int &backBuffHeight)> fnQuerySurfacePresenter)
{
_AutoLock<_VideoRenderer> lock(this);

m_fnQuerySurfacePresenter = fnQuerySurfacePresenter;
}

void _VideoRenderer::SetFnQueryHwnd(cpp11::function<HWND()> fnQueryHwnd)
{
_AutoLock<_VideoRenderer> lock(this);

m_fnQueryHwnd = fnQueryHwnd;
}

#endif /* WE_UNDER_WINDOWS */

// VideoRendererInterface implementation
Expand Down Expand Up @@ -317,6 +329,10 @@ void _VideoRenderer::RenderFrame(const cricket::VideoFrame* frame)
m_bmi.bmiHeader.biSizeImage,
m_bmi.bmiHeader.biWidth *
m_bmi.bmiHeader.biBitCount / 8);

if (!m_Hwnd && m_fnQueryHwnd) {
SetHwnd(m_fnQueryHwnd(), m_lpUsrData);
}

if (m_Hwnd) {
InvalidateRect(m_Hwnd, NULL, TRUE);
Expand Down Expand Up @@ -390,9 +406,9 @@ void _RTCDisplay::StartVideoRenderer(VideoTrackInterfacePtr video)
_VideoRenderer* _video = new _VideoRenderer(1, 1, cpp11::bind(&_RTCDisplay::OnStartVideoRenderer, this), _v);
if (_video) {
#if WE_UNDER_WINDOWS
_video->SetFnQuerySurfacePresentere(cpp11::bind(&_RTCDisplay::QuerySurfacePresenter, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
_video->SetHwnd(Handle());
SetWindowLongPtr(_video->GetHwnd(), GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
_video->SetFnQuerySurfacePresenter(cpp11::bind(&_RTCDisplay::QuerySurfacePresenter, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
_video->SetFnQueryHwnd(cpp11::bind(&_RTCDisplay::QueryHwnd, this));
_video->SetHwnd(Handle(), reinterpret_cast<LONG_PTR>(this));
#elif WE_UNDER_APPLE
_video->SetLayer(Layer());
#endif
Expand All @@ -407,7 +423,7 @@ void _RTCDisplay::StopVideoRenderer()

#if WE_UNDER_WINDOWS
if (m_renderer) {
SetWindowLongPtr(m_renderer->GetHwnd(), GWLP_USERDATA, NULL);
m_renderer->SetHwnd(m_renderer->GetHwnd(), NULL);
}
#endif

Expand Down
11 changes: 9 additions & 2 deletions common/_RTCDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class _VideoRenderer : public webrtc::VideoRendererInterface
void Leave() { m_cs->Leave(); }

#if WE_UNDER_WINDOWS
void SetHwnd(HWND hwnd);
void SetHwnd(HWND hwnd, LONG_PTR lpUsrData);
HWND GetHwnd();
#elif WE_UNDER_APPLE
void SetLayer(CALayer *layer);
Expand All @@ -41,7 +41,8 @@ class _VideoRenderer : public webrtc::VideoRendererInterface
int GetVideoHeight();
size_t CopyFromFrame(void* bufferPtr, size_t bufferSize);
#if WE_UNDER_WINDOWS
void SetFnQuerySurfacePresentere(cpp11::function<void(CComPtr<ISurfacePresenter> &spPtr, CComPtr<ID3D10Texture2D> &spText, int &backBuffWidth, int &backBuffHeight)> fnQuerySurfacePresenter);
void SetFnQuerySurfacePresenter(cpp11::function<void(CComPtr<ISurfacePresenter> &spPtr, CComPtr<ID3D10Texture2D> &spText, int &backBuffWidth, int &backBuffHeight)> fnQuerySurfacePresenter);
void SetFnQueryHwnd(cpp11::function<HWND()> fnQueryHwnd);
#endif

// VideoRendererInterface implementation
Expand All @@ -56,8 +57,10 @@ class _VideoRenderer : public webrtc::VideoRendererInterface

#if WE_UNDER_WINDOWS
HWND m_Hwnd;
LONG_PTR m_lpUsrData;
BITMAPINFO m_bmi;
cpp11::function<void(CComPtr<ISurfacePresenter> &spPtr, CComPtr<ID3D10Texture2D> &spText, int &backBuffWidth, int &backBuffHeight)> m_fnQuerySurfacePresenter;
cpp11::function<HWND()> m_fnQueryHwnd;
#elif WE_UNDER_APPLE
CALayer *m_layer;
CGContextRef m_context;
Expand Down Expand Up @@ -101,6 +104,10 @@ class WEBRTC_EVERYWHERE_API _RTCDisplay
{
spPtr = NULL, spText = NULL, backBuffWidth = 0, backBuffHeight = 0;
}
virtual HWND QueryHwnd()
{
return Handle();
}
#elif WE_UNDER_APPLE
virtual CALayer *Layer() = 0;
#endif
Expand Down
Binary file modified common/webrtc-everywhere-common.rc
Binary file not shown.
Binary file modified ie/Debug/webrtc-everywhere.res
Binary file not shown.
8 changes: 4 additions & 4 deletions ie/webrtc-everywhere.rc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,0,2
PRODUCTVERSION 1,2,0,2
FILEVERSION 1,2,0,3
PRODUCTVERSION 1,2,0,3
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -75,12 +75,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Sarandogou"
VALUE "FileDescription", "WebRTC plugin for Safari, IE, Chrome, Opera and Firefox"
VALUE "FileVersion", "1.2.0.2"
VALUE "FileVersion", "1.2.0.3"
VALUE "LegalCopyright", "(c) 2014-2015 Sarandogou. All rights reserved."
VALUE "InternalName", "webrtc-everywhere-ie.dll"
VALUE "OriginalFilename", "webrtc-everywhere-ie.dll"
VALUE "ProductName", "WebRTC Everywhere Plugin"
VALUE "ProductVersion", "1.2.0.2"
VALUE "ProductVersion", "1.2.0.3"
END
END
BLOCK "VarFileInfo"
Expand Down
Binary file modified npapi/Release/webrtc-everywhere-npapi.res
Binary file not shown.
8 changes: 4 additions & 4 deletions npapi/webrtc-everywhere-npapi.rc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,0,2
PRODUCTVERSION 1,2,0,2
FILEVERSION 1,2,0,3
PRODUCTVERSION 1,2,0,3
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -71,13 +71,13 @@ BEGIN
BEGIN
VALUE "CompanyName", "Sarandogou"
VALUE "FileDescription", "WebRTC plugin for Safari, IE, Chrome, Opera and Firefox"
VALUE "FileVersion", "1.2.0.2"
VALUE "FileVersion", "1.2.0.3"
VALUE "InternalName", "npwebrtc-everywhere.dll"
VALUE "LegalCopyright", "(c) 2014-2015 Sarandogou. All rights reserved."
VALUE "MIMEType", "application/webrtc-everywhere"
VALUE "OriginalFilename", "npwebrtc-everywhere.dll"
VALUE "ProductName", "WebRTC Everywhere Plugin"
VALUE "ProductVersion", "1.2.0.2"
VALUE "ProductVersion", "1.2.0.3"
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion wininstall/innosetup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "webrtc-everywhere"
#define MyAppVersion "1.2.0.2"
#define MyAppVersion "1.2.0.3"
#define MyAppPublisher "Sarandogou"
#define MyAppURL "https://ns313841.ovh.net/webrtc/"

Expand Down

0 comments on commit 26ae452

Please sign in to comment.