fix: improve field diagnostics and mirror logs to USB CDC
This commit is contained in:
@@ -13,7 +13,8 @@
|
||||
#include <netdb.h>
|
||||
#include "sockets.h"
|
||||
#include "mp3dec.h"
|
||||
#include "test_mp3.h"
|
||||
#include "test_mp3.h"
|
||||
#include "net_diag_voice.h"
|
||||
|
||||
#define RLOGD printf
|
||||
struct webclient_session *session = NULL;
|
||||
@@ -24,6 +25,7 @@ static Mp3PlayConfigInfo mp3_configInfo;
|
||||
static unsigned char mp3_player_status = 0;
|
||||
QFILE *local_mp3_file_fd=NULL;
|
||||
|
||||
static unsigned int diag_player_round;
|
||||
static int mp3_player_end_frame = 0;
|
||||
static int mp3_player_last_result = 0;
|
||||
|
||||
@@ -252,7 +254,13 @@ int mp3_decoder_run(struct mp3_decoder* decoder)
|
||||
current_sample_rate = decoder->frame_info.samprate;
|
||||
}
|
||||
|
||||
ql_audio_track_write(track_hd, (char*)pcm_buff, 1152);
|
||||
{
|
||||
int pcm_ret = ql_audio_track_write(track_hd, (char*)pcm_buff, 1152);
|
||||
if (diag_player_round && pcm_ret >= 0) {
|
||||
net_diag_voice_mark(diag_player_round, VOICE_FIRST_PCM);
|
||||
diag_player_round = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -396,6 +404,7 @@ void aofei_mp3_player(char *file_name)
|
||||
{
|
||||
int ret = 0;
|
||||
uint8_t *mp3_buff = NULL;
|
||||
diag_player_round = 0;
|
||||
|
||||
mp3_player_last_result = -1;
|
||||
if(file_name == NULL){
|
||||
@@ -413,7 +422,9 @@ void aofei_mp3_player(char *file_name)
|
||||
//直接下载到一个100k的buffer
|
||||
if(strncmp(file_name, "http://", strlen("http://")) == 0 ||
|
||||
strncmp(file_name, "https://", strlen("https://")) == 0){//播放url
|
||||
diag_player_round = net_diag_audio_begin(file_name);
|
||||
ret = url_mp3_data_fetch(file_name, mp3_buff, 100*1024);
|
||||
net_diag_audio_done(diag_player_round, total_length, ret);
|
||||
}else if(strstr(file_name, "test.mp3")){//播放本地音频
|
||||
total_length = test_data_size;
|
||||
memcpy(mp3_buff, test_data, total_length);
|
||||
|
||||
Reference in New Issue
Block a user