codec_test.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef REMOTING_CODEC_CODEC_TEST_H_
  5. #define REMOTING_CODEC_CODEC_TEST_H_
  6. #include <list>
  7. #include "base/memory/ref_counted.h"
  8. namespace webrtc {
  9. class DesktopFrame;
  10. class DesktopSize;
  11. }
  12. namespace remoting {
  13. class VideoDecoder;
  14. class VideoEncoder;
  15. // Generate test data and test the encoder for a regular encoding sequence.
  16. // This will test encoder test and the sequence of messages sent.
  17. //
  18. // If |strict| is set to true then this routine will make sure the updated
  19. // rects match dirty rects.
  20. void TestVideoEncoder(VideoEncoder* encoder, bool strict);
  21. // Generate test data and test the encoder for a sequence of one "changed"
  22. // frame followed by one or more "unchanged" frames, and verify that the
  23. // encoder sends up to |max_topoff_frames| of non-empty data for unchanged
  24. // frames, after which it returns null frames.
  25. void TestVideoEncoderEmptyFrames(VideoEncoder* encoder, int max_topoff_frames);
  26. // Generate test data and test the encoder and decoder pair.
  27. //
  28. // If |strict| is set to true, this routine will make sure the updated rects
  29. // are correct.
  30. void TestVideoEncoderDecoder(VideoEncoder* encoder,
  31. VideoDecoder* decoder,
  32. bool strict);
  33. // Generate a frame containing a gradient, and test the encoder and decoder
  34. // pair.
  35. void TestVideoEncoderDecoderGradient(VideoEncoder* encoder,
  36. VideoDecoder* decoder,
  37. const webrtc::DesktopSize& screen_size,
  38. double max_error_limit,
  39. double mean_error_limit);
  40. // Run sufficient encoding iterations to measure the FPS of the specified
  41. // encoder. The caller may supply one or more DesktopFrames to encode, which
  42. // will be cycled through until timing is complete. If the caller does not
  43. // supply any frames then a single full-frame of randomized pixels is used.
  44. float MeasureVideoEncoderFpsWithSize(VideoEncoder* encoder,
  45. const webrtc::DesktopSize& size);
  46. float MeasureVideoEncoderFpsWithFrames(
  47. VideoEncoder* encoder,
  48. const std::list<webrtc::DesktopFrame*>& frames);
  49. } // namespace remoting
  50. #endif // REMOTING_CODEC_CODEC_TEST_H_