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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // The demuxer should always output positive timestamps. | 353 // The demuxer should always output positive timestamps. |
354 DCHECK(buffer->timestamp() >= base::TimeDelta()); | 354 DCHECK(buffer->timestamp() >= base::TimeDelta()); |
355 DCHECK(buffer->timestamp() != kNoTimestamp()); | 355 DCHECK(buffer->timestamp() != kNoTimestamp()); |
356 | 356 |
357 if (last_packet_timestamp_ < buffer->timestamp()) { | 357 if (last_packet_timestamp_ < buffer->timestamp()) { |
358 buffered_ranges_.Add(last_packet_timestamp_, buffer->timestamp()); | 358 buffered_ranges_.Add(last_packet_timestamp_, buffer->timestamp()); |
359 demuxer_->NotifyBufferingChanged(); | 359 demuxer_->NotifyBufferingChanged(); |
360 } | 360 } |
361 } | 361 } |
362 | 362 |
| 363 if (packet.get()->flags & AV_PKT_FLAG_KEY) |
| 364 buffer->set_is_key_frame(true); |
| 365 |
363 last_packet_timestamp_ = buffer->timestamp(); | 366 last_packet_timestamp_ = buffer->timestamp(); |
364 last_packet_duration_ = buffer->duration(); | 367 last_packet_duration_ = buffer->duration(); |
365 | 368 |
366 buffer_queue_.Push(buffer); | 369 buffer_queue_.Push(buffer); |
367 SatisfyPendingRead(); | 370 SatisfyPendingRead(); |
368 } | 371 } |
369 | 372 |
370 void FFmpegDemuxerStream::SetEndOfStream() { | 373 void FFmpegDemuxerStream::SetEndOfStream() { |
371 DCHECK(task_runner_->BelongsToCurrentThread()); | 374 DCHECK(task_runner_->BelongsToCurrentThread()); |
372 end_of_stream_ = true; | 375 end_of_stream_ = true; |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 } | 1269 } |
1267 for (size_t i = 0; i < buffered.size(); ++i) | 1270 for (size_t i = 0; i < buffered.size(); ++i) |
1268 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); | 1271 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); |
1269 } | 1272 } |
1270 | 1273 |
1271 void FFmpegDemuxer::OnDataSourceError() { | 1274 void FFmpegDemuxer::OnDataSourceError() { |
1272 host_->OnDemuxerError(PIPELINE_ERROR_READ); | 1275 host_->OnDemuxerError(PIPELINE_ERROR_READ); |
1273 } | 1276 } |
1274 | 1277 |
1275 } // namespace media | 1278 } // namespace media |
OLD | NEW |