1 /*
2  *  Copyright (c) 2014 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_ENCODER_SETTINGS_H_
11 #define TEST_ENCODER_SETTINGS_H_
12 
13 #include <stddef.h>
14 
15 #include <string>
16 #include <vector>
17 
18 #include "api/video_codecs/video_encoder_config.h"
19 #include "call/video_receive_stream.h"
20 #include "call/video_send_stream.h"
21 
22 namespace webrtc {
23 namespace test {
24 
25 class DefaultVideoStreamFactory
26     : public VideoEncoderConfig::VideoStreamFactoryInterface {
27  public:
28   DefaultVideoStreamFactory();
29 
30   static const size_t kMaxNumberOfStreams = 3;
31   // Defined as {150000, 450000, 1500000};
32   static const int kMaxBitratePerStream[];
33   // Defined as {50000, 200000, 700000};
34   static const int kDefaultMinBitratePerStream[];
35 
36  private:
37   std::vector<VideoStream> CreateEncoderStreams(
38       int width,
39       int height,
40       const VideoEncoderConfig& encoder_config) override;
41 };
42 
43 // Creates |encoder_config.number_of_streams| VideoStreams where index
44 // |encoder_config.number_of_streams -1| have width = |width|, height =
45 // |height|. The total max bitrate of all VideoStreams is
46 // |encoder_config.max_bitrate_bps|.
47 std::vector<VideoStream> CreateVideoStreams(
48     int width,
49     int height,
50     const webrtc::VideoEncoderConfig& encoder_config);
51 
52 void FillEncoderConfiguration(VideoCodecType codec_type,
53                               size_t num_streams,
54                               VideoEncoderConfig* configuration);
55 
56 VideoReceiveStream::Decoder CreateMatchingDecoder(
57     int payload_type,
58     const std::string& payload_name);
59 
60 VideoReceiveStream::Decoder CreateMatchingDecoder(
61     const VideoSendStream::Config& config);
62 }  // namespace test
63 }  // namespace webrtc
64 
65 #endif  // TEST_ENCODER_SETTINGS_H_
66