Reason for revert: This breaks every buildbot in chromium.webrtc.fyi and I don't see any roll in progress to address this (and I don't see how that would be possible either). Usage in Chrome: https://code.google.com/p/chromium/codesearch#search/&q=modules.gyp%3Avideo_render&sq=package:chromium&type=cs Example failures: https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/5420 https://build.chromium.org/p/chromium.webrtc.fyi/builders/Win%20Builder/builds/4526 I think it's fine to delete our video_render_module_internal_impl target and those files, but video_render target needs to remain. Original issue's description: > Delete video_render module. > > BUG=webrtc:5817 > > Committed: https://crrev.com/97cfd1ec05d07ef233356e57f7aa4b028b74ffba > Cr-Commit-Position: refs/heads/master@{#12526} TBR=mflodman@webrtc.org,pbos@webrtc.org,nisse@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5817 Review-Url: https://codereview.webrtc.org/1923613003 Cr-Commit-Position: refs/heads/master@{#12534}
154 lines
4.8 KiB
C++
154 lines
4.8 KiB
C++
/*
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "webrtc/modules/video_render/linux/video_x11_channel.h"
|
|
#include "webrtc/modules/video_render/linux/video_x11_render.h"
|
|
|
|
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
|
#include "webrtc/system_wrappers/include/trace.h"
|
|
|
|
namespace webrtc {
|
|
|
|
VideoX11Render::VideoX11Render(Window window) :
|
|
_window(window),
|
|
_critSect(*CriticalSectionWrapper::CreateCriticalSection())
|
|
{
|
|
}
|
|
|
|
VideoX11Render::~VideoX11Render()
|
|
{
|
|
delete &_critSect;
|
|
}
|
|
|
|
int32_t VideoX11Render::Init()
|
|
{
|
|
CriticalSectionScoped cs(&_critSect);
|
|
|
|
_streamIdToX11ChannelMap.clear();
|
|
|
|
return 0;
|
|
}
|
|
|
|
int32_t VideoX11Render::ChangeWindow(Window window)
|
|
{
|
|
CriticalSectionScoped cs(&_critSect);
|
|
VideoX11Channel* renderChannel = NULL;
|
|
|
|
std::map<int, VideoX11Channel*>::iterator iter =
|
|
_streamIdToX11ChannelMap.begin();
|
|
|
|
while (iter != _streamIdToX11ChannelMap.end())
|
|
{
|
|
renderChannel = iter->second;
|
|
if (renderChannel)
|
|
{
|
|
renderChannel->ChangeWindow(window);
|
|
}
|
|
iter++;
|
|
}
|
|
|
|
_window = window;
|
|
|
|
return 0;
|
|
}
|
|
|
|
VideoX11Channel* VideoX11Render::CreateX11RenderChannel(
|
|
int32_t streamId,
|
|
int32_t zOrder,
|
|
const float left,
|
|
const float top,
|
|
const float right,
|
|
const float bottom)
|
|
{
|
|
CriticalSectionScoped cs(&_critSect);
|
|
VideoX11Channel* renderChannel = NULL;
|
|
|
|
std::map<int, VideoX11Channel*>::iterator iter =
|
|
_streamIdToX11ChannelMap.find(streamId);
|
|
|
|
if (iter == _streamIdToX11ChannelMap.end())
|
|
{
|
|
renderChannel = new VideoX11Channel(streamId);
|
|
if (!renderChannel)
|
|
{
|
|
WEBRTC_TRACE(
|
|
kTraceError,
|
|
kTraceVideoRenderer,
|
|
-1,
|
|
"Failed to create VideoX11Channel for streamId : %d",
|
|
streamId);
|
|
return NULL;
|
|
}
|
|
renderChannel->Init(_window, left, top, right, bottom);
|
|
_streamIdToX11ChannelMap[streamId] = renderChannel;
|
|
}
|
|
else
|
|
{
|
|
WEBRTC_TRACE(kTraceInfo, kTraceVideoRenderer, -1,
|
|
"Render Channel already exists for streamId: %d", streamId);
|
|
renderChannel = iter->second;
|
|
}
|
|
|
|
return renderChannel;
|
|
}
|
|
|
|
int32_t VideoX11Render::DeleteX11RenderChannel(int32_t streamId)
|
|
{
|
|
CriticalSectionScoped cs(&_critSect);
|
|
|
|
std::map<int, VideoX11Channel*>::iterator iter =
|
|
_streamIdToX11ChannelMap.find(streamId);
|
|
if (iter != _streamIdToX11ChannelMap.end())
|
|
{
|
|
VideoX11Channel *renderChannel = iter->second;
|
|
if (renderChannel)
|
|
{
|
|
renderChannel->ReleaseWindow();
|
|
delete renderChannel;
|
|
renderChannel = NULL;
|
|
}
|
|
_streamIdToX11ChannelMap.erase(iter);
|
|
}
|
|
|
|
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, -1,
|
|
"No VideoX11Channel object exists for stream id: %d",
|
|
streamId);
|
|
return -1;
|
|
}
|
|
|
|
int32_t VideoX11Render::GetIncomingStreamProperties(
|
|
int32_t streamId,
|
|
uint32_t& zOrder,
|
|
float& left,
|
|
float& top,
|
|
float& right,
|
|
float& bottom)
|
|
{
|
|
CriticalSectionScoped cs(&_critSect);
|
|
|
|
std::map<int, VideoX11Channel*>::iterator iter =
|
|
_streamIdToX11ChannelMap.find(streamId);
|
|
if (iter != _streamIdToX11ChannelMap.end())
|
|
{
|
|
VideoX11Channel *renderChannel = iter->second;
|
|
if (renderChannel)
|
|
{
|
|
renderChannel->GetStreamProperties(zOrder, left, top, right, bottom);
|
|
}
|
|
}
|
|
|
|
WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, -1,
|
|
"No VideoX11Channel object exists for stream id: %d",
|
|
streamId);
|
|
return -1;
|
|
}
|
|
|
|
} // namespace webrtc
|