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

Side by Side Diff: talk/media/base/fakevideorenderer.h

Issue 1574963002: Deleted renderer-related SetSize methods, and all uses. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « talk/media/base/capturerenderadapter.cc ('k') | talk/media/base/videocapturer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 24 matching lines...) Expand all
35 35
36 namespace cricket { 36 namespace cricket {
37 37
38 // Faked video renderer that has a callback for actions on rendering. 38 // Faked video renderer that has a callback for actions on rendering.
39 class FakeVideoRenderer : public VideoRenderer { 39 class FakeVideoRenderer : public VideoRenderer {
40 public: 40 public:
41 FakeVideoRenderer() 41 FakeVideoRenderer()
42 : errors_(0), 42 : errors_(0),
43 width_(0), 43 width_(0),
44 height_(0), 44 height_(0),
45 num_set_sizes_(0),
46 num_rendered_frames_(0), 45 num_rendered_frames_(0),
47 black_frame_(false) { 46 black_frame_(false) {
48 } 47 }
49 48
50 virtual bool SetSize(int width, int height, int reserved) {
51 rtc::CritScope cs(&crit_);
52 width_ = width;
53 height_ = height;
54 ++num_set_sizes_;
55 SignalSetSize(width, height, reserved);
56 return true;
57 }
58
59 virtual bool RenderFrame(const VideoFrame* frame) { 49 virtual bool RenderFrame(const VideoFrame* frame) {
60 rtc::CritScope cs(&crit_); 50 rtc::CritScope cs(&crit_);
61 // TODO(zhurunz) Check with VP8 team to see if we can remove this 51 // TODO(zhurunz) Check with VP8 team to see if we can remove this
62 // tolerance on Y values. 52 // tolerance on Y values.
63 black_frame_ = CheckFrameColorYuv(6, 48, 128, 128, 128, 128, frame); 53 black_frame_ = CheckFrameColorYuv(6, 48, 128, 128, 128, 128, frame);
64 // Treat unexpected frame size as error. 54 // Treat unexpected frame size as error.
65 if (!frame || 55 if (!frame) {
66 frame->GetWidth() != static_cast<size_t>(width_) || 56 LOG(LS_WARNING) << "RenderFrame expected non-null frame.";
67 frame->GetHeight() != static_cast<size_t>(height_)) {
68 if (!frame) {
69 LOG(LS_WARNING) << "RenderFrame expected non-null frame.";
70 } else {
71 LOG(LS_WARNING) << "RenderFrame expected frame of size " << width_
72 << "x" << height_ << " but received frame of size "
73 << frame->GetWidth() << "x" << frame->GetHeight();
74 }
75 ++errors_; 57 ++errors_;
76 return false; 58 return false;
77 } 59 }
78 ++num_rendered_frames_; 60 ++num_rendered_frames_;
61 width_ = static_cast<int>(frame->GetWidth());
62 height_ = static_cast<int>(frame->GetHeight());
79 SignalRenderFrame(frame); 63 SignalRenderFrame(frame);
80 return true; 64 return true;
81 } 65 }
82 66
83 int errors() const { return errors_; } 67 int errors() const { return errors_; }
84 int width() const { 68 int width() const {
85 rtc::CritScope cs(&crit_); 69 rtc::CritScope cs(&crit_);
86 return width_; 70 return width_;
87 } 71 }
88 int height() const { 72 int height() const {
89 rtc::CritScope cs(&crit_); 73 rtc::CritScope cs(&crit_);
90 return height_; 74 return height_;
91 } 75 }
92 int num_set_sizes() const {
93 rtc::CritScope cs(&crit_);
94 return num_set_sizes_;
95 }
96 int num_rendered_frames() const { 76 int num_rendered_frames() const {
97 rtc::CritScope cs(&crit_); 77 rtc::CritScope cs(&crit_);
98 return num_rendered_frames_; 78 return num_rendered_frames_;
99 } 79 }
100 bool black_frame() const { 80 bool black_frame() const {
101 rtc::CritScope cs(&crit_); 81 rtc::CritScope cs(&crit_);
102 return black_frame_; 82 return black_frame_;
103 } 83 }
104 84
105 sigslot::signal3<int, int, int> SignalSetSize; 85 sigslot::signal3<int, int, int> SignalSetSize;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 133 }
154 u_pos += u_pitch; 134 u_pos += u_pitch;
155 v_pos += v_pitch; 135 v_pos += v_pitch;
156 } 136 }
157 return true; 137 return true;
158 } 138 }
159 139
160 int errors_; 140 int errors_;
161 int width_; 141 int width_;
162 int height_; 142 int height_;
163 int num_set_sizes_;
164 int num_rendered_frames_; 143 int num_rendered_frames_;
165 bool black_frame_; 144 bool black_frame_;
166 mutable rtc::CriticalSection crit_; 145 mutable rtc::CriticalSection crit_;
167 }; 146 };
168 147
169 } // namespace cricket 148 } // namespace cricket
170 149
171 #endif // TALK_MEDIA_BASE_FAKEVIDEORENDERER_H_ 150 #endif // TALK_MEDIA_BASE_FAKEVIDEORENDERER_H_
OLDNEW
« no previous file with comments | « talk/media/base/capturerenderadapter.cc ('k') | talk/media/base/videocapturer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698