| 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" |
| 11 #include "chrome/renderer/media/cast_udp_transport.h" | 11 #include "chrome/renderer/media/cast_udp_transport.h" |
| 12 #include "content/public/renderer/media_stream_audio_sink.h" | 12 #include "content/public/renderer/media_stream_audio_sink.h" |
| 13 #include "content/public/renderer/media_stream_video_sink.h" | 13 #include "content/public/renderer/media_stream_video_sink.h" |
| 14 #include "content/public/renderer/render_thread.h" | 14 #include "content/public/renderer/render_thread.h" |
| 15 #include "media/audio/audio_parameters.h" | 15 #include "media/audio/audio_parameters.h" |
| 16 #include "media/base/audio_bus.h" | 16 #include "media/base/audio_bus.h" |
| 17 #include "media/base/audio_fifo.h" | 17 #include "media/base/audio_fifo.h" |
| 18 #include "media/base/bind_to_current_loop.h" | 18 #include "media/base/bind_to_current_loop.h" |
| 19 #include "media/base/multi_channel_resampler.h" | 19 #include "media/base/multi_channel_resampler.h" |
| 20 #include "media/base/video_frame.h" |
| 20 #include "media/cast/cast_config.h" | 21 #include "media/cast/cast_config.h" |
| 21 #include "media/cast/cast_defines.h" | 22 #include "media/cast/cast_defines.h" |
| 22 #include "media/cast/cast_sender.h" | 23 #include "media/cast/cast_sender.h" |
| 23 #include "media/cast/transport/cast_transport_config.h" | 24 #include "media/cast/transport/cast_transport_config.h" |
| 24 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 25 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 26 #include "ui/gfx/geometry/size.h" |
| 25 | 27 |
| 26 using media::cast::AudioSenderConfig; | 28 using media::cast::AudioSenderConfig; |
| 27 using media::cast::VideoSenderConfig; | 29 using media::cast::VideoSenderConfig; |
| 28 | 30 |
| 29 namespace { | 31 namespace { |
| 30 | 32 |
| 31 const char kCodecNameOpus[] = "OPUS"; | 33 const char kCodecNameOpus[] = "OPUS"; |
| 32 const char kCodecNameVp8[] = "VP8"; | 34 const char kCodecNameVp8[] = "VP8"; |
| 33 | 35 |
| 34 // This constant defines the number of sets of audio data to buffer | 36 // This constant defines the number of sets of audio data to buffer |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 434 } |
| 433 | 435 |
| 434 void CastRtpStream::DidEncounterError(const std::string& message) { | 436 void CastRtpStream::DidEncounterError(const std::string& message) { |
| 435 // Save the WeakPtr first because the error callback might delete this object. | 437 // Save the WeakPtr first because the error callback might delete this object. |
| 436 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 438 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
| 437 error_callback_.Run(message); | 439 error_callback_.Run(message); |
| 438 content::RenderThread::Get()->GetMessageLoop()->PostTask( | 440 content::RenderThread::Get()->GetMessageLoop()->PostTask( |
| 439 FROM_HERE, | 441 FROM_HERE, |
| 440 base::Bind(&CastRtpStream::Stop, ptr)); | 442 base::Bind(&CastRtpStream::Stop, ptr)); |
| 441 } | 443 } |
| OLD | NEW |