@@ -132,6 +132,8 @@ class SnapOutput : public AudioInfoSupport {
132
132
// / ignored - update playback speed
133
133
bool synchronizePlayback () {
134
134
bool result = true ;
135
+ assert (p_snap_time_sync!=nullptr );
136
+
135
137
SnapTimeSync &ts = *p_snap_time_sync;
136
138
137
139
// calculate how long we need to wait to playback the audio
@@ -170,8 +172,7 @@ class SnapOutput : public AudioInfoSupport {
170
172
bool is_mute = false ;
171
173
SnapAudioHeader header;
172
174
SnapTime &snap_time = SnapTime::instance();
173
- SnapTimeSyncDynamic time_sync_default;
174
- SnapTimeSync *p_snap_time_sync = &time_sync_default;
175
+ SnapTimeSync *p_snap_time_sync = nullptr ;
175
176
bool is_sync_started = false ;
176
177
bool is_audio_begin_called = false ;
177
178
@@ -181,6 +182,10 @@ class SnapOutput : public AudioInfoSupport {
181
182
ESP_LOGI (TAG, " out is null" );
182
183
return false ;
183
184
}
185
+ if (p_snap_time_sync==nullptr ){
186
+ ESP_LOGI (TAG, " p_snap_time_sync is null" );
187
+ return false ;
188
+ }
184
189
185
190
// open volume control: allow amplification
186
191
auto vol_cfg = vol_stream.defaultConfig ();
@@ -241,6 +246,7 @@ class SnapOutput : public AudioInfoSupport {
241
246
} else {
242
247
// wait for the audio to become valid
243
248
ESP_LOGI (TAG, " starting after %d ms" , delay_ms);
249
+ assert (p_snap_time_sync!=nullptr );
244
250
setPlaybackFactor (p_snap_time_sync->getFactor ());
245
251
is_sync_started = true ;
246
252
result = true ;
@@ -250,6 +256,7 @@ class SnapOutput : public AudioInfoSupport {
250
256
251
257
// / Calculate the delay in ms
252
258
int getDelayMs () {
259
+ assert (p_snap_time_sync!=nullptr );
253
260
auto msg_time = snap_time.toMillis (header.sec , header.usec );
254
261
auto server_time = snap_time.serverMillis ();
255
262
// wait for the audio to become valid
0 commit comments