Chromium Code Reviews| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 | 499 |
| 500 base::TimeDelta FFmpegDemuxer::GetStartTime() const { | 500 base::TimeDelta FFmpegDemuxer::GetStartTime() const { |
| 501 DCHECK(task_runner_->BelongsToCurrentThread()); | 501 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 502 return start_time_; | 502 return start_time_; |
| 503 } | 503 } |
| 504 | 504 |
| 505 base::Time FFmpegDemuxer::GetTimelineOffset() const { | 505 base::Time FFmpegDemuxer::GetTimelineOffset() const { |
| 506 return timeline_offset_; | 506 return timeline_offset_; |
| 507 } | 507 } |
| 508 | 508 |
| 509 bool FFmpegDemuxer::IsLiveMode() const { | |
| 510 DCHECK(task_runner_->BelongsToCurrentThread()); | |
| 511 return false; | |
| 512 } | |
| 513 | |
| 509 void FFmpegDemuxer::AddTextStreams() { | 514 void FFmpegDemuxer::AddTextStreams() { |
| 510 DCHECK(task_runner_->BelongsToCurrentThread()); | 515 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 511 | 516 |
| 512 for (StreamVector::size_type idx = 0; idx < streams_.size(); ++idx) { | 517 for (StreamVector::size_type idx = 0; idx < streams_.size(); ++idx) { |
| 513 FFmpegDemuxerStream* stream = streams_[idx]; | 518 FFmpegDemuxerStream* stream = streams_[idx]; |
| 514 if (stream == NULL || stream->type() != DemuxerStream::TEXT) | 519 if (stream == NULL || stream->type() != DemuxerStream::TEXT) |
| 515 continue; | 520 continue; |
| 516 | 521 |
| 517 TextKind kind = stream->GetTextKind(); | 522 TextKind kind = stream->GetTextKind(); |
| 518 std::string title = stream->GetMetadata("title"); | 523 std::string title = stream->GetMetadata("title"); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 674 | 679 |
| 675 if (format_context->duration != static_cast<int64_t>(AV_NOPTS_VALUE)) { | 680 if (format_context->duration != static_cast<int64_t>(AV_NOPTS_VALUE)) { |
| 676 // If there is a duration value in the container use that to find the | 681 // If there is a duration value in the container use that to find the |
| 677 // maximum between it and the duration from A/V streams. | 682 // maximum between it and the duration from A/V streams. |
| 678 const AVRational av_time_base = {1, AV_TIME_BASE}; | 683 const AVRational av_time_base = {1, AV_TIME_BASE}; |
| 679 max_duration = | 684 max_duration = |
| 680 std::max(max_duration, | 685 std::max(max_duration, |
| 681 ConvertFromTimeBase(av_time_base, format_context->duration)); | 686 ConvertFromTimeBase(av_time_base, format_context->duration)); |
| 682 } else { | 687 } else { |
| 683 // The duration is unknown, in which case this is likely a live stream. | 688 // The duration is unknown, in which case this is likely a live stream. |
| 684 max_duration = kInfiniteDuration(); | 689 max_duration = kInfiniteDuration(); |
|
acolwell GONE FROM CHROMIUM
2014/04/24 21:14:16
We should probably reflect this assumption via IsL
Sergey Ulanov
2014/04/24 23:17:45
Done. For consistency with the WebM parser it chec
| |
| 685 } | 690 } |
| 686 | 691 |
| 687 // Some demuxers, like WAV, do not put timestamps on their frames. We | 692 // Some demuxers, like WAV, do not put timestamps on their frames. We |
| 688 // assume the the start time is 0. | 693 // assume the the start time is 0. |
| 689 if (start_time_ == kNoTimestamp()) | 694 if (start_time_ == kNoTimestamp()) |
| 690 start_time_ = base::TimeDelta(); | 695 start_time_ = base::TimeDelta(); |
| 691 | 696 |
| 692 // MPEG-4 B-frames cause grief for a simple container like AVI. Enable PTS | 697 // MPEG-4 B-frames cause grief for a simple container like AVI. Enable PTS |
| 693 // generation so we always get timestamps, see http://crbug.com/169570 | 698 // generation so we always get timestamps, see http://crbug.com/169570 |
| 694 if (strcmp(format_context->iformat->name, "avi") == 0) | 699 if (strcmp(format_context->iformat->name, "avi") == 0) |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1002 } | 1007 } |
| 1003 for (size_t i = 0; i < buffered.size(); ++i) | 1008 for (size_t i = 0; i < buffered.size(); ++i) |
| 1004 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); | 1009 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); |
| 1005 } | 1010 } |
| 1006 | 1011 |
| 1007 void FFmpegDemuxer::OnDataSourceError() { | 1012 void FFmpegDemuxer::OnDataSourceError() { |
| 1008 host_->OnDemuxerError(PIPELINE_ERROR_READ); | 1013 host_->OnDemuxerError(PIPELINE_ERROR_READ); |
| 1009 } | 1014 } |
| 1010 | 1015 |
| 1011 } // namespace media | 1016 } // namespace media |
| OLD | NEW |