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 "media/cast/receiver/video_decoder.h" | 5 #include "media/cast/receiver/video_decoder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (ImplBase::cast_initialization_status_ != STATUS_VIDEO_UNINITIALIZED) | 178 if (ImplBase::cast_initialization_status_ != STATUS_VIDEO_UNINITIALIZED) |
179 return; | 179 return; |
180 ImplBase::cast_initialization_status_ = STATUS_VIDEO_INITIALIZED; | 180 ImplBase::cast_initialization_status_ = STATUS_VIDEO_INITIALIZED; |
181 } | 181 } |
182 | 182 |
183 private: | 183 private: |
184 virtual ~FakeImpl() {} | 184 virtual ~FakeImpl() {} |
185 | 185 |
186 virtual scoped_refptr<VideoFrame> Decode(uint8* data, int len) OVERRIDE { | 186 virtual scoped_refptr<VideoFrame> Decode(uint8* data, int len) OVERRIDE { |
187 base::JSONReader reader; | 187 base::JSONReader reader; |
188 scoped_ptr<base::Value> values(reader.Read( | 188 scoped_ptr<base::Value> values( |
189 base::StringPiece(reinterpret_cast<char*>(data), len))); | 189 reader.Read(base::StringPiece(reinterpret_cast<char*>(data)))); |
190 base::DictionaryValue* dict = NULL; | 190 base::DictionaryValue* dict = NULL; |
191 values->GetAsDictionary(&dict); | 191 values->GetAsDictionary(&dict); |
192 | 192 |
193 bool key = false; | 193 bool key = false; |
194 int id = 0; | 194 int id = 0; |
195 int ref = 0; | 195 int ref = 0; |
196 dict->GetBoolean("key", &key); | 196 dict->GetBoolean("key", &key); |
197 dict->GetInteger("id", &id); | 197 dict->GetInteger("id", &id); |
198 dict->GetInteger("ref", &ref); | 198 dict->GetInteger("ref", &ref); |
199 DCHECK(id == last_decoded_id_ + 1); | 199 DCHECK(id == last_decoded_id_ + 1); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 cast_environment_->PostTask(CastEnvironment::VIDEO, | 250 cast_environment_->PostTask(CastEnvironment::VIDEO, |
251 FROM_HERE, | 251 FROM_HERE, |
252 base::Bind(&VideoDecoder::ImplBase::DecodeFrame, | 252 base::Bind(&VideoDecoder::ImplBase::DecodeFrame, |
253 impl_, | 253 impl_, |
254 base::Passed(&encoded_frame), | 254 base::Passed(&encoded_frame), |
255 callback)); | 255 callback)); |
256 } | 256 } |
257 | 257 |
258 } // namespace cast | 258 } // namespace cast |
259 } // namespace media | 259 } // namespace media |
OLD | NEW |