Don't return fail if the denoising is already enabled/disabled.

BUG=
TEST=

Review URL: https://webrtc-codereview.appspot.com/488001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1994 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org 2012-04-06 01:01:16 +00:00
parent 231f5d0d25
commit 78075451ed
2 changed files with 8 additions and 8 deletions

View File

@ -200,10 +200,12 @@ void ViEAutoTest::ViEImageProcessAPITest()
// Denoising // Denoising
// //
EXPECT_EQ(0, ViE.image_process->EnableDenoising(tbCapture.captureId, true)); EXPECT_EQ(0, ViE.image_process->EnableDenoising(tbCapture.captureId, true));
EXPECT_NE(0, ViE.image_process->EnableDenoising(tbCapture.captureId, true)); // If the denoising is already enabled, it will just reuturn 0.
EXPECT_EQ(0, ViE.image_process->EnableDenoising(tbCapture.captureId, true));
EXPECT_EQ(0, ViE.image_process->EnableDenoising( EXPECT_EQ(0, ViE.image_process->EnableDenoising(
tbCapture.captureId, false)); tbCapture.captureId, false));
EXPECT_NE(0, ViE.image_process->EnableDenoising( // If the denoising is already disabled, it will just reuturn 0.
EXPECT_EQ(0, ViE.image_process->EnableDenoising(
tbCapture.captureId, false)); tbCapture.captureId, false));
EXPECT_NE(0, ViE.image_process->EnableDenoising( EXPECT_NE(0, ViE.image_process->EnableDenoising(
tbChannel.videoChannel, true)); tbChannel.videoChannel, true));

View File

@ -448,9 +448,8 @@ WebRtc_Word32 ViECapturer::EnableDenoising(bool enable) {
CriticalSectionScoped cs(deliver_cs_.get()); CriticalSectionScoped cs(deliver_cs_.get());
if (enable) { if (enable) {
if (denoising_enabled_) { if (denoising_enabled_) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), // Already enabled, nothing need to be done.
"%s: denoising already enabled", __FUNCTION__); return 0;
return -1;
} }
denoising_enabled_ = true; denoising_enabled_ = true;
if (IncImageProcRefCount() != 0) { if (IncImageProcRefCount() != 0) {
@ -458,9 +457,8 @@ WebRtc_Word32 ViECapturer::EnableDenoising(bool enable) {
} }
} else { } else {
if (denoising_enabled_ == false) { if (denoising_enabled_ == false) {
WEBRTC_TRACE(kTraceError, kTraceVideo, ViEId(engine_id_, capture_id_), // Already disabled, nothing need to be done.
"%s: denoising not enabled", __FUNCTION__); return 0;
return -1;
} }
denoising_enabled_ = false; denoising_enabled_ = false;
DecImageProcRefCount(); DecImageProcRefCount();