| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // returned string is undefined. | 68 // returned string is undefined. |
| 69 static std::string ExtractManagerStreamLabel( | 69 static std::string ExtractManagerStreamLabel( |
| 70 const std::string& track_label) { | 70 const std::string& track_label) { |
| 71 std::string manager_label = track_label; | 71 std::string manager_label = track_label; |
| 72 size_t pos = manager_label.rfind("#"); | 72 size_t pos = manager_label.rfind("#"); |
| 73 // If # isn't found, the string is left intact. | 73 // If # isn't found, the string is left intact. |
| 74 manager_label = manager_label.substr(0, pos); | 74 manager_label = manager_label.substr(0, pos); |
| 75 return manager_label; | 75 return manager_label; |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 static int g_next_request_id = 0; |
| 79 int MediaStreamImpl::next_request_id_ = 0; | |
| 80 | 79 |
| 81 MediaStreamImpl::MediaStreamImpl( | 80 MediaStreamImpl::MediaStreamImpl( |
| 82 content::RenderView* render_view, | 81 content::RenderView* render_view, |
| 83 MediaStreamDispatcher* media_stream_dispatcher, | 82 MediaStreamDispatcher* media_stream_dispatcher, |
| 84 content::P2PSocketDispatcher* p2p_socket_dispatcher, | 83 content::P2PSocketDispatcher* p2p_socket_dispatcher, |
| 85 VideoCaptureImplManager* vc_manager, | 84 VideoCaptureImplManager* vc_manager, |
| 86 MediaStreamDependencyFactory* dependency_factory) | 85 MediaStreamDependencyFactory* dependency_factory) |
| 87 : content::RenderViewObserver(render_view), | 86 : content::RenderViewObserver(render_view), |
| 88 dependency_factory_(dependency_factory), | 87 dependency_factory_(dependency_factory), |
| 89 media_stream_dispatcher_(media_stream_dispatcher), | 88 media_stream_dispatcher_(media_stream_dispatcher), |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 void MediaStreamImpl::requestUserMedia( | 173 void MediaStreamImpl::requestUserMedia( |
| 175 const WebKit::WebUserMediaRequest& user_media_request, | 174 const WebKit::WebUserMediaRequest& user_media_request, |
| 176 const WebKit::WebVector<WebKit::WebMediaStreamSource>& audio_sources, | 175 const WebKit::WebVector<WebKit::WebMediaStreamSource>& audio_sources, |
| 177 const WebKit::WebVector<WebKit::WebMediaStreamSource>& video_sources) { | 176 const WebKit::WebVector<WebKit::WebMediaStreamSource>& video_sources) { |
| 178 // Save histogram data so we can see how much GetUserMedia is used. | 177 // Save histogram data so we can see how much GetUserMedia is used. |
| 179 // The histogram counts the number of calls to the JS API | 178 // The histogram counts the number of calls to the JS API |
| 180 // webGetUserMedia. | 179 // webGetUserMedia. |
| 181 UMA_HISTOGRAM_COUNTS_100(kHistogramGetUserMedia, 1); | 180 UMA_HISTOGRAM_COUNTS_100(kHistogramGetUserMedia, 1); |
| 182 DCHECK(CalledOnValidThread()); | 181 DCHECK(CalledOnValidThread()); |
| 183 DCHECK(!user_media_request.isNull()); | 182 DCHECK(!user_media_request.isNull()); |
| 184 int request_id = next_request_id_++; | 183 int request_id = g_next_request_id++; |
| 185 | 184 |
| 186 bool audio = user_media_request.audio(); | 185 bool audio = user_media_request.audio(); |
| 187 media_stream::StreamOptions::VideoOption video_option = | 186 media_stream::StreamOptions::VideoOption video_option = |
| 188 media_stream::StreamOptions::kNoCamera; | 187 media_stream::StreamOptions::kNoCamera; |
| 189 if (user_media_request.video()) | 188 if (user_media_request.video()) |
| 190 video_option = media_stream::StreamOptions::kFacingBoth; | 189 video_option = media_stream::StreamOptions::kFacingBoth; |
| 191 | 190 |
| 192 std::string security_origin = UTF16ToUTF8( | 191 std::string security_origin = UTF16ToUTF8( |
| 193 user_media_request.securityOrigin().toString()); | 192 user_media_request.securityOrigin().toString()); |
| 194 | 193 |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 return rtc_video_decoder; | 519 return rtc_video_decoder; |
| 521 } | 520 } |
| 522 | 521 |
| 523 MediaStreamImpl::VideoRendererWrapper::VideoRendererWrapper( | 522 MediaStreamImpl::VideoRendererWrapper::VideoRendererWrapper( |
| 524 RTCVideoDecoder* decoder) | 523 RTCVideoDecoder* decoder) |
| 525 : rtc_video_decoder_(decoder) { | 524 : rtc_video_decoder_(decoder) { |
| 526 } | 525 } |
| 527 | 526 |
| 528 MediaStreamImpl::VideoRendererWrapper::~VideoRendererWrapper() { | 527 MediaStreamImpl::VideoRendererWrapper::~VideoRendererWrapper() { |
| 529 } | 528 } |
| OLD | NEW |