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 #include <utility> |
8 | 9 |
9 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
10 #include "chrome/renderer/media/cast_session_delegate.h" | 11 #include "chrome/renderer/media/cast_session_delegate.h" |
11 #include "content/public/renderer/render_thread.h" | 12 #include "content/public/renderer/render_thread.h" |
12 #include "content/public/renderer/video_encode_accelerator.h" | 13 #include "content/public/renderer/video_encode_accelerator.h" |
13 #include "media/base/bind_to_current_loop.h" | 14 #include "media/base/bind_to_current_loop.h" |
14 #include "media/base/video_frame.h" | 15 #include "media/base/video_frame.h" |
15 #include "media/cast/cast_sender.h" | 16 #include "media/cast/cast_sender.h" |
16 #include "media/cast/logging/logging_defines.h" | 17 #include "media/cast/logging/logging_defines.h" |
17 | 18 |
(...skipping 11 matching lines...) Expand all Loading... |
29 size_t size, | 30 size_t size, |
30 const media::cast::ReceiveVideoEncodeMemoryCallback& callback) { | 31 const media::cast::ReceiveVideoEncodeMemoryCallback& callback) { |
31 DCHECK(content::RenderThread::Get()); | 32 DCHECK(content::RenderThread::Get()); |
32 | 33 |
33 scoped_ptr<base::SharedMemory> shm = | 34 scoped_ptr<base::SharedMemory> shm = |
34 content::RenderThread::Get()->HostAllocateSharedMemoryBuffer(size); | 35 content::RenderThread::Get()->HostAllocateSharedMemoryBuffer(size); |
35 DCHECK(shm) << "Failed to allocate shared memory"; | 36 DCHECK(shm) << "Failed to allocate shared memory"; |
36 if (!shm->Map(size)) { | 37 if (!shm->Map(size)) { |
37 NOTREACHED() << "Map failed"; | 38 NOTREACHED() << "Map failed"; |
38 } | 39 } |
39 callback.Run(shm.Pass()); | 40 callback.Run(std::move(shm)); |
40 } | 41 } |
41 | 42 |
42 } // namespace | 43 } // namespace |
43 | 44 |
44 CastSession::CastSession() | 45 CastSession::CastSession() |
45 : delegate_(new CastSessionDelegate()), | 46 : delegate_(new CastSessionDelegate()), |
46 io_task_runner_( | 47 io_task_runner_( |
47 content::RenderThread::Get()->GetIOMessageLoopProxy()) {} | 48 content::RenderThread::Get()->GetIOMessageLoopProxy()) {} |
48 | 49 |
49 CastSession::~CastSession() { | 50 CastSession::~CastSession() { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 121 |
121 void CastSession::GetStatsAndReset(bool is_audio, | 122 void CastSession::GetStatsAndReset(bool is_audio, |
122 const StatsCallback& callback) { | 123 const StatsCallback& callback) { |
123 io_task_runner_->PostTask( | 124 io_task_runner_->PostTask( |
124 FROM_HERE, | 125 FROM_HERE, |
125 base::Bind(&CastSessionDelegate::GetStatsAndReset, | 126 base::Bind(&CastSessionDelegate::GetStatsAndReset, |
126 base::Unretained(delegate_.get()), | 127 base::Unretained(delegate_.get()), |
127 is_audio, | 128 is_audio, |
128 media::BindToCurrentLoop(callback))); | 129 media::BindToCurrentLoop(callback))); |
129 } | 130 } |
OLD | NEW |