fix(audio): prevent empty session replay

This commit is contained in:
chenjintao
2026-09-24 18:00:48 +08:00
parent 83ef72839e
commit 6fad31c37a
2 changed files with 33 additions and 18 deletions
@@ -1365,9 +1365,17 @@ sender_loop:
continue;
}
if(!app_get_data_call_net_status()) continue;
if(shine_init==0){
if(!app_get_data_call_net_status()) continue;
/* One recording can release the semaphore many times while the sender
* drains the ring buffer. A stale token must never create an empty
* session after the previous encoder has already been closed. */
left = rb_get_space_used(ring_sender);
if(shine_init == 0 && left <= 0){
continue;
}
if(shine_init==0){
shine_set_config_mpeg_defaults(&(sh_config.mpeg)); //--init sh_config struct
sh_config.wave.channels=PCM_MONO; //PCM_STEREO;//PCM_MONO;
sh_config.wave.samplerate=16000;//valid samplerates: 44100,48000,32000,22050,24000,16000,11025,12000,8000
@@ -1417,10 +1425,13 @@ sender_loop:
sh_shine = NULL;
}
shine_init = 0;
audio_packet_type = 0;
}
shine_init = 0;
audio_packet_type = 0;
/* Discard semaphore tokens already represented by the PCM that this
* session drained. Recording has stopped, so no new frames race here. */
while(ql_rtos_semaphore_wait(sender_sem, 0) == 0) {}
}
}
}