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

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

Issue 12209111: Set AVFMT_FLAG_GENPTS when demuxing AVI content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/media/media_browsertest.cc ('k') | 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 <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } else { 471 } else {
472 // The duration is unknown, in which case this is likely a live stream. 472 // The duration is unknown, in which case this is likely a live stream.
473 max_duration = kInfiniteDuration(); 473 max_duration = kInfiniteDuration();
474 } 474 }
475 475
476 // Some demuxers, like WAV, do not put timestamps on their frames. We 476 // Some demuxers, like WAV, do not put timestamps on their frames. We
477 // assume the the start time is 0. 477 // assume the the start time is 0.
478 if (start_time_ == kNoTimestamp()) 478 if (start_time_ == kNoTimestamp())
479 start_time_ = base::TimeDelta(); 479 start_time_ = base::TimeDelta();
480 480
481 // MPEG-4 B-frames cause grief for a simple container like AVI. Enable PTS
482 // generation so we always get timestamps, see http://crbug.com/169570
483 if (strcmp(format_context->iformat->name, "avi") == 0)
DaleCurtis 2013/02/12 19:23:30 avi_crazy_codec_would_still_match_strcmp_reminder
scherkus (not reviewing) 2013/02/13 17:53:14 gcc disagrees: strcmp("avi", "avi") -> 0 strcmp("a
484 format_context->flags |= AVFMT_FLAG_GENPTS;
485
481 // Good to go: set the duration and bitrate and notify we're done 486 // Good to go: set the duration and bitrate and notify we're done
482 // initializing. 487 // initializing.
483 host_->SetDuration(max_duration); 488 host_->SetDuration(max_duration);
484 duration_known_ = (max_duration != kInfiniteDuration()); 489 duration_known_ = (max_duration != kInfiniteDuration());
485 490
486 int64 filesize_in_bytes = 0; 491 int64 filesize_in_bytes = 0;
487 url_protocol_.GetSize(&filesize_in_bytes); 492 url_protocol_.GetSize(&filesize_in_bytes);
488 bitrate_ = CalculateBitrate(format_context, max_duration, filesize_in_bytes); 493 bitrate_ = CalculateBitrate(format_context, max_duration, filesize_in_bytes);
489 if (bitrate_ > 0) 494 if (bitrate_ > 0)
490 data_source_->SetBitrate(bitrate_); 495 data_source_->SetBitrate(bitrate_);
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 683 }
679 for (size_t i = 0; i < buffered.size(); ++i) 684 for (size_t i = 0; i < buffered.size(); ++i)
680 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i)); 685 host_->AddBufferedTimeRange(buffered.start(i), buffered.end(i));
681 } 686 }
682 687
683 void FFmpegDemuxer::OnDataSourceError() { 688 void FFmpegDemuxer::OnDataSourceError() {
684 host_->OnDemuxerError(PIPELINE_ERROR_READ); 689 host_->OnDemuxerError(PIPELINE_ERROR_READ);
685 } 690 }
686 691
687 } // namespace media 692 } // namespace media
OLDNEW
« no previous file with comments | « content/browser/media/media_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698