Add concept of whether video renderer supports rotation.

Rotation is best done when rendered in GPU, added the shader code which rotates the frame. For renderers which don't support rotation, the rotation will be done before sending down the frame to render. By default, assume renderer can't do rotation.

Tested with peerconnection_client on windows, AppRTCDemo on Mac.

BUG=4145
R=glaznev@webrtc.org, pthatcher@webrtc.org

Committed: https://code.google.com/p/webrtc/source/detail?r=8660

Committed: https://code.google.com/p/webrtc/source/detail?r=8661

Review URL: https://webrtc-codereview.appspot.com/43569004

Cr-Commit-Position: refs/heads/master@{#8705}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8705 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
guoweis@webrtc.org
2015-03-12 21:37:26 +00:00
parent 04cd69887d
commit 00c509ad1c
23 changed files with 379 additions and 119 deletions

View File

@@ -484,15 +484,26 @@ GtkMainWnd::VideoRenderer::~VideoRenderer() {
void GtkMainWnd::VideoRenderer::SetSize(int width, int height) {
gdk_threads_enter();
if (width_ == width && height_ == height) {
return;
}
width_ = width;
height_ = height;
image_.reset(new uint8[width * height * 4]);
gdk_threads_leave();
}
void GtkMainWnd::VideoRenderer::RenderFrame(const cricket::VideoFrame* frame) {
void GtkMainWnd::VideoRenderer::RenderFrame(
const cricket::VideoFrame* video_frame) {
gdk_threads_enter();
const cricket::VideoFrame* frame = video_frame->GetCopyWithRotationApplied();
SetSize(static_cast<int>(frame->GetWidth()),
static_cast<int>(frame->GetHeight()));
int size = width_ * height_ * 4;
// TODO: Convert directly to RGBA
frame->ConvertToRgbBuffer(cricket::FOURCC_ARGB,