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

Side by Side Diff: media/formats/webm/webm_cluster_parser.cc

Issue 220103002: Fix unit test failures with estimated durations and splice frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 6 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/formats/webm/webm_cluster_parser.h" 5 #include "media/formats/webm/webm_cluster_parser.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/sys_byteorder.h" 10 #include "base/sys_byteorder.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 bool WebMClusterParser::Track::QueueBuffer( 523 bool WebMClusterParser::Track::QueueBuffer(
524 const scoped_refptr<StreamParserBuffer>& buffer) { 524 const scoped_refptr<StreamParserBuffer>& buffer) {
525 DCHECK(!last_added_buffer_missing_duration_); 525 DCHECK(!last_added_buffer_missing_duration_);
526 base::TimeDelta duration = buffer->duration(); 526 base::TimeDelta duration = buffer->duration();
527 if (duration < base::TimeDelta() || duration == kNoTimestamp()) { 527 if (duration < base::TimeDelta() || duration == kNoTimestamp()) {
528 DVLOG(2) << "QueueBuffer() : Invalid buffer duration: " 528 DVLOG(2) << "QueueBuffer() : Invalid buffer duration: "
529 << duration.InSecondsF(); 529 << duration.InSecondsF();
530 return false; 530 return false;
531 } 531 }
532 532
533 estimated_next_frame_duration_ = std::max(duration, 533 // The estimated frame duration is the minimum non-zero duration since the
534 estimated_next_frame_duration_); 534 // last initialization segment. The minimum is used to ensure frame durations
535 // aren't overestimated.
536 if (duration > base::TimeDelta()) {
537 if (estimated_next_frame_duration_ == kNoTimestamp()) {
538 estimated_next_frame_duration_ = duration;
539 } else {
540 estimated_next_frame_duration_ =
541 std::min(duration, estimated_next_frame_duration_);
542 }
543 }
544
535 buffers_.push_back(buffer); 545 buffers_.push_back(buffer);
536 return true; 546 return true;
537 } 547 }
538 548
539 base::TimeDelta WebMClusterParser::Track::GetDurationDefaultOrEstimate() { 549 base::TimeDelta WebMClusterParser::Track::GetDurationDefaultOrEstimate() {
540 base::TimeDelta duration = default_duration_; 550 base::TimeDelta duration = default_duration_;
541 if (duration != kNoTimestamp()) { 551 if (duration != kNoTimestamp()) {
542 DVLOG(3) << __FUNCTION__ << " : using TrackEntry DefaultDuration"; 552 DVLOG(3) << __FUNCTION__ << " : using TrackEntry DefaultDuration";
543 } else if (estimated_next_frame_duration_ != kNoTimestamp()) { 553 } else if (estimated_next_frame_duration_ != kNoTimestamp()) {
544 DVLOG(3) << __FUNCTION__ << " : using estimated duration"; 554 DVLOG(3) << __FUNCTION__ << " : using estimated duration";
(...skipping 27 matching lines...) Expand all
572 WebMClusterParser::FindTextTrack(int track_num) { 582 WebMClusterParser::FindTextTrack(int track_num) {
573 const TextTrackMap::iterator it = text_track_map_.find(track_num); 583 const TextTrackMap::iterator it = text_track_map_.find(track_num);
574 584
575 if (it == text_track_map_.end()) 585 if (it == text_track_map_.end())
576 return NULL; 586 return NULL;
577 587
578 return &it->second; 588 return &it->second;
579 } 589 }
580 590
581 } // namespace media 591 } // namespace media
OLDNEW
« media/filters/source_buffer_stream.cc ('K') | « media/filters/source_buffer_stream_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698