summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/audio/linux/alsa_output.cc5
-rw-r--r--media/audio/linux/alsa_output_unittest.cc12
2 files changed, 14 insertions, 3 deletions
diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc
index 1ee85e7..d878a74 100644
--- a/media/audio/linux/alsa_output.cc
+++ b/media/audio/linux/alsa_output.cc
@@ -756,10 +756,11 @@ snd_pcm_t* AlsaPcmOutputStream::OpenDevice(const std::string& device_name,
}
bool AlsaPcmOutputStream::CloseDevice(snd_pcm_t* handle) {
+ std::string name = wrapper_->PcmName(handle);
int error = wrapper_->PcmClose(handle);
if (error < 0) {
- LOG(ERROR) << "Cannot close audio device (" << wrapper_->PcmName(handle)
- << "): " << wrapper_->StrError(error);
+ LOG(ERROR) << "Error closing audio device (" << name << "): "
+ << wrapper_->StrError(error);
return false;
}
diff --git a/media/audio/linux/alsa_output_unittest.cc b/media/audio/linux/alsa_output_unittest.cc
index 72c4c90..70949b5 100644
--- a/media/audio/linux/alsa_output_unittest.cc
+++ b/media/audio/linux/alsa_output_unittest.cc
@@ -227,7 +227,9 @@ TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) {
message_loop_.RunAllPending();
// Now close it and test that everything was released.
- EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)) .WillOnce(Return(0));
+ EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle)).WillOnce(Return(0));
+ EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle))
+ .WillOnce(Return(kTestDeviceName));
EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get()));
test_stream_->Close();
message_loop_.RunAllPending();
@@ -258,6 +260,8 @@ TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) {
// Now close it and test that everything was released.
EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle))
.WillOnce(Return(0));
+ EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle))
+ .WillOnce(Return(kTestDeviceName));
EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get()));
test_stream_->Close();
message_loop_.RunAllPending();
@@ -303,6 +307,8 @@ TEST_F(AlsaPcmOutputStreamTest, OpenClose) {
// Now close it and test that everything was released.
EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle))
.WillOnce(Return(0));
+ EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle))
+ .WillOnce(Return(kTestDeviceName));
EXPECT_CALL(mock_manager_, ReleaseStream(test_stream_.get()));
test_stream_->Close();
message_loop_.RunAllPending();
@@ -346,6 +352,8 @@ TEST_F(AlsaPcmOutputStreamTest, PcmSetParamsFailed) {
.WillOnce(Return(kTestFailedErrno));
EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle))
.WillOnce(Return(0));
+ EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle))
+ .WillOnce(Return(kTestDeviceName));
EXPECT_CALL(mock_alsa_wrapper_, StrError(kTestFailedErrno))
.WillOnce(Return(kDummyMessage));
@@ -414,6 +422,8 @@ TEST_F(AlsaPcmOutputStreamTest, StartStop) {
EXPECT_CALL(mock_callback, OnClose(test_stream_.get()));
EXPECT_CALL(mock_alsa_wrapper_, PcmClose(kFakeHandle))
.WillOnce(Return(0));
+ EXPECT_CALL(mock_alsa_wrapper_, PcmName(kFakeHandle))
+ .WillOnce(Return(kTestDeviceName));
test_stream_->Close();
message_loop_.RunAllPending();
}