OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2016 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 |
| 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INITIALIZER_H_ |
| 12 #define WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INITIALIZER_H_ |
| 13 |
| 14 #include <memory> |
| 15 #include <string> |
| 16 #include <vector> |
| 17 |
| 18 #include "webrtc/video_send_stream.h" |
| 19 |
| 20 namespace webrtc { |
| 21 |
| 22 class TemporalLayersFactory; |
| 23 class VideoBitrateAllocator; |
| 24 class VideoCodec; |
| 25 class VideoEncoderConfig; |
| 26 |
| 27 class VideoCodecInitializer { |
| 28 public: |
| 29 // Takes an EncoderSettings, a VideoEncoderConfig and the VideoStream |
| 30 // configuration and translated them into the old school VideoCodec type. |
| 31 // It also creates a VideoBitrateAllocator instance, suitable for the codec |
| 32 // type used. For instance, VP8 will create an allocator than can handle |
| 33 // simulcast and temporal layering. |
| 34 // GetBitrateAllocator is called implicitly from here, no need to call again. |
| 35 static bool SetupCodec( |
| 36 const VideoEncoderConfig& config, |
| 37 const VideoSendStream::Config::EncoderSettings settings, |
| 38 const std::vector<VideoStream>& streams, |
| 39 VideoCodec* codec, |
| 40 std::unique_ptr<VideoBitrateAllocator>* bitrate_allocator); |
| 41 |
| 42 // Create a bitrate allocator for the specified codec. |tl_factory| is |
| 43 // optional, if it is populated, ownership of that instance will be |
| 44 // transferred to the VideoBitrateAllocator instance. |
| 45 static std::unique_ptr<VideoBitrateAllocator> GetBitrateAllocator( |
| 46 const VideoCodec& codec, |
| 47 std::unique_ptr<TemporalLayersFactory> tl_factory); |
| 48 |
| 49 private: |
| 50 static VideoCodec VideoEncoderConfigToVideoCodec( |
| 51 const VideoEncoderConfig& config, |
| 52 const std::vector<VideoStream>& streams, |
| 53 const std::string& payload_name, |
| 54 int payload_type); |
| 55 }; |
| 56 |
| 57 } // namespace webrtc |
| 58 |
| 59 #endif // WEBRTC_MODULES_VIDEO_CODING_INCLUDE_VIDEO_CODEC_INITIALIZER_H_ |
OLD | NEW |