Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: webrtc/media/devices/gdivideorenderer.cc

Issue 1819103003: Delete cricket::VideoRenderer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/media/devices/gdivideorenderer.h ('k') | webrtc/media/devices/gtkvideorenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/devices/gdivideorenderer.cc
diff --git a/webrtc/media/devices/gdivideorenderer.cc b/webrtc/media/devices/gdivideorenderer.cc
index 78cba3ff26862a4b8cf63aa20eccc062947a06dd..f9472e5a6ed1399739a916558baf50039ec7cc39 100644
--- a/webrtc/media/devices/gdivideorenderer.cc
+++ b/webrtc/media/devices/gdivideorenderer.cc
@@ -30,25 +30,27 @@ class GdiVideoRenderer::VideoWindow : public rtc::Win32Window {
VideoWindow(int x, int y, int width, int height);
virtual ~VideoWindow();
- // Called when the video size changes. If it is called the first time, we
- // create and start the thread. Otherwise, we send kSetSizeMsg to the thread.
- // Context: non-worker thread.
- bool SetSize(int width, int height);
-
// Called when a new frame is available. Upon this call, we send
// kRenderFrameMsg to the window thread. Context: non-worker thread. It may be
// better to pass RGB bytes to VideoWindow. However, we pass VideoFrame to put
// all the thread synchronization within VideoWindow.
- bool RenderFrame(const VideoFrame* frame);
+ void OnFrame(const VideoFrame& frame);
protected:
// Override virtual method of rtc::Win32Window. Context: worker Thread.
- virtual bool OnMessage(UINT uMsg, WPARAM wParam, LPARAM lParam,
- LRESULT& result);
+ bool OnMessage(UINT uMsg,
+ WPARAM wParam,
+ LPARAM lParam,
+ LRESULT& result) override;
private:
enum { kSetSizeMsg = WM_USER, kRenderFrameMsg};
+ // Called when the video size changes. If it is called the first time, we
+ // create and start the thread. Otherwise, we send kSetSizeMsg to the thread.
+ // Context: non-worker thread.
+ bool SetSize(int width, int height);
+
class WindowThread : public rtc::Thread {
public:
explicit WindowThread(VideoWindow* window) : window_(window) {}
@@ -128,20 +130,17 @@ bool GdiVideoRenderer::VideoWindow::SetSize(int width, int height) {
return true;
}
-bool GdiVideoRenderer::VideoWindow::RenderFrame(const VideoFrame* video_frame) {
+void GdiVideoRenderer::VideoWindow::OnFrame(const VideoFrame& video_frame) {
if (!handle()) {
- return false;
+ return;
}
- const VideoFrame* frame = video_frame->GetCopyWithRotationApplied();
+ const VideoFrame* frame = video_frame.GetCopyWithRotationApplied();
- if (!SetSize(static_cast<int>(frame->GetWidth()),
- static_cast<int>(frame->GetHeight()))) {
- return false;
+ if (SetSize(static_cast<int>(frame->GetWidth()),
+ static_cast<int>(frame->GetHeight()))) {
+ SendMessage(handle(), kRenderFrameMsg, reinterpret_cast<WPARAM>(frame), 0);
}
-
- SendMessage(handle(), kRenderFrameMsg, reinterpret_cast<WPARAM>(frame), 0);
- return true;
}
bool GdiVideoRenderer::VideoWindow::OnMessage(UINT uMsg, WPARAM wParam,
@@ -243,18 +242,13 @@ GdiVideoRenderer::GdiVideoRenderer(int x, int y)
}
GdiVideoRenderer::~GdiVideoRenderer() {}
-bool GdiVideoRenderer::SetSize(int width, int height, int reserved) {
- if (!window_.get()) { // Create the window for the first frame
- window_.reset(new VideoWindow(initial_x_, initial_y_, width, height));
- }
- return window_->SetSize(width, height);
-}
-
-bool GdiVideoRenderer::RenderFrame(const VideoFrame* frame) {
- if (!frame || !window_.get()) {
- return false;
+void GdiVideoRenderer::OnFrame(const VideoFrame& frame) {
+ if (!window_.get()) { // Create the window for the first frame
+ window_.reset(new VideoWindow(initial_x_, initial_y_,
+ static_cast<int>(frame.GetWidth()),
+ static_cast<int>(frame.GetHeight())));
}
- return window_->RenderFrame(frame);
+ window_->OnFrame(frame);
}
} // namespace cricket
« no previous file with comments | « webrtc/media/devices/gdivideorenderer.h ('k') | webrtc/media/devices/gtkvideorenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698