1 // Copyright 2020 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 5 #ifndef CAST_STREAMING_CAPTURE_CONFIGS_H_ 6 #define CAST_STREAMING_CAPTURE_CONFIGS_H_ 7 8 #include <string> 9 #include <vector> 10 11 #include "cast/streaming/constants.h" 12 13 namespace openscreen { 14 namespace cast { 15 16 // A configuration set that can be used by the sender to capture audio, and the 17 // receiver to playback audio. Used by Cast Streaming to provide an offer to the 18 // receiver. 19 struct AudioCaptureConfig { 20 // Audio codec represented by this configuration. 21 AudioCodec codec = AudioCodec::kOpus; 22 23 // Number of channels used by this configuration. 24 int channels = kDefaultAudioChannels; 25 26 // Average bit rate in bits per second used by this configuration. A value 27 // of "zero" suggests that the bitrate should be automatically selected by 28 // the sender. 29 int bit_rate = 0; 30 31 // Sample rate for audio RTP timebase. 32 int sample_rate = kDefaultAudioSampleRate; 33 34 // Target playout delay in milliseconds. 35 std::chrono::milliseconds target_playout_delay = kDefaultTargetPlayoutDelay; 36 }; 37 38 // Display resolution in pixels. 39 struct DisplayResolution { 40 // Width in pixels. 41 int width = 1920; 42 43 // Height in pixels. 44 int height = 1080; 45 }; 46 47 // Frame rates are expressed as a rational number, and must be positive. 48 struct FrameRate { 49 // For simple cases, the frame rate may be provided by simply setting the 50 // number to the desired value, e.g. 30 or 60FPS. Some common frame rates like 51 // 23.98 FPS (for NTSC compatibility) are represented as fractions, in this 52 // case 24000/1001. 53 int numerator = kDefaultFrameRate; 54 int denominator = 1; 55 }; 56 57 // A configuration set that can be used by the sender to capture video, as 58 // well as the receiver to playback video. Used by Cast Streaming to provide an 59 // offer to the receiver. 60 struct VideoCaptureConfig { 61 // Video codec represented by this configuration. 62 VideoCodec codec = VideoCodec::kVp8; 63 64 // Maximum frame rate in frames per second. 65 FrameRate max_frame_rate; 66 67 // Number specifying the maximum bit rate for this stream. A value of 68 // zero means that the maximum bit rate should be automatically selected by 69 // the sender. 70 int max_bit_rate = 0; 71 72 // Resolutions to be offered to the receiver. At least one resolution 73 // must be provided. 74 std::vector<DisplayResolution> resolutions; 75 76 // Target playout delay in milliseconds. 77 std::chrono::milliseconds target_playout_delay = kDefaultTargetPlayoutDelay; 78 }; 79 80 } // namespace cast 81 } // namespace openscreen 82 83 #endif // CAST_STREAMING_CAPTURE_CONFIGS_H_ 84