winlin

refine code, write audio immediatly

@@ -579,12 +579,9 @@ int SrsTSMuxer::write_audio(u_int32_t time, SrsCodec* codec, SrsCodecSample* sam @@ -579,12 +579,9 @@ int SrsTSMuxer::write_audio(u_int32_t time, SrsCodec* codec, SrsCodecSample* sam
579 { 579 {
580 int ret = ERROR_SUCCESS; 580 int ret = ERROR_SUCCESS;
581 581
582 - if (!audio_frame) {  
583 - audio_frame = new SrsMpegtsFrame();  
584 audio_frame->dts = audio_frame->pts = time * 90; 582 audio_frame->dts = audio_frame->pts = time * 90;
585 audio_frame->pid = TS_AUDIO_PID; 583 audio_frame->pid = TS_AUDIO_PID;
586 audio_frame->sid = TS_AUDIO_AAC; 584 audio_frame->sid = TS_AUDIO_AAC;
587 - }  
588 585
589 for (int i = 0; i < sample->nb_buffers; i++) { 586 for (int i = 0; i < sample->nb_buffers; i++) {
590 SrsCodecBuffer* buf = &sample->buffers[i]; 587 SrsCodecBuffer* buf = &sample->buffers[i];
@@ -649,7 +646,6 @@ int SrsTSMuxer::write_audio(u_int32_t time, SrsCodec* codec, SrsCodecSample* sam @@ -649,7 +646,6 @@ int SrsTSMuxer::write_audio(u_int32_t time, SrsCodec* codec, SrsCodecSample* sam
649 if ((ret = SrsMpegtsWriter::write_frame(fd, audio_frame, audio_buffer)) != ERROR_SUCCESS) { 646 if ((ret = SrsMpegtsWriter::write_frame(fd, audio_frame, audio_buffer)) != ERROR_SUCCESS) {
650 return ret; 647 return ret;
651 } 648 }
652 - srs_freep(audio_frame);  
653 649
654 return ret; 650 return ret;
655 } 651 }