| 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 } |
| 427 | 428 |
| 428 read_position_ = position; | 429 read_position_ = position; |
| 429 return true; | 430 return true; |
| 430 } | 431 } |
| 431 | 432 |
| 432 bool FFmpegDemuxer::GetSize(int64* size_out) { | 433 bool FFmpegDemuxer::GetSize(int64* size_out) { |
| 433 DCHECK(data_source_); | 434 DCHECK(data_source_); |
| 434 | 435 |
| 435 return data_source_->GetSize(size_out); | 436 return data_source_->GetSize(size_out); |
| 436 } | 437 } |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 read_event_.Wait(); | 701 read_event_.Wait(); |
| 701 return last_read_bytes_; | 702 return last_read_bytes_; |
| 702 } | 703 } |
| 703 | 704 |
| 704 void FFmpegDemuxer::SignalReadCompleted(size_t size) { | 705 void FFmpegDemuxer::SignalReadCompleted(size_t size) { |
| 705 last_read_bytes_ = size; | 706 last_read_bytes_ = size; |
| 706 read_event_.Signal(); | 707 read_event_.Signal(); |
| 707 } | 708 } |
| 708 | 709 |
| 709 } // namespace media | 710 } // namespace media |
| OLD | NEW |