video_encoder.cc 1.0 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright 2016 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. #include "remoting/codec/video_encoder.h"
  5. #include "base/notreached.h"
  6. #include "remoting/codec/video_encoder_verbatim.h"
  7. #include "remoting/codec/video_encoder_vpx.h"
  8. #include "remoting/protocol/session_config.h"
  9. namespace remoting {
  10. std::unique_ptr<VideoEncoder> VideoEncoder::Create(
  11. const protocol::SessionConfig& config) {
  12. const protocol::ChannelConfig& video_config = config.video_config();
  13. if (video_config.codec == protocol::ChannelConfig::CODEC_VP8) {
  14. return VideoEncoderVpx::CreateForVP8();
  15. } else if (video_config.codec == protocol::ChannelConfig::CODEC_VP9) {
  16. return VideoEncoderVpx::CreateForVP9();
  17. } else if (video_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) {
  18. return std::make_unique<VideoEncoderVerbatim>();
  19. }
  20. NOTREACHED() << "Unknown codec type: " << video_config.codec;
  21. return nullptr;
  22. }
  23. } // namespace remoting