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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 UTF16ToUTF8((*request_it)->web_stream.id())); | 556 UTF16ToUTF8((*request_it)->web_stream.id())); |
557 } else { | 557 } else { |
558 media_stream_dispatcher_->CancelGenerateStream( | 558 media_stream_dispatcher_->CancelGenerateStream( |
559 (*request_it)->request_id, AsWeakPtr()); | 559 (*request_it)->request_id, AsWeakPtr()); |
560 } | 560 } |
561 request_it = user_media_requests_.erase(request_it); | 561 request_it = user_media_requests_.erase(request_it); |
562 } else { | 562 } else { |
563 ++request_it; | 563 ++request_it; |
564 } | 564 } |
565 } | 565 } |
566 | |
567 // Free the potentially-cached audio renderer. If we don't do this, the | |
568 // audio device will be held open after the tab has been closed even though | |
569 // it's not being used. | |
570 WebRtcAudioDeviceImpl* audio_device = | |
571 dependency_factory_->GetWebRtcAudioDevice(); | |
572 if (audio_device) { | |
573 scoped_refptr<WebRtcAudioRenderer> renderer(audio_device->renderer()); | |
574 if (renderer.get()) { | |
575 renderer->Stop(); // This will clear the dependency factory's pointer. | |
576 DCHECK(!audio_device->renderer().get()); | |
577 } | |
578 } | |
579 } | 566 } |
580 | 567 |
581 scoped_refptr<VideoFrameProvider> | 568 scoped_refptr<VideoFrameProvider> |
582 MediaStreamImpl::CreateVideoFrameProvider( | 569 MediaStreamImpl::CreateVideoFrameProvider( |
583 webrtc::MediaStreamInterface* stream, | 570 webrtc::MediaStreamInterface* stream, |
584 const base::Closure& error_cb, | 571 const base::Closure& error_cb, |
585 const VideoFrameProvider::RepaintCB& repaint_cb) { | 572 const VideoFrameProvider::RepaintCB& repaint_cb) { |
586 if (stream->GetVideoTracks().empty()) | 573 if (stream->GetVideoTracks().empty()) |
587 return NULL; | 574 return NULL; |
588 | 575 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 } | 758 } |
772 | 759 |
773 for (size_t i = 0; i < video_sources.size(); ++i) { | 760 for (size_t i = 0; i < video_sources.size(); ++i) { |
774 video_sources[i].setReadyState( | 761 video_sources[i].setReadyState( |
775 WebKit::WebMediaStreamSource::ReadyStateEnded); | 762 WebKit::WebMediaStreamSource::ReadyStateEnded); |
776 video_sources[i].setExtraData(NULL); | 763 video_sources[i].setExtraData(NULL); |
777 } | 764 } |
778 } | 765 } |
779 | 766 |
780 } // namespace content | 767 } // namespace content |
OLD | NEW |