| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/renderer/media/cast_session.h" | 5 #include "chrome/renderer/media/cast_session.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 if (!shm->Map(size)) { | 39 if (!shm->Map(size)) { |
| 40 NOTREACHED() << "Map failed"; | 40 NOTREACHED() << "Map failed"; |
| 41 } | 41 } |
| 42 callback.Run(std::move(shm)); | 42 callback.Run(std::move(shm)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 CastSession::CastSession() | 47 CastSession::CastSession() |
| 48 : delegate_(new CastSessionDelegate()), | 48 : delegate_(new CastSessionDelegate()), |
| 49 io_task_runner_( | 49 io_task_runner_(content::RenderThread::Get()->GetIOTaskRunner()) {} |
| 50 content::RenderThread::Get()->GetIOMessageLoopProxy()) {} | |
| 51 | 50 |
| 52 CastSession::~CastSession() { | 51 CastSession::~CastSession() { |
| 53 // We should always be able to delete the object on the IO thread. | 52 // We should always be able to delete the object on the IO thread. |
| 54 CHECK(io_task_runner_->DeleteSoon(FROM_HERE, delegate_.release())); | 53 CHECK(io_task_runner_->DeleteSoon(FROM_HERE, delegate_.release())); |
| 55 } | 54 } |
| 56 | 55 |
| 57 void CastSession::StartAudio(const media::cast::AudioSenderConfig& config, | 56 void CastSession::StartAudio(const media::cast::AudioSenderConfig& config, |
| 58 const AudioFrameInputAvailableCallback& callback, | 57 const AudioFrameInputAvailableCallback& callback, |
| 59 const ErrorCallback& error_callback) { | 58 const ErrorCallback& error_callback) { |
| 60 DCHECK(content::RenderThread::Get()); | 59 DCHECK(content::RenderThread::Get()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 122 |
| 124 void CastSession::GetStatsAndReset(bool is_audio, | 123 void CastSession::GetStatsAndReset(bool is_audio, |
| 125 const StatsCallback& callback) { | 124 const StatsCallback& callback) { |
| 126 io_task_runner_->PostTask( | 125 io_task_runner_->PostTask( |
| 127 FROM_HERE, | 126 FROM_HERE, |
| 128 base::Bind(&CastSessionDelegate::GetStatsAndReset, | 127 base::Bind(&CastSessionDelegate::GetStatsAndReset, |
| 129 base::Unretained(delegate_.get()), | 128 base::Unretained(delegate_.get()), |
| 130 is_audio, | 129 is_audio, |
| 131 media::BindToCurrentLoop(callback))); | 130 media::BindToCurrentLoop(callback))); |
| 132 } | 131 } |
| OLD | NEW |