1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

CI: Refine hls ts context writer

This commit is contained in:
winlin 2019-02-05 16:26:43 +08:00
parent 36c41715e7
commit 073d42ca7d
3 changed files with 1 additions and 44 deletions

View file

@ -458,7 +458,7 @@ srs_error_t SrsHlsMuxer::segment_open()
// open temp ts file.
std::string tmp_file = current->tmppath();
if ((err = current->tscw->open(tmp_file.c_str())) != srs_success) {
if ((err = current->writer->open(tmp_file)) != srs_success) {
return srs_error_wrap(err, "open hls muxer");
}

View file

@ -2554,28 +2554,6 @@ SrsTsContextWriter::SrsTsContextWriter(ISrsStreamWriter* w, SrsTsContext* c, Srs
SrsTsContextWriter::~SrsTsContextWriter()
{
close();
}
srs_error_t SrsTsContextWriter::open(string p)
{
srs_error_t err = srs_success;
path = p;
close();
// reset the context for a new ts start.
context->reset();
SrsFileWriter* fw = dynamic_cast<SrsFileWriter*>(writer);
srs_assert(fw);
if ((err = fw->open(path)) != srs_success) {
return srs_error_wrap(err, "ts: open writer");
}
return err;
}
srs_error_t SrsTsContextWriter::write_audio(SrsTsMessage* audio)
@ -2608,14 +2586,6 @@ srs_error_t SrsTsContextWriter::write_video(SrsTsMessage* video)
return err;
}
void SrsTsContextWriter::close()
{
SrsFileWriter* fw = dynamic_cast<SrsFileWriter*>(writer);
srs_assert(fw);
fw->close();
}
SrsVideoCodecId SrsTsContextWriter::video_codec()
{
return vcodec;
@ -3033,10 +3003,6 @@ srs_error_t SrsTsTransmuxer::initialize(ISrsStreamWriter* fw)
// TODO: FIXME: Support config the codec.
tscw = new SrsTsContextWriter(fw, context, SrsAudioCodecIdAAC, SrsVideoCodecIdAVC);
if ((err = tscw->open("")) != srs_success) {
return srs_error_wrap(err, "ts: open writer");
}
return err;
}

View file

@ -1549,11 +1549,6 @@ public:
SrsTsContextWriter(ISrsStreamWriter* w, SrsTsContext* c, SrsAudioCodecId ac, SrsVideoCodecId vc);
virtual ~SrsTsContextWriter();
public:
/**
* open the writer, donot write the PSI of ts.
* @param p a string indicates the path of ts file to mux to.
*/
virtual srs_error_t open(std::string p);
/**
* write an audio frame to ts,
*/
@ -1562,10 +1557,6 @@ public:
* write a video frame to ts,
*/
virtual srs_error_t write_video(SrsTsMessage* video);
/**
* close the writer.
*/
virtual void close();
public:
/**
* get the video codec of ts muxer.