diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 60b1b34..d07a092 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3153,7 +3153,7 @@ static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data,
         // Compare signed timecodes. Timecode may be negative due to codec delay
         // offset. We don't support timestamps greater than int64_t anyway - see
         // AVPacket's pts.
-        if ((int64_t)timecode < (int64_t)(matroska->skip_to_timecode))
+        if ((int64_t)timecode < (int64_t)matroska->skip_to_timecode)
             return res;
         if (is_keyframe)
             matroska->skip_to_keyframe = 0;
diff --git a/tests/fate/seek.mak b/tests/fate/seek.mak
index b831cf8..f835da5 100644
--- a/tests/fate/seek.mak
+++ b/tests/fate/seek.mak
@@ -247,8 +247,11 @@ FATE_SEEK += $(FATE_SEEK_LAVF-yes:%=fate-seek-lavf-%)
 
 FATE_SEEK_EXTRA-$(CONFIG_MP3_DEMUXER)   += fate-seek-extra-mp3
 FATE_SEEK_EXTRA-$(call ALLYES, CACHE_PROTOCOL PIPE_PROTOCOL MP3_DEMUXER) += fate-seek-cache-pipe
+FATE_SEEK_EXTRA-$(CONFIG_MATROSKA_DEMUXER) += fate-seek-mkv-codec-delay
 fate-seek-extra-mp3:  CMD = run libavformat/tests/seek$(EXESUF) $(TARGET_SAMPLES)/gapless/gapless.mp3 -fastseek 1
 fate-seek-cache-pipe: CMD = cat $(TARGET_SAMPLES)/gapless/gapless.mp3 | run libavformat/tests/seek$(EXESUF) cache:pipe:0 -read_ahead_limit -1
+fate-seek-mkv-codec-delay:   CMD = run libavformat/tests/seek$(EXESUF) $(TARGET_SAMPLES)/mkv/codec_delay_opus.mkv
+
 FATE_SEEK_EXTRA += $(FATE_SEEK_EXTRA-yes)
 
 
diff --git a/tests/ref/seek/mkv-codec-delay b/tests/ref/seek/mkv-codec-delay
new file mode 100644
index 0000000..9d4582c
--- /dev/null
+++ b/tests/ref/seek/mkv-codec-delay
@@ -0,0 +1,48 @@
+ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
+ret: 0         st:-1 flags:0  ts:-1.000000
+ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
+ret: 0         st:-1 flags:1  ts: 1.894167
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:0  ts: 0.788000
+ret: 0         st: 0 flags:1 dts: 0.794000 pts: 0.794000 pos:   7358 size:   154
+ret: 0         st: 0 flags:1  ts:-0.317000
+ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
+ret:-1         st:-1 flags:0  ts: 2.576668
+ret: 0         st:-1 flags:1  ts: 1.470835
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:0  ts: 0.365000
+ret: 0         st: 0 flags:1 dts: 0.374000 pts: 0.374000 pos:   3963 size:   150
+ret: 0         st: 0 flags:1  ts:-0.741000
+ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
+ret:-1         st:-1 flags:0  ts: 2.153336
+ret: 0         st:-1 flags:1  ts: 1.047503
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st: 0 flags:0  ts:-0.058000
+ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
+ret: 0         st: 0 flags:1  ts: 2.836000
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret:-1         st:-1 flags:0  ts: 1.730004
+ret: 0         st:-1 flags:1  ts: 0.624171
+ret: 0         st: 0 flags:1 dts: 0.614000 pts: 0.614000 pos:   5903 size:   159
+ret: 0         st: 0 flags:0  ts:-0.482000
+ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
+ret: 0         st: 0 flags:1  ts: 2.413000
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret:-1         st:-1 flags:0  ts: 1.306672
+ret: 0         st:-1 flags:1  ts: 0.200839
+ret: 0         st: 0 flags:1 dts: 0.194000 pts: 0.194000 pos:   2512 size:   159
+ret: 0         st: 0 flags:0  ts:-0.905000
+ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
+ret: 0         st: 0 flags:1  ts: 1.989000
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st:-1 flags:0  ts: 0.883340
+ret: 0         st: 0 flags:1 dts: 0.894000 pts: 0.894000 pos:   8154 size:   155
+ret: 0         st:-1 flags:1  ts:-0.222493
+ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
+ret:-1         st: 0 flags:0  ts: 2.672000
+ret: 0         st: 0 flags:1  ts: 1.566000
+ret: 0         st: 0 flags:1 dts: 1.014000 pts: 1.014000 pos:   9306 size:   291
+ret: 0         st:-1 flags:0  ts: 0.460008
+ret: 0         st: 0 flags:1 dts: 0.474000 pts: 0.474000 pos:   4768 size:   153
+ret: 0         st:-1 flags:1  ts:-0.645825
+ret: 0         st: 0 flags:1 dts:-0.007000 pts:-0.007000 pos:    748 size:   320
