Commit 0aef1555 authored by burnik's avatar burnik Committed by Commit bot

Several memory leaks in unit test: SpeechRecognitionAudioSinkTest.

Due to uninitialized memory.
This CL is fixing the issue.

BUG=408940, 422164, 422472
TEST=Memory bot for content_unittests

Review URL: https://codereview.chromium.org/645363005

Cr-Commit-Position: refs/heads/master@{#299277}
parent 8b04ce89
......@@ -129,6 +129,7 @@ class FakeSpeechRecognizer {
media::AudioInputBuffer* buffer =
static_cast<media::AudioInputBuffer*>(shared_memory_->memory());
audio_track_bus_ = media::AudioBus::WrapMemory(sink_params, buffer->audio);
audio_track_bus_->Zero();
// Reference to the counter used to synchronize.
buffer_index_ = &(buffer->params.size);
......@@ -221,7 +222,7 @@ class SpeechRecognitionAudioSinkTest : public testing::Test {
output_sample_rate,
kOutputBitsPerSample,
output_frames_per_buffer);
source_data_.reset(new int16[input_frames_per_buffer * kInputChannels]);
source_data_.reset(new int16[input_frames_per_buffer * kInputChannels]{});
// Prepare the track and audio source.
blink::WebMediaStreamTrack blink_track;
......@@ -318,9 +319,10 @@ class SpeechRecognitionAudioSinkTest : public testing::Test {
const int output_sample_rate,
const int output_frames_per_buffer,
const uint32 consumptions) {
const uint32 kBuffersPerNotification =
Initialize(input_sample_rate, input_frames_per_buffer,
output_sample_rate, output_frames_per_buffer);
const uint32 kBuffersPerNotification = Initialize(input_sample_rate,
input_frames_per_buffer,
output_sample_rate,
output_frames_per_buffer);
AssertConsumedBuffers(0U);
for (uint32 i = 1U; i <= consumptions; ++i) {
......
......@@ -667,37 +667,3 @@ blink_web.dll!blink::FrameView::removeFromAXObjectCache
blink_web.dll!blink::FrameView::prepareForDetach
blink_web.dll!blink::LocalFrame::setView
blink_web.dll!blink::FrameTree::~FrameTree
UNINITIALIZED READ
name=http://crbug.com/422472 (a)
shared_memory_support.dll!media::FromInterleavedInternal<>
shared_memory_support.dll!media::AudioBus::FromInterleavedPartial
shared_memory_support.dll!media::AudioBus::FromInterleaved
content.dll!content::SpeechRecognitionAudioSink::OnData
content.dll!content::MediaStreamAudioSinkOwner::OnData
content.dll!content::WebRtcLocalAudioTrack::Capture
*!content::SpeechRecognitionAudioSinkTest_RecognizerNotifiedOnSocket_Test::TestBody
*!testing::internal::HandleExceptionsInMethodIfSupported<>
UNINITIALIZED READ
name=http://crbug.com/422472 (b)
shared_memory_support.dll!media::FromInterleavedInternal<>
...
*!content::SpeechRecognitionAudioSinkTest::CaptureAudio
*!content::SpeechRecognitionAudioSinkTest_OnReadyStateChangedOccured_Test::TestBody
UNINITIALIZED READ
name=http://crbug.com/422472 (c)
shared_memory_support.dll!media::FromInterleavedInternal<>
...
*!content::SpeechRecognitionAudioSinkTest::CaptureAudio
*!content::SpeechRecognitionAudioSinkTest_SyncSocketFailsSendingData_Test::TestBody
UNINITIALIZED READ
name=http://crbug.com/422472 (d)
content.dll!content::`anonymous namespace'::MaxAmplitude
content.dll!content::MediaStreamAudioLevelCalculator::Calculate
content.dll!content::WebRtcLocalAudioTrack::Capture
...
*!content::SpeechRecognitionAudioSinkTest_*_Test::TestBody
......@@ -3469,23 +3469,6 @@
fun:_ZN5blink13InlineFlowBox5paintERNS_9PaintInfoERKNS_11LayoutPointENS_10LayoutUnitES6_
fun:_ZN5blink13RootInlineBox5paintERNS_9PaintInfoERKNS_11LayoutPointENS_10LayoutUnitES6_
}
{
bug_422472a
Memcheck:Uninitialized
fun:_ZN5mediaL23FromInterleavedInternalIssLs0EEEvPKviiPNS_8AudioBusEff
...
fun:_ZN7content30SpeechRecognitionAudioSinkTest12CaptureAudioEj
fun:_ZN7content30SpeechRecognitionAudioSinkTest35AssertConsumptionForAudioParametersEiiiij
fun:_ZN7content62SpeechRecognitionAudioSinkTest_RecognizerNotifiedOnSocket_Test8TestBodyEv
}
{
bug_422472b
Memcheck:Uninitialized
...
fun:_ZN7content31MediaStreamAudioLevelCalculator9CalculateEPKsii
...
fun:_ZN7content62SpeechRecognitionAudioSinkTest_RecognizerNotifiedOnSocket_Test8TestBodyEv
}
{
bug_422485
Memcheck:Overlap
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment