video_codec_settings.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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->width = kTestWidth;
  26. settings->height = kTestHeight;
  27. settings->startBitrate = kTestStartBitrateKbps;
  28. settings->maxBitrate = 0;
  29. settings->minBitrate = kTestMinBitrateKbps;
  30. settings->maxFramerate = kTestFrameRate;
  31. settings->active = true;
  32. settings->qpMax = 56; // See webrtcvideoengine.h.
  33. settings->numberOfSimulcastStreams = 0;
  34. settings->timing_frame_thresholds = {
  35. kTestTimingFramesDelayMs,
  36. kTestOutlierFrameSizePercent,
  37. };
  38. settings->codecType = codec_type;
  39. switch (codec_type) {
  40. case kVideoCodecVP8:
  41. *(settings->VP8()) = VideoEncoder::GetDefaultVp8Settings();
  42. return;
  43. case kVideoCodecVP9:
  44. *(settings->VP9()) = VideoEncoder::GetDefaultVp9Settings();
  45. return;
  46. case kVideoCodecH264:
  47. // TODO(brandtr): Set |qpMax| here, when the OpenH264 wrapper supports it.
  48. *(settings->H264()) = VideoEncoder::GetDefaultH264Settings();
  49. return;
  50. default:
  51. return;
  52. }
  53. }
  54. } // namespace test
  55. } // namespace webrtc
  56. #endif // TEST_VIDEO_CODEC_SETTINGS_H_