modules/video_coding/main/source/video_sender.cc
int32_t VideoSender::RegisterExternalEncoder(VideoEncoder* externalEncoder,
                                             uint8_t payloadType,
                                             bool internalSource /*= false*/) {
  DCHECK(main_thread_.CalledOnValidThread());

  CriticalSectionScoped cs(_sendCritSect);

  if (externalEncoder == NULL) {
    bool wasSendCodec = false;
    const bool ret =
        _codecDataBase.DeregisterExternalEncoder(payloadType, &wasSendCodec);
    if (wasSendCodec) {
      // Make sure the VCM doesn't use the de-registered codec
      _encoder = NULL;
    }
    return ret ? 0 : -1;
  }
  _codecDataBase.RegisterExternalEncoder(
      externalEncoder, payloadType, internalSource);
  return 0;
}
// Register an external decoder object.
// This can not be used together with external decoder callbacks.
Register an external decoder object.
This can not be used together with external decoder callbacks.
Register an external decoder object . This can not be used together with external decoder callbacks .
int32_t VideoSender::RegisterExternalEncoder(VideoEncoder* externalEncoder,
                                             uint8_t payloadType,
                                             bool internalSource ) {
  DCHECK(main_thread_.CalledOnValidThread());
  CriticalSectionScoped cs(_sendCritSect);
  if (externalEncoder == NULL) {
    bool wasSendCodec = false;
    const bool ret =
        _codecDataBase.DeregisterExternalEncoder(payloadType, &wasSendCodec);
    if (wasSendCodec) {
      _encoder = NULL;
    }
    return ret ? 0 : -1;
  }
  _codecDataBase.RegisterExternalEncoder(
      externalEncoder, payloadType, internalSource);
  return 0;
}
int32_t VideoSender :: RegisterExternalEncoder ( VideoEncoder * externalEncoder , uint8_t payloadType , bool internalSource ) { DCHECK ( main_thread_ . CalledOnValidThread ( ) ) ; CriticalSectionScoped cs ( _sendCritSect ) ; if ( externalEncoder == NULL ) { bool wasSendCodec = false ; const bool ret = _codecDataBase . DeregisterExternalEncoder ( payloadType , & wasSendCodec ) ; if ( wasSendCodec ) { _encoder = NULL ; } return ret ? 0 : -1 ; } _codecDataBase . RegisterExternalEncoder ( externalEncoder , payloadType , internalSource ) ; return 0 ; }
Register an external decoder object.
Register an external decoder object .
/*= false*/ // Make sure the VCM doesn't use the de-registered codec