| 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 <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 format_context->start_time != static_cast<int64_t>(AV_NOPTS_VALUE)) { | 1228 format_context->start_time != static_cast<int64_t>(AV_NOPTS_VALUE)) { |
| 1229 struct AVPacketList* packet_buffer = internal->packet_buffer; | 1229 struct AVPacketList* packet_buffer = internal->packet_buffer; |
| 1230 while (packet_buffer != internal->packet_buffer_end) { | 1230 while (packet_buffer != internal->packet_buffer_end) { |
| 1231 DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index), | 1231 DCHECK_LT(static_cast<size_t>(packet_buffer->pkt.stream_index), |
| 1232 start_time_estimates.size()); | 1232 start_time_estimates.size()); |
| 1233 const AVStream* stream = | 1233 const AVStream* stream = |
| 1234 format_context->streams[packet_buffer->pkt.stream_index]; | 1234 format_context->streams[packet_buffer->pkt.stream_index]; |
| 1235 if (packet_buffer->pkt.pts != static_cast<int64_t>(AV_NOPTS_VALUE)) { | 1235 if (packet_buffer->pkt.pts != static_cast<int64_t>(AV_NOPTS_VALUE)) { |
| 1236 const base::TimeDelta packet_pts = | 1236 const base::TimeDelta packet_pts = |
| 1237 ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts); | 1237 ConvertFromTimeBase(stream->time_base, packet_buffer->pkt.pts); |
| 1238 if (packet_pts < start_time_estimates[stream->index]) | 1238 // We ignore kNoTimestamp here since -int64_t::min() is possible; see |
| 1239 // https://crbug.com/700501. Technically this is a valid value, but in |
| 1240 // practice shouldn't occur, so just ignore it when estimating. |
| 1241 if (packet_pts != kNoTimestamp && packet_pts != kInfiniteDuration && |
| 1242 packet_pts < start_time_estimates[stream->index]) { |
| 1239 start_time_estimates[stream->index] = packet_pts; | 1243 start_time_estimates[stream->index] = packet_pts; |
| 1244 } |
| 1240 } | 1245 } |
| 1241 packet_buffer = packet_buffer->next; | 1246 packet_buffer = packet_buffer->next; |
| 1242 } | 1247 } |
| 1243 } | 1248 } |
| 1244 | 1249 |
| 1245 std::unique_ptr<MediaTracks> media_tracks(new MediaTracks()); | 1250 std::unique_ptr<MediaTracks> media_tracks(new MediaTracks()); |
| 1246 | 1251 |
| 1247 DCHECK(track_id_to_demux_stream_map_.empty()); | 1252 DCHECK(track_id_to_demux_stream_map_.empty()); |
| 1248 | 1253 |
| 1249 // If available, |start_time_| will be set to the lowest stream start time. | 1254 // If available, |start_time_| will be set to the lowest stream start time. |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 | 1852 |
| 1848 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { | 1853 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { |
| 1849 DCHECK(task_runner_->BelongsToCurrentThread()); | 1854 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 1850 for (const auto& stream : streams_) { | 1855 for (const auto& stream : streams_) { |
| 1851 if (stream) | 1856 if (stream) |
| 1852 stream->SetLiveness(liveness); | 1857 stream->SetLiveness(liveness); |
| 1853 } | 1858 } |
| 1854 } | 1859 } |
| 1855 | 1860 |
| 1856 } // namespace media | 1861 } // namespace media |
| OLD | NEW |