OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/renderer/media/cast_rtp_stream.h" | 5 #include "chrome/renderer/media/cast_rtp_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/renderer/media/cast_session.h" | 10 #include "chrome/renderer/media/cast_session.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 271 } |
272 | 272 |
273 CastRtpParams::CastRtpParams() { | 273 CastRtpParams::CastRtpParams() { |
274 } | 274 } |
275 | 275 |
276 CastRtpParams::~CastRtpParams() { | 276 CastRtpParams::~CastRtpParams() { |
277 } | 277 } |
278 | 278 |
279 CastRtpStream::CastRtpStream(const blink::WebMediaStreamTrack& track, | 279 CastRtpStream::CastRtpStream(const blink::WebMediaStreamTrack& track, |
280 const scoped_refptr<CastSession>& session) | 280 const scoped_refptr<CastSession>& session) |
281 : track_(track), cast_session_(session), weak_factory_(this) {} | 281 : track_(track), |
| 282 cast_session_(session), |
| 283 weak_factory_(this) {} |
282 | 284 |
283 CastRtpStream::~CastRtpStream() { | 285 CastRtpStream::~CastRtpStream() { |
284 } | 286 } |
285 | 287 |
286 std::vector<CastRtpParams> CastRtpStream::GetSupportedParams() { | 288 std::vector<CastRtpParams> CastRtpStream::GetSupportedParams() { |
287 if (IsAudio()) | 289 if (IsAudio()) |
288 return SupportedAudioParams(); | 290 return SupportedAudioParams(); |
289 else | 291 else |
290 return SupportedVideoParams(); | 292 return SupportedVideoParams(); |
291 } | 293 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 start_callback.Run(); | 338 start_callback.Run(); |
337 } | 339 } |
338 } | 340 } |
339 | 341 |
340 void CastRtpStream::Stop() { | 342 void CastRtpStream::Stop() { |
341 audio_sink_.reset(); | 343 audio_sink_.reset(); |
342 video_sink_.reset(); | 344 video_sink_.reset(); |
343 stop_callback_.Run(); | 345 stop_callback_.Run(); |
344 } | 346 } |
345 | 347 |
| 348 void CastRtpStream::ToggleLogging(bool enable) { |
| 349 cast_session_->ToggleLogging(IsAudio(), enable); |
| 350 } |
| 351 |
| 352 void CastRtpStream::GetRawEvents( |
| 353 const base::Callback<void(scoped_ptr<std::string>)>& callback) { |
| 354 cast_session_->GetEventLogsAndReset(IsAudio(), callback); |
| 355 } |
| 356 |
346 bool CastRtpStream::IsAudio() const { | 357 bool CastRtpStream::IsAudio() const { |
347 return track_.source().type() == blink::WebMediaStreamSource::TypeAudio; | 358 return track_.source().type() == blink::WebMediaStreamSource::TypeAudio; |
348 } | 359 } |
349 | 360 |
350 void CastRtpStream::DidEncounterError(const std::string& message) { | 361 void CastRtpStream::DidEncounterError(const std::string& message) { |
351 error_callback_.Run(message); | 362 error_callback_.Run(message); |
352 Stop(); | 363 Stop(); |
353 } | 364 } |
OLD | NEW |