Skip to content

Commit

Permalink
added resetting epoch in seek
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed Oct 24, 2012
1 parent 98d959a commit 924f2c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ngx_rtmp_flv_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef struct {

#define NGX_RTMP_FLV_BUFFER (1024*1024)
#define NGX_RTMP_FLV_DEFAULT_BUFLEN 1000
#define NGX_RTMP_FLV_BUFLEN_ADDON 1000
#define NGX_RTMP_FLV_TAG_HEADER 11
#define NGX_RTMP_FLV_DATA_OFFSET 13

Expand Down Expand Up @@ -526,7 +527,8 @@ ngx_rtmp_flv_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
return NGX_OK;
}

buflen = (s->buflen ? s->buflen : NGX_RTMP_FLV_DEFAULT_BUFLEN);
buflen = (s->buflen ? s->buflen + NGX_RTMP_FLV_BUFLEN_ADDON:
NGX_RTMP_FLV_DEFAULT_BUFLEN);
end_timestamp = (ngx_current_msec - ctx->epoch) +
ctx->start_timestamp + buflen;

Expand Down Expand Up @@ -604,6 +606,7 @@ ngx_rtmp_flv_seek(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
"flv: seek timestamp=%ui", timestamp);

ctx->start_timestamp = timestamp;
ctx->epoch = ngx_current_msec;
ctx->offset = -1;
ctx->msg_mask = 0;

Expand Down
5 changes: 4 additions & 1 deletion ngx_rtmp_mp4_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ ngx_rtmp_mp4_from_rtmp_timestamp(ngx_rtmp_mp4_track_t *t, uint32_t ts)


#define NGX_RTMP_MP4_DEFAULT_BUFLEN 1000
#define NGX_RTMP_MP4_BUFLEN_ADDON 1000


static u_char ngx_rtmp_mp4_buffer[1024*1024];
Expand Down Expand Up @@ -1959,7 +1960,8 @@ ngx_rtmp_mp4_send(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t *ts)
return rc;
}

buflen = (s->buflen ? s->buflen : NGX_RTMP_MP4_DEFAULT_BUFLEN);
buflen = (s->buflen ? s->buflen + NGX_RTMP_MP4_BUFLEN_ADDON:
NGX_RTMP_MP4_DEFAULT_BUFLEN);

t = ctx->tracks;

Expand Down Expand Up @@ -2263,6 +2265,7 @@ ngx_rtmp_mp4_seek(ngx_rtmp_session_t *s, ngx_file_t *f, ngx_uint_t timestamp)
}

ctx->start_timestamp = timestamp;
ctx->epoch = ngx_current_msec;

return ngx_rtmp_mp4_reset(s);
}
Expand Down

0 comments on commit 924f2c1

Please sign in to comment.