winlin

fix #85, fix the segment-dvr sequence header missing. 0.9.187.

... ... @@ -207,6 +207,7 @@ Supported operating systems and hardware:
* 2013-10-17, Created.<br/>
## History
* v1.0, 2014-08-03, fix [#85](https://github.com/winlinvip/simple-rtmp-server/issues/85), fix the segment-dvr sequence header missing. 0.9.187.
* v1.0, 2014-08-03, fix [#145](https://github.com/winlinvip/simple-rtmp-server/issues/145), refine ffmpeg log, check abitrate for libaacplus. 0.9.186.
* v1.0, 2014-08-03, fix [#143](https://github.com/winlinvip/simple-rtmp-server/issues/143), fix retrieve sys stat bug for all linux. 0.9.185.
* v1.0, 2014-08-02, fix [#138](https://github.com/winlinvip/simple-rtmp-server/issues/138), fix http hooks bug, regression bug. 0.9.184.
... ...
... ... @@ -399,10 +399,13 @@ void SrsDvrSessionPlan::on_unpublish()
SrsDvrSegmentPlan::SrsDvrSegmentPlan()
{
segment_duration = -1;
sh_video = sh_audio = NULL;
}
SrsDvrSegmentPlan::~SrsDvrSegmentPlan()
{
srs_freep(sh_video);
srs_freep(sh_audio);
}
int SrsDvrSegmentPlan::initialize(SrsSource* source, SrsRequest* req)
... ... @@ -445,6 +448,26 @@ void SrsDvrSegmentPlan::on_unpublish()
dvr_enabled = false;
}
int SrsDvrSegmentPlan::on_audio(SrsSharedPtrMessage* audio)
{
if (SrsFlvCodec::audio_is_sequence_header(audio->payload, audio->size)) {
srs_freep(sh_audio);
sh_audio = audio->copy();
}
return SrsDvrPlan::on_audio(audio);
}
int SrsDvrSegmentPlan::on_video(SrsSharedPtrMessage* video)
{
if (SrsFlvCodec::video_is_sequence_header(video->payload, video->size)) {
srs_freep(sh_video);
sh_video = video->copy();
}
return SrsDvrPlan::on_video(video);
}
int SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg)
{
int ret = ERROR_SUCCESS;
... ... @@ -463,9 +486,18 @@ int SrsDvrSegmentPlan::update_duration(SrsSharedPtrMessage* msg)
}
on_unpublish();
// open new flv file
if ((ret = open_new_segment()) != ERROR_SUCCESS) {
return ret;
}
// update sequence header
if (sh_video && (ret = SrsDvrPlan::on_video(sh_video)) != ERROR_SUCCESS) {
return ret;
}
if (sh_audio && (ret = SrsDvrPlan::on_audio(sh_audio)) != ERROR_SUCCESS) {
return ret;
}
}
return ret;
... ...
... ... @@ -161,6 +161,8 @@ class SrsDvrSegmentPlan : public SrsDvrPlan
private:
// in config, in ms
int segment_duration;
SrsSharedPtrMessage* sh_audio;
SrsSharedPtrMessage* sh_video;
public:
SrsDvrSegmentPlan();
virtual ~SrsDvrSegmentPlan();
... ... @@ -168,6 +170,8 @@ public:
virtual int initialize(SrsSource* source, SrsRequest* req);
virtual int on_publish();
virtual void on_unpublish();
virtual int on_audio(SrsSharedPtrMessage* audio);
virtual int on_video(SrsSharedPtrMessage* video);
private:
virtual int update_duration(SrsSharedPtrMessage* msg);
};
... ...
... ... @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "186"
#define VERSION_REVISION "187"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
... ...