| 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/base/buffering_frame_provider.h" | 5 #include "chromecast/media/cma/base/buffering_frame_provider.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 9 #include "chromecast/media/cma/base/buffering_state.h" | 11 #include "chromecast/media/cma/base/buffering_state.h" |
| 10 #include "chromecast/media/cma/base/decoder_buffer_base.h" | 12 #include "chromecast/media/cma/base/decoder_buffer_base.h" |
| 11 #include "media/base/bind_to_current_loop.h" | 13 #include "media/base/bind_to_current_loop.h" |
| 12 | 14 |
| 13 namespace chromecast { | 15 namespace chromecast { |
| 14 namespace media { | 16 namespace media { |
| 15 | 17 |
| 16 BufferingFrameProvider::BufferWithConfig::BufferWithConfig( | 18 BufferingFrameProvider::BufferWithConfig::BufferWithConfig( |
| 17 const scoped_refptr<DecoderBufferBase>& buffer, | 19 const scoped_refptr<DecoderBufferBase>& buffer, |
| 18 const ::media::AudioDecoderConfig& audio_config, | 20 const ::media::AudioDecoderConfig& audio_config, |
| 19 const ::media::VideoDecoderConfig& video_config) | 21 const ::media::VideoDecoderConfig& video_config) |
| 20 : buffer_(buffer), | 22 : buffer_(buffer), |
| 21 audio_config_(audio_config), | 23 audio_config_(audio_config), |
| 22 video_config_(video_config) { | 24 video_config_(video_config) { |
| 23 } | 25 } |
| 24 | 26 |
| 25 BufferingFrameProvider::BufferWithConfig::~BufferWithConfig() { | 27 BufferingFrameProvider::BufferWithConfig::~BufferWithConfig() { |
| 26 } | 28 } |
| 27 | 29 |
| 28 BufferingFrameProvider::BufferingFrameProvider( | 30 BufferingFrameProvider::BufferingFrameProvider( |
| 29 scoped_ptr<CodedFrameProvider> coded_frame_provider, | 31 scoped_ptr<CodedFrameProvider> coded_frame_provider, |
| 30 size_t max_buffer_size, | 32 size_t max_buffer_size, |
| 31 size_t max_frame_size, | 33 size_t max_frame_size, |
| 32 const FrameBufferedCB& frame_buffered_cb) | 34 const FrameBufferedCB& frame_buffered_cb) |
| 33 : coded_frame_provider_(coded_frame_provider.Pass()), | 35 : coded_frame_provider_(std::move(coded_frame_provider)), |
| 34 is_pending_request_(false), | 36 is_pending_request_(false), |
| 35 is_eos_(false), | 37 is_eos_(false), |
| 36 total_buffer_size_(0), | 38 total_buffer_size_(0), |
| 37 max_buffer_size_(max_buffer_size), | 39 max_buffer_size_(max_buffer_size), |
| 38 max_frame_size_(max_frame_size), | 40 max_frame_size_(max_frame_size), |
| 39 frame_buffered_cb_(frame_buffered_cb), | 41 frame_buffered_cb_(frame_buffered_cb), |
| 40 weak_factory_(this) { | 42 weak_factory_(this) { |
| 41 DCHECK_LE(max_frame_size, max_buffer_size); | 43 DCHECK_LE(max_frame_size, max_buffer_size); |
| 42 weak_this_ = weak_factory_.GetWeakPtr(); | 44 weak_this_ = weak_factory_.GetWeakPtr(); |
| 43 thread_checker_.DetachFromThread(); | 45 thread_checker_.DetachFromThread(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 total_buffer_size_ -= buffer_with_config.buffer()->data_size(); | 132 total_buffer_size_ -= buffer_with_config.buffer()->data_size(); |
| 131 | 133 |
| 132 base::ResetAndReturn(&read_cb_).Run( | 134 base::ResetAndReturn(&read_cb_).Run( |
| 133 buffer_with_config.buffer(), | 135 buffer_with_config.buffer(), |
| 134 buffer_with_config.audio_config(), | 136 buffer_with_config.audio_config(), |
| 135 buffer_with_config.video_config()); | 137 buffer_with_config.video_config()); |
| 136 } | 138 } |
| 137 | 139 |
| 138 } // namespace media | 140 } // namespace media |
| 139 } // namespace chromecast | 141 } // namespace chromecast |
| OLD | NEW |