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 } | |
568 } | 555 } |
569 | 556 |
570 scoped_refptr<VideoFrameProvider> | 557 scoped_refptr<VideoFrameProvider> |
571 MediaStreamImpl::CreateVideoFrameProvider( | 558 MediaStreamImpl::CreateVideoFrameProvider( |
572 webrtc::MediaStreamInterface* stream, | 559 webrtc::MediaStreamInterface* stream, |
573 const base::Closure& error_cb, | 560 const base::Closure& error_cb, |
574 const VideoFrameProvider::RepaintCB& repaint_cb) { | 561 const VideoFrameProvider::RepaintCB& repaint_cb) { |
575 if (stream->GetVideoTracks().empty()) | 562 if (stream->GetVideoTracks().empty()) |
576 return NULL; | 563 return NULL; |
577 | 564 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 684 } |
698 | 685 |
699 for (size_t i = 0; i < video_sources.size(); ++i) { | 686 for (size_t i = 0; i < video_sources.size(); ++i) { |
700 video_sources[i].setReadyState( | 687 video_sources[i].setReadyState( |
701 WebKit::WebMediaStreamSource::ReadyStateEnded); | 688 WebKit::WebMediaStreamSource::ReadyStateEnded); |
702 video_sources[i].setExtraData(NULL); | 689 video_sources[i].setExtraData(NULL); |
703 } | 690 } |
704 } | 691 } |
705 | 692 |
706 } // namespace content | 693 } // namespace content |
OLD | NEW |