Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: media/remoting/fake_media_resource.cc

Issue 2667283002: Refactor MediaResource to be multi-stream capable (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/remoting/fake_media_resource.h ('k') | media/renderers/renderer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/remoting/fake_media_resource.h ('k') | media/renderers/renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698