mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
lavf/mpegtsenc: Add parentheses to clarify operator precedence in CC update
While "cc + 1 & 0xf" is technically correct because addition has higher precedence than bitwise AND in C, the intent of "(cc + 1) & 0xf" is not immediately obvious without recalling the precedence table. Add explicit parentheses to make the intended evaluation order clear and improve readability. Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
This commit is contained in:
@@ -170,7 +170,7 @@ static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
|
||||
b |= 0x40;
|
||||
*q++ = b;
|
||||
*q++ = s->pid;
|
||||
s->cc = s->cc + 1 & 0xf;
|
||||
s->cc = (s->cc + 1) & 0xf;
|
||||
*q++ = 0x10 | s->cc;
|
||||
if (s->discontinuity) {
|
||||
q[-1] |= 0x20;
|
||||
@@ -1583,7 +1583,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
|
||||
val |= 0x40;
|
||||
*q++ = val;
|
||||
*q++ = ts_st->pid;
|
||||
ts_st->cc = ts_st->cc + 1 & 0xf;
|
||||
ts_st->cc = (ts_st->cc + 1) & 0xf;
|
||||
*q++ = 0x10 | ts_st->cc; // payload indicator + CC
|
||||
if (ts_st->discontinuity) {
|
||||
set_af_flag(buf, 0x80);
|
||||
|
||||
Reference in New Issue
Block a user