diff mbox

[FFmpeg-devel] avformat/segment: remove last_cut check when detecting a new segment

Message ID 20170126022408.13987-1-cus@passwd.hu
State Accepted
Commit 85169a75e17e35d17d26769324628d3202050bff
Headers show

Commit Message

Marton Balint Jan. 26, 2017, 2:24 a.m. UTC
Not starting a new segment if the elapsed microsecs since the start of the day
equals the the elapsed microsecs since the start of the day at the time of the
last cut seems plain wrong to me, Deti do you remember the original reason
behind this check?

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/segment.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Marton Balint Jan. 30, 2017, 7:39 p.m. UTC | #1
On Thu, 26 Jan 2017, Marton Balint wrote:

> Not starting a new segment if the elapsed microsecs since the start of the day
> equals the the elapsed microsecs since the start of the day at the time of the
> last cut seems plain wrong to me, Deti do you remember the original reason
> behind this check?
>
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
> libavformat/segment.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/libavformat/segment.c b/libavformat/segment.c
> index 9d47148..8ec3653 100644
> --- a/libavformat/segment.c
> +++ b/libavformat/segment.c
> @@ -87,7 +87,6 @@ typedef struct SegmentContext {
>     int64_t clocktime_offset; //< clock offset for cutting the segments at regular clock time
>     int64_t clocktime_wrap_duration; //< wrapping duration considered for starting a new segment
>     int64_t last_val;      ///< remember last time for wrap around detection
> -    int64_t last_cut;      ///< remember last cut
>     int cut_pending;
>     int header_written;    ///< whether we've already called avformat_write_header
> 
> @@ -870,10 +869,8 @@ calc_times:
>             localtime_r(&sec, &ti);
>             usecs = (int64_t)(ti.tm_hour * 3600 + ti.tm_min * 60 + ti.tm_sec) * 1000000 + (avgt % 1000000);
>             wrapped_val = (usecs + seg->clocktime_offset) % seg->time;
> -            if (seg->last_cut != usecs && wrapped_val < seg->last_val && wrapped_val < seg->clocktime_wrap_duration) {
> +            if (wrapped_val < seg->last_val && wrapped_val < seg->clocktime_wrap_duration)
>                 seg->cut_pending = 1;
> -                seg->last_cut = usecs;
> -            }
>             seg->last_val = wrapped_val;
>         } else {
>             end_pts = seg->time * (seg->segment_count + 1);
> --

Ping...

Thanks,
Marton
Marton Balint Feb. 4, 2017, 10:50 p.m. UTC | #2
On Mon, 30 Jan 2017, Marton Balint wrote:

>
>
> On Thu, 26 Jan 2017, Marton Balint wrote:
>
>> Not starting a new segment if the elapsed microsecs since the start of the 
> day
>> equals the the elapsed microsecs since the start of the day at the time of 
> the
>> last cut seems plain wrong to me, Deti do you remember the original reason
>> behind this check?
>>
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>> libavformat/segment.c | 5 +----
>> 1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/libavformat/segment.c b/libavformat/segment.c
>> index 9d47148..8ec3653 100644
>> --- a/libavformat/segment.c
>> +++ b/libavformat/segment.c
>> @@ -87,7 +87,6 @@ typedef struct SegmentContext {
>>     int64_t clocktime_offset; //< clock offset for cutting the segments at 
> regular clock time
>>     int64_t clocktime_wrap_duration; //< wrapping duration considered for 
> starting a new segment
>>     int64_t last_val;      ///< remember last time for wrap around 
> detection
>> -    int64_t last_cut;      ///< remember last cut
>>     int cut_pending;
>>     int header_written;    ///< whether we've already called 
> avformat_write_header
>> 
>> @@ -870,10 +869,8 @@ calc_times:
>>             localtime_r(&sec, &ti);
>>             usecs = (int64_t)(ti.tm_hour * 3600 + ti.tm_min * 60 + 
> ti.tm_sec) * 1000000 + (avgt % 1000000);
>>             wrapped_val = (usecs + seg->clocktime_offset) % seg->time;
>> -            if (seg->last_cut != usecs && wrapped_val < seg->last_val && 
> wrapped_val < seg->clocktime_wrap_duration) {
>> +            if (wrapped_val < seg->last_val && wrapped_val < 
> seg->clocktime_wrap_duration)
>>                 seg->cut_pending = 1;
>> -                seg->last_cut = usecs;
>> -            }
>>             seg->last_val = wrapped_val;
>>         } else {
>>             end_pts = seg->time * (seg->segment_count + 1);
>> --
>
> Ping...
>

Applied.

Regards,
Marton
diff mbox

Patch

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 9d47148..8ec3653 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -87,7 +87,6 @@  typedef struct SegmentContext {
     int64_t clocktime_offset; //< clock offset for cutting the segments at regular clock time
     int64_t clocktime_wrap_duration; //< wrapping duration considered for starting a new segment
     int64_t last_val;      ///< remember last time for wrap around detection
-    int64_t last_cut;      ///< remember last cut
     int cut_pending;
     int header_written;    ///< whether we've already called avformat_write_header
 
@@ -870,10 +869,8 @@  calc_times:
             localtime_r(&sec, &ti);
             usecs = (int64_t)(ti.tm_hour * 3600 + ti.tm_min * 60 + ti.tm_sec) * 1000000 + (avgt % 1000000);
             wrapped_val = (usecs + seg->clocktime_offset) % seg->time;
-            if (seg->last_cut != usecs && wrapped_val < seg->last_val && wrapped_val < seg->clocktime_wrap_duration) {
+            if (wrapped_val < seg->last_val && wrapped_val < seg->clocktime_wrap_duration)
                 seg->cut_pending = 1;
-                seg->last_cut = usecs;
-            }
             seg->last_val = wrapped_val;
         } else {
             end_pts = seg->time * (seg->segment_count + 1);