Fix data alignment issues in get_data() in AudioStreamSample
I am fixing the issue by adding DATA_PAD to the return pointer as suggested by hi-ogawa When using set_data in AudioStreamSample in PoolByteArray, the data is set using a DATA_PAD to pad the pointer to the correct place as such uint8_t *dataptr = (uint8_t *)data; copymem(dataptr + DATA_PAD, r.ptr(), datalen); data_bytes = datalen; godot/scene/resources/audio_stream_sample.cpp#L473 All I am doing is adding a DATA_PAD to the return pointer to get_data() in AudioStreamSample to change godot/scene/resources/audio_stream_sample.cpp#L48 PoolVector<uint8_t>::Write w = pv.write(); copymem(w.ptr(), data, data_bytes); to PoolVector<uint8_t>::Write w = pv.write(); uint8_t *dataptr = (uint8_t *)data; copymem(w.ptr(), dataptr + DATA_PAD, data_bytes); Please review whether or not set or get is correct. Because this issue seems to be fixable by removing DATA_PAD in set_data() instead of adding DATA_PAD to get_data(). I have not tested the latter fix Fixes #issue, 11873
This commit is contained in:
parent
c95ba4d7a7
commit
5080a9cf21
1 changed files with 2 additions and 1 deletions
|
@ -486,7 +486,8 @@ PoolVector<uint8_t> AudioStreamSample::get_data() const {
|
|||
{
|
||||
|
||||
PoolVector<uint8_t>::Write w = pv.write();
|
||||
copymem(w.ptr(), data, data_bytes);
|
||||
uint8_t *dataptr = (uint8_t *)data;
|
||||
copymem(w.ptr(), dataptr + DATA_PAD, data_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue