[vlc-commits] demux: ts: don't reattach decoder on pmt update
Francois Cartegnie
git at videolan.org
Sun Jul 26 16:39:11 CEST 2015
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jul 26 14:21:07 2015 +0200| [d7b6368fb0ee6ad0b0913c1f99afd10d0e545faf] | committer: Francois Cartegnie
demux: ts: don't reattach decoder on pmt update
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d7b6368fb0ee6ad0b0913c1f99afd10d0e545faf
---
modules/demux/mpeg/ts.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 7d8df00..9b0f7c0 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -5486,6 +5486,7 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_dvbpsipat )
ValidateDVBMeta( p_demux, p_program->i_pid );
+ bool b_existing = (pmtpid->type == TYPE_PMT);
/* create or temporary incref pid */
if( !PIDSetup( p_demux, TYPE_PMT, pmtpid, patpid ) )
{
@@ -5494,11 +5495,17 @@ static void PATCallBack( void *data, dvbpsi_pat_t *p_dvbpsipat )
continue;
}
- pmtpid->u.p_pmt->i_number = p_program->i_number;
+ if( !b_existing || pmtpid->u.p_pmt->i_number != p_program->i_number )
+ {
+ if( b_existing && pmtpid->u.p_pmt->i_number != p_program->i_number )
+ dvbpsi_pmt_detach(pmtpid->u.p_pmt->handle);
- if( !dvbpsi_pmt_attach( pmtpid->u.p_pmt->handle, p_program->i_number, PMTCallBack, p_demux ) )
- msg_Err( p_demux, "PATCallback failed attaching PMTCallback to program %d",
- p_program->i_number );
+ if( !dvbpsi_pmt_attach( pmtpid->u.p_pmt->handle, p_program->i_number, PMTCallBack, p_demux ) )
+ msg_Err( p_demux, "PATCallback failed attaching PMTCallback to program %d",
+ p_program->i_number );
+ }
+
+ pmtpid->u.p_pmt->i_number = p_program->i_number;
ARRAY_APPEND( p_pat->programs, pmtpid );
More information about the vlc-commits
mailing list