Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: media/filters/ffmpeg_demuxer.cc

Issue 2736643003: Remove FFmpegDemuxer DCHECKs that are handled via conditionals. (Closed)
Patch Set: Improve comment. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 duration_known_ = true; 1746 duration_known_ = true;
1747 duration_ = max_duration; 1747 duration_ = max_duration;
1748 } 1748 }
1749 1749
1750 // If we have reached the end of stream, tell the downstream filters about 1750 // If we have reached the end of stream, tell the downstream filters about
1751 // the event. 1751 // the event.
1752 StreamHasEnded(); 1752 StreamHasEnded();
1753 return; 1753 return;
1754 } 1754 }
1755 1755
1756 // Queue the packet with the appropriate stream. 1756 // Queue the packet with the appropriate stream; we must defend against ffmpeg
1757 DCHECK_GE(packet->stream_index, 0); 1757 // giving us a bad stream index. See http://crbug.com/698549 for example.
1758 DCHECK_LT(packet->stream_index, static_cast<int>(streams_.size()));
1759
1760 // Defend against ffmpeg giving us a bad stream index.
1761 if (packet->stream_index >= 0 && 1758 if (packet->stream_index >= 0 &&
1762 packet->stream_index < static_cast<int>(streams_.size()) && 1759 packet->stream_index < static_cast<int>(streams_.size()) &&
1763 streams_[packet->stream_index]) { 1760 streams_[packet->stream_index]) {
1764 // TODO(scherkus): Fix demuxing upstream to never return packets w/o data 1761 // TODO(scherkus): Fix demuxing upstream to never return packets w/o data
1765 // when av_read_frame() returns success code. See bug comment for ideas: 1762 // when av_read_frame() returns success code. See bug comment for ideas:
1766 // 1763 //
1767 // https://code.google.com/p/chromium/issues/detail?id=169133#c10 1764 // https://code.google.com/p/chromium/issues/detail?id=169133#c10
1768 if (!packet->data) { 1765 if (!packet->data) {
1769 ScopedAVPacket new_packet(new AVPacket()); 1766 ScopedAVPacket new_packet(new AVPacket());
1770 av_new_packet(new_packet.get(), 0); 1767 av_new_packet(new_packet.get(), 0);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 1836
1840 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) { 1837 void FFmpegDemuxer::SetLiveness(DemuxerStream::Liveness liveness) {
1841 DCHECK(task_runner_->BelongsToCurrentThread()); 1838 DCHECK(task_runner_->BelongsToCurrentThread());
1842 for (const auto& stream : streams_) { 1839 for (const auto& stream : streams_) {
1843 if (stream) 1840 if (stream)
1844 stream->SetLiveness(liveness); 1841 stream->SetLiveness(liveness);
1845 } 1842 }
1846 } 1843 }
1847 1844
1848 } // namespace media 1845 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698