| 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/host/linux/audio_pipe_reader.h" | 5 #include "remoting/host/linux/audio_pipe_reader.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (fstat(pipe_.GetPlatformFile(), &old_stat) == 0 && | 108 if (fstat(pipe_.GetPlatformFile(), &old_stat) == 0 && |
| 109 fstat(new_pipe.GetPlatformFile(), &new_stat) == 0 && | 109 fstat(new_pipe.GetPlatformFile(), &new_stat) == 0 && |
| 110 old_stat.st_ino == new_stat.st_ino) { | 110 old_stat.st_ino == new_stat.st_ino) { |
| 111 return; | 111 return; |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 file_descriptor_watcher_.StopWatchingFileDescriptor(); | 115 file_descriptor_watcher_.StopWatchingFileDescriptor(); |
| 116 timer_.Stop(); | 116 timer_.Stop(); |
| 117 | 117 |
| 118 pipe_ = new_pipe.Pass(); | 118 pipe_ = std::move(new_pipe); |
| 119 | 119 |
| 120 if (pipe_.IsValid()) { | 120 if (pipe_.IsValid()) { |
| 121 // Get buffer size for the pipe. | 121 // Get buffer size for the pipe. |
| 122 pipe_buffer_size_ = fpathconf(pipe_.GetPlatformFile(), _PC_PIPE_BUF); | 122 pipe_buffer_size_ = fpathconf(pipe_.GetPlatformFile(), _PC_PIPE_BUF); |
| 123 if (pipe_buffer_size_ < 0) { | 123 if (pipe_buffer_size_ < 0) { |
| 124 PLOG(ERROR) << "fpathconf(_PC_PIPE_BUF)"; | 124 PLOG(ERROR) << "fpathconf(_PC_PIPE_BUF)"; |
| 125 pipe_buffer_size_ = 4096; | 125 pipe_buffer_size_ = 4096; |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Read from the pipe twice per buffer length, to avoid starving the stream. | 128 // Read from the pipe twice per buffer length, to avoid starving the stream. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 pipe_.GetPlatformFile(), false, base::MessageLoopForIO::WATCH_READ, | 202 pipe_.GetPlatformFile(), false, base::MessageLoopForIO::WATCH_READ, |
| 203 &file_descriptor_watcher_, this); | 203 &file_descriptor_watcher_, this); |
| 204 } | 204 } |
| 205 | 205 |
| 206 // static | 206 // static |
| 207 void AudioPipeReaderTraits::Destruct(const AudioPipeReader* audio_pipe_reader) { | 207 void AudioPipeReaderTraits::Destruct(const AudioPipeReader* audio_pipe_reader) { |
| 208 audio_pipe_reader->task_runner_->DeleteSoon(FROM_HERE, audio_pipe_reader); | 208 audio_pipe_reader->task_runner_->DeleteSoon(FROM_HERE, audio_pipe_reader); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace remoting | 211 } // namespace remoting |
| OLD | NEW |