OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 buffer_ = new uint8_t[buffer_size_]; | 62 buffer_ = new uint8_t[buffer_size_]; |
63 assert(buffer_ != NULL); | 63 assert(buffer_ != NULL); |
64 memset(buffer_, 0, buffer_size_); | 64 memset(buffer_, 0, buffer_size_); |
65 glBindTexture(GL_TEXTURE_2D, texture_); | 65 glBindTexture(GL_TEXTURE_2D, texture_); |
66 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); | 66 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); |
67 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); | 67 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); |
68 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_BGRA, | 68 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_BGRA, |
69 GL_UNSIGNED_INT_8_8_8_8, static_cast<GLvoid*>(buffer_)); | 69 GL_UNSIGNED_INT_8_8_8_8, static_cast<GLvoid*>(buffer_)); |
70 } | 70 } |
71 | 71 |
72 void GlRenderer::RenderFrame(const webrtc::VideoFrame& frame, | 72 void GlRenderer::OnFrame(const webrtc::VideoFrame& frame) { |
73 int /*render_delay_ms*/) { | |
74 assert(is_init_); | 73 assert(is_init_); |
75 | 74 |
76 if (static_cast<size_t>(frame.width()) != width_ || | 75 if (static_cast<size_t>(frame.width()) != width_ || |
77 static_cast<size_t>(frame.height()) != height_) { | 76 static_cast<size_t>(frame.height()) != height_) { |
78 ResizeVideo(frame.width(), frame.height()); | 77 ResizeVideo(frame.width(), frame.height()); |
79 } | 78 } |
80 | 79 |
81 webrtc::ConvertFromI420(frame, kBGRA, 0, buffer_); | 80 webrtc::ConvertFromI420(frame, kBGRA, 0, buffer_); |
82 | 81 |
83 glEnable(GL_TEXTURE_2D); | 82 glEnable(GL_TEXTURE_2D); |
(...skipping 19 matching lines...) Expand all Loading... |
103 glTexCoord2f(1.0f, 0.0f); | 102 glTexCoord2f(1.0f, 0.0f); |
104 glVertex3f(1.0f, 0.0f, 0.0f); | 103 glVertex3f(1.0f, 0.0f, 0.0f); |
105 } | 104 } |
106 glEnd(); | 105 glEnd(); |
107 | 106 |
108 glBindTexture(GL_TEXTURE_2D, 0); | 107 glBindTexture(GL_TEXTURE_2D, 0); |
109 glFlush(); | 108 glFlush(); |
110 } | 109 } |
111 } // test | 110 } // test |
112 } // webrtc | 111 } // webrtc |
OLD | NEW |