OLD | NEW |
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 int64_t last_frame_elapsed_time_ns() const { | 107 int64_t last_frame_elapsed_time_ns() const { |
108 rtc::CritScope cs(&crit_); | 108 rtc::CritScope cs(&crit_); |
109 return last_frame_elapsed_time_ns_; | 109 return last_frame_elapsed_time_ns_; |
110 } | 110 } |
111 | 111 |
112 sigslot::signal3<int, int, int> SignalSetSize; | 112 sigslot::signal3<int, int, int> SignalSetSize; |
113 sigslot::signal1<const VideoFrame*> SignalRenderFrame; | 113 sigslot::signal1<const VideoFrame*> SignalRenderFrame; |
114 | 114 |
115 private: | 115 private: |
116 static bool CheckFrameColorYuv(uint8 y_min, uint8 y_max, | 116 static bool CheckFrameColorYuv(uint8_t y_min, |
117 uint8 u_min, uint8 u_max, | 117 uint8_t y_max, |
118 uint8 v_min, uint8 v_max, | 118 uint8_t u_min, |
| 119 uint8_t u_max, |
| 120 uint8_t v_min, |
| 121 uint8_t v_max, |
119 const cricket::VideoFrame* frame) { | 122 const cricket::VideoFrame* frame) { |
120 if (!frame) { | 123 if (!frame) { |
121 return false; | 124 return false; |
122 } | 125 } |
123 // Y | 126 // Y |
124 size_t y_width = frame->GetWidth(); | 127 size_t y_width = frame->GetWidth(); |
125 size_t y_height = frame->GetHeight(); | 128 size_t y_height = frame->GetHeight(); |
126 const uint8* y_plane = frame->GetYPlane(); | 129 const uint8_t* y_plane = frame->GetYPlane(); |
127 const uint8* y_pos = y_plane; | 130 const uint8_t* y_pos = y_plane; |
128 int32 y_pitch = frame->GetYPitch(); | 131 int32_t y_pitch = frame->GetYPitch(); |
129 for (size_t i = 0; i < y_height; ++i) { | 132 for (size_t i = 0; i < y_height; ++i) { |
130 for (size_t j = 0; j < y_width; ++j) { | 133 for (size_t j = 0; j < y_width; ++j) { |
131 uint8 y_value = *(y_pos + j); | 134 uint8_t y_value = *(y_pos + j); |
132 if (y_value < y_min || y_value > y_max) { | 135 if (y_value < y_min || y_value > y_max) { |
133 return false; | 136 return false; |
134 } | 137 } |
135 } | 138 } |
136 y_pos += y_pitch; | 139 y_pos += y_pitch; |
137 } | 140 } |
138 // U and V | 141 // U and V |
139 size_t chroma_width = frame->GetChromaWidth(); | 142 size_t chroma_width = frame->GetChromaWidth(); |
140 size_t chroma_height = frame->GetChromaHeight(); | 143 size_t chroma_height = frame->GetChromaHeight(); |
141 const uint8* u_plane = frame->GetUPlane(); | 144 const uint8_t* u_plane = frame->GetUPlane(); |
142 const uint8* v_plane = frame->GetVPlane(); | 145 const uint8_t* v_plane = frame->GetVPlane(); |
143 const uint8* u_pos = u_plane; | 146 const uint8_t* u_pos = u_plane; |
144 const uint8* v_pos = v_plane; | 147 const uint8_t* v_pos = v_plane; |
145 int32 u_pitch = frame->GetUPitch(); | 148 int32_t u_pitch = frame->GetUPitch(); |
146 int32 v_pitch = frame->GetVPitch(); | 149 int32_t v_pitch = frame->GetVPitch(); |
147 for (size_t i = 0; i < chroma_height; ++i) { | 150 for (size_t i = 0; i < chroma_height; ++i) { |
148 for (size_t j = 0; j < chroma_width; ++j) { | 151 for (size_t j = 0; j < chroma_width; ++j) { |
149 uint8 u_value = *(u_pos + j); | 152 uint8_t u_value = *(u_pos + j); |
150 if (u_value < u_min || u_value > u_max) { | 153 if (u_value < u_min || u_value > u_max) { |
151 return false; | 154 return false; |
152 } | 155 } |
153 uint8 v_value = *(v_pos + j); | 156 uint8_t v_value = *(v_pos + j); |
154 if (v_value < v_min || v_value > v_max) { | 157 if (v_value < v_min || v_value > v_max) { |
155 return false; | 158 return false; |
156 } | 159 } |
157 } | 160 } |
158 u_pos += u_pitch; | 161 u_pos += u_pitch; |
159 v_pos += v_pitch; | 162 v_pos += v_pitch; |
160 } | 163 } |
161 return true; | 164 return true; |
162 } | 165 } |
163 | 166 |
164 int errors_; | 167 int errors_; |
165 int width_; | 168 int width_; |
166 int height_; | 169 int height_; |
167 int num_set_sizes_; | 170 int num_set_sizes_; |
168 int num_rendered_frames_; | 171 int num_rendered_frames_; |
169 bool black_frame_; | 172 bool black_frame_; |
170 int64_t last_frame_elapsed_time_ns_; | 173 int64_t last_frame_elapsed_time_ns_; |
171 mutable rtc::CriticalSection crit_; | 174 mutable rtc::CriticalSection crit_; |
172 }; | 175 }; |
173 | 176 |
174 } // namespace cricket | 177 } // namespace cricket |
175 | 178 |
176 #endif // TALK_MEDIA_BASE_FAKEVIDEORENDERER_H_ | 179 #endif // TALK_MEDIA_BASE_FAKEVIDEORENDERER_H_ |
OLD | NEW |