@@ -29,12 +29,11 @@ internal class SessionCaptureStrategy(
2929 }
3030
3131 override fun start (
32- recorderConfig : ScreenshotRecorderConfig ,
3332 segmentId : Int ,
3433 replayId : SentryId ,
3534 replayType : ReplayType ?
3635 ) {
37- super .start(recorderConfig, segmentId, replayId, replayType)
36+ super .start(segmentId, replayId, replayType)
3837 // only set replayId on the scope if it's a full session, otherwise all events will be
3938 // tagged with the replay that might never be sent when we're recording in buffer mode
4039 scopes?.configureScope {
@@ -80,8 +79,6 @@ internal class SessionCaptureStrategy(
8079 // have to do it before submitting, otherwise if the queue is busy, the timestamp won't be
8180 // reflecting the exact time of when it was captured
8281 val frameTimestamp = dateProvider.currentTimeMillis
83- val height = recorderConfig.recordingHeight
84- val width = recorderConfig.recordingWidth
8582 replayExecutor.submitSafely(options, " $TAG .add_frame" ) {
8683 cache?.store(frameTimestamp)
8784
@@ -98,20 +95,24 @@ internal class SessionCaptureStrategy(
9895
9996 val now = dateProvider.currentTimeMillis
10097 if ((now - currentSegmentTimestamp.time >= options.sessionReplay.sessionSegmentDuration)) {
101- val segment =
102- createSegmentInternal(
103- options.sessionReplay.sessionSegmentDuration,
104- currentSegmentTimestamp,
105- currentReplayId,
106- currentSegment,
107- height,
108- width
109- )
110- if (segment is ReplaySegment .Created ) {
111- segment.capture(scopes)
112- currentSegment++
113- // set next segment timestamp as close to the previous one as possible to avoid gaps
114- segmentTimestamp = segment.replay.timestamp
98+ recorderConfig?.let { config ->
99+ val segment =
100+ createSegmentInternal(
101+ options.sessionReplay.sessionSegmentDuration,
102+ currentSegmentTimestamp,
103+ currentReplayId,
104+ currentSegment,
105+ config.recordingHeight,
106+ config.recordingWidth,
107+ config.frameRate,
108+ config.bitRate
109+ )
110+ if (segment is ReplaySegment .Created ) {
111+ segment.capture(scopes)
112+ currentSegment++
113+ // set next segment timestamp as close to the previous one as possible to avoid gaps
114+ segmentTimestamp = segment.replay.timestamp
115+ }
115116 }
116117 }
117118
@@ -140,17 +141,26 @@ internal class SessionCaptureStrategy(
140141 override fun convert (): CaptureStrategy = this
141142
142143 private fun createCurrentSegment (taskName : String , onSegmentCreated : (ReplaySegment ) -> Unit ) {
143- val now = dateProvider.currentTimeMillis
144- val currentSegmentTimestamp = segmentTimestamp ? : return
145- val segmentId = currentSegment
146- val duration = now - currentSegmentTimestamp.time
147- val replayId = currentReplayId
148- val height = recorderConfig.recordingHeight
149- val width = recorderConfig.recordingWidth
150- replayExecutor.submitSafely(options, " $TAG .$taskName " ) {
151- val segment =
152- createSegmentInternal(duration, currentSegmentTimestamp, replayId, segmentId, height, width)
153- onSegmentCreated(segment)
144+ recorderConfig?.let { config ->
145+ val now = dateProvider.currentTimeMillis
146+ val currentSegmentTimestamp = segmentTimestamp ? : return
147+ val segmentId = currentSegment
148+ val duration = now - currentSegmentTimestamp.time
149+ val replayId = currentReplayId
150+ replayExecutor.submitSafely(options, " $TAG .$taskName " ) {
151+ val segment =
152+ createSegmentInternal(
153+ duration,
154+ currentSegmentTimestamp,
155+ replayId,
156+ segmentId,
157+ config.recordingHeight,
158+ config.recordingWidth,
159+ config.frameRate,
160+ config.bitRate
161+ )
162+ onSegmentCreated(segment)
163+ }
154164 }
155165 }
156166}
0 commit comments