OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/remoting/fake_media_resource.h" | 5 #include "media/remoting/fake_media_resource.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "media/base/decoder_buffer.h" | 10 #include "media/base/decoder_buffer.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 bool FakeDemuxerStream::SupportsConfigChanges() { | 67 bool FakeDemuxerStream::SupportsConfigChanges() { |
68 return false; | 68 return false; |
69 } | 69 } |
70 | 70 |
71 VideoRotation FakeDemuxerStream::video_rotation() { | 71 VideoRotation FakeDemuxerStream::video_rotation() { |
72 return VIDEO_ROTATION_0; | 72 return VIDEO_ROTATION_0; |
73 } | 73 } |
74 | 74 |
75 bool FakeDemuxerStream::enabled() const { | 75 bool FakeDemuxerStream::enabled() const { |
76 return false; | 76 return true; |
77 } | 77 } |
78 | 78 |
79 void FakeDemuxerStream::CreateFakeFrame(size_t size, | 79 void FakeDemuxerStream::CreateFakeFrame(size_t size, |
80 bool key_frame, | 80 bool key_frame, |
81 int pts_ms) { | 81 int pts_ms) { |
82 std::vector<uint8_t> buffer(size); | 82 std::vector<uint8_t> buffer(size); |
83 // Assign each byte in the buffer its index mod 256. | 83 // Assign each byte in the buffer its index mod 256. |
84 for (size_t i = 0; i < size; ++i) { | 84 for (size_t i = 0; i < size; ++i) { |
85 buffer[i] = static_cast<uint8_t>(i & 0xFF); | 85 buffer[i] = static_cast<uint8_t>(i & 0xFF); |
86 } | 86 } |
(...skipping 12 matching lines...) Expand all Loading... |
99 } else { | 99 } else { |
100 base::ResetAndReturn(&pending_read_cb_).Run(kOk, input_buffer); | 100 base::ResetAndReturn(&pending_read_cb_).Run(kOk, input_buffer); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 FakeMediaResource::FakeMediaResource() | 104 FakeMediaResource::FakeMediaResource() |
105 : demuxer_stream_(new FakeDemuxerStream(true)) {} | 105 : demuxer_stream_(new FakeDemuxerStream(true)) {} |
106 | 106 |
107 FakeMediaResource::~FakeMediaResource() {} | 107 FakeMediaResource::~FakeMediaResource() {} |
108 | 108 |
109 DemuxerStream* FakeMediaResource::GetStream(DemuxerStream::Type type) { | 109 std::vector<DemuxerStream*> FakeMediaResource::GetStreams() { |
110 if (type == DemuxerStream::AUDIO) | 110 std::vector<DemuxerStream*> streams; |
111 return reinterpret_cast<DemuxerStream*>(demuxer_stream_.get()); | 111 streams.push_back(demuxer_stream_.get()); |
112 return nullptr; | 112 return streams; |
| 113 } |
| 114 |
| 115 void FakeMediaResource::SetStreamStatusChangeCB( |
| 116 const StreamStatusChangeCB& cb) { |
| 117 NOTIMPLEMENTED(); |
113 } | 118 } |
114 | 119 |
115 } // namespace remoting | 120 } // namespace remoting |
116 } // namespace media | 121 } // namespace media |
OLD | NEW |