[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: demux: mkv: turn the PCR update into a function
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Nov 27 10:03:12 UTC 2021
Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC
Commits:
80708059 by Steve Lhomme at 2021-11-27T09:46:10+00:00
demux: mkv: turn the PCR update into a function
(cherry picked from commit 7a5eede42d1a80a1be0171adc813d6310f118186) (edited)
edited:
* 3.0 branch uses mtime_t instead of vlc_tick_t
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
73439b6b by Steve Lhomme at 2021-11-27T09:46:10+00:00
demux: mkv: make sure we send the first valid PCR before we send a valid block
Negative or VLC_TICK_INVALID timestamps are not sent as a PCR but there might
still be such blocks sent before the PCR.
(cherry picked from commit a18356f3f364b8d673b267bddab5dd64f1c12b72) (edited)
edited:
* vlc 3.0 branches uses VLC_TS_INVALID instead of VLC_TICK_INVALID
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
3 changed files:
- modules/demux/mkv/mkv.cpp
- modules/demux/mkv/util.cpp
- modules/demux/mkv/util.hpp
Changes:
=====================================
modules/demux/mkv/mkv.cpp
=====================================
@@ -778,40 +778,12 @@ static int Demux( demux_t *p_demux)
}
}
- /* update pcr */
+ if (UpdatePCR( p_demux ) != VLC_SUCCESS)
{
- int64_t i_pcr = VLC_TS_INVALID;
-
- typedef matroska_segment_c::tracks_map_t tracks_map_t;
-
- for( tracks_map_t::const_iterator it = p_segment->tracks.begin(); it != p_segment->tracks.end(); ++it )
- {
- mkv_track_t &track = *it->second;
-
- if( track.i_last_dts == VLC_TS_INVALID )
- continue;
-
- if( track.fmt.i_cat != VIDEO_ES && track.fmt.i_cat != AUDIO_ES )
- continue;
-
- if( track.i_last_dts < i_pcr || i_pcr <= VLC_TS_INVALID )
- {
- i_pcr = track.i_last_dts;
- }
- }
-
- if( i_pcr > VLC_TS_INVALID && i_pcr > p_sys->i_pcr )
- {
- if( es_out_SetPCR( p_demux->out, i_pcr ) )
- {
- msg_Err( p_demux, "ES_OUT_SET_PCR failed, aborting." );
- delete block;
- delete additions;
- return 0;
- }
-
- p_sys->i_pcr = i_pcr;
- }
+ msg_Err( p_demux, "ES_OUT_SET_PCR failed, aborting." );
+ delete block;
+ delete additions;
+ return VLC_DEMUXER_EGENERIC;
}
/* set pts */
=====================================
modules/demux/mkv/util.cpp
=====================================
@@ -310,6 +310,44 @@ error:
return NULL;
}
+int UpdatePCR( demux_t * p_demux )
+{
+ demux_sys_t *p_sys = (demux_sys_t *)p_demux->p_sys;
+ matroska_segment_c *p_segment = p_sys->p_current_vsegment->CurrentSegment();
+
+ int64_t i_pcr = VLC_TS_INVALID;
+
+ typedef matroska_segment_c::tracks_map_t tracks_map_t;
+
+ for( tracks_map_t::const_iterator it = p_segment->tracks.begin(); it != p_segment->tracks.end(); ++it )
+ {
+ mkv_track_t &track = *it->second;
+
+ if( track.i_last_dts == VLC_TS_INVALID )
+ continue;
+
+ if( track.fmt.i_cat != VIDEO_ES && track.fmt.i_cat != AUDIO_ES )
+ continue;
+
+ if( track.i_last_dts < i_pcr || i_pcr <= VLC_TS_INVALID )
+ {
+ i_pcr = track.i_last_dts;
+ }
+ }
+
+ if( i_pcr > VLC_TS_INVALID && i_pcr > p_sys->i_pcr )
+ {
+ if( es_out_SetPCR( p_demux->out, i_pcr ) )
+ {
+ return VLC_EGENERIC;
+ }
+
+ p_sys->i_pcr = i_pcr;
+ }
+
+ return VLC_SUCCESS;
+}
+
void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsigned int i_number_frames, mtime_t i_duration )
{
demux_sys_t *p_sys = p_demux->p_sys;
@@ -340,6 +378,9 @@ void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsig
p_tk->b_discontinuity = false;
}
+ if ( p_sys->i_pcr == VLC_TS_INVALID )
+ UpdatePCR( p_demux );
+
es_out_Send( p_demux->out, p_tk->p_es, p_block);
}
=====================================
modules/demux/mkv/util.hpp
=====================================
@@ -35,6 +35,7 @@ void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, m
block_t *WEBVTT_Repack_Sample(block_t *p_block, bool b_webm = false,
const uint8_t * = NULL, size_t = 0);
void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsigned int i_number_frames, mtime_t i_duration );
+int UpdatePCR( demux_t * p_demux );
struct real_audio_private
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1353e52693d8deb4e629e153d9c73d7dc69afc13...73439b6b5839ec045462a1d98e37192328225bca
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1353e52693d8deb4e629e153d9c73d7dc69afc13...73439b6b5839ec045462a1d98e37192328225bca
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list