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

Side by Side Diff: extensions/renderer/api/display_source/wifi_display/wifi_display_session.cc

Issue 1871553003: [chrome.displaySource][WiFi Display] Send media stream to sink (renderer part) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media_pipeline
Patch Set: Added result callback to WiFiDisplayMediaService.SetDestinationPoint Created 4 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
« no previous file with comments | « extensions/renderer/api/display_source/wifi_display/wifi_display_session.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "extensions/renderer/api/display_source/wifi_display/wifi_display_sessi on.h" 5 #include "extensions/renderer/api/display_source/wifi_display/wifi_display_sessi on.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 state_ = DisplaySourceSession::Establishing; 68 state_ = DisplaySourceSession::Establishing;
69 start_completion_callback_ = callback; 69 start_completion_callback_ = callback;
70 } 70 }
71 71
72 void WiFiDisplaySession::Terminate(const CompletionCallback& callback) { 72 void WiFiDisplaySession::Terminate(const CompletionCallback& callback) {
73 DCHECK_EQ(DisplaySourceSession::Established, state_); 73 DCHECK_EQ(DisplaySourceSession::Established, state_);
74 Terminate(); 74 Terminate();
75 teminate_completion_callback_ = callback; 75 teminate_completion_callback_ = callback;
76 } 76 }
77 77
78 void WiFiDisplaySession::OnConnected(const mojo::String& ip_address) { 78 void WiFiDisplaySession::OnConnected(const mojo::String& local_ip_address,
79 const mojo::String& sink_ip_address) {
79 DCHECK_EQ(DisplaySourceSession::Established, state_); 80 DCHECK_EQ(DisplaySourceSession::Established, state_);
80 ip_address_ = ip_address; 81 local_ip_address_ = local_ip_address;
81 media_manager_.reset( 82 media_manager_.reset(
82 new WiFiDisplayMediaManager( 83 new WiFiDisplayMediaManager(
83 params_.video_track, 84 params_.video_track,
84 params_.audio_track, 85 params_.audio_track,
86 sink_ip_address,
87 params_.render_frame->GetServiceRegistry(),
85 base::Bind( 88 base::Bind(
86 &WiFiDisplaySession::OnMediaError, 89 &WiFiDisplaySession::OnMediaError,
87 weak_factory_.GetWeakPtr()))); 90 weak_factory_.GetWeakPtr())));
88 wfd_source_.reset(wds::Source::Create(this, media_manager_.get(), this)); 91 wfd_source_.reset(wds::Source::Create(this, media_manager_.get(), this));
89 wfd_source_->Start(); 92 wfd_source_->Start();
90 } 93 }
91 94
92 void WiFiDisplaySession::OnConnectRequestHandled(bool success, 95 void WiFiDisplaySession::OnConnectRequestHandled(bool success,
93 const mojo::String& error) { 96 const mojo::String& error) {
94 DCHECK_EQ(DisplaySourceSession::Establishing, state_); 97 DCHECK_EQ(DisplaySourceSession::Establishing, state_);
(...skipping 23 matching lines...) Expand all
118 error_callback_.Run(static_cast<ErrorType>(type), description); 121 error_callback_.Run(static_cast<ErrorType>(type), description);
119 } 122 }
120 123
121 void WiFiDisplaySession::OnMessage(const mojo::String& data) { 124 void WiFiDisplaySession::OnMessage(const mojo::String& data) {
122 DCHECK_EQ(DisplaySourceSession::Established, state_); 125 DCHECK_EQ(DisplaySourceSession::Established, state_);
123 DCHECK(wfd_source_); 126 DCHECK(wfd_source_);
124 wfd_source_->RTSPDataReceived(data); 127 wfd_source_->RTSPDataReceived(data);
125 } 128 }
126 129
127 std::string WiFiDisplaySession::GetLocalIPAddress() const { 130 std::string WiFiDisplaySession::GetLocalIPAddress() const {
128 return ip_address_; 131 return local_ip_address_;
129 } 132 }
130 133
131 int WiFiDisplaySession::GetNextCSeq(int* initial_peer_cseq) const { 134 int WiFiDisplaySession::GetNextCSeq(int* initial_peer_cseq) const {
132 return ++cseq_; 135 return ++cseq_;
133 } 136 }
134 137
135 void WiFiDisplaySession::SendRTSPData(const std::string& message) { 138 void WiFiDisplaySession::SendRTSPData(const std::string& message) {
136 service_->SendMessage(message); 139 service_->SendMessage(message);
137 } 140 }
138 141
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 219 }
217 220
218 void WiFiDisplaySession::RunTerminateCallback( 221 void WiFiDisplaySession::RunTerminateCallback(
219 bool success, 222 bool success,
220 const std::string& error_message) { 223 const std::string& error_message) {
221 if (!teminate_completion_callback_.is_null()) 224 if (!teminate_completion_callback_.is_null())
222 teminate_completion_callback_.Run(success, error_message); 225 teminate_completion_callback_.Run(success, error_message);
223 } 226 }
224 227
225 } // namespace extensions 228 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/api/display_source/wifi_display/wifi_display_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698