Permalink
Browse files

util: extra safety checks

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
  • Loading branch information...
felipec committed Oct 20, 2012
1 parent 9e47242 commit 9caca4678d52c0047b4ac194ca146f788ec1ba0e
Showing with 4 additions and 0 deletions.
  1. +4 −0 util.c
View
4 util.c
@@ -16,11 +16,15 @@
int64_t gstav_timestamp_to_pts(AVCodecContext *ctx, int64_t ts)
{
AVRational bq = { 1, GST_SECOND * ctx->ticks_per_frame };
+ if (ts == -1)
+ return AV_NOPTS_VALUE;
return av_rescale_q(ts, bq, ctx->time_base);
}
int64_t gstav_pts_to_timestamp(AVCodecContext *ctx, int64_t pts)
{
AVRational bq = { 1, GST_SECOND * ctx->ticks_per_frame };
+ if (pts == (int64_t) AV_NOPTS_VALUE)
+ return -1;
return av_rescale_q(pts, ctx->time_base, bq);
}

0 comments on commit 9caca46

Please sign in to comment.