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