winlin

for #301, hls support h.264+mp3, ok for vlc. 2.0.107

... ... @@ -521,6 +521,7 @@ Supported operating systems and hardware:
### SRS 2.0 history
* v2.0, 2015-01-25, for [#301](https://github.com/winlinvip/simple-rtmp-server/issues/301), hls support h.264+mp3, ok for vlc. 2.0.107
* v2.0, 2015-01-25, for [#301](https://github.com/winlinvip/simple-rtmp-server/issues/301), http ts stream support h.264+mp3. 2.0.106
* v2.0, 2015-01-25, hotfix [#268](https://github.com/winlinvip/simple-rtmp-server/issues/268), refine the pcr start at 0, dts/pts plus delay. 2.0.105
* v2.0, 2015-01-25, hotfix [#151](https://github.com/winlinvip/simple-rtmp-server/issues/151), refine pcr=dts-800ms and use dts/pts directly. 2.0.104
... ...
... ... @@ -92,6 +92,7 @@ SrsHlsMuxer::SrsHlsMuxer()
hls_fragment = hls_window = 0;
_sequence_no = 0;
current = NULL;
acodec = SrsCodecAudioReserved1;
}
SrsHlsMuxer::~SrsHlsMuxer()
... ... @@ -170,6 +171,11 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts)
}
srs_info("open HLS muxer success. path=%s, tmp=%s",
current->full_path.c_str(), tmp_file.c_str());
// set the segment muxer audio codec.
if (acodec != SrsCodecAudioReserved1) {
current->muxer->update_acodec(acodec);
}
return ret;
}
... ... @@ -199,11 +205,12 @@ bool SrsHlsMuxer::is_segment_absolutely_overflow()
return current->duration >= 2 * hls_fragment;
}
int SrsHlsMuxer::update_acodec(SrsCodecAudio acodec)
int SrsHlsMuxer::update_acodec(SrsCodecAudio ac)
{
srs_assert(current);
srs_assert(current->muxer);
return current->muxer->update_acodec(acodec);
acodec = ac;
return current->muxer->update_acodec(ac);
}
int SrsHlsMuxer::flush_audio(SrsMpegtsFrame* af, SrsSimpleBuffer* ab)
... ... @@ -801,7 +808,7 @@ int SrsHls::on_audio(SrsSharedPtrMessage* __audio)
}
// ignore sequence header
if (sample->aac_packet_type == SrsCodecAudioTypeSequenceHeader) {
if (acodec == SrsCodecAudioAAC && sample->aac_packet_type == SrsCodecAudioTypeSequenceHeader) {
return hls_cache->on_sequence_header(muxer);
}
... ...
... ... @@ -118,6 +118,12 @@ private:
* current writing segment.
*/
SrsHlsSegment* current;
/**
* the current audio codec, when open new muxer,
* set the muxer audio codec.
* @see https://github.com/winlinvip/simple-rtmp-server/issues/301
*/
SrsCodecAudio acodec;
public:
SrsHlsMuxer();
virtual ~SrsHlsMuxer();
... ... @@ -144,7 +150,7 @@ public:
*/
virtual bool is_segment_absolutely_overflow();
public:
virtual int update_acodec(SrsCodecAudio acodec);
virtual int update_acodec(SrsCodecAudio ac);
virtual int flush_audio(SrsMpegtsFrame* af, SrsSimpleBuffer* ab);
virtual int flush_video(SrsMpegtsFrame* af, SrsSimpleBuffer* ab, SrsMpegtsFrame* vf, SrsSimpleBuffer* vb);
/**
... ...
... ... @@ -352,6 +352,7 @@ int SrsGoHttpFileServer::serve_file(ISrsGoHttpResponseWriter* w, SrsHttpMessage*
_mime[".zip"] = "application/zip";
_mime[".rar"] = "application/x-rar-compressed";
_mime[".xml"] = "text/xml;charset=utf-8";
_mime[".html"] = "text/html;charset=utf-8";
_mime[".js"] = "text/javascript";
_mime[".css"] = "text/css;charset=utf-8";
_mime[".ico"] = "image/x-icon";
... ...
... ... @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 106
#define VERSION_REVISION 107
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
... ...
... ... @@ -430,14 +430,14 @@ int SrsTSMuxer::open(string _path)
return ret;
}
int SrsTSMuxer::update_acodec(SrsCodecAudio acodec)
int SrsTSMuxer::update_acodec(SrsCodecAudio ac)
{
int ret = ERROR_SUCCESS;
if (current == acodec) {
if (current == ac) {
return ret;
}
current = acodec;
current = ac;
return ret;
}
... ...
... ... @@ -85,7 +85,7 @@ public:
* @remark for audio aac codec, for example, SRS1, it's ok to write PSI when open ts.
* @see https://github.com/winlinvip/simple-rtmp-server/issues/301
*/
virtual int update_acodec(SrsCodecAudio acodec);
virtual int update_acodec(SrsCodecAudio ac);
/**
* write an audio frame to ts,
* @remark write PSI first when not write yet.
... ...