Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: content/renderer/media/media_stream_impl.cc

Issue 10947030: Removed the use of WebFrame::frameForCurrentContext() in MediaStreamCenter::didStopLocalMediaStream (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Renamed callback. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_impl.cc
diff --git a/content/renderer/media/media_stream_impl.cc b/content/renderer/media/media_stream_impl.cc
index f3cf45fc18ef98c41fa2fd69faf836a01e702a3d..fb7012cf33077ea48cb135f1af4597bd421eead7 100644
--- a/content/renderer/media/media_stream_impl.cc
+++ b/content/renderer/media/media_stream_impl.cc
@@ -69,18 +69,10 @@ MediaStreamImpl::MediaStreamImpl(
MediaStreamImpl::~MediaStreamImpl() {
}
-void MediaStreamImpl::StopLocalMediaStream(
- const WebKit::WebMediaStreamDescriptor& stream) {
- DVLOG(1) << "MediaStreamImpl::StopLocalMediaStream";
-
- MediaStreamExtraData* extra_data =
- static_cast<MediaStreamExtraData*>(stream.extraData());
- if (extra_data && extra_data->local_stream()) {
- media_stream_dispatcher_->StopStream(extra_data->local_stream()->label());
- local_media_streams_.erase(extra_data->local_stream()->label());
- } else {
- NOTREACHED();
- }
+void MediaStreamImpl::OnLocalMediaStreamStop(const std::string& label) {
+ DVLOG(1) << "MediaStreamImpl::OnLocalMediaStreamStop";
+ media_stream_dispatcher_->StopStream(label);
+ local_media_streams_.erase(label);
}
void MediaStreamImpl::requestUserMedia(
@@ -205,7 +197,9 @@ void MediaStreamImpl::OnStreamGenerated(
description.initialize(webkit_label, audio_source_vector,
video_source_vector);
- if (!dependency_factory_->CreateNativeLocalMediaStream(&description)) {
+ if (!dependency_factory_->CreateNativeLocalMediaStream(
+ &description, base::Bind(&MediaStreamImpl::OnLocalMediaStreamStop,
tommi (sloooow) - chröme 2012/09/21 09:18:03 indent
perkj_chrome 2012/09/21 10:47:10 ? What is wrong with this?
tommi (sloooow) - chröme 2012/09/21 11:23:53 MyFunction( bar, baz); should in Chrome be MyFun
+ base::Unretained(this)))) {
DVLOG(1) << "Failed to create native stream in OnStreamGenerated.";
media_stream_dispatcher_->StopStream(label);
it->second.request_.requestFailed();
@@ -357,9 +351,22 @@ MediaStreamExtraData::MediaStreamExtraData(
webrtc::MediaStreamInterface* remote_stream)
: remote_stream_(remote_stream) {
}
+
MediaStreamExtraData::MediaStreamExtraData(
webrtc::LocalMediaStreamInterface* local_stream)
: local_stream_(local_stream) {
}
+
+void MediaStreamExtraData::SetLocalStreamStopCallback(
+ const StreamStopCallback& stop_callback) {
+ stream_stop_callback_ = stop_callback;
+}
+
MediaStreamExtraData::~MediaStreamExtraData() {
}
+
+void MediaStreamExtraData::RunStreamStopCallback() {
+ if (!stream_stop_callback_.is_null()) {
+ stream_stop_callback_.Run(local_stream_->label());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698