mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #512, partical hotfix the hls pure audio. 2.0.196
This commit is contained in:
parent
3683f06e4d
commit
d1979c760f
5 changed files with 25 additions and 6 deletions
|
@ -336,6 +336,7 @@ Remark:
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
|
||||||
|
* v2.0, 2015-10-27, for [#512][bug #512] partical hotfix the hls pure audio. 2.0.196
|
||||||
* <strong>v2.0, 2015-10-08, [2.0 alpha2(2.0.195)][r2.0a2] released. 89358 lines.</strong>
|
* <strong>v2.0, 2015-10-08, [2.0 alpha2(2.0.195)][r2.0a2] released. 89358 lines.</strong>
|
||||||
* v2.0, 2015-10-04, for [#448][bug #448] fix the bug of response of http hooks. 2.0.195
|
* v2.0, 2015-10-04, for [#448][bug #448] fix the bug of response of http hooks. 2.0.195
|
||||||
* v2.0, 2015-10-01, for [#497][bug #497] response error when client not found to kickoff. 2.0.194
|
* v2.0, 2015-10-01, for [#497][bug #497] response error when client not found to kickoff. 2.0.194
|
||||||
|
|
|
@ -578,6 +578,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts)
|
||||||
current->full_path.c_str(), tmp_file.c_str());
|
current->full_path.c_str(), tmp_file.c_str());
|
||||||
|
|
||||||
// set the segment muxer audio codec.
|
// set the segment muxer audio codec.
|
||||||
|
// TODO: FIXME: refine code, use event instead.
|
||||||
if (acodec != SrsCodecAudioReserved1) {
|
if (acodec != SrsCodecAudioReserved1) {
|
||||||
current->muxer->update_acodec(acodec);
|
current->muxer->update_acodec(acodec);
|
||||||
}
|
}
|
||||||
|
@ -1044,7 +1045,7 @@ int SrsHlsCache::on_sequence_header(SrsHlsMuxer* muxer)
|
||||||
// when the sequence header changed, the stream is not republish.
|
// when the sequence header changed, the stream is not republish.
|
||||||
return muxer->on_sequence_header();
|
return muxer->on_sequence_header();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsHlsCache::write_audio(SrsAvcAacCodec* codec, SrsHlsMuxer* muxer, int64_t pts, SrsCodecSample* sample)
|
int SrsHlsCache::write_audio(SrsAvcAacCodec* codec, SrsHlsMuxer* muxer, int64_t pts, SrsCodecSample* sample)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
@ -1069,6 +1070,13 @@ int SrsHlsCache::write_audio(SrsAvcAacCodec* codec, SrsHlsMuxer* muxer, int64_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for pure audio, aggregate some frame to one.
|
||||||
|
if (muxer->pure_audio() && cache->audio) {
|
||||||
|
if (pts - cache->audio->start_pts < SRS_CONSTS_HLS_PURE_AUDIO_AGGREGATE) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// directly write the audio frame by frame to ts,
|
// directly write the audio frame by frame to ts,
|
||||||
// it's ok for the hls overload, or maybe cause the audio corrupt,
|
// it's ok for the hls overload, or maybe cause the audio corrupt,
|
||||||
// which introduced by aggregate the audios to a big one.
|
// which introduced by aggregate the audios to a big one.
|
||||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
// current release version
|
// current release version
|
||||||
#define VERSION_MAJOR 2
|
#define VERSION_MAJOR 2
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_REVISION 195
|
#define VERSION_REVISION 196
|
||||||
|
|
||||||
// server info.
|
// server info.
|
||||||
#define RTMP_SIG_SRS_KEY "SRS"
|
#define RTMP_SIG_SRS_KEY "SRS"
|
||||||
|
|
|
@ -459,8 +459,11 @@ int SrsTsContext::encode_pes(SrsFileWriter* writer, SrsTsMessage* msg, int16_t p
|
||||||
while (p < end) {
|
while (p < end) {
|
||||||
SrsTsPacket* pkt = NULL;
|
SrsTsPacket* pkt = NULL;
|
||||||
if (p == start) {
|
if (p == start) {
|
||||||
// for pure audio stream, always write pcr.
|
// write pcr according to message.
|
||||||
bool write_pcr = msg->write_pcr;
|
bool write_pcr = msg->write_pcr;
|
||||||
|
|
||||||
|
// for pure audio, always write pcr.
|
||||||
|
// TODO: FIXME: maybe only need to write at begin and end of ts.
|
||||||
if (pure_audio && msg->is_audio()) {
|
if (pure_audio && msg->is_audio()) {
|
||||||
write_pcr = true;
|
write_pcr = true;
|
||||||
}
|
}
|
||||||
|
@ -2785,11 +2788,12 @@ int SrsTsCache::cache_audio(SrsAvcAacCodec* codec, int64_t dts, SrsCodecSample*
|
||||||
if (!audio) {
|
if (!audio) {
|
||||||
audio = new SrsTsMessage();
|
audio = new SrsTsMessage();
|
||||||
audio->write_pcr = false;
|
audio->write_pcr = false;
|
||||||
audio->start_pts = dts;
|
audio->dts = audio->pts = audio->start_pts = dts;
|
||||||
}
|
}
|
||||||
|
|
||||||
audio->dts = dts;
|
// TODO: FIXME: refine code.
|
||||||
audio->pts = audio->dts;
|
//audio->dts = dts;
|
||||||
|
//audio->pts = audio->dts;
|
||||||
audio->sid = SrsTsPESStreamIdAudioCommon;
|
audio->sid = SrsTsPESStreamIdAudioCommon;
|
||||||
|
|
||||||
// must be aac or mp3
|
// must be aac or mp3
|
||||||
|
@ -3139,6 +3143,8 @@ int SrsTsEncoder::write_audio(int64_t timestamp, char* data, int size)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: FIXME: for pure audio, aggregate some frame to one.
|
||||||
|
|
||||||
// always flush audio frame by frame.
|
// always flush audio frame by frame.
|
||||||
// @see https://github.com/simple-rtmp-server/srs/issues/512
|
// @see https://github.com/simple-rtmp-server/srs/issues/512
|
||||||
return flush_audio();
|
return flush_audio();
|
||||||
|
|
|
@ -54,6 +54,9 @@ class SrsTsContext;
|
||||||
// Transport Stream packets are 188 bytes in length.
|
// Transport Stream packets are 188 bytes in length.
|
||||||
#define SRS_TS_PACKET_SIZE 188
|
#define SRS_TS_PACKET_SIZE 188
|
||||||
|
|
||||||
|
// the aggregate pure audio for hls, in ts tbn(ms * 90).
|
||||||
|
#define SRS_CONSTS_HLS_PURE_AUDIO_AGGREGATE 720 * 90
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the pid of ts packet,
|
* the pid of ts packet,
|
||||||
* Table 2-3 - PID table, hls-mpeg-ts-iso13818-1.pdf, page 37
|
* Table 2-3 - PID table, hls-mpeg-ts-iso13818-1.pdf, page 37
|
||||||
|
@ -359,6 +362,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* whether the hls stream is pure audio stream.
|
* whether the hls stream is pure audio stream.
|
||||||
*/
|
*/
|
||||||
|
// TODO: FIXME: merge with muxer codec detect.
|
||||||
virtual bool is_pure_audio();
|
virtual bool is_pure_audio();
|
||||||
/**
|
/**
|
||||||
* when PMT table parsed, we know some info about stream.
|
* when PMT table parsed, we know some info about stream.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue