OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/media/media_stream_impl.h" | 5 #include "content/renderer/media/media_stream_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 UTF16ToUTF8((*request_it)->web_stream.id())); | 545 UTF16ToUTF8((*request_it)->web_stream.id())); |
546 } else { | 546 } else { |
547 media_stream_dispatcher_->CancelGenerateStream( | 547 media_stream_dispatcher_->CancelGenerateStream( |
548 (*request_it)->request_id, AsWeakPtr()); | 548 (*request_it)->request_id, AsWeakPtr()); |
549 } | 549 } |
550 request_it = user_media_requests_.erase(request_it); | 550 request_it = user_media_requests_.erase(request_it); |
551 } else { | 551 } else { |
552 ++request_it; | 552 ++request_it; |
553 } | 553 } |
554 } | 554 } |
| 555 |
| 556 // Free the potentially-cached audio renderer. If we don't do this, the |
| 557 // audio device will be held open after the tab has been closed even though |
| 558 // it's not being used. |
| 559 WebRtcAudioDeviceImpl* audio_device = |
| 560 dependency_factory_->GetWebRtcAudioDevice(); |
| 561 if (audio_device) { |
| 562 scoped_refptr<WebRtcAudioRenderer> renderer(audio_device->renderer()); |
| 563 if (renderer.get()) { |
| 564 renderer->Stop(); // This will clear the dependency factory's pointer. |
| 565 DCHECK(!audio_device->renderer().get()); |
| 566 } |
| 567 } |
555 } | 568 } |
556 | 569 |
557 scoped_refptr<VideoFrameProvider> | 570 scoped_refptr<VideoFrameProvider> |
558 MediaStreamImpl::CreateVideoFrameProvider( | 571 MediaStreamImpl::CreateVideoFrameProvider( |
559 webrtc::MediaStreamInterface* stream, | 572 webrtc::MediaStreamInterface* stream, |
560 const base::Closure& error_cb, | 573 const base::Closure& error_cb, |
561 const VideoFrameProvider::RepaintCB& repaint_cb) { | 574 const VideoFrameProvider::RepaintCB& repaint_cb) { |
562 if (stream->GetVideoTracks().empty()) | 575 if (stream->GetVideoTracks().empty()) |
563 return NULL; | 576 return NULL; |
564 | 577 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 } | 697 } |
685 | 698 |
686 for (size_t i = 0; i < video_sources.size(); ++i) { | 699 for (size_t i = 0; i < video_sources.size(); ++i) { |
687 video_sources[i].setReadyState( | 700 video_sources[i].setReadyState( |
688 WebKit::WebMediaStreamSource::ReadyStateEnded); | 701 WebKit::WebMediaStreamSource::ReadyStateEnded); |
689 video_sources[i].setExtraData(NULL); | 702 video_sources[i].setExtraData(NULL); |
690 } | 703 } |
691 } | 704 } |
692 | 705 |
693 } // namespace content | 706 } // namespace content |
OLD | NEW |