OLD | NEW |
---|---|
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 "chromecast/media/cma/pipeline/media_pipeline_impl.h" | 5 #include "chromecast/media/cma/pipeline/media_pipeline_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 #include "chromecast/media/cma/pipeline/video_pipeline_impl.h" | 25 #include "chromecast/media/cma/pipeline/video_pipeline_impl.h" |
26 #include "chromecast/public/media/media_pipeline_backend.h" | 26 #include "chromecast/public/media/media_pipeline_backend.h" |
27 #include "media/base/timestamp_constants.h" | 27 #include "media/base/timestamp_constants.h" |
28 | 28 |
29 namespace chromecast { | 29 namespace chromecast { |
30 namespace media { | 30 namespace media { |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 // Buffering parameters when load_type is kLoadTypeUrl. | 34 // Buffering parameters when load_type is kLoadTypeUrl. |
35 const base::TimeDelta kLowBufferThresholdURL( | 35 constexpr base::TimeDelta kLowBufferThresholdURL( |
36 base::TimeDelta::FromMilliseconds(2000)); | 36 base::TimeDelta::FromMilliseconds(2000)); |
37 const base::TimeDelta kHighBufferThresholdURL( | 37 constexpr base::TimeDelta kHighBufferThresholdURL( |
38 base::TimeDelta::FromMilliseconds(6000)); | 38 base::TimeDelta::FromMilliseconds(6000)); |
39 | 39 |
40 // Buffering parameters when load_type is kLoadTypeMediaSource. | 40 // Buffering parameters when load_type is kLoadTypeMediaSource. |
41 const base::TimeDelta kLowBufferThresholdMediaSource( | 41 constexpr base::TimeDelta kLowBufferThresholdMediaSource( |
42 base::TimeDelta::FromMilliseconds(0)); | 42 base::TimeDelta::FromMilliseconds(0)); |
43 const base::TimeDelta kHighBufferThresholdMediaSource( | 43 const base::TimeDelta kHighBufferThresholdMediaSource( |
kmackay
2017/02/24 18:03:55
constexpr here too
bshaya
2017/02/27 17:00:15
Done.
| |
44 base::TimeDelta::FromMilliseconds(300)); | 44 base::TimeDelta::FromMilliseconds(300)); |
45 | 45 |
46 // Buffering parameters when load_type is kLoadTypeCommunication. | |
47 constexpr base::TimeDelta kLowBufferThresholdCommunication( | |
48 base::TimeDelta::FromMilliseconds(0)); | |
49 constexpr base::TimeDelta kHighBufferThresholdCommunication( | |
50 base::TimeDelta::FromMilliseconds(20)); | |
51 | |
46 // Interval between two updates of the media time. | 52 // Interval between two updates of the media time. |
47 const base::TimeDelta kTimeUpdateInterval( | 53 constexpr base::TimeDelta kTimeUpdateInterval( |
48 base::TimeDelta::FromMilliseconds(250)); | 54 base::TimeDelta::FromMilliseconds(250)); |
49 | 55 |
50 // Interval between two updates of the statistics is equal to: | 56 // Interval between two updates of the statistics is equal to: |
51 // kTimeUpdateInterval * kStatisticsUpdatePeriod. | 57 // kTimeUpdateInterval * kStatisticsUpdatePeriod. |
52 const int kStatisticsUpdatePeriod = 4; | 58 const int kStatisticsUpdatePeriod = 4; |
53 | 59 |
54 // Stall duration threshold that triggers a playback stall event. | 60 // Stall duration threshold that triggers a playback stall event. |
55 constexpr int kPlaybackStallEventThresholdMs = 2500; | 61 constexpr int kPlaybackStallEventThresholdMs = 2500; |
56 | 62 |
57 void LogEstimatedBitrate(int decoded_bytes, | 63 void LogEstimatedBitrate(int decoded_bytes, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 DCHECK(thread_checker_.CalledOnValidThread()); | 122 DCHECK(thread_checker_.CalledOnValidThread()); |
117 audio_decoder_.reset(); | 123 audio_decoder_.reset(); |
118 media_pipeline_backend_ = std::move(media_pipeline_backend); | 124 media_pipeline_backend_ = std::move(media_pipeline_backend); |
119 | 125 |
120 if (load_type == kLoadTypeURL || load_type == kLoadTypeMediaSource) { | 126 if (load_type == kLoadTypeURL || load_type == kLoadTypeMediaSource) { |
121 base::TimeDelta low_threshold(kLowBufferThresholdURL); | 127 base::TimeDelta low_threshold(kLowBufferThresholdURL); |
122 base::TimeDelta high_threshold(kHighBufferThresholdURL); | 128 base::TimeDelta high_threshold(kHighBufferThresholdURL); |
123 if (load_type == kLoadTypeMediaSource) { | 129 if (load_type == kLoadTypeMediaSource) { |
124 low_threshold = kLowBufferThresholdMediaSource; | 130 low_threshold = kLowBufferThresholdMediaSource; |
125 high_threshold = kHighBufferThresholdMediaSource; | 131 high_threshold = kHighBufferThresholdMediaSource; |
132 } else if (load_type == kLoadTypeCommunication) { | |
133 low_threshold = kLowBufferThresholdCommunication; | |
134 high_threshold = kHighBufferThresholdCommunication; | |
126 } | 135 } |
127 scoped_refptr<BufferingConfig> buffering_config( | 136 scoped_refptr<BufferingConfig> buffering_config( |
128 new BufferingConfig(low_threshold, high_threshold)); | 137 new BufferingConfig(low_threshold, high_threshold)); |
129 buffering_controller_.reset(new BufferingController( | 138 buffering_controller_.reset(new BufferingController( |
130 buffering_config, | 139 buffering_config, |
131 base::Bind(&MediaPipelineImpl::OnBufferingNotification, weak_this_))); | 140 base::Bind(&MediaPipelineImpl::OnBufferingNotification, weak_this_))); |
132 } | 141 } |
133 } | 142 } |
134 | 143 |
135 void MediaPipelineImpl::SetClient(const MediaPipelineClient& client) { | 144 void MediaPipelineImpl::SetClient(const MediaPipelineClient& client) { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
524 | 533 |
525 void MediaPipelineImpl::ResetBitrateState() { | 534 void MediaPipelineImpl::ResetBitrateState() { |
526 elapsed_time_delta_ = base::TimeDelta::FromSeconds(0); | 535 elapsed_time_delta_ = base::TimeDelta::FromSeconds(0); |
527 audio_bytes_for_bitrate_estimation_ = 0; | 536 audio_bytes_for_bitrate_estimation_ = 0; |
528 video_bytes_for_bitrate_estimation_ = 0; | 537 video_bytes_for_bitrate_estimation_ = 0; |
529 last_sample_time_ = base::TimeTicks::Now(); | 538 last_sample_time_ = base::TimeTicks::Now(); |
530 } | 539 } |
531 | 540 |
532 } // namespace media | 541 } // namespace media |
533 } // namespace chromecast | 542 } // namespace chromecast |
OLD | NEW |