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

Side by Side Diff: media/blink/buffered_data_source_host_impl.cc

Issue 2158923004: Convert media constants to constexpr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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/blink/buffered_data_source_host_impl.h" 5 #include "media/blink/buffered_data_source_host_impl.h"
6 6
7 #include "media/base/timestamp_constants.h" 7 #include "media/base/timestamp_constants.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 27 matching lines...) Expand all
38 return base::TimeDelta(); 38 return base::TimeDelta();
39 if (position > 0.99) 39 if (position > 0.99)
40 return duration; 40 return duration;
41 return base::TimeDelta::FromMilliseconds( 41 return base::TimeDelta::FromMilliseconds(
42 static_cast<int64_t>(position * duration.InMilliseconds())); 42 static_cast<int64_t>(position * duration.InMilliseconds()));
43 } 43 }
44 44
45 void BufferedDataSourceHostImpl::AddBufferedTimeRanges( 45 void BufferedDataSourceHostImpl::AddBufferedTimeRanges(
46 Ranges<base::TimeDelta>* buffered_time_ranges, 46 Ranges<base::TimeDelta>* buffered_time_ranges,
47 base::TimeDelta media_duration) const { 47 base::TimeDelta media_duration) const {
48 DCHECK(media_duration != kNoTimestamp()); 48 DCHECK(media_duration != kNoTimestamp);
49 DCHECK(media_duration != kInfiniteDuration()); 49 DCHECK(media_duration != kInfiniteDuration);
50 if (total_bytes_ && !buffered_byte_ranges_.empty()) { 50 if (total_bytes_ && !buffered_byte_ranges_.empty()) {
51 for (const auto i : buffered_byte_ranges_) { 51 for (const auto i : buffered_byte_ranges_) {
52 if (i.second) { 52 if (i.second) {
53 int64_t start = i.first.begin; 53 int64_t start = i.first.begin;
54 int64_t end = i.first.end; 54 int64_t end = i.first.end;
55 buffered_time_ranges->Add( 55 buffered_time_ranges->Add(
56 TimeForByteOffset(start, total_bytes_, media_duration), 56 TimeForByteOffset(start, total_bytes_, media_duration),
57 TimeForByteOffset(end, total_bytes_, media_duration)); 57 TimeForByteOffset(end, total_bytes_, media_duration));
58 } 58 }
59 } 59 }
60 } 60 }
61 } 61 }
62 62
63 bool BufferedDataSourceHostImpl::DidLoadingProgress() { 63 bool BufferedDataSourceHostImpl::DidLoadingProgress() {
64 bool ret = did_loading_progress_; 64 bool ret = did_loading_progress_;
65 did_loading_progress_ = false; 65 did_loading_progress_ = false;
66 return ret; 66 return ret;
67 } 67 }
68 68
69 } // namespace media 69 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698