OLD | NEW |
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/source_buffer_stream.h" | 5 #include "media/filters/source_buffer_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // An arbitrarily-chosen number to estimate the duration of a buffer if none | 301 // An arbitrarily-chosen number to estimate the duration of a buffer if none |
302 // is set and there's not enough information to get a better estimate. | 302 // is set and there's not enough information to get a better estimate. |
303 static int kDefaultBufferDurationInMs = 125; | 303 static int kDefaultBufferDurationInMs = 125; |
304 | 304 |
305 // The amount of time the beginning of the buffered data can differ from the | 305 // The amount of time the beginning of the buffered data can differ from the |
306 // start time in order to still be considered the start of stream. | 306 // start time in order to still be considered the start of stream. |
307 static base::TimeDelta kSeekToStartFudgeRoom() { | 307 static base::TimeDelta kSeekToStartFudgeRoom() { |
308 return base::TimeDelta::FromMilliseconds(1000); | 308 return base::TimeDelta::FromMilliseconds(1000); |
309 } | 309 } |
310 // The maximum amount of data in bytes the stream will keep in memory. | 310 // The maximum amount of data in bytes the stream will keep in memory. |
311 #if defined(GOOGLE_TV) | |
312 // In Google TV, set the size of the buffer to 1 min because of | |
313 // the limited memory of the embedded system. | |
314 // 2MB: approximately 1 minutes of 256Kbps content. | |
315 // 30MB: approximately 1 minutes of 4Mbps content. | |
316 static int kDefaultAudioMemoryLimit = 2 * 1024 * 1024; | |
317 static int kDefaultVideoMemoryLimit = 30 * 1024 * 1024; | |
318 #else | |
319 // 12MB: approximately 5 minutes of 320Kbps content. | 311 // 12MB: approximately 5 minutes of 320Kbps content. |
320 // 150MB: approximately 5 minutes of 4Mbps content. | 312 // 150MB: approximately 5 minutes of 4Mbps content. |
321 static int kDefaultAudioMemoryLimit = 12 * 1024 * 1024; | 313 static int kDefaultAudioMemoryLimit = 12 * 1024 * 1024; |
322 static int kDefaultVideoMemoryLimit = 150 * 1024 * 1024; | 314 static int kDefaultVideoMemoryLimit = 150 * 1024 * 1024; |
323 #endif | |
324 | 315 |
325 namespace media { | 316 namespace media { |
326 | 317 |
327 SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config, | 318 SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config, |
328 const LogCB& log_cb) | 319 const LogCB& log_cb) |
329 : log_cb_(log_cb), | 320 : log_cb_(log_cb), |
330 current_config_index_(0), | 321 current_config_index_(0), |
331 append_config_index_(0), | 322 append_config_index_(0), |
332 seek_pending_(false), | 323 seek_pending_(false), |
333 end_of_stream_(false), | 324 end_of_stream_(false), |
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 return ComputeFudgeRoom(GetApproximateDuration()); | 1975 return ComputeFudgeRoom(GetApproximateDuration()); |
1985 } | 1976 } |
1986 | 1977 |
1987 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { | 1978 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { |
1988 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); | 1979 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); |
1989 DCHECK(max_interbuffer_distance != kNoTimestamp()); | 1980 DCHECK(max_interbuffer_distance != kNoTimestamp()); |
1990 return max_interbuffer_distance; | 1981 return max_interbuffer_distance; |
1991 } | 1982 } |
1992 | 1983 |
1993 } // namespace media | 1984 } // namespace media |
OLD | NEW |