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/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 | 488 |
489 while (request_it != user_media_requests_.end()) { | 489 while (request_it != user_media_requests_.end()) { |
490 if ((*request_it)->frame == frame) { | 490 if ((*request_it)->frame == frame) { |
491 DVLOG(1) << "MediaStreamImpl::FrameWillClose: " | 491 DVLOG(1) << "MediaStreamImpl::FrameWillClose: " |
492 << "Cancel user media request " << (*request_it)->request_id; | 492 << "Cancel user media request " << (*request_it)->request_id; |
493 // If the request is generated, it means that the MediaStreamDispatcher | 493 // If the request is generated, it means that the MediaStreamDispatcher |
494 // has generated a stream for us and we need to let the | 494 // has generated a stream for us and we need to let the |
495 // MediaStreamDispatcher know that the stream is no longer wanted. | 495 // MediaStreamDispatcher know that the stream is no longer wanted. |
496 // If not, we cancel the request and delete the request object. | 496 // If not, we cancel the request and delete the request object. |
497 if ((*request_it)->generated) { | 497 if ((*request_it)->generated) { |
498 MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>( | |
perkj_chrome
2013/03/20 10:39:53
Looks like all of this belongs in the same place a
no longer working on chromium
2013/03/20 15:10:19
Done.
| |
499 (*request_it)->descriptor.extraData()); | |
500 if (extra_data && extra_data->is_local() && extra_data->stream() && | |
501 !extra_data->stream()->GetAudioTracks().empty()) { | |
502 // We need to stop the capturer for local media stream. | |
perkj_chrome
2013/03/20 10:39:53
audio track - not stream
no longer working on chromium
2013/03/20 15:10:19
Done.
| |
503 // TODO(xians): Loop through audio tracks to stop their capturer if | |
504 // there are multiple audio tracks. | |
505 if (dependency_factory_->GetWebRtcAudioDevice()) { | |
506 scoped_refptr<WebRtcAudioCapturer> capturer = | |
507 dependency_factory_->GetWebRtcAudioDevice()->capturer(); | |
508 if (capturer) | |
509 capturer->Stop(); | |
510 } | |
511 } | |
512 | |
498 media_stream_dispatcher_->StopStream( | 513 media_stream_dispatcher_->StopStream( |
perkj_chrome
2013/03/20 10:39:53
So is StopStream only used for video now or audio
no longer working on chromium
2013/03/20 15:10:19
both audio and video as before.
| |
499 UTF16ToUTF8((*request_it)->descriptor.label())); | 514 UTF16ToUTF8((*request_it)->descriptor.label())); |
500 } else { | 515 } else { |
501 media_stream_dispatcher_->CancelGenerateStream( | 516 media_stream_dispatcher_->CancelGenerateStream( |
502 (*request_it)->request_id); | 517 (*request_it)->request_id); |
503 } | 518 } |
504 request_it = user_media_requests_.erase(request_it); | 519 request_it = user_media_requests_.erase(request_it); |
505 } else { | 520 } else { |
506 ++request_it; | 521 ++request_it; |
507 } | 522 } |
508 } | 523 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 const StreamStopCallback& stop_callback) { | 604 const StreamStopCallback& stop_callback) { |
590 stream_stop_callback_ = stop_callback; | 605 stream_stop_callback_ = stop_callback; |
591 } | 606 } |
592 | 607 |
593 void MediaStreamExtraData::OnLocalStreamStop() { | 608 void MediaStreamExtraData::OnLocalStreamStop() { |
594 if (!stream_stop_callback_.is_null()) | 609 if (!stream_stop_callback_.is_null()) |
595 stream_stop_callback_.Run(stream_->label()); | 610 stream_stop_callback_.Run(stream_->label()); |
596 } | 611 } |
597 | 612 |
598 } // namespace content | 613 } // namespace content |
OLD | NEW |