mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
H265: Support HEVC over HTTP-TS. v6.0.4 (#3275)
1. Update TS video codec to HEVC during streaming. 2. Return error when HEVC is disabled. 3. Parse HEVC NALU type by SrsHevcNaluTypeParse. 4. Show message when codec change for TS. Co-authored-by: runner365 <shi.weibd@hotmail.com>
This commit is contained in:
parent
8debbe6db8
commit
70d5618979
10 changed files with 178 additions and 33 deletions
|
|
@ -555,7 +555,7 @@ srs_error_t SrsHlsMuxer::flush_audio(SrsTsMessageCache* cache)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsHlsMuxer::flush_video(SrsTsMessageCache* cache)
|
||||
srs_error_t SrsHlsMuxer::flush_video(SrsTsMessageCache* cache, SrsVideoFrame* frame)
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
|
|
@ -573,6 +573,12 @@ srs_error_t SrsHlsMuxer::flush_video(SrsTsMessageCache* cache)
|
|||
|
||||
// update the duration of segment.
|
||||
current->append(cache->video->dts / 90);
|
||||
|
||||
// The video codec might change during streaming. Note that the frame might be NULL, when reap segment.
|
||||
if (frame && frame->vcodec()) {
|
||||
SrsTsContextWriter* tscw = current->tscw;
|
||||
tscw->update_video_codec(frame->vcodec()->id);
|
||||
}
|
||||
|
||||
if ((err = current->tscw->write_video(cache->video)) != srs_success) {
|
||||
return srs_error_wrap(err, "hls: write video");
|
||||
|
|
@ -1025,7 +1031,7 @@ srs_error_t SrsHlsController::write_video(SrsVideoFrame* frame, int64_t dts)
|
|||
}
|
||||
|
||||
// flush video when got one
|
||||
if ((err = muxer->flush_video(tsmc)) != srs_success) {
|
||||
if ((err = muxer->flush_video(tsmc, frame)) != srs_success) {
|
||||
return srs_error_wrap(err, "hls: flush video");
|
||||
}
|
||||
|
||||
|
|
@ -1057,7 +1063,7 @@ srs_error_t SrsHlsController::reap_segment()
|
|||
}
|
||||
|
||||
// segment open, flush video first.
|
||||
if ((err = muxer->flush_video(tsmc)) != srs_success) {
|
||||
if ((err = muxer->flush_video(tsmc, NULL)) != srs_success) {
|
||||
return srs_error_wrap(err, "hls: flush video");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ public:
|
|||
// Whether current hls muxer is pure audio mode.
|
||||
virtual bool pure_audio();
|
||||
virtual srs_error_t flush_audio(SrsTsMessageCache* cache);
|
||||
virtual srs_error_t flush_video(SrsTsMessageCache* cache);
|
||||
virtual srs_error_t flush_video(SrsTsMessageCache* cache, SrsVideoFrame* frame);
|
||||
// Close segment(ts).
|
||||
virtual srs_error_t segment_close();
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue