zoukankan      html  css  js  c++  java
  • webrtc codec

    1、视频

    std::unique_ptr<VideoEncoder> InternalEncoderFactory::CreateVideoEncoder(
        const SdpVideoFormat& format) {
      if (absl::EqualsIgnoreCase(format.name, cricket::kVp8CodecName))
        return VP8Encoder::Create();
      if (absl::EqualsIgnoreCase(format.name, cricket::kVp9CodecName))
        return VP9Encoder::Create(cricket::VideoCodec(format));
      if (absl::EqualsIgnoreCase(format.name, cricket::kH264CodecName))
        return H264Encoder::Create(cricket::VideoCodec(format));
      RTC_LOG(LS_ERROR) << "Trying to created encoder of unsupported format "
                        << format.name;
      return nullptr;
    }
    

     从上到下的优先级的形式设置

     2 音频

    WebRtcVoiceMediaChannel::SetRecvCodecs

    WebRtcVoiceMediaChannel::SetSendCodecs

     for (const AudioCodec& voice_codec : codecs) {
        if (!(IsCodec(voice_codec, kCnCodecName) ||
              IsCodec(voice_codec, kDtmfCodecName) ||
              IsCodec(voice_codec, kRedCodecName))) {
          webrtc::SdpAudioFormat format(voice_codec.name, voice_codec.clockrate,
                                        voice_codec.channels, voice_codec.params);
    
          voice_codec_info = engine()->encoder_factory_->QueryAudioEncoder(format);
          if (!voice_codec_info) {
            RTC_LOG(LS_WARNING) << "Unknown codec " << ToString(voice_codec);
            continue;
          }
    

      这个里边 从codecs的列表里 从头到尾的优先级找到当前使用的codec。

    而这个codecs的列表数据,是音频引擎在启动的时候,获取到的,代码如下:

    void WebRtcVoiceEngine::Init() {
      RTC_DCHECK(worker_thread_checker_.IsCurrent());
      RTC_LOG(LS_INFO) << "WebRtcVoiceEngine::Init";
    
      // TaskQueue expects to be created/destroyed on the same thread.
      low_priority_worker_queue_.reset(
          new rtc::TaskQueue(task_queue_factory_->CreateTaskQueue(
              "rtc-low-prio", webrtc::TaskQueueFactory::Priority::LOW)));
    
      // Load our audio codec lists.
      RTC_LOG(LS_VERBOSE) << "Supported send codecs in order of preference:";
      send_codecs_ = CollectCodecs(encoder_factory_->GetSupportedEncoders());
      for (const AudioCodec& codec : send_codecs_) {
        RTC_LOG(LS_VERBOSE) << ToString(codec);
      }
    
      RTC_LOG(LS_VERBOSE) << "Supported recv codecs in order of preference:";
      recv_codecs_ = CollectCodecs(decoder_factory_->GetSupportedDecoders());
      for (const AudioCodec& codec : recv_codecs_) {
        RTC_LOG(LS_VERBOSE) << ToString(codec);
      }
    

      

  • 相关阅读:
    vue导出Excel表格(纯前端)
    Ubuntu16.04+CUDA8.0+CUNN5.1+caffe+tensorflow+Theano
    python高级特性
    顺序容器
    感知机和支持向量机
    IO库
    字符串、向量、数组、迭代器

    c++函数
    C++语句
  • 原文地址:https://www.cnblogs.com/132818Creator/p/12942279.html
Copyright © 2011-2022 走看看