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 #include "webrtc/media/engine/internalencoderfactory.h" |
| 12 |
| 13 #include <utility> |
| 14 |
| 15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
| 16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
| 17 #include "webrtc/modules/video_coding/codecs/vp9/include/vp9.h" |
| 18 |
| 19 namespace cricket { |
| 20 |
| 21 InternalEncoderFactory::InternalEncoderFactory() { |
| 22 supported_codecs_.push_back(cricket::VideoCodec(kVp8CodecName)); |
| 23 if (webrtc::VP9Encoder::IsSupported()) |
| 24 supported_codecs_.push_back(cricket::VideoCodec(kVp9CodecName)); |
| 25 if (webrtc::H264Encoder::IsSupported()) { |
| 26 cricket::VideoCodec codec(kH264CodecName); |
| 27 // TODO(magjed): Move setting these parameters into webrtc::H264Encoder |
| 28 // instead. |
| 29 // TODO(hta): Set FMTP parameters for all codecs of type H264. |
| 30 codec.SetParam(kH264FmtpProfileLevelId, |
| 31 kH264ProfileLevelConstrainedBaseline); |
| 32 codec.SetParam(kH264FmtpLevelAsymmetryAllowed, "1"); |
| 33 codec.SetParam(kH264FmtpPacketizationMode, "1"); |
| 34 supported_codecs_.push_back(std::move(codec)); |
| 35 } |
| 36 |
| 37 supported_codecs_.push_back(cricket::VideoCodec(kRedCodecName)); |
| 38 supported_codecs_.push_back(cricket::VideoCodec(kUlpfecCodecName)); |
| 39 } |
| 40 |
| 41 InternalEncoderFactory::~InternalEncoderFactory() {} |
| 42 |
| 43 // WebRtcVideoEncoderFactory implementation. |
| 44 webrtc::VideoEncoder* InternalEncoderFactory::CreateVideoEncoder( |
| 45 const cricket::VideoCodec& codec) { |
| 46 switch (CodecTypeFromName(codec.name)) { |
| 47 case webrtc::kVideoCodecH264: |
| 48 return webrtc::H264Encoder::Create(); |
| 49 case webrtc::kVideoCodecVP8: |
| 50 return webrtc::VP8Encoder::Create(); |
| 51 case webrtc::kVideoCodecVP9: |
| 52 return webrtc::VP9Encoder::Create(); |
| 53 default: |
| 54 return nullptr; |
| 55 } |
| 56 } |
| 57 |
| 58 const std::vector<cricket::VideoCodec>& |
| 59 InternalEncoderFactory::supported_codecs() const { |
| 60 return supported_codecs_; |
| 61 } |
| 62 |
| 63 void InternalEncoderFactory::DestroyVideoEncoder( |
| 64 webrtc::VideoEncoder* encoder) { |
| 65 delete encoder; |
| 66 } |
| 67 |
| 68 } // namespace cricket |
OLD | NEW |