kopia lustrzana https://github.com/kierank/libmpegts
Don't write a PCR on every video frame
rodzic
09a210b077
commit
106fd8e5ba
11
libmpegts.c
11
libmpegts.c
|
@ -1710,22 +1710,21 @@ int ts_write_frames( ts_writer_t *w, ts_frame_t *frames, int num_frames, uint8_t
|
||||||
#endif
|
#endif
|
||||||
bs_init( &q, temp, 150 );
|
bs_init( &q, temp, 150 );
|
||||||
|
|
||||||
/* It is good practice to write a pcr at the beginning of a video payload, and allows the packet to be
|
|
||||||
* a random access indicator if applicable */
|
|
||||||
if( program->pcr_stream == stream && pes_start )
|
if( program->pcr_stream == stream && pes_start )
|
||||||
write_pcr = 1;
|
write_adapt_field = 1;
|
||||||
else if( check_pcr( w, program ) )
|
|
||||||
|
if( check_pcr( w, program ) )
|
||||||
{
|
{
|
||||||
if( program->pcr_stream == stream )
|
if( program->pcr_stream == stream )
|
||||||
{
|
{
|
||||||
/* piggyback pcr on this stream */
|
/* piggyback pcr on this stream */
|
||||||
write_pcr = 1;
|
write_adapt_field = write_pcr = 1;
|
||||||
}
|
}
|
||||||
else if( write_pcr_empty( w, program, 0 ) < 0 )
|
else if( write_pcr_empty( w, program, 0 ) < 0 )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( write_pcr )
|
if( write_adapt_field )
|
||||||
{
|
{
|
||||||
adapt_field_len = write_adaptation_field( w, &q, program, pes, write_pcr, 1, 0, 0 );
|
adapt_field_len = write_adaptation_field( w, &q, program, pes, write_pcr, 1, 0, 0 );
|
||||||
pkt_bytes_left -= adapt_field_len;
|
pkt_bytes_left -= adapt_field_len;
|
||||||
|
|
Ładowanie…
Reference in New Issue