summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0d350ff)
scratch was too soon then SM_CANCEL would arrive at the speaker before
SM_PLAY, leaving the speaker thinking this was a queue removal rather
than a scratch, and therefore not sending a response.
The fix is to respond to _all_ SM_CANCELs whatever the speaker thinks
they are, and disorderd to always check the ID against the playing
track. The responses are distinguished, but the server no longer uses
this information.
* initialization. */
#define SM_READY 132
* initialization. */
#define SM_READY 132
+/** @brief Cancelled track @c id which wasn't playing */
+#define SM_STILLBORN 133
+
void speaker_send(int fd, const struct speaker_message *sm);
/* Send a message. */
void speaker_send(int fd, const struct speaker_message *sm);
/* Send a message. */
D(("SM_PAUSED %s %ld", sm.id, sm.data));
playing->sofar = sm.data;
break;
D(("SM_PAUSED %s %ld", sm.id, sm.data));
playing->sofar = sm.data;
break;
- case SM_FINISHED:
- /* the playing track finished */
- D(("SM_FINISHED %s", sm.id));
- finished(ev);
- break;
- case SM_UNKNOWN:
- /* we asked for an unknown track to be cancelled */
+ case SM_FINISHED: /* scratched the playing track */
+ case SM_STILLBORN: /* scratched too early */
+ case SM_UNKNOWN: /* scratched WAY too early */
if(playing && !strcmp(sm.id, playing->id))
finished(ev);
break;
if(playing && !strcmp(sm.id, playing->id))
finished(ev);
break;
report();
break;
case SM_CANCEL:
report();
break;
case SM_CANCEL:
- D(("SM_CANCEL %s", sm.id));
+ D(("SM_CANCEL %s", sm.id));
t = removetrack(sm.id);
if(t) {
if(t == playing) {
t = removetrack(sm.id);
if(t) {
if(t == playing) {
+ /* scratching the playing track */
- strcpy(sm.id, playing->id);
- speaker_send(1, &sm);
+ } else {
+ /* Could be scratching the playing track before it's quite got
+ * going, or could be just removing a track from the queue. We
+ * log more because there's been a bug here recently than because
+ * it's particularly interesting; the log message will be removed
+ * if no further problems show up. */
+ info("SM_CANCEL for nonplaying track %s", sm.id);
+ sm.type = SM_STILLBORN;
+ /* Probably scratching the playing track well before it's got
+ * going, but could indicate a bug, so we log this as an error. */
error(0, "SM_CANCEL for unknown track %s", sm.id);
}
error(0, "SM_CANCEL for unknown track %s", sm.id);
}
report();
break;
case SM_RELOAD:
report();
break;
case SM_RELOAD: