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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // An arbitrarily-chosen number to estimate the duration of a buffer if none | 306 // An arbitrarily-chosen number to estimate the duration of a buffer if none |
307 // is set and there's not enough information to get a better estimate. | 307 // is set and there's not enough information to get a better estimate. |
308 static int kDefaultBufferDurationInMs = 125; | 308 static int kDefaultBufferDurationInMs = 125; |
309 | 309 |
310 // The amount of time the beginning of the buffered data can differ from the | 310 // The amount of time the beginning of the buffered data can differ from the |
311 // start time in order to still be considered the start of stream. | 311 // start time in order to still be considered the start of stream. |
312 static base::TimeDelta kSeekToStartFudgeRoom() { | 312 static base::TimeDelta kSeekToStartFudgeRoom() { |
313 return base::TimeDelta::FromMilliseconds(1000); | 313 return base::TimeDelta::FromMilliseconds(1000); |
314 } | 314 } |
315 // The maximum amount of data in bytes the stream will keep in memory. | 315 // The maximum amount of data in bytes the stream will keep in memory. |
316 #if defined(GOOGLE_TV) | |
317 // In Google TV, set the size of the buffer to 1 min because of | |
318 // the limited memory of the embedded system. | |
319 // 2MB: approximately 1 minutes of 256Kbps content. | |
320 // 30MB: approximately 1 minutes of 4Mbps content. | |
321 static int kDefaultAudioMemoryLimit = 2 * 1024 * 1024; | |
322 static int kDefaultVideoMemoryLimit = 30 * 1024 * 1024; | |
323 #else | |
324 // 12MB: approximately 5 minutes of 320Kbps content. | 316 // 12MB: approximately 5 minutes of 320Kbps content. |
325 // 150MB: approximately 5 minutes of 4Mbps content. | 317 // 150MB: approximately 5 minutes of 4Mbps content. |
326 static int kDefaultAudioMemoryLimit = 12 * 1024 * 1024; | 318 static int kDefaultAudioMemoryLimit = 12 * 1024 * 1024; |
327 static int kDefaultVideoMemoryLimit = 150 * 1024 * 1024; | 319 static int kDefaultVideoMemoryLimit = 150 * 1024 * 1024; |
328 #endif | |
329 | 320 |
330 namespace media { | 321 namespace media { |
331 | 322 |
332 SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config, | 323 SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config, |
333 const LogCB& log_cb) | 324 const LogCB& log_cb) |
334 : log_cb_(log_cb), | 325 : log_cb_(log_cb), |
335 current_config_index_(0), | 326 current_config_index_(0), |
336 append_config_index_(0), | 327 append_config_index_(0), |
337 seek_pending_(false), | 328 seek_pending_(false), |
338 end_of_stream_(false), | 329 end_of_stream_(false), |
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2007 return ComputeFudgeRoom(GetApproximateDuration()); | 1998 return ComputeFudgeRoom(GetApproximateDuration()); |
2008 } | 1999 } |
2009 | 2000 |
2010 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { | 2001 base::TimeDelta SourceBufferRange::GetApproximateDuration() const { |
2011 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); | 2002 base::TimeDelta max_interbuffer_distance = interbuffer_distance_cb_.Run(); |
2012 DCHECK(max_interbuffer_distance != kNoTimestamp()); | 2003 DCHECK(max_interbuffer_distance != kNoTimestamp()); |
2013 return max_interbuffer_distance; | 2004 return max_interbuffer_distance; |
2014 } | 2005 } |
2015 | 2006 |
2016 } // namespace media | 2007 } // namespace media |
OLD | NEW |