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> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 input_params_.sample_rate()); | 562 input_params_.sample_rate()); |
563 converter_.reset( | 563 converter_.reset( |
564 new media::AudioConverter(input_params_, output_params, false)); | 564 new media::AudioConverter(input_params_, output_params, false)); |
565 converter_->AddInput(this); | 565 converter_->AddInput(this); |
566 sample_frames_in_ = 0; | 566 sample_frames_in_ = 0; |
567 sample_frames_out_ = 0; | 567 sample_frames_out_ = 0; |
568 } | 568 } |
569 | 569 |
570 // Called on real-time audio thread. | 570 // Called on real-time audio thread. |
571 double ProvideInput(media::AudioBus* audio_bus, | 571 double ProvideInput(media::AudioBus* audio_bus, |
572 base::TimeDelta buffer_delay) override { | 572 uint32_t frames_delayed) override { |
573 DCHECK(current_input_bus_); | 573 DCHECK(current_input_bus_); |
574 current_input_bus_->CopyTo(audio_bus); | 574 current_input_bus_->CopyTo(audio_bus); |
575 current_input_bus_ = nullptr; | 575 current_input_bus_ = nullptr; |
576 return 1.0; | 576 return 1.0; |
577 } | 577 } |
578 | 578 |
579 private: | 579 private: |
580 const blink::WebMediaStreamTrack track_; | 580 const blink::WebMediaStreamTrack track_; |
581 const int output_channels_; | 581 const int output_channels_; |
582 const int output_sample_rate_; | 582 const int output_sample_rate_; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 DCHECK(content::RenderThread::Get()); | 735 DCHECK(content::RenderThread::Get()); |
736 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " | 736 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " |
737 << (IsAudio() ? "audio" : "video"); | 737 << (IsAudio() ? "audio" : "video"); |
738 // Save the WeakPtr first because the error callback might delete this object. | 738 // Save the WeakPtr first because the error callback might delete this object. |
739 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); | 739 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); |
740 error_callback_.Run(message); | 740 error_callback_.Run(message); |
741 base::ThreadTaskRunnerHandle::Get()->PostTask( | 741 base::ThreadTaskRunnerHandle::Get()->PostTask( |
742 FROM_HERE, | 742 FROM_HERE, |
743 base::Bind(&CastRtpStream::Stop, ptr)); | 743 base::Bind(&CastRtpStream::Stop, ptr)); |
744 } | 744 } |
OLD | NEW |