Skip to content

Commit

Permalink
for ossrs#179, wait keyframe for dvr. 2.0.127
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Feb 27, 2015
1 parent 0213cc6 commit 8ed256b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions trunk/src/app/srs_app_dvr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,10 @@ int SrsFlvSegment::write_video(SrsSharedPtrMessage* __video)
char* payload = video->payload;
int size = video->size;

bool is_sequence_header = SrsFlvCodec::video_is_sequence_header(payload, size);
#ifdef SRS_AUTO_HTTP_CALLBACK
bool is_key_frame = SrsFlvCodec::video_is_h264(payload, size)
&& SrsFlvCodec::video_is_keyframe(payload, size)
&& !SrsFlvCodec::video_is_sequence_header(payload, size);
&& SrsFlvCodec::video_is_keyframe(payload, size) && !is_sequence_header;
if (is_key_frame) {
has_keyframe = true;
if ((ret = plan->on_video_keyframe()) != ERROR_SUCCESS) {
Expand All @@ -319,6 +319,16 @@ int SrsFlvSegment::write_video(SrsSharedPtrMessage* __video)
}
srs_verbose("dvr video is key: %d", is_key_frame);
#endif

// accept the sequence header here.
// when got no keyframe, ignore when should wait keyframe.
if (!has_keyframe && !is_sequence_header) {
bool wait_keyframe = _srs_config->get_dvr_wait_keyframe(req->vhost);
if (wait_keyframe) {
srs_info("dvr: ignore when wait keyframe.");
return ret;
}
}

if ((jitter->correct(video, 0, 0, jitter_algorithm)) != ERROR_SUCCESS) {
return ret;
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 126
#define VERSION_REVISION 127

// server info.
#define RTMP_SIG_SRS_KEY "SRS"
Expand Down

0 comments on commit 8ed256b

Please sign in to comment.