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

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

Issue 1240323003: MSE: Update DTS by the same delta as PTS during partial append window trimming (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes my self-nit Created 5 years, 5 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 | media/filters/frame_processor_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/filters/frame_processor.h" 5 #include "media/filters/frame_processor.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "media/base/buffers.h" 10 #include "media/base/buffers.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 DVLOG(1) << "Truncating buffer which overlaps append window start." 381 DVLOG(1) << "Truncating buffer which overlaps append window start."
382 << " presentation_timestamp " << buffer->timestamp().InSecondsF() 382 << " presentation_timestamp " << buffer->timestamp().InSecondsF()
383 << " frame_end_timestamp " << frame_end_timestamp.InSecondsF() 383 << " frame_end_timestamp " << frame_end_timestamp.InSecondsF()
384 << " append_window_start " << append_window_start.InSecondsF(); 384 << " append_window_start " << append_window_start.InSecondsF();
385 385
386 // Mark the overlapping portion of the buffer for discard. 386 // Mark the overlapping portion of the buffer for discard.
387 buffer->set_discard_padding(std::make_pair( 387 buffer->set_discard_padding(std::make_pair(
388 append_window_start - buffer->timestamp(), base::TimeDelta())); 388 append_window_start - buffer->timestamp(), base::TimeDelta()));
389 389
390 // Adjust the timestamp of this buffer forward to |append_window_start| and 390 // Adjust the timestamp of this buffer forward to |append_window_start| and
391 // decrease the duration to compensate. 391 // decrease the duration to compensate. Adjust DTS by the same delta as PTS
392 // to help prevent spurious discontinuities when DTS > PTS.
393 base::TimeDelta pts_delta = append_window_start - buffer->timestamp();
392 buffer->set_timestamp(append_window_start); 394 buffer->set_timestamp(append_window_start);
393 buffer->SetDecodeTimestamp( 395 buffer->SetDecodeTimestamp(buffer->GetDecodeTimestamp() + pts_delta);
394 DecodeTimestamp::FromPresentationTime(append_window_start));
395 buffer->set_duration(frame_end_timestamp - append_window_start); 396 buffer->set_duration(frame_end_timestamp - append_window_start);
396 processed_buffer = true; 397 processed_buffer = true;
397 } 398 }
398 399
399 // See if a partial discard can be done around |append_window_end|. 400 // See if a partial discard can be done around |append_window_end|.
400 if (frame_end_timestamp > append_window_end) { 401 if (frame_end_timestamp > append_window_end) {
401 DVLOG(1) << "Truncating buffer which overlaps append window end." 402 DVLOG(1) << "Truncating buffer which overlaps append window end."
402 << " presentation_timestamp " << buffer->timestamp().InSecondsF() 403 << " presentation_timestamp " << buffer->timestamp().InSecondsF()
403 << " frame_end_timestamp " << frame_end_timestamp.InSecondsF() 404 << " frame_end_timestamp " << frame_end_timestamp.InSecondsF()
404 << " append_window_end " << append_window_end.InSecondsF(); 405 << " append_window_end " << append_window_end.InSecondsF();
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 DCHECK(group_end_timestamp_ >= base::TimeDelta()); 696 DCHECK(group_end_timestamp_ >= base::TimeDelta());
696 697
697 return true; 698 return true;
698 } 699 }
699 700
700 NOTREACHED(); 701 NOTREACHED();
701 return false; 702 return false;
702 } 703 }
703 704
704 } // namespace media 705 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/filters/frame_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698