input/icy: adjust offset at end of stream in Read()
ProxyInputStream::Read() assigns the `offset` field, which is the wrong offset because it does not consider Icy metadata removed from the stream. Therefore, after every ProxyInputStream::Read() call, IcyInputStream::Read() needs to override this offset. This was missing at the end of the stream, when Read()==0. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1216
This commit is contained in:
		
							
								
								
									
										2
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								NEWS
									
									
									
									
									
								
							| @@ -3,6 +3,8 @@ ver 0.22.10 (not yet released) | |||||||
|   - support "albumart" for virtual tracks in CUE sheets |   - support "albumart" for virtual tracks in CUE sheets | ||||||
| * database | * database | ||||||
|   - simple: fix crash bug |   - simple: fix crash bug | ||||||
|  | * input | ||||||
|  |   - curl: fix crash bug after stream with Icy metadata was closed by peer | ||||||
|  |  | ||||||
| ver 0.22.9 (2021/06/23) | ver 0.22.9 (2021/06/23) | ||||||
| * database | * database | ||||||
|   | |||||||
| @@ -104,8 +104,11 @@ IcyInputStream::Read(std::unique_lock<Mutex> &lock, | |||||||
|  |  | ||||||
| 	while (true) { | 	while (true) { | ||||||
| 		size_t nbytes = ProxyInputStream::Read(lock, ptr, read_size); | 		size_t nbytes = ProxyInputStream::Read(lock, ptr, read_size); | ||||||
| 		if (nbytes == 0) | 		if (nbytes == 0) { | ||||||
|  | 			assert(IsEOF()); | ||||||
|  | 			offset = override_offset; | ||||||
| 			return 0; | 			return 0; | ||||||
|  | 		} | ||||||
|  |  | ||||||
| 		size_t result = parser->ParseInPlace(ptr, nbytes); | 		size_t result = parser->ParseInPlace(ptr, nbytes); | ||||||
| 		if (result > 0) { | 		if (result > 0) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann