| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/filters/frame_processor.h" | 5 #include "media/filters/frame_processor.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "media/base/buffers.h" | 10 #include "media/base/buffers.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 if (buffer->timestamp() >= append_window_end) | 349 if (buffer->timestamp() >= append_window_end) |
| 350 return false; | 350 return false; |
| 351 | 351 |
| 352 DCHECK(buffer->timestamp() >= append_window_start || | 352 DCHECK(buffer->timestamp() >= append_window_start || |
| 353 frame_end_timestamp > append_window_start); | 353 frame_end_timestamp > append_window_start); |
| 354 | 354 |
| 355 bool processed_buffer = false; | 355 bool processed_buffer = false; |
| 356 | 356 |
| 357 // If we have a preroll buffer see if we can attach it to the first buffer | 357 // If we have a preroll buffer see if we can attach it to the first buffer |
| 358 // overlapping or after |append_window_start|. | 358 // overlapping or after |append_window_start|. |
| 359 if (audio_preroll_buffer_) { | 359 if (audio_preroll_buffer_.get()) { |
| 360 // We only want to use the preroll buffer if it directly precedes (less | 360 // We only want to use the preroll buffer if it directly precedes (less |
| 361 // than one sample apart) the current buffer. | 361 // than one sample apart) the current buffer. |
| 362 const int64 delta = std::abs((audio_preroll_buffer_->timestamp() + | 362 const int64 delta = std::abs((audio_preroll_buffer_->timestamp() + |
| 363 audio_preroll_buffer_->duration() - | 363 audio_preroll_buffer_->duration() - |
| 364 buffer->timestamp()).InMicroseconds()); | 364 buffer->timestamp()).InMicroseconds()); |
| 365 if (delta < sample_duration_.InMicroseconds()) { | 365 if (delta < sample_duration_.InMicroseconds()) { |
| 366 DVLOG(1) << "Attaching audio preroll buffer [" | 366 DVLOG(1) << "Attaching audio preroll buffer [" |
| 367 << audio_preroll_buffer_->timestamp().InSecondsF() << ", " | 367 << audio_preroll_buffer_->timestamp().InSecondsF() << ", " |
| 368 << (audio_preroll_buffer_->timestamp() + | 368 << (audio_preroll_buffer_->timestamp() + |
| 369 audio_preroll_buffer_->duration()).InSecondsF() << ") to " | 369 audio_preroll_buffer_->duration()).InSecondsF() << ") to " |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 DCHECK(group_end_timestamp_ >= base::TimeDelta()); | 701 DCHECK(group_end_timestamp_ >= base::TimeDelta()); |
| 702 | 702 |
| 703 return true; | 703 return true; |
| 704 } | 704 } |
| 705 | 705 |
| 706 NOTREACHED(); | 706 NOTREACHED(); |
| 707 return false; | 707 return false; |
| 708 } | 708 } |
| 709 | 709 |
| 710 } // namespace media | 710 } // namespace media |
| OLD | NEW |