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 <stdint.h> |
| 8 |
7 #include <algorithm> | 9 #include <algorithm> |
8 | 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
11 #include "base/command_line.h" | 13 #include "base/command_line.h" |
12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
14 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
15 #include "base/sys_info.h" | 18 #include "base/sys_info.h" |
16 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
17 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/renderer/media/cast_session.h" | 21 #include "chrome/renderer/media/cast_session.h" |
19 #include "chrome/renderer/media/cast_udp_transport.h" | 22 #include "chrome/renderer/media/cast_udp_transport.h" |
20 #include "content/public/renderer/media_stream_audio_sink.h" | 23 #include "content/public/renderer/media_stream_audio_sink.h" |
21 #include "content/public/renderer/media_stream_video_sink.h" | 24 #include "content/public/renderer/media_stream_video_sink.h" |
22 #include "content/public/renderer/render_thread.h" | 25 #include "content/public/renderer/render_thread.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 const int output_sample_rate_; | 480 const int output_sample_rate_; |
478 | 481 |
479 // This must be set before the real-time audio thread starts calling OnData(), | 482 // This must be set before the real-time audio thread starts calling OnData(), |
480 // and remain unchanged until after the thread will stop calling OnData(). | 483 // and remain unchanged until after the thread will stop calling OnData(). |
481 scoped_refptr<media::cast::AudioFrameInput> frame_input_; | 484 scoped_refptr<media::cast::AudioFrameInput> frame_input_; |
482 | 485 |
483 // These members are accessed on the real-time audio time only. | 486 // These members are accessed on the real-time audio time only. |
484 media::AudioParameters input_params_; | 487 media::AudioParameters input_params_; |
485 scoped_ptr<media::AudioConverter> converter_; | 488 scoped_ptr<media::AudioConverter> converter_; |
486 const media::AudioBus* current_input_bus_; | 489 const media::AudioBus* current_input_bus_; |
487 int64 sample_frames_in_; | 490 int64_t sample_frames_in_; |
488 int64 sample_frames_out_; | 491 int64_t sample_frames_out_; |
489 | 492 |
490 DISALLOW_COPY_AND_ASSIGN(CastAudioSink); | 493 DISALLOW_COPY_AND_ASSIGN(CastAudioSink); |
491 }; | 494 }; |
492 | 495 |
493 CastRtpParams::CastRtpParams(const CastRtpPayloadParams& payload_params) | 496 CastRtpParams::CastRtpParams(const CastRtpPayloadParams& payload_params) |
494 : payload(payload_params) {} | 497 : payload(payload_params) {} |
495 | 498 |
496 CastCodecSpecificParams::CastCodecSpecificParams() {} | 499 CastCodecSpecificParams::CastCodecSpecificParams() {} |
497 | 500 |
498 CastCodecSpecificParams::~CastCodecSpecificParams() {} | 501 CastCodecSpecificParams::~CastCodecSpecificParams() {} |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 DCHECK(content::RenderThread::Get()); | 627 DCHECK(content::RenderThread::Get()); |
625 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " | 628 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " |
626 << (IsAudio() ? "audio" : "video"); | 629 << (IsAudio() ? "audio" : "video"); |
627 // Save the WeakPtr first because the error callback might delete this object. | 630 // Save the WeakPtr first because the error callback might delete this object. |
628 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 631 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
629 error_callback_.Run(message); | 632 error_callback_.Run(message); |
630 base::ThreadTaskRunnerHandle::Get()->PostTask( | 633 base::ThreadTaskRunnerHandle::Get()->PostTask( |
631 FROM_HERE, | 634 FROM_HERE, |
632 base::Bind(&CastRtpStream::Stop, ptr)); | 635 base::Bind(&CastRtpStream::Stop, ptr)); |
633 } | 636 } |
OLD | NEW |