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

Side by Side Diff: content/renderer/media/media_stream_center.cc

Issue 9699069: Adding JSEP PeerConnection glue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed missing export. Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 ateDescriptor.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 scriptionDescriptor.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
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::WebICECandidateDescriptor& 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))
58 LOG(ERROR) << "Could not create SDP string";
59 return UTF8ToUTF16(sdp);
60 }
61
62 WebKit::WebString MediaStreamCenter::constructSDP(
63 const WebKit::WebSessionDescriptionDescriptor& description) {
64 webrtc::SessionDescriptionInterface* native_desc =
65 webrtc::CreateSessionDescription(UTF16ToUTF8(description.initialSDP()));
66 if (!native_desc)
67 return WebKit::WebString();
68
69 for (size_t i = 0; i < description.numberOfAddedCandidates(); ++i) {
70 WebKit::WebICECandidateDescriptor 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
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_center.h ('k') | content/renderer/media/media_stream_dependency_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698