diff mbox

[FFmpeg-devel,01/15] avformat/matroskaenc: Fix relative timestamp check

Message ID 20190419234110.32980-1-andreas.rheinhardt@gmail.com
State Accepted
Headers show

Commit Message

Andreas Rheinhardt April 19, 2019, 11:40 p.m. UTC
At this point, ts already includes the ts_offset so that the relative
time written with the cluster is already given by ts - mkv->cluster_pts.
It is this number that needs to fit into an int16_t.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
The only difference between this version and the earlier version is the
authorship information. My earlier emails were munged and in order to
make the committer's life easier, I'll resend the whole patchset.
I would appreciate reviews and comments.
 libavformat/matroskaenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Rheinhardt May 7, 2019, 12:19 a.m. UTC | #1
Andreas Rheinhardt:
> At this point, ts already includes the ts_offset so that the relative
> time written with the cluster is already given by ts - mkv->cluster_pts.
> It is this number that needs to fit into an int16_t.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> The only difference between this version and the earlier version is the
> authorship information. My earlier emails were munged and in order to
> make the committer's life easier, I'll resend the whole patchset.
> I would appreciate reviews and comments.
>  libavformat/matroskaenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 1c98c0dceb..c006cbf35c 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -2404,7 +2404,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_
>      ts += mkv->tracks[pkt->stream_index].ts_offset;
>  
>      if (mkv->cluster_pos != -1) {
> -        int64_t cluster_time = ts - mkv->cluster_pts + mkv->tracks[pkt->stream_index].ts_offset;
> +        int64_t cluster_time = ts - mkv->cluster_pts;
>          if ((int16_t)cluster_time != cluster_time) {
>              av_log(s, AV_LOG_WARNING, "Starting new cluster due to timestamp\n");
>              mkv_start_new_cluster(s, pkt);
> 
Ping for the whole patchset.

- Andreas
James Almer May 8, 2019, 8:14 p.m. UTC | #2
On 5/6/2019 9:19 PM, Andreas Rheinhardt wrote:
> Andreas Rheinhardt:
>> At this point, ts already includes the ts_offset so that the relative
>> time written with the cluster is already given by ts - mkv->cluster_pts.
>> It is this number that needs to fit into an int16_t.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
>> ---
>> The only difference between this version and the earlier version is the
>> authorship information. My earlier emails were munged and in order to
>> make the committer's life easier, I'll resend the whole patchset.
>> I would appreciate reviews and comments.
>>  libavformat/matroskaenc.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
>> index 1c98c0dceb..c006cbf35c 100644
>> --- a/libavformat/matroskaenc.c
>> +++ b/libavformat/matroskaenc.c
>> @@ -2404,7 +2404,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_
>>      ts += mkv->tracks[pkt->stream_index].ts_offset;
>>  
>>      if (mkv->cluster_pos != -1) {
>> -        int64_t cluster_time = ts - mkv->cluster_pts + mkv->tracks[pkt->stream_index].ts_offset;
>> +        int64_t cluster_time = ts - mkv->cluster_pts;
>>          if ((int16_t)cluster_time != cluster_time) {
>>              av_log(s, AV_LOG_WARNING, "Starting new cluster due to timestamp\n");
>>              mkv_start_new_cluster(s, pkt);
>>
> Ping for the whole patchset.
> 
> - Andreas

Set pushed. Thanks!
diff mbox

Patch

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 1c98c0dceb..c006cbf35c 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2404,7 +2404,7 @@  static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_
     ts += mkv->tracks[pkt->stream_index].ts_offset;
 
     if (mkv->cluster_pos != -1) {
-        int64_t cluster_time = ts - mkv->cluster_pts + mkv->tracks[pkt->stream_index].ts_offset;
+        int64_t cluster_time = ts - mkv->cluster_pts;
         if ((int16_t)cluster_time != cluster_time) {
             av_log(s, AV_LOG_WARNING, "Starting new cluster due to timestamp\n");
             mkv_start_new_cluster(s, pkt);