mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 903023 - memset with 0 if the buffer of audio chunk is null. r=roc
This commit is contained in:
parent
880433f3e1
commit
d35691b860
@ -274,9 +274,8 @@ OpusTrackEncoder::GetEncodedTrack(nsTArray<uint8_t>* aOutput,
|
||||
InterleaveTrackData(chunk, frameToCopy, mChannels,
|
||||
pcm.Elements() + frameCopied * mChannels);
|
||||
} else {
|
||||
for (int i = 0; i < frameToCopy * mChannels; i++) {
|
||||
pcm.AppendElement(0);
|
||||
}
|
||||
memset(pcm.Elements() + frameCopied * mChannels, 0,
|
||||
frameToCopy * mChannels * sizeof(AudioDataValue));
|
||||
}
|
||||
|
||||
frameCopied += frameToCopy;
|
||||
@ -301,9 +300,8 @@ OpusTrackEncoder::GetEncodedTrack(nsTArray<uint8_t>* aOutput,
|
||||
// Append null data to pcm buffer if the leftover data is not enough for
|
||||
// opus encoder.
|
||||
if (frameCopied < GetPacketDuration() && mEndOfStream) {
|
||||
for (int i = frameCopied * mChannels; i < GetPacketDuration() * mChannels; i++) {
|
||||
pcm.AppendElement(0);
|
||||
}
|
||||
memset(pcm.Elements() + frameCopied * mChannels, 0,
|
||||
(GetPacketDuration()-frameCopied)*mChannels*sizeof(AudioDataValue));
|
||||
}
|
||||
|
||||
// Encode the data with Opus Encoder.
|
||||
|
Loading…
Reference in New Issue
Block a user