| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ffmpeg_demuxer.h" | 5 #include "media/filters/ffmpeg_demuxer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // go backwards in time. | 341 // go backwards in time. |
| 342 // | 342 // |
| 343 // If the new link starts with a negative timestamp or a timestamp less than | 343 // If the new link starts with a negative timestamp or a timestamp less than |
| 344 // the original (positive) |start_time|, we will get a negative timestamp | 344 // the original (positive) |start_time|, we will get a negative timestamp |
| 345 // here. It's also possible FFmpeg returns kNoTimestamp() here if it's not | 345 // here. It's also possible FFmpeg returns kNoTimestamp() here if it's not |
| 346 // able to work out a timestamp using the previous link and the next. | 346 // able to work out a timestamp using the previous link and the next. |
| 347 // | 347 // |
| 348 // Fixing chained ogg is non-trivial, so for now just reuse the last good | 348 // Fixing chained ogg is non-trivial, so for now just reuse the last good |
| 349 // timestamp. The decoder will rewrite the timestamps to be sample accurate | 349 // timestamp. The decoder will rewrite the timestamps to be sample accurate |
| 350 // later. See http://crbug.com/396864. | 350 // later. See http://crbug.com/396864. |
| 351 if (fixup_negative_ogg_timestamps_ && | 351 // |
| 352 (buffer->timestamp() == kNoTimestamp() || | 352 // TODO(dalecurtis): ffvp9 packet parser generates AV_NOPTS packets when a |
| 353 buffer->timestamp() < last_packet_timestamp_)) { | 353 // superframe is split, so adjust timestamps here... |
| 354 if ((fixup_negative_ogg_timestamps_ || |
| 355 buffer->timestamp() == kNoTimestamp()) && |
| 356 (buffer->timestamp() < last_packet_timestamp_)) { |
| 354 buffer->set_timestamp(last_packet_timestamp_ + | 357 buffer->set_timestamp(last_packet_timestamp_ + |
| 355 (last_packet_duration_ != kNoTimestamp() | 358 (last_packet_duration_ != kNoTimestamp() |
| 356 ? last_packet_duration_ | 359 ? last_packet_duration_ |
| 357 : base::TimeDelta::FromMicroseconds(1))); | 360 : base::TimeDelta::FromMicroseconds(1))); |
| 358 } | 361 } |
| 359 | 362 |
| 360 // The demuxer should always output positive timestamps. | 363 // The demuxer should always output positive timestamps. |
| 361 DCHECK(buffer->timestamp() >= base::TimeDelta()); | 364 DCHECK(buffer->timestamp() >= base::TimeDelta()); |
| 362 DCHECK(buffer->timestamp() != kNoTimestamp()); | 365 DCHECK(buffer->timestamp() != kNoTimestamp()); |
| 363 | 366 |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 | 1289 |
| 1287 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1290 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
| 1288 DCHECK(task_runner_->BelongsToCurrentThread()); | 1291 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 1289 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. | 1292 for (const auto& stream : streams_) { // |stream| is a ref to a pointer. |
| 1290 if (stream) | 1293 if (stream) |
| 1291 stream->SetLiveness(liveness); | 1294 stream->SetLiveness(liveness); |
| 1292 } | 1295 } |
| 1293 } | 1296 } |
| 1294 | 1297 |
| 1295 } // namespace media | 1298 } // namespace media |
| OLD | NEW |