OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/client/audio_decode_scheduler.h" | 5 #include "remoting/client/audio_decode_scheduler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "remoting/client/audio_player.h" | 10 #include "remoting/client/audio_player.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 scoped_ptr<AudioPacket> decoded_packet = decoder_->Decode(packet.Pass()); | 44 scoped_ptr<AudioPacket> decoded_packet = decoder_->Decode(packet.Pass()); |
45 | 45 |
46 main_task_runner_->PostTask(FROM_HERE, base::Bind( | 46 main_task_runner_->PostTask(FROM_HERE, base::Bind( |
47 &AudioDecodeScheduler::ProcessDecodedPacket, base::Unretained(this), | 47 &AudioDecodeScheduler::ProcessDecodedPacket, base::Unretained(this), |
48 base::Passed(decoded_packet.Pass()), done)); | 48 base::Passed(decoded_packet.Pass()), done)); |
49 } | 49 } |
50 | 50 |
51 void AudioDecodeScheduler::ProcessDecodedPacket(scoped_ptr<AudioPacket> packet, | 51 void AudioDecodeScheduler::ProcessDecodedPacket(scoped_ptr<AudioPacket> packet, |
52 const base::Closure& done) { | 52 const base::Closure& done) { |
53 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 53 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
54 audio_player_->ProcessAudioPacket(packet.Pass()); | 54 // Only process |packet| if it is non-NULL. |
| 55 if (packet.get()) |
| 56 audio_player_->ProcessAudioPacket(packet.Pass()); |
55 done.Run(); | 57 done.Run(); |
56 } | 58 } |
57 | 59 |
58 } // namespace remoting | 60 } // namespace remoting |
OLD | NEW |