| 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/av_pipeline_impl.h" | 5 #include "chromecast/media/cma/pipeline/av_pipeline_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 AvPipelineImpl::~AvPipelineImpl() { | 59 AvPipelineImpl::~AvPipelineImpl() { |
| 60 DCHECK(thread_checker_.CalledOnValidThread()); | 60 DCHECK(thread_checker_.CalledOnValidThread()); |
| 61 | 61 |
| 62 if (media_keys_ && media_keys_callback_id_ != kNoCallbackId) | 62 if (media_keys_ && media_keys_callback_id_ != kNoCallbackId) |
| 63 media_keys_->UnregisterPlayer(media_keys_callback_id_); | 63 media_keys_->UnregisterPlayer(media_keys_callback_id_); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void AvPipelineImpl::SetCodedFrameProvider( | 66 void AvPipelineImpl::SetCodedFrameProvider( |
| 67 scoped_ptr<CodedFrameProvider> frame_provider, | 67 std::unique_ptr<CodedFrameProvider> frame_provider, |
| 68 size_t max_buffer_size, | 68 size_t max_buffer_size, |
| 69 size_t max_frame_size) { | 69 size_t max_frame_size) { |
| 70 DCHECK_EQ(state_, kUninitialized); | 70 DCHECK_EQ(state_, kUninitialized); |
| 71 DCHECK(frame_provider); | 71 DCHECK(frame_provider); |
| 72 | 72 |
| 73 // Wrap the incoming frame provider to add some buffering capabilities. | 73 // Wrap the incoming frame provider to add some buffering capabilities. |
| 74 frame_provider_.reset(new BufferingFrameProvider( | 74 frame_provider_.reset(new BufferingFrameProvider( |
| 75 std::move(frame_provider), max_buffer_size, max_frame_size, | 75 std::move(frame_provider), max_buffer_size, max_frame_size, |
| 76 base::Bind(&AvPipelineImpl::OnDataBuffered, weak_this_))); | 76 base::Bind(&AvPipelineImpl::OnDataBuffered, weak_this_))); |
| 77 } | 77 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return; | 199 return; |
| 200 | 200 |
| 201 DCHECK(!pushed_buffer_); | 201 DCHECK(!pushed_buffer_); |
| 202 | 202 |
| 203 // Break the feeding loop when the end of stream is reached. | 203 // Break the feeding loop when the end of stream is reached. |
| 204 if (pending_buffer_->end_of_stream()) { | 204 if (pending_buffer_->end_of_stream()) { |
| 205 CMALOG(kLogControl) << __FUNCTION__ << ": EOS reached, stopped feeding"; | 205 CMALOG(kLogControl) << __FUNCTION__ << ": EOS reached, stopped feeding"; |
| 206 enable_feeding_ = false; | 206 enable_feeding_ = false; |
| 207 } | 207 } |
| 208 | 208 |
| 209 scoped_ptr<DecryptContextImpl> decrypt_context; | 209 std::unique_ptr<DecryptContextImpl> decrypt_context; |
| 210 if (!pending_buffer_->end_of_stream() && | 210 if (!pending_buffer_->end_of_stream() && |
| 211 pending_buffer_->decrypt_config()) { | 211 pending_buffer_->decrypt_config()) { |
| 212 // Verify that CDM has the key ID. | 212 // Verify that CDM has the key ID. |
| 213 // Should not send the frame if the key ID is not available yet. | 213 // Should not send the frame if the key ID is not available yet. |
| 214 std::string key_id(pending_buffer_->decrypt_config()->key_id()); | 214 std::string key_id(pending_buffer_->decrypt_config()->key_id()); |
| 215 if (!media_keys_) { | 215 if (!media_keys_) { |
| 216 CMALOG(kLogControl) << "No CDM for frame: pts=" | 216 CMALOG(kLogControl) << "No CDM for frame: pts=" |
| 217 << pending_buffer_->timestamp(); | 217 << pending_buffer_->timestamp(); |
| 218 return; | 218 return; |
| 219 } | 219 } |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 // The frame is playable: remove it from the list of non playable frames. | 369 // The frame is playable: remove it from the list of non playable frames. |
| 370 non_playable_frames_.pop_front(); | 370 non_playable_frames_.pop_front(); |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace media | 374 } // namespace media |
| 375 } // namespace chromecast | 375 } // namespace chromecast |
| OLD | NEW |