Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc

Issue 187413004: Fixed the Memcheck:Uninitialized warning in WebRtcLocalAudioTrackAdapterTest_AddAndRemoveSink (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebased Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc
diff --git a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc
index f32c7fb9563108030ca6169430164090530a27fd..6375aed99f4945983644bf8a078d53fcb7f062bc 100644
--- a/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc
+++ b/content/renderer/media/webrtc/webrtc_local_audio_track_adapter_unittest.cc
@@ -62,8 +62,11 @@ TEST_F(WebRtcLocalAudioTrackAdapterTest, AddAndRemoveSink) {
// Send a packet via |track_| and it data should reach the sink of the
// |adapter_|.
- scoped_ptr<int16[]> data(
- new int16[params_.frames_per_buffer() * params_.channels()]);
+ const int length = params_.frames_per_buffer() * params_.channels();
+ scoped_ptr<int16[]> data(new int16[length]);
+ // Initialize the data to 0 to avoid Memcheck:Uninitialized warning.
+ memset(data.get(), 0, length * sizeof(data[0]));
+
EXPECT_CALL(*sink,
OnData(_, 16, params_.sample_rate(), params_.channels(),
params_.frames_per_buffer()));
« no previous file with comments | « no previous file | tools/valgrind/memcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698