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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // |devices| from the MediaStreamDispatcher. | 77 // |devices| from the MediaStreamDispatcher. |
78 void CreateWebKitSourceVector( | 78 void CreateWebKitSourceVector( |
79 const std::string& label, | 79 const std::string& label, |
80 const StreamDeviceInfoArray& devices, | 80 const StreamDeviceInfoArray& devices, |
81 WebKit::WebMediaStreamSource::Type type, | 81 WebKit::WebMediaStreamSource::Type type, |
82 WebKit::WebVector<WebKit::WebMediaStreamSource>& webkit_sources) { | 82 WebKit::WebVector<WebKit::WebMediaStreamSource>& webkit_sources) { |
83 CHECK_EQ(devices.size(), webkit_sources.size()); | 83 CHECK_EQ(devices.size(), webkit_sources.size()); |
84 for (size_t i = 0; i < devices.size(); ++i) { | 84 for (size_t i = 0; i < devices.size(); ++i) { |
85 const char* track_type = | 85 const char* track_type = |
86 (type == WebKit::WebMediaStreamSource::TypeAudio) ? "a" : "v"; | 86 (type == WebKit::WebMediaStreamSource::TypeAudio) ? "a" : "v"; |
87 std::string source_id = StringPrintf("%s%s%u", label.c_str(), | 87 std::string source_id = base::StringPrintf("%s%s%u", label.c_str(), |
88 track_type, | 88 track_type, |
89 static_cast<unsigned int>(i)); | 89 static_cast<unsigned int>(i)); |
90 webkit_sources[i].initialize( | 90 webkit_sources[i].initialize( |
91 UTF8ToUTF16(source_id), | 91 UTF8ToUTF16(source_id), |
92 type, | 92 type, |
93 UTF8ToUTF16(devices[i].device.name)); | 93 UTF8ToUTF16(devices[i].device.name)); |
94 webkit_sources[i].setExtraData( | 94 webkit_sources[i].setExtraData( |
95 new content::MediaStreamSourceExtraData(devices[i])); | 95 new content::MediaStreamSourceExtraData(devices[i])); |
96 webkit_sources[i].setDeviceId(UTF8ToUTF16(devices[i].device.id.c_str())); | 96 webkit_sources[i].setDeviceId(UTF8ToUTF16(devices[i].device.id.c_str())); |
97 } | 97 } |
98 } | 98 } |
99 | 99 |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 const StreamStopCallback& stop_callback) { | 589 const StreamStopCallback& stop_callback) { |
590 stream_stop_callback_ = stop_callback; | 590 stream_stop_callback_ = stop_callback; |
591 } | 591 } |
592 | 592 |
593 void MediaStreamExtraData::OnLocalStreamStop() { | 593 void MediaStreamExtraData::OnLocalStreamStop() { |
594 if (!stream_stop_callback_.is_null()) | 594 if (!stream_stop_callback_.is_null()) |
595 stream_stop_callback_.Run(stream_->label()); | 595 stream_stop_callback_.Run(stream_->label()); |
596 } | 596 } |
597 | 597 |
598 } // namespace content | 598 } // namespace content |
OLD | NEW |