equal
deleted
inserted
replaced
62 private boolean chunkFinished; |
62 private boolean chunkFinished; |
63 private InternalEventFilter eventFilter = InternalEventFilter.ACCEPT_ALL; |
63 private InternalEventFilter eventFilter = InternalEventFilter.ACCEPT_ALL; |
64 private boolean reuse; |
64 private boolean reuse; |
65 private boolean ordered; |
65 private boolean ordered; |
66 private boolean resetEventCache; |
66 private boolean resetEventCache; |
67 private long firstNanos; |
67 private long firstNanos = 0; |
|
68 private long lastNanos = Long.MAX_VALUE; |
68 |
69 |
69 public ChunkParser(RecordingInput input, boolean reuse) throws IOException { |
70 public ChunkParser(RecordingInput input, boolean reuse) throws IOException { |
70 this(new ChunkHeader(input), null, 1000); |
71 this(new ChunkHeader(input), null, 1000); |
71 this.reuse = reuse; |
72 this.reuse = reuse; |
72 } |
73 } |
115 } |
116 } |
116 |
117 |
117 public InternalEventFilter getEventFilter() { |
118 public InternalEventFilter getEventFilter() { |
118 return this.eventFilter; |
119 return this.eventFilter; |
119 } |
120 } |
120 |
|
121 |
121 |
122 /** |
122 /** |
123 * Reads an event and returns null when segment or chunk ends. |
123 * Reads an event and returns null when segment or chunk ends. |
124 * |
124 * |
125 * @param awaitNewEvents wait for new data. |
125 * @param awaitNewEvents wait for new data. |
371 if (firstNanos < chunkStart - 1_000_000_000L) { |
371 if (firstNanos < chunkStart - 1_000_000_000L) { |
372 firstNanos = 0; |
372 firstNanos = 0; |
373 } |
373 } |
374 this.firstNanos = firstNanos; |
374 this.firstNanos = firstNanos; |
375 } |
375 } |
|
376 public void setLastNanos(long lastNanos) { |
|
377 this.lastNanos = lastNanos; |
|
378 } |
|
379 |
376 |
380 |
377 // Need to call updateEventParsers() for |
381 // Need to call updateEventParsers() for |
378 // change to take effect |
382 // change to take effect |
379 public void resetEventCache() { |
383 public void resetEventCache() { |
380 this.resetEventCache = true; |
384 this.resetEventCache = true; |
386 EventParser ep = (EventParser) p; |
390 EventParser ep = (EventParser) p; |
387 String name = ep.getEventType().getName(); |
391 String name = ep.getEventType().getName(); |
388 ep.setOrdered(ordered); |
392 ep.setOrdered(ordered); |
389 ep.setReuse(reuse); |
393 ep.setReuse(reuse); |
390 ep.setFirstNanos(firstNanos); |
394 ep.setFirstNanos(firstNanos); |
|
395 ep.setLastNanos(lastNanos); |
391 if (resetEventCache) { |
396 if (resetEventCache) { |
392 ep.resetCache(); |
397 ep.resetCache(); |
393 } |
398 } |
394 long threshold = eventFilter.getThreshold(name); |
399 long threshold = eventFilter.getThreshold(name); |
395 if (threshold >= 0) { |
400 if (threshold >= 0) { |
405 } |
410 } |
406 |
411 |
407 public long getChunkDuration() { |
412 public long getChunkDuration() { |
408 return chunkHeader.getDurationNanos(); |
413 return chunkHeader.getDurationNanos(); |
409 } |
414 } |
|
415 |
|
416 public long getStartNanos() { |
|
417 return chunkHeader.getStartNanos(); |
|
418 } |
|
419 |
|
420 |
410 } |
421 } |