[vlc-commits] demux:asf: fix the i_preroll_start substracting milliseconds from an mtime
Steve Lhomme
git at videolan.org
Tue Sep 18 11:01:52 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jun 7 11:30:04 2018 +0200| [120e2cb800da292077e80dc790f323b901a13ff2] | committer: Steve Lhomme
demux:asf: fix the i_preroll_start substracting milliseconds from an mtime
store the preroll in vlc_tick_t instead of milliseconds
Divide all uses by 1000 for now
SeekIndex was using the value in milliseconds substracted from the vlc_tick_t date.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=120e2cb800da292077e80dc790f323b901a13ff2
---
modules/demux/asf/asf.c | 12 ++++++------
modules/demux/asf/asfpacket.c | 6 +++---
modules/demux/asf/asfpacket.h | 2 +-
modules/demux/asf/libasf.c | 4 ++--
modules/demux/asf/libasf.h | 2 +-
modules/demux/mp4/mp4.c | 2 +-
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index 89f1ae671c..f9cc4ce28e 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -213,8 +213,8 @@ static int Demux( demux_t *p_demux )
}
while( !p_sys->b_eos && ( p_sys->i_sendtime - p_sys->i_time - CHUNK < 0 ||
- ( p_sys->i_sendtime - p_sys->i_time - CHUNK ) /
- UINT64_C( 1000 ) < p_sys->p_fp->i_preroll ) )
+ ( p_sys->i_sendtime - p_sys->i_time - CHUNK ) <
+ p_sys->p_fp->i_preroll ) )
{
/* Read and demux a packet */
if( DemuxASFPacket( &p_sys->packet_sys,
@@ -242,8 +242,8 @@ static int Demux( demux_t *p_demux )
}
if( p_sys->b_eos || ( p_sys->i_sendtime - p_sys->i_time - CHUNK >= 0 &&
- ( p_sys->i_sendtime - p_sys->i_time - CHUNK ) /
- UINT64_C( 1000 ) >= p_sys->p_fp->i_preroll ) )
+ ( p_sys->i_sendtime - p_sys->i_time - CHUNK ) >=
+ p_sys->p_fp->i_preroll ) )
{
bool b_data = Block_Dequeue( p_demux, p_sys->i_time + CHUNK );
@@ -358,7 +358,7 @@ static int SeekIndex( demux_t *p_demux, vlc_tick_t i_date, float f_pos )
if( i_date < 0 )
i_date = p_sys->i_length * f_pos;
- p_sys->i_preroll_start = i_date - (int64_t) p_sys->p_fp->i_preroll;
+ p_sys->i_preroll_start = i_date - p_sys->p_fp->i_preroll;
if ( p_sys->i_preroll_start < 0 ) p_sys->i_preroll_start = 0;
p_index = ASF_FindObject( p_sys->p_root, &asf_object_simple_index_guid, 0 );
@@ -1237,7 +1237,7 @@ static int DemuxInit( demux_t *p_demux )
/* calculate the time duration in micro-s */
p_sys->i_length = VLC_TICK_FROM_MSFTIME(p_sys->p_fp->i_play_duration) *
(vlc_tick_t)i_count /
- (vlc_tick_t)p_sys->p_fp->i_data_packets_count - p_sys->p_fp->i_preroll * 1000;
+ (vlc_tick_t)p_sys->p_fp->i_data_packets_count - p_sys->p_fp->i_preroll;
if( p_sys->i_length < 0 )
p_sys->i_length = 0;
diff --git a/modules/demux/asf/asfpacket.c b/modules/demux/asf/asfpacket.c
index 21c4250067..e99cb6b68a 100644
--- a/modules/demux/asf/asfpacket.c
+++ b/modules/demux/asf/asfpacket.c
@@ -237,7 +237,7 @@ static int DemuxPayload(asf_packet_sys_t *p_packetsys, asf_packet_t *pkt, int i_
&pkt->p_peek[pkt->i_skip + 8],
i_replicated_data_length - 8,
&b_packet_keyframe );
- i_pkt_time -= *p_packetsys->pi_preroll;
+ i_pkt_time -= MS_FROM_VLC_TICK(*p_packetsys->pi_preroll);
pkt->i_skip += i_replicated_data_length;
}
else if ( i_replicated_data_length == 0 )
@@ -253,7 +253,7 @@ static int DemuxPayload(asf_packet_sys_t *p_packetsys, asf_packet_t *pkt, int i_
i_pkt_time_delta = VLC_TICK_FROM_MS(pkt->p_peek[pkt->i_skip]);
b_ignore_pts = false;
i_pkt_time = (vlc_tick_t)i_media_object_offset;
- i_pkt_time -= *p_packetsys->pi_preroll;
+ i_pkt_time -= MS_FROM_VLC_TICK(*p_packetsys->pi_preroll);
pkt->i_skip++;
i_media_object_offset = 0;
}
@@ -271,7 +271,7 @@ static int DemuxPayload(asf_packet_sys_t *p_packetsys, asf_packet_t *pkt, int i_
if( ! pkt->left || pkt->i_skip >= pkt->left )
return -1;
- bool b_preroll_done = ( pkt->send_time/1000 > (*p_packetsys->pi_preroll_start/1000 + *p_packetsys->pi_preroll) );
+ bool b_preroll_done = ( pkt->send_time > (*p_packetsys->pi_preroll_start + *p_packetsys->pi_preroll) );
if (i_pkt_time < 0) i_pkt_time = 0; // FIXME?
i_pkt_time *= 1000;
diff --git a/modules/demux/asf/asfpacket.h b/modules/demux/asf/asfpacket.h
index 3d4c1a5b22..9a5af1aa66 100644
--- a/modules/demux/asf/asfpacket.h
+++ b/modules/demux/asf/asfpacket.h
@@ -43,7 +43,7 @@ struct asf_packet_sys_s
demux_t *p_demux;
/* global stream info */
- uint64_t *pi_preroll;
+ vlc_tick_t *pi_preroll;
vlc_tick_t *pi_preroll_start;
/* callbacks */
diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c
index 119ef4d0e3..027478a0c8 100644
--- a/modules/demux/asf/libasf.c
+++ b/modules/demux/asf/libasf.c
@@ -317,7 +317,7 @@ static int ASF_ReadObject_file_properties( stream_t *s, asf_object_t *p_obj )
p_fp->i_data_packets_count = GetQWLE( p_peek + 56 );
p_fp->i_play_duration = GetQWLE( p_peek + 64 );
p_fp->i_send_duration = GetQWLE( p_peek + 72 );
- p_fp->i_preroll = GetQWLE( p_peek + 80 );
+ p_fp->i_preroll = VLC_TICK_FROM_MS(GetQWLE( p_peek + 80 ));
p_fp->i_flags = GetDWLE( p_peek + 88 );
p_fp->i_min_data_packet_size = __MAX( GetDWLE( p_peek + 92 ), (uint32_t) 1 );
p_fp->i_max_data_packet_size = __MAX( GetDWLE( p_peek + 96 ), (uint32_t) 1 );
@@ -333,7 +333,7 @@ static int ASF_ReadObject_file_properties( stream_t *s, asf_object_t *p_obj )
GUID_PRINT( p_fp->i_file_id ), p_fp->i_file_size,
p_fp->i_creation_date, p_fp->i_data_packets_count,
p_fp->i_play_duration, p_fp->i_send_duration,
- p_fp->i_preroll, p_fp->i_flags,
+ MS_FROM_VLC_TICK(p_fp->i_preroll), p_fp->i_flags,
p_fp->i_min_data_packet_size, p_fp->i_max_data_packet_size,
p_fp->i_max_bitrate );
#endif
diff --git a/modules/demux/asf/libasf.h b/modules/demux/asf/libasf.h
index 9f2cb9f356..90f46d12c3 100644
--- a/modules/demux/asf/libasf.h
+++ b/modules/demux/asf/libasf.h
@@ -106,7 +106,7 @@ typedef struct
uint64_t i_data_packets_count;
msftime_t i_play_duration;
msftime_t i_send_duration;
- uint64_t i_preroll;
+ vlc_tick_t i_preroll;
uint32_t i_flags;
uint32_t i_min_data_packet_size;
uint32_t i_max_data_packet_size;
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 7c904a89d0..37883281fc 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -132,7 +132,7 @@ typedef struct
/* ASF in MP4 */
asf_packet_sys_t asfpacketsys;
- uint64_t i_preroll; /* foobar */
+ vlc_tick_t i_preroll; /* foobar */
vlc_tick_t i_preroll_start;
struct
More information about the vlc-commits
mailing list