浏览代码

update opus and remove certs

philippe44 2 年之前
父节点
当前提交
6376fee954

+ 2 - 2
components/codecs/inc/opus/opus.h

@@ -198,7 +198,7 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT int opus_encoder_get_size(int channels);
  *                                     This must be one of 8000, 12000, 16000,
  *                                     This must be one of 8000, 12000, 16000,
  *                                     24000, or 48000.
  *                                     24000, or 48000.
  * @param [in] channels <tt>int</tt>: Number of channels (1 or 2) in input signal
  * @param [in] channels <tt>int</tt>: Number of channels (1 or 2) in input signal
- * @param [in] application <tt>int</tt>: Coding mode (@ref OPUS_APPLICATION_VOIP/@ref OPUS_APPLICATION_AUDIO/@ref OPUS_APPLICATION_RESTRICTED_LOWDELAY)
+ * @param [in] application <tt>int</tt>: Coding mode (one of @ref OPUS_APPLICATION_VOIP, @ref OPUS_APPLICATION_AUDIO, or @ref OPUS_APPLICATION_RESTRICTED_LOWDELAY)
  * @param [out] error <tt>int*</tt>: @ref opus_errorcodes
  * @param [out] error <tt>int*</tt>: @ref opus_errorcodes
  * @note Regardless of the sampling rate and number channels selected, the Opus encoder
  * @note Regardless of the sampling rate and number channels selected, the Opus encoder
  * can switch to a lower audio bandwidth or number of channels if the bitrate
  * can switch to a lower audio bandwidth or number of channels if the bitrate
@@ -222,7 +222,7 @@ OPUS_EXPORT OPUS_WARN_UNUSED_RESULT OpusEncoder *opus_encoder_create(
  *                                      This must be one of 8000, 12000, 16000,
  *                                      This must be one of 8000, 12000, 16000,
  *                                      24000, or 48000.
  *                                      24000, or 48000.
   * @param [in] channels <tt>int</tt>: Number of channels (1 or 2) in input signal
   * @param [in] channels <tt>int</tt>: Number of channels (1 or 2) in input signal
-  * @param [in] application <tt>int</tt>: Coding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO/OPUS_APPLICATION_RESTRICTED_LOWDELAY)
+  * @param [in] application <tt>int</tt>: Coding mode (one of OPUS_APPLICATION_VOIP, OPUS_APPLICATION_AUDIO, or OPUS_APPLICATION_RESTRICTED_LOWDELAY)
   * @retval #OPUS_OK Success or @ref opus_errorcodes
   * @retval #OPUS_OK Success or @ref opus_errorcodes
   */
   */
 OPUS_EXPORT int opus_encoder_init(
 OPUS_EXPORT int opus_encoder_init(

+ 4 - 3
components/codecs/inc/opus/opus_custom.h

@@ -104,7 +104,8 @@ typedef struct OpusCustomDecoder OpusCustomDecoder;
 /** The mode contains all the information necessary to create an
 /** The mode contains all the information necessary to create an
     encoder. Both the encoder and decoder need to be initialized
     encoder. Both the encoder and decoder need to be initialized
     with exactly the same mode, otherwise the output will be
     with exactly the same mode, otherwise the output will be
-    corrupted.
+    corrupted. The mode MUST NOT BE DESTROYED until the encoders and
+    decoders that use it are destroyed as well.
    @brief Mode configuration
    @brief Mode configuration
  */
  */
 typedef struct OpusCustomMode OpusCustomMode;
 typedef struct OpusCustomMode OpusCustomMode;
@@ -178,7 +179,7 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomEncoder *opus_custom_encode
 ) OPUS_ARG_NONNULL(1);
 ) OPUS_ARG_NONNULL(1);
 
 
 
 
-/** Destroys a an encoder state.
+/** Destroys an encoder state.
   * @param[in] st <tt>OpusCustomEncoder*</tt>: State to be freed.
   * @param[in] st <tt>OpusCustomEncoder*</tt>: State to be freed.
   */
   */
 OPUS_CUSTOM_EXPORT void opus_custom_encoder_destroy(OpusCustomEncoder *st);
 OPUS_CUSTOM_EXPORT void opus_custom_encoder_destroy(OpusCustomEncoder *st);
@@ -286,7 +287,7 @@ OPUS_CUSTOM_EXPORT OPUS_WARN_UNUSED_RESULT OpusCustomDecoder *opus_custom_decode
     int *error
     int *error
 ) OPUS_ARG_NONNULL(1);
 ) OPUS_ARG_NONNULL(1);
 
 
-/** Destroys a an decoder state.
+/** Destroys a decoder state.
   * @param[in] st <tt>OpusCustomDecoder*</tt>: State to be freed.
   * @param[in] st <tt>OpusCustomDecoder*</tt>: State to be freed.
   */
   */
 OPUS_CUSTOM_EXPORT void opus_custom_decoder_destroy(OpusCustomDecoder *st);
 OPUS_CUSTOM_EXPORT void opus_custom_decoder_destroy(OpusCustomDecoder *st);

+ 5 - 3
components/codecs/inc/opus/opus_defines.h

@@ -64,7 +64,7 @@ extern "C" {
 /**Export control for opus functions */
 /**Export control for opus functions */
 
 
 #ifndef OPUS_EXPORT
 #ifndef OPUS_EXPORT
-# if defined(WIN32)
+# if defined(_WIN32)
 #  if defined(OPUS_BUILD) && defined(DLL_EXPORT)
 #  if defined(OPUS_BUILD) && defined(DLL_EXPORT)
 #   define OPUS_EXPORT __declspec(dllexport)
 #   define OPUS_EXPORT __declspec(dllexport)
 #  else
 #  else
@@ -482,7 +482,8 @@ extern "C" {
   * @param[in] x <tt>opus_int32</tt>: Allowed values:
   * @param[in] x <tt>opus_int32</tt>: Allowed values:
   * <dl>
   * <dl>
   * <dt>0</dt><dd>Disable inband FEC (default).</dd>
   * <dt>0</dt><dd>Disable inband FEC (default).</dd>
-  * <dt>1</dt><dd>Enable inband FEC.</dd>
+  * <dt>1</dt><dd>Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.</dd>
+  * <dt>2</dt><dd>Inband FEC enabled, but does not necessarily switch to SILK if we have music.</dd>
   * </dl>
   * </dl>
   * @hideinitializer */
   * @hideinitializer */
 #define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, __opus_check_int(x)
 #define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, __opus_check_int(x)
@@ -491,7 +492,8 @@ extern "C" {
   * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
   * @param[out] x <tt>opus_int32 *</tt>: Returns one of the following values:
   * <dl>
   * <dl>
   * <dt>0</dt><dd>Inband FEC disabled (default).</dd>
   * <dt>0</dt><dd>Inband FEC disabled (default).</dd>
-  * <dt>1</dt><dd>Inband FEC enabled.</dd>
+  * <dt>1</dt><dd>Inband FEC enabled. If the packet loss rate is sufficiently high, Opus will automatically switch to SILK even at high rates to enable use of that FEC.</dd>
+  * <dt>2</dt><dd>Inband FEC enabled, but does not necessarily switch to SILK if we have music.</dd>
   * </dl>
   * </dl>
   * @hideinitializer */
   * @hideinitializer */
 #define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, __opus_check_int_ptr(x)
 #define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, __opus_check_int_ptr(x)

二进制
components/codecs/lib/libopus.a


+ 4 - 3
components/platform_console/cmd_system.c

@@ -69,7 +69,7 @@ static void register_deep_sleep();
 static void register_light_sleep();
 static void register_light_sleep();
 static void register_factory_boot();
 static void register_factory_boot();
 static void register_restart_ota();
 static void register_restart_ota();
-static void register_update_certs();
+//static void register_update_certs();
 static void register_set_services();
 static void register_set_services();
 #if WITH_TASKS_INFO
 #if WITH_TASKS_INFO
 static void register_tasks();
 static void register_tasks();
@@ -86,7 +86,7 @@ void register_system()
     register_restart();
     register_restart();
     register_deep_sleep();
     register_deep_sleep();
     register_light_sleep();
     register_light_sleep();
-    register_update_certs();
+    //register_update_certs();
     register_factory_boot();
     register_factory_boot();
     register_restart_ota();
     register_restart_ota();
 #if WITH_TASKS_INFO
 #if WITH_TASKS_INFO
@@ -562,6 +562,7 @@ static void register_tasks()
 
 
 #endif // WITH_TASKS_INFO
 #endif // WITH_TASKS_INFO
 
 
+/*
 extern esp_err_t update_certificates(bool force);
 extern esp_err_t update_certificates(bool force);
 static int force_update_cert(int argc, char **argv){
 static int force_update_cert(int argc, char **argv){
 	return update_certificates(true);
 	return update_certificates(true);
@@ -577,7 +578,7 @@ static void register_update_certs()
     };
     };
     ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
     ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
 }
 }
-
+*/
 
 
 
 
 /** 'deep_sleep' command puts the chip into deep sleep mode */
 /** 'deep_sleep' command puts the chip into deep sleep mode */

+ 1 - 1
components/squeezelite-ota/squeezelite-ota.c

@@ -349,7 +349,7 @@ esp_err_t init_config(ota_thread_parms_t * p_ota_thread_parms){
 		}
 		}
 	switch (ota_status->ota_type) {
 	switch (ota_status->ota_type) {
 	case OTA_TYPE_HTTP:
 	case OTA_TYPE_HTTP:
-		http_client_config.cert_pem =get_certificate();
+		//http_client_config.cert_pem =get_certificate();
 		http_client_config.event_handler = _http_event_handler;
 		http_client_config.event_handler = _http_event_handler;
 		http_client_config.disable_auto_redirect=false;
 		http_client_config.disable_auto_redirect=false;
 		http_client_config.skip_cert_common_name_check = false;
 		http_client_config.skip_cert_common_name_check = false;

+ 11 - 1
main/esp_app_main.c

@@ -47,9 +47,11 @@
 #include "cmd_system.h"
 #include "cmd_system.h"
 #include "tools.h"
 #include "tools.h"
 
 
+/*
 static const char certs_namespace[] = "certificates";
 static const char certs_namespace[] = "certificates";
 static const char certs_key[] = "blob";
 static const char certs_key[] = "blob";
 static const char certs_version[] = "version";
 static const char certs_version[] = "version";
+*/
 const char unknown_string_placeholder[] = "unknown";
 const char unknown_string_placeholder[] = "unknown";
 const char null_string_placeholder[] = "null";
 const char null_string_placeholder[] = "null";
 EventGroupHandle_t network_event_group;
 EventGroupHandle_t network_event_group;
@@ -67,8 +69,10 @@ RTC_NOINIT_ATTR uint16_t ColdBootIndicatorFlag;
 bool cold_boot=true;
 bool cold_boot=true;
 
 
 static bool bNetworkConnected=false;
 static bool bNetworkConnected=false;
+/*
 extern const uint8_t server_cert_pem_start[] asm("_binary_github_pem_start");
 extern const uint8_t server_cert_pem_start[] asm("_binary_github_pem_start");
 extern const uint8_t server_cert_pem_end[] asm("_binary_github_pem_end");
 extern const uint8_t server_cert_pem_end[] asm("_binary_github_pem_end");
+*/
 
 
 // as an exception _init function don't need include
 // as an exception _init function don't need include
 extern void services_init(void);
 extern void services_init(void);
@@ -159,8 +163,8 @@ void set_log_level(char * tag, char * level){
 }
 }
 
 
 
 
+/*
 esp_err_t update_certificates(bool force){
 esp_err_t update_certificates(bool force){
-
 	nvs_handle handle;
 	nvs_handle handle;
 	esp_err_t esp_err;
 	esp_err_t esp_err;
     esp_app_desc_t running_app_info;
     esp_app_desc_t running_app_info;
@@ -231,6 +235,9 @@ esp_err_t update_certificates(bool force){
 	nvs_close(handle);
 	nvs_close(handle);
 	return ESP_OK;
 	return ESP_OK;
 }
 }
+*/
+
+/*
 const char * get_certificate(){
 const char * get_certificate(){
 	nvs_handle handle;
 	nvs_handle handle;
 	esp_err_t esp_err;
 	esp_err_t esp_err;
@@ -266,6 +273,7 @@ const char * get_certificate(){
 	}
 	}
 	return blob;
 	return blob;
 }
 }
+*/
 
 
 #define DEFAULT_NAME_WITH_MAC(var,defval) char var[strlen(defval)+sizeof(macStr)]; strcpy(var,defval); strcat(var,macStr)
 #define DEFAULT_NAME_WITH_MAC(var,defval) char var[strlen(defval)+sizeof(macStr)]; strcpy(var,defval); strcat(var,macStr)
 void register_default_string_val(const char * key, char * value){
 void register_default_string_val(const char * key, char * value){
@@ -495,9 +503,11 @@ void app_main()
 	}
 	}
 
 
 
 
+/*
 	ESP_LOGI(TAG,"Checking if certificates need to be updated");
 	ESP_LOGI(TAG,"Checking if certificates need to be updated");
 	update_certificates(false);
 	update_certificates(false);
 	MEMTRACE_PRINT_DELTA();
 	MEMTRACE_PRINT_DELTA();
+*/    
 
 
 	ESP_LOGD(TAG,"Getting firmware OTA URL (if any)");
 	ESP_LOGD(TAG,"Getting firmware OTA URL (if any)");
 	fwurl = process_ota_url();
 	fwurl = process_ota_url();