refine code, write audio immediatly
This commit is contained in:
parent
dbdfb29de1
commit
501b182dc9
10
trunk/src/core/srs_core_hls.cpp
Executable file → Normal file
10
trunk/src/core/srs_core_hls.cpp
Executable file → Normal file
|
|
@ -579,12 +579,9 @@ int SrsTSMuxer::write_audio(u_int32_t time, SrsCodec* codec, SrsCodecSample* sam
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
if (!audio_frame) {
|
audio_frame->dts = audio_frame->pts = time * 90;
|
||||||
audio_frame = new SrsMpegtsFrame();
|
audio_frame->pid = TS_AUDIO_PID;
|
||||||
audio_frame->dts = audio_frame->pts = time * 90;
|
audio_frame->sid = TS_AUDIO_AAC;
|
||||||
audio_frame->pid = TS_AUDIO_PID;
|
|
||||||
audio_frame->sid = TS_AUDIO_AAC;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < sample->nb_buffers; i++) {
|
for (int i = 0; i < sample->nb_buffers; i++) {
|
||||||
SrsCodecBuffer* buf = &sample->buffers[i];
|
SrsCodecBuffer* buf = &sample->buffers[i];
|
||||||
|
|
@ -649,7 +646,6 @@ int SrsTSMuxer::write_audio(u_int32_t time, SrsCodec* codec, SrsCodecSample* sam
|
||||||
if ((ret = SrsMpegtsWriter::write_frame(fd, audio_frame, audio_buffer)) != ERROR_SUCCESS) {
|
if ((ret = SrsMpegtsWriter::write_frame(fd, audio_frame, audio_buffer)) != ERROR_SUCCESS) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
srs_freep(audio_frame);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user