video_codec_settings.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef TEST_VIDEO_CODEC_SETTINGS_H_
  11. #define TEST_VIDEO_CODEC_SETTINGS_H_
  12. #include "api/video_codecs/video_encoder.h"
  13. namespace webrtc {
  14. namespace test {
  15. const uint16_t kTestWidth = 352;
  16. const uint16_t kTestHeight = 288;
  17. const uint32_t kTestFrameRate = 30;
  18. const unsigned int kTestMinBitrateKbps = 30;
  19. const unsigned int kTestStartBitrateKbps = 300;
  20. const uint8_t kTestPayloadType = 100;
  21. const int64_t kTestTimingFramesDelayMs = 200;
  22. const uint16_t kTestOutlierFrameSizePercent = 250;
  23. static void CodecSettings(VideoCodecType codec_type, VideoCodec* settings) {
  24. memset(settings, 0, sizeof(VideoCodec));
  25. settings->plType = kTestPayloadType;
  26. settings->width = kTestWidth;
  27. settings->height = kTestHeight;
  28. settings->startBitrate = kTestStartBitrateKbps;
  29. settings->maxBitrate = 0;
  30. settings->minBitrate = kTestMinBitrateKbps;
  31. settings->maxFramerate = kTestFrameRate;
  32. settings->active = true;
  33. settings->qpMax = 56; // See webrtcvideoengine.h.
  34. settings->numberOfSimulcastStreams = 0;
  35. settings->timing_frame_thresholds = {
  36. kTestTimingFramesDelayMs,
  37. kTestOutlierFrameSizePercent,
  38. };
  39. settings->codecType = codec_type;
  40. switch (codec_type) {
  41. case kVideoCodecVP8:
  42. *(settings->VP8()) = VideoEncoder::GetDefaultVp8Settings();
  43. return;
  44. case kVideoCodecVP9:
  45. *(settings->VP9()) = VideoEncoder::GetDefaultVp9Settings();
  46. return;
  47. case kVideoCodecH264:
  48. // TODO(brandtr): Set |qpMax| here, when the OpenH264 wrapper supports it.
  49. *(settings->H264()) = VideoEncoder::GetDefaultH264Settings();
  50. return;
  51. default:
  52. return;
  53. }
  54. }
  55. } // namespace test
  56. } // namespace webrtc
  57. #endif // TEST_VIDEO_CODEC_SETTINGS_H_