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_center.h" | 5 #include "content/renderer/media/media_stream_center.h" |
6 | 6 |
7 #include <string> | |
8 | |
9 #include "base/logging.h" | |
10 #include "base/utf_string_conversions.h" | |
11 #include "third_party/libjingle/source/talk/app/webrtc/jsep.h" | |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebIceCandid ate.h" | |
7 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amCenterClient.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amCenterClient.h" |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amDescriptor.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSource.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSourcesRequest.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebMediaStre amSourcesRequest.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSessionDe scription.h" | |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
12 | 19 |
13 namespace content { | 20 namespace content { |
14 | 21 |
15 MediaStreamCenter::MediaStreamCenter( | 22 MediaStreamCenter::MediaStreamCenter( |
16 WebKit::WebMediaStreamCenterClient* client) | 23 WebKit::WebMediaStreamCenterClient* client) |
17 : client_(client) { | 24 : client_(client) { |
18 } | 25 } |
19 | 26 |
20 void MediaStreamCenter::queryMediaStreamSources( | 27 void MediaStreamCenter::queryMediaStreamSources( |
(...skipping 13 matching lines...) Expand all Loading... | |
34 } | 41 } |
35 | 42 |
36 void MediaStreamCenter::didStopLocalMediaStream( | 43 void MediaStreamCenter::didStopLocalMediaStream( |
37 const WebKit::WebMediaStreamDescriptor& stream) { | 44 const WebKit::WebMediaStreamDescriptor& stream) { |
38 } | 45 } |
39 | 46 |
40 void MediaStreamCenter::didConstructMediaStream( | 47 void MediaStreamCenter::didConstructMediaStream( |
41 const WebKit::WebMediaStreamDescriptor& stream) { | 48 const WebKit::WebMediaStreamDescriptor& stream) { |
42 } | 49 } |
43 | 50 |
51 WebKit::WebString MediaStreamCenter::constructSdp( | |
52 const WebKit::WebIceCandidate& candidate) { | |
53 webrtc::IceCandidateInterface* native_candidate = | |
54 webrtc::CreateIceCandidate(UTF16ToUTF8(candidate.label()), | |
55 UTF16ToUTF8(candidate.candidateLine())); | |
56 std::string sdp; | |
57 if (!native_candidate->ToString(&sdp)) | |
tommi (sloooow) - chröme
2012/03/15 12:31:52
is this the same as oom? If so, then maybe just CH
Henrik Grunell
2012/03/23 12:50:45
This could be some other error according to libjin
| |
58 LOG(ERROR) << "Could not create SDP string"; | |
59 return UTF8ToUTF16(sdp); | |
60 } | |
61 | |
62 WebKit::WebString MediaStreamCenter::constructSdp( | |
63 const WebKit::WebSessionDescription& description) { | |
64 webrtc::SessionDescriptionInterface* native_desc = | |
65 webrtc::CreateSessionDescription(UTF16ToUTF8(description.initialSdp())); | |
66 if (!native_desc) | |
67 return ""; | |
68 | |
69 for (size_t i = 0; i < description.numberOfAddedCandidates(); ++i) { | |
70 WebKit::WebIceCandidate candidate = description.candidate(i); | |
71 webrtc::IceCandidateInterface* native_candidate = | |
72 webrtc::CreateIceCandidate(UTF16ToUTF8(candidate.label()), | |
73 UTF16ToUTF8(candidate.candidateLine())); | |
74 native_desc->AddCandidate(native_candidate); | |
75 } | |
76 | |
77 std::string sdp; | |
78 if (!native_desc->ToString(&sdp)) | |
79 LOG(ERROR) << "Could not create SDP string"; | |
80 return UTF8ToUTF16(sdp); | |
81 } | |
82 | |
44 } // namespace content | 83 } // namespace content |
OLD | NEW |