=> fa0b64bdcea3000292fed79dc4d18e3e24dbb690
[1mdiff --git a/src/audio/player.c b/src/audio/player.c[m [1mindex 67ca9521..01e54191 100644[m [1m--- a/src/audio/player.c[m [1m+++ b/src/audio/player.c[m [36m@@ -475,12 +475,11 @@[m [mstatic iRangecc mediaType_(const iString *str) {[m return part;[m }[m [m [31m-static iContentSpec contentSpec_Player_(const iPlayer *d) {[m [32m+[m[32mstatic iContentSpec detectContentSpec_Player_(const iPlayer *d) {[m iContentSpec content;[m iZap(content);[m const size_t dataSize = size_InputBuf(d->data);[m [31m- iBuffer *buf = iClob(new_Buffer());[m [31m- open_Buffer(buf, &d->data->data);[m [32m+[m[32m iBuffer *buf = NULL;[m const iRangecc mediaType = mediaType_(&d->mime);[m if (equal_Rangecc(mediaType, "audio/wave") || equal_Rangecc(mediaType, "audio/wav") ||[m equal_Rangecc(mediaType, "audio/x-wav") || equal_Rangecc(mediaType, "audio/x-pn-wav")) {[m [36m@@ -499,6 +498,12 @@[m [mstatic iContentSpec contentSpec_Player_(const iPlayer *d) {[m /* TODO: Could try decoders to see if one works? */[m content.type = none_DecoderType;[m }[m [32m+[m[32m if (content.type != none_DecoderType) {[m [32m+[m[32m buf = iClob(new_Buffer());[m [32m+[m[32m /* This holds a reference to the data block. The decoder runs in a background[m [32m+[m[32m thread so it needs its own copy of the data. */[m [32m+[m[32m open_Buffer(buf, &d->data->data);[m [32m+[m[32m }[m if (content.type == wav_DecoderType && dataSize >= 44) {[m /* Read the RIFF/WAVE header. */[m iStream *is = stream_Buffer(buf);[m [36m@@ -713,6 +718,8 @@[m [mvoid updateSourceData_Player(iPlayer *d, const iString *mimeType, const iBlock *[m break;[m }[m /* The old parts cannot have changed. */[m [32m+[m[32m /* NOTE: The decoder will hold a reference to the data block, which means[m [32m+[m[32m appending here will cause a copy-on-write detach to occur. */[m appendData_Block(&input->data, constBegin_Block(data) + oldSize, newSize - oldSize);[m break;[m }[m [36m@@ -769,7 +776,7 @@[m [miBool start_Player(iPlayer *d) {[m return iTrue;[m }[m #endif[m [31m- iContentSpec content = contentSpec_Player_(d);[m [32m+[m[32m iContentSpec content = detectContentSpec_Player_(d);[m if (!content.output.freq) {[m return iFalse;[m }[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).