| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/scoped_ptr.h" | 5 #include "base/scoped_ptr.h" |
| 6 #include "base/stl_util-inl.h" | 6 #include "base/stl_util-inl.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "media/base/filter_host.h" | 9 #include "media/base/filter_host.h" |
| 10 #include "media/filters/ffmpeg_common.h" | 10 #include "media/filters/ffmpeg_common.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 if (discontinuous_) { | 200 if (discontinuous_) { |
| 201 buffer->SetDiscontinuous(true); | 201 buffer->SetDiscontinuous(true); |
| 202 discontinuous_ = false; | 202 discontinuous_ = false; |
| 203 } | 203 } |
| 204 | 204 |
| 205 // Execute the callback. | 205 // Execute the callback. |
| 206 read_callback->Run(buffer); | 206 read_callback->Run(buffer); |
| 207 } | 207 } |
| 208 | 208 |
| 209 base::TimeDelta FFmpegDemuxerStream::ConvertTimestamp(int64 timestamp) { | 209 base::TimeDelta FFmpegDemuxerStream::ConvertTimestamp(int64 timestamp) { |
| 210 if (timestamp == AV_NOPTS_VALUE) |
| 211 return StreamSample::kInvalidTimestamp; |
| 210 AVRational time_base = { 1, base::Time::kMicrosecondsPerSecond }; | 212 AVRational time_base = { 1, base::Time::kMicrosecondsPerSecond }; |
| 211 int64 microseconds = av_rescale_q(timestamp, stream_->time_base, time_base); | 213 int64 microseconds = av_rescale_q(timestamp, stream_->time_base, time_base); |
| 212 return base::TimeDelta::FromMicroseconds(microseconds); | 214 return base::TimeDelta::FromMicroseconds(microseconds); |
| 213 } | 215 } |
| 214 | 216 |
| 215 // | 217 // |
| 216 // FFmpegDemuxer | 218 // FFmpegDemuxer |
| 217 // | 219 // |
| 218 FFmpegDemuxer::FFmpegDemuxer() | 220 FFmpegDemuxer::FFmpegDemuxer() |
| 219 : format_context_(NULL), | 221 : format_context_(NULL), |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 read_event_.Wait(); | 578 read_event_.Wait(); |
| 577 return last_read_bytes_; | 579 return last_read_bytes_; |
| 578 } | 580 } |
| 579 | 581 |
| 580 void FFmpegDemuxer::SignalReadCompleted(size_t size) { | 582 void FFmpegDemuxer::SignalReadCompleted(size_t size) { |
| 581 last_read_bytes_ = size; | 583 last_read_bytes_ = size; |
| 582 read_event_.Signal(); | 584 read_event_.Signal(); |
| 583 } | 585 } |
| 584 | 586 |
| 585 } // namespace media | 587 } // namespace media |
| OLD | NEW |