| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "remoting/protocol/audio_decode_scheduler.h" | 5 #include "remoting/protocol/audio_decode_scheduler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 audio_consumer_(audio_consumer), | 24 audio_consumer_(audio_consumer), |
| 25 weak_factory_(this) {} | 25 weak_factory_(this) {} |
| 26 | 26 |
| 27 AudioDecodeScheduler::~AudioDecodeScheduler() { | 27 AudioDecodeScheduler::~AudioDecodeScheduler() { |
| 28 audio_decode_task_runner_->DeleteSoon(FROM_HERE, decoder_.release()); | 28 audio_decode_task_runner_->DeleteSoon(FROM_HERE, decoder_.release()); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void AudioDecodeScheduler::Initialize(const protocol::SessionConfig& config) { | 31 void AudioDecodeScheduler::Initialize(const protocol::SessionConfig& config) { |
| 32 DCHECK(thread_checker_.CalledOnValidThread()); | 32 DCHECK(thread_checker_.CalledOnValidThread()); |
| 33 DCHECK(!decoder_); | 33 DCHECK(!decoder_); |
| 34 decoder_.reset(AudioDecoder::CreateAudioDecoder(config).release()); | 34 decoder_ = AudioDecoder::CreateAudioDecoder(config); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void AudioDecodeScheduler::ProcessAudioPacket( | 37 void AudioDecodeScheduler::ProcessAudioPacket( |
| 38 std::unique_ptr<AudioPacket> packet, | 38 std::unique_ptr<AudioPacket> packet, |
| 39 const base::Closure& done) { | 39 const base::Closure& done) { |
| 40 DCHECK(thread_checker_.CalledOnValidThread()); | 40 DCHECK(thread_checker_.CalledOnValidThread()); |
| 41 | 41 |
| 42 base::PostTaskAndReplyWithResult( | 42 base::PostTaskAndReplyWithResult( |
| 43 audio_decode_task_runner_.get(), FROM_HERE, | 43 audio_decode_task_runner_.get(), FROM_HERE, |
| 44 base::Bind(&AudioDecoder::Decode, base::Unretained(decoder_.get()), | 44 base::Bind(&AudioDecoder::Decode, base::Unretained(decoder_.get()), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 55 if (!packet || !audio_consumer_) { | 55 if (!packet || !audio_consumer_) { |
| 56 done.Run(); | 56 done.Run(); |
| 57 return; | 57 return; |
| 58 } | 58 } |
| 59 | 59 |
| 60 audio_consumer_->ProcessAudioPacket(std::move(packet), done); | 60 audio_consumer_->ProcessAudioPacket(std::move(packet), done); |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace protocol | 63 } // namespace protocol |
| 64 } // namespace remoting | 64 } // namespace remoting |
| OLD | NEW |