| 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 15 matching lines...) Expand all Loading... |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "talk/media/base/videoframe.h" | 28 #include "talk/media/base/videoframe.h" |
| 29 | 29 |
| 30 #include <string.h> | 30 #include <string.h> |
| 31 | 31 |
| 32 #include "libyuv/compare.h" | 32 #include "libyuv/compare.h" |
| 33 #include "libyuv/planar_functions.h" | 33 #include "libyuv/planar_functions.h" |
| 34 #include "libyuv/scale.h" | 34 #include "libyuv/scale.h" |
| 35 #include "talk/media/base/videocommon.h" | 35 #include "talk/media/base/videocommon.h" |
| 36 #include "webrtc/base/arraysize.h" |
| 36 #include "webrtc/base/checks.h" | 37 #include "webrtc/base/checks.h" |
| 37 #include "webrtc/base/logging.h" | 38 #include "webrtc/base/logging.h" |
| 38 | 39 |
| 39 namespace cricket { | 40 namespace cricket { |
| 40 | 41 |
| 41 // Round to 2 pixels because Chroma channels are half size. | 42 // Round to 2 pixels because Chroma channels are half size. |
| 42 #define ROUNDTO2(v) (v & ~1) | 43 #define ROUNDTO2(v) (v & ~1) |
| 43 | 44 |
| 44 rtc::StreamResult VideoFrame::Write(rtc::StreamInterface* stream, | 45 rtc::StreamResult VideoFrame::Write(rtc::StreamInterface* stream, |
| 45 int* error) const { | 46 int* error) const { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 LOG(LS_ERROR) << "NULL sample pointer." | 312 LOG(LS_ERROR) << "NULL sample pointer." |
| 312 << " format: " << GetFourccName(format) | 313 << " format: " << GetFourccName(format) |
| 313 << " bpp: " << expected_bpp | 314 << " bpp: " << expected_bpp |
| 314 << " size: " << w << "x" << h | 315 << " size: " << w << "x" << h |
| 315 << " expected: " << expected_size | 316 << " expected: " << expected_size |
| 316 << " " << sample_size; | 317 << " " << sample_size; |
| 317 return false; | 318 return false; |
| 318 } | 319 } |
| 319 // TODO(fbarchard): Make function to dump information about frames. | 320 // TODO(fbarchard): Make function to dump information about frames. |
| 320 uint8_t four_samples[4] = {0, 0, 0, 0}; | 321 uint8_t four_samples[4] = {0, 0, 0, 0}; |
| 321 for (size_t i = 0; i < ARRAY_SIZE(four_samples) && i < sample_size; ++i) { | 322 for (size_t i = 0; i < arraysize(four_samples) && i < sample_size; ++i) { |
| 322 four_samples[i] = sample[i]; | 323 four_samples[i] = sample[i]; |
| 323 } | 324 } |
| 324 if (sample_size < expected_size) { | 325 if (sample_size < expected_size) { |
| 325 LOG(LS_ERROR) << "Size field is too small." | 326 LOG(LS_ERROR) << "Size field is too small." |
| 326 << " format: " << GetFourccName(format) | 327 << " format: " << GetFourccName(format) |
| 327 << " bpp: " << expected_bpp | 328 << " bpp: " << expected_bpp |
| 328 << " size: " << w << "x" << h | 329 << " size: " << w << "x" << h |
| 329 << " " << sample_size | 330 << " " << sample_size |
| 330 << " expected: " << expected_size | 331 << " expected: " << expected_size |
| 331 << " sample[0..3]: " << static_cast<int>(four_samples[0]) | 332 << " sample[0..3]: " << static_cast<int>(four_samples[0]) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 << " expected: " << expected_size | 381 << " expected: " << expected_size |
| 381 << " sample[0..3]: " << static_cast<int>(four_samples[0]) | 382 << " sample[0..3]: " << static_cast<int>(four_samples[0]) |
| 382 << ", " << static_cast<int>(four_samples[1]) | 383 << ", " << static_cast<int>(four_samples[1]) |
| 383 << ", " << static_cast<int>(four_samples[2]) | 384 << ", " << static_cast<int>(four_samples[2]) |
| 384 << ", " << static_cast<int>(four_samples[3]); | 385 << ", " << static_cast<int>(four_samples[3]); |
| 385 } | 386 } |
| 386 return true; | 387 return true; |
| 387 } | 388 } |
| 388 | 389 |
| 389 } // namespace cricket | 390 } // namespace cricket |
| OLD | NEW |