| 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/user_media_client_impl.h" | 5 #include "content/renderer/media/user_media_client_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 MediaStreamAudioSource::From(track.source()); | 1082 MediaStreamAudioSource::From(track.source()); |
| 1083 // Add the source as pending since OnTrackStarted will expect it to be there. | 1083 // Add the source as pending since OnTrackStarted will expect it to be there. |
| 1084 sources_waiting_for_callback_.push_back(native_source); | 1084 sources_waiting_for_callback_.push_back(native_source); |
| 1085 | 1085 |
| 1086 sources_.push_back(track.source()); | 1086 sources_.push_back(track.source()); |
| 1087 bool connected = native_source->ConnectToTrack(track); | 1087 bool connected = native_source->ConnectToTrack(track); |
| 1088 if (!is_pending) { | 1088 if (!is_pending) { |
| 1089 OnTrackStarted( | 1089 OnTrackStarted( |
| 1090 native_source, | 1090 native_source, |
| 1091 connected ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE, ""); | 1091 connected ? MEDIA_DEVICE_OK : MEDIA_DEVICE_TRACK_START_FAILURE, ""); |
| 1092 #if defined(OS_ANDROID) | |
| 1093 } else if (connected) { | |
| 1094 CHECK(native_source->is_local_source()); | |
| 1095 // On Android, we won't get the callback indicating the device readyness. | |
| 1096 // TODO(tommi): Update the android implementation to support the | |
| 1097 // OnAudioSourceStarted notification. http://crbug.com/679302 | |
| 1098 OnTrackStarted(native_source, MEDIA_DEVICE_OK, ""); | |
| 1099 #endif | |
| 1100 } | 1092 } |
| 1101 } | 1093 } |
| 1102 | 1094 |
| 1103 blink::WebMediaStreamTrack | 1095 blink::WebMediaStreamTrack |
| 1104 UserMediaClientImpl::UserMediaRequestInfo::CreateAndStartVideoTrack( | 1096 UserMediaClientImpl::UserMediaRequestInfo::CreateAndStartVideoTrack( |
| 1105 const blink::WebMediaStreamSource& source, | 1097 const blink::WebMediaStreamSource& source, |
| 1106 const blink::WebMediaConstraints& constraints) { | 1098 const blink::WebMediaConstraints& constraints) { |
| 1107 DCHECK(source.getType() == blink::WebMediaStreamSource::TypeVideo); | 1099 DCHECK(source.getType() == blink::WebMediaStreamSource::TypeVideo); |
| 1108 MediaStreamVideoSource* native_source = | 1100 MediaStreamVideoSource* native_source = |
| 1109 MediaStreamVideoSource::GetVideoSource(source); | 1101 MediaStreamVideoSource::GetVideoSource(source); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 sources_waiting_for_callback_.end(), source); | 1158 sources_waiting_for_callback_.end(), source); |
| 1167 if (found != sources_waiting_for_callback_.end()) | 1159 if (found != sources_waiting_for_callback_.end()) |
| 1168 OnTrackStarted(source, result, result_name); | 1160 OnTrackStarted(source, result, result_name); |
| 1169 } | 1161 } |
| 1170 | 1162 |
| 1171 void UserMediaClientImpl::OnDestruct() { | 1163 void UserMediaClientImpl::OnDestruct() { |
| 1172 delete this; | 1164 delete this; |
| 1173 } | 1165 } |
| 1174 | 1166 |
| 1175 } // namespace content | 1167 } // namespace content |
| OLD | NEW |