diff --git a/README.md b/README.md index a467b26d4..d60c442e5 100755 --- a/README.md +++ b/README.md @@ -186,6 +186,7 @@ Please select your language: ### V3 changes +* v3.0, 2017-02-12, Fix [#301][bug #301], User must config the codec in right way for HLS. 3.0.18 * v3.0, 2017-02-07, fix [#738][bug #738] support DVR general mp4. 3.0.17 * v3.0, 2017-01-19, for [#742][bug #742] refine source, meta and origin hub. 3.0.16 * v3.0, 2017-01-17, for [#742][bug #742] refine source, timeout, live cycle. 3.0.15 @@ -1219,8 +1220,6 @@ Winlin [bug #310]: https://github.com/ossrs/srs/issues/310 [bug #136]: https://github.com/ossrs/srs/issues/136 [bug #250]: https://github.com/ossrs/srs/issues/250 -[bug #301]: https://github.com/ossrs/srs/issues/301 -[bug #301]: https://github.com/ossrs/srs/issues/301 [bug #268]: https://github.com/ossrs/srs/issues/268 [bug #151]: https://github.com/ossrs/srs/issues/151 [bug #151]: https://github.com/ossrs/srs/issues/151 diff --git a/trunk/src/app/srs_app_hls.cpp b/trunk/src/app/srs_app_hls.cpp index d05c78057..8dc1b160a 100644 --- a/trunk/src/app/srs_app_hls.cpp +++ b/trunk/src/app/srs_app_hls.cpp @@ -223,7 +223,6 @@ SrsHlsMuxer::SrsHlsMuxer() max_td = 0; _sequence_no = 0; current = NULL; - acodec = SrsAudioCodecIdReserved1; async = new SrsAsyncCallWorker(); context = new SrsTsContext(); } @@ -478,14 +477,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts) srs_error("open hls muxer failed. ret=%d", ret); return ret; } - 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. - // TODO: FIXME: refine code, use event instead. - if (acodec != SrsAudioCodecIdReserved1) { - current->muxer->update_acodec(acodec); - } + srs_info("open HLS muxer success. path=%s, tmp=%s", current->full_path.c_str(), tmp_file.c_str()); return ret; } @@ -543,14 +535,6 @@ bool SrsHlsMuxer::is_segment_absolutely_overflow() return current->duration >= hls_aof_ratio * hls_fragment + deviation; } -int SrsHlsMuxer::update_acodec(SrsAudioCodecId ac) -{ - srs_assert(current); - srs_assert(current->muxer); - acodec = ac; - return current->muxer->update_acodec(ac); -} - bool SrsHlsMuxer::pure_audio() { return current && current->muxer && current->muxer->video_codec() == SrsVideoCodecIdDisabled; @@ -863,11 +847,6 @@ void SrsHlsController::dispose() muxer->dispose(); } -int SrsHlsController::update_acodec(SrsAudioCodecId ac) -{ - return muxer->update_acodec(ac); -} - int SrsHlsController::sequence_no() { return muxer->sequence_no(); @@ -1220,12 +1199,6 @@ int SrsHls::on_audio(SrsSharedPtrMessage* shared_audio, SrsFormat* format) if (acodec != SrsAudioCodecIdAAC && acodec != SrsAudioCodecIdMP3) { return ret; } - - // when codec changed, write new header. - if ((ret = controller->update_acodec(acodec)) != ERROR_SUCCESS) { - srs_error("http: ts audio write header failed. ret=%d", ret); - return ret; - } // ignore sequence header srs_assert(format->audio); diff --git a/trunk/src/app/srs_app_hls.hpp b/trunk/src/app/srs_app_hls.hpp index 8bc83d93b..b0adcf86a 100644 --- a/trunk/src/app/srs_app_hls.hpp +++ b/trunk/src/app/srs_app_hls.hpp @@ -174,12 +174,6 @@ private: * current writing segment. */ SrsHlsSegment* current; - /** - * the current audio codec, when open new muxer, - * set the muxer audio codec. - * @see https://github.com/ossrs/srs/issues/301 - */ - SrsAudioCodecId acodec; /** * the ts context, to keep cc continous between ts. * @see https://github.com/ossrs/srs/issues/375 @@ -230,7 +224,6 @@ public: */ virtual bool is_segment_absolutely_overflow(); public: - virtual int update_acodec(SrsAudioCodecId ac); /** * whether current hls muxer is pure audio mode. */ @@ -278,7 +271,6 @@ public: public: virtual int initialize(); virtual void dispose(); - virtual int update_acodec(SrsAudioCodecId ac); virtual int sequence_no(); virtual std::string ts_url(); virtual double duration(); diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index 7831f0769..af5bf4d93 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // current release version #define VERSION_MAJOR 3 #define VERSION_MINOR 0 -#define VERSION_REVISION 17 +#define VERSION_REVISION 18 // generated by configure, only macros. #include diff --git a/trunk/src/kernel/srs_kernel_ts.cpp b/trunk/src/kernel/srs_kernel_ts.cpp index 37bef5d8c..d13c88148 100644 --- a/trunk/src/kernel/srs_kernel_ts.cpp +++ b/trunk/src/kernel/srs_kernel_ts.cpp @@ -2740,12 +2740,6 @@ int SrsTsMuxer::open(string p) return ret; } -int SrsTsMuxer::update_acodec(SrsAudioCodecId ac) -{ - acodec = ac; - return ERROR_SUCCESS; -} - int SrsTsMuxer::write_audio(SrsTsMessage* audio) { int ret = ERROR_SUCCESS; @@ -3117,6 +3111,7 @@ int SrsTsEncoder::initialize(SrsFileWriter* fw) writer = fw; srs_freep(muxer); + // TODO: FIXME: Support config the codec. muxer = new SrsTsMuxer(fw, context, SrsAudioCodecIdAAC, SrsVideoCodecIdAVC); if ((ret = muxer->open("")) != ERROR_SUCCESS) { @@ -3139,12 +3134,6 @@ int SrsTsEncoder::write_audio(int64_t timestamp, char* data, int size) if (format->acodec->id != SrsAudioCodecIdAAC && format->acodec->id != SrsAudioCodecIdMP3) { return ret; } - - // when codec changed, write new header. - if ((ret = muxer->update_acodec(format->acodec->id)) != ERROR_SUCCESS) { - srs_error("http: ts audio write header failed. ret=%d", ret); - return ret; - } // for aac: ignore sequence header if (format->acodec->id == SrsAudioCodecIdAAC && format->audio->aac_packet_type == SrsAudioAacFrameTraitSequenceHeader) { diff --git a/trunk/src/kernel/srs_kernel_ts.hpp b/trunk/src/kernel/srs_kernel_ts.hpp index 004465b3d..7fcfc91d9 100644 --- a/trunk/src/kernel/srs_kernel_ts.hpp +++ b/trunk/src/kernel/srs_kernel_ts.hpp @@ -1562,6 +1562,8 @@ protected: class SrsTsMuxer { private: + // User must config the codec in right way. + // @see https://github.com/ossrs/srs/issues/301 SrsVideoCodecId vcodec; SrsAudioCodecId acodec; private: @@ -1578,15 +1580,6 @@ public: */ virtual int open(std::string p); /** - * when open ts, we donot write the header(PSI), - * for user may need to update the acodec to mp3 or others, - * so we use delay write PSI, when write audio or video. - * @remark for audio aac codec, for example, SRS1, it's ok to write PSI when open ts. - * @see https://github.com/ossrs/srs/issues/301 - */ - // TODO: FIXME: Remove it. - virtual int update_acodec(SrsAudioCodecId ac); - /** * write an audio frame to ts, */ virtual int write_audio(SrsTsMessage* audio);