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

Unified Diff: chromecast/media/cma/backend/alsa/mock_alsa_wrapper.cc

Issue 1578983003: [Chromecast] Store ALSA Mixer test data as uint32_t. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Comment update, sizeof => size_t Created 4 years, 11 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 | chromecast/media/cma/backend/alsa/stream_mixer_alsa_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/media/cma/backend/alsa/mock_alsa_wrapper.cc
diff --git a/chromecast/media/cma/backend/alsa/mock_alsa_wrapper.cc b/chromecast/media/cma/backend/alsa/mock_alsa_wrapper.cc
index 34d7a0232c0bb64885fd465466945dca3bd2aea6..cb3f2fb460743f2149414230f9aca874850b7485 100644
--- a/chromecast/media/cma/backend/alsa/mock_alsa_wrapper.cc
+++ b/chromecast/media/cma/backend/alsa/mock_alsa_wrapper.cc
@@ -13,6 +13,9 @@ struct _snd_pcm {};
namespace chromecast {
namespace media {
+const size_t kBytesPerSample = sizeof(int32_t);
+const int kNumChannels = 2;
+
// This class keeps basic state to ensure that ALSA is being used correctly.
// Calls from MockAlsaWrapper are delegated to an instance of this class in
// cases where internal ALSA state change occurs, or where a valid value needs
@@ -57,7 +60,7 @@ class MockAlsaWrapper::FakeAlsaWrapper : public AlsaWrapper {
CHECK_EQ(fake_handle_, handle);
CHECK(buffer);
const uint8_t* ptr = reinterpret_cast<const uint8_t*>(buffer);
- int len = size * 2 * 4;
+ int len = size * kNumChannels * kBytesPerSample;
data_.assign(ptr, ptr + len);
return size;
}
@@ -70,7 +73,7 @@ class MockAlsaWrapper::FakeAlsaWrapper : public AlsaWrapper {
}
ssize_t PcmFormatSize(snd_pcm_format_t format, size_t samples) override {
- return 4 * samples;
+ return kBytesPerSample * samples;
};
snd_pcm_state_t state() { return state_; }
« no previous file with comments | « no previous file | chromecast/media/cma/backend/alsa/stream_mixer_alsa_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698