diff --git a/webrtc/api/androidvideocapturer.cc b/webrtc/api/androidvideocapturer.cc index 30311859b9..22c75552fb 100644 --- a/webrtc/api/androidvideocapturer.cc +++ b/webrtc/api/androidvideocapturer.cc @@ -22,8 +22,7 @@ namespace webrtc { AndroidVideoCapturer::AndroidVideoCapturer( const rtc::scoped_refptr& delegate) : running_(false), - delegate_(delegate), - current_state_(cricket::CS_STOPPED) { + delegate_(delegate) { thread_checker_.DetachFromThread(); SetSupportedFormats(delegate_->GetSupportedFormats()); } @@ -43,8 +42,7 @@ cricket::CaptureState AndroidVideoCapturer::Start( running_ = true; delegate_->Start(capture_format.width, capture_format.height, fps, this); SetCaptureFormat(&capture_format); - current_state_ = cricket::CS_STARTING; - return current_state_; + return cricket::CS_STARTING; } void AndroidVideoCapturer::Stop() { @@ -55,8 +53,7 @@ void AndroidVideoCapturer::Stop() { SetCaptureFormat(NULL); delegate_->Stop(); - current_state_ = cricket::CS_STOPPED; - SetCaptureState(current_state_); + SetCaptureState(cricket::CS_STOPPED); } bool AndroidVideoCapturer::IsRunning() { @@ -72,11 +69,8 @@ bool AndroidVideoCapturer::GetPreferredFourccs(std::vector* fourccs) { void AndroidVideoCapturer::OnCapturerStarted(bool success) { RTC_CHECK(thread_checker_.CalledOnValidThread()); - cricket::CaptureState new_state = + const cricket::CaptureState new_state = success ? cricket::CS_RUNNING : cricket::CS_FAILED; - if (new_state == current_state_) - return; - current_state_ = new_state; SetCaptureState(new_state); } diff --git a/webrtc/api/androidvideocapturer.h b/webrtc/api/androidvideocapturer.h index bd0dd7c304..24294efc13 100644 --- a/webrtc/api/androidvideocapturer.h +++ b/webrtc/api/androidvideocapturer.h @@ -77,8 +77,6 @@ class AndroidVideoCapturer : public cricket::VideoCapturer { rtc::scoped_refptr delegate_; rtc::ThreadChecker thread_checker_; - - cricket::CaptureState current_state_; }; } // namespace webrtc