Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added resetting epoch in seek

  • Loading branch information...
commit 924f2c1b56d95c0094435befa2b2d5c78ea39cf6 1 parent 98d959a
@arut authored
Showing with 8 additions and 2 deletions.
  1. +4 −1 ngx_rtmp_flv_module.c
  2. +4 −1 ngx_rtmp_mp4_module.c
View
5 ngx_rtmp_flv_module.c
@@ -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
@@ -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;
@@ -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;
View
5 ngx_rtmp_mp4_module.c
@@ -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];
@@ -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;
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.