OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 414 |
415 bool FFmpegDemuxer::GetPosition(int64* position_out) { | 415 bool FFmpegDemuxer::GetPosition(int64* position_out) { |
416 *position_out = read_position_; | 416 *position_out = read_position_; |
417 return true; | 417 return true; |
418 } | 418 } |
419 | 419 |
420 bool FFmpegDemuxer::SetPosition(int64 position) { | 420 bool FFmpegDemuxer::SetPosition(int64 position) { |
421 DCHECK(data_source_); | 421 DCHECK(data_source_); |
422 | 422 |
423 int64 file_size; | 423 int64 file_size; |
424 if ((data_source_->GetSize(&file_size) && position >= file_size) || | 424 if (!data_source_->GetSize(&file_size) || position >= file_size || |
425 position < 0) { | 425 position < 0) |
426 return false; | 426 return false; |
427 } | |
428 | 427 |
429 read_position_ = position; | 428 read_position_ = position; |
430 return true; | 429 return true; |
431 } | 430 } |
432 | 431 |
433 bool FFmpegDemuxer::GetSize(int64* size_out) { | 432 bool FFmpegDemuxer::GetSize(int64* size_out) { |
434 DCHECK(data_source_); | 433 DCHECK(data_source_); |
435 | 434 |
436 return data_source_->GetSize(size_out); | 435 return data_source_->GetSize(size_out); |
437 } | 436 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 read_event_.Wait(); | 700 read_event_.Wait(); |
702 return last_read_bytes_; | 701 return last_read_bytes_; |
703 } | 702 } |
704 | 703 |
705 void FFmpegDemuxer::SignalReadCompleted(size_t size) { | 704 void FFmpegDemuxer::SignalReadCompleted(size_t size) { |
706 last_read_bytes_ = size; | 705 last_read_bytes_ = size; |
707 read_event_.Signal(); | 706 read_event_.Signal(); |
708 } | 707 } |
709 | 708 |
710 } // namespace media | 709 } // namespace media |
OLD | NEW |