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/stream_parser_buffer.h" | 10 #include "media/base/stream_parser_buffer.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 DCHECK(buffer->timestamp() >= append_window_start || | 368 DCHECK(buffer->timestamp() >= append_window_start || |
369 frame_end_timestamp > append_window_start); | 369 frame_end_timestamp > append_window_start); |
370 | 370 |
371 bool processed_buffer = false; | 371 bool processed_buffer = false; |
372 | 372 |
373 // If we have a preroll buffer see if we can attach it to the first buffer | 373 // If we have a preroll buffer see if we can attach it to the first buffer |
374 // overlapping or after |append_window_start|. | 374 // overlapping or after |append_window_start|. |
375 if (audio_preroll_buffer_.get()) { | 375 if (audio_preroll_buffer_.get()) { |
376 // We only want to use the preroll buffer if it directly precedes (less | 376 // We only want to use the preroll buffer if it directly precedes (less |
377 // than one sample apart) the current buffer. | 377 // than one sample apart) the current buffer. |
378 const int64 delta = | 378 const int64_t delta = |
379 (audio_preroll_buffer_->timestamp() + | 379 (audio_preroll_buffer_->timestamp() + |
380 audio_preroll_buffer_->duration() - buffer->timestamp()) | 380 audio_preroll_buffer_->duration() - buffer->timestamp()) |
381 .InMicroseconds(); | 381 .InMicroseconds(); |
382 if (std::abs(delta) < sample_duration_.InMicroseconds()) { | 382 if (std::abs(delta) < sample_duration_.InMicroseconds()) { |
383 DVLOG(1) << "Attaching audio preroll buffer [" | 383 DVLOG(1) << "Attaching audio preroll buffer [" |
384 << audio_preroll_buffer_->timestamp().InSecondsF() << ", " | 384 << audio_preroll_buffer_->timestamp().InSecondsF() << ", " |
385 << (audio_preroll_buffer_->timestamp() + | 385 << (audio_preroll_buffer_->timestamp() + |
386 audio_preroll_buffer_->duration()).InSecondsF() << ") to " | 386 audio_preroll_buffer_->duration()).InSecondsF() << ") to " |
387 << buffer->timestamp().InSecondsF(); | 387 << buffer->timestamp().InSecondsF(); |
388 buffer->SetPrerollBuffer(audio_preroll_buffer_); | 388 buffer->SetPrerollBuffer(audio_preroll_buffer_); |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 DCHECK(group_end_timestamp_ >= base::TimeDelta()); | 735 DCHECK(group_end_timestamp_ >= base::TimeDelta()); |
736 | 736 |
737 return true; | 737 return true; |
738 } | 738 } |
739 | 739 |
740 NOTREACHED(); | 740 NOTREACHED(); |
741 return false; | 741 return false; |
742 } | 742 } |
743 | 743 |
744 } // namespace media | 744 } // namespace media |
OLD | NEW |