| Index: content/browser/renderer_host/media/desktop_capture_device_aura.cc
|
| diff --git a/content/browser/renderer_host/media/desktop_capture_device_aura.cc b/content/browser/renderer_host/media/desktop_capture_device_aura.cc
|
| index a36d26b8b5f8955646ba33964c72a9e55a133769..15e86f0323ba9008d4343158284d088d587c120e 100644
|
| --- a/content/browser/renderer_host/media/desktop_capture_device_aura.cc
|
| +++ b/content/browser/renderer_host/media/desktop_capture_device_aura.cc
|
| @@ -217,14 +217,17 @@ void DesktopVideoCaptureMachine::Stop() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| // Stop observing window events.
|
| - if (desktop_window_)
|
| + if (desktop_window_) {
|
| desktop_window_->RemoveObserver(this);
|
| + desktop_window_ = NULL;
|
| + }
|
|
|
| // Stop observing compositor updates.
|
| if (desktop_layer_) {
|
| ui::Compositor* compositor = desktop_layer_->GetCompositor();
|
| if (compositor)
|
| compositor->RemoveObserver(this);
|
| + desktop_layer_ = NULL;
|
| }
|
|
|
| // Stop timer.
|
| @@ -290,7 +293,7 @@ void DesktopVideoCaptureMachine::DidCopyOutput(
|
| base::Time start_time,
|
| const ThreadSafeCaptureOracle::CaptureFrameCallback& capture_frame_cb,
|
| scoped_ptr<cc::CopyOutputResult> result) {
|
| - if (result->IsEmpty() || result->size().IsEmpty())
|
| + if (result->IsEmpty() || result->size().IsEmpty() || !desktop_layer_)
|
| return;
|
|
|
| // Compute the dest size we want after the letterboxing resize. Make the
|
| @@ -396,13 +399,11 @@ void DesktopVideoCaptureMachine::OnWindowBoundsChanged(
|
| }
|
|
|
| void DesktopVideoCaptureMachine::OnWindowDestroyed(aura::Window* window) {
|
| - DCHECK(desktop_window_ && window == desktop_window_);
|
| - desktop_window_ = NULL;
|
| - desktop_layer_ = NULL;
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| - // Post task to stop capture on UI thread.
|
| - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
|
| - &DesktopVideoCaptureMachine::Stop, AsWeakPtr()));
|
| + Stop();
|
| +
|
| + oracle_proxy_->ReportError();
|
| }
|
|
|
| void DesktopVideoCaptureMachine::OnCompositingEnded(
|
|
|