| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 int32_t FakeDecoder::RegisterDecodeCompleteCallback( | 47 int32_t FakeDecoder::RegisterDecodeCompleteCallback( |
| 48 DecodedImageCallback* callback) { | 48 DecodedImageCallback* callback) { |
| 49 callback_ = callback; | 49 callback_ = callback; |
| 50 return WEBRTC_VIDEO_CODEC_OK; | 50 return WEBRTC_VIDEO_CODEC_OK; |
| 51 } | 51 } |
| 52 | 52 |
| 53 int32_t FakeDecoder::Release() { | 53 int32_t FakeDecoder::Release() { |
| 54 return WEBRTC_VIDEO_CODEC_OK; | 54 return WEBRTC_VIDEO_CODEC_OK; |
| 55 } | 55 } |
| 56 |
| 56 int32_t FakeDecoder::Reset() { | 57 int32_t FakeDecoder::Reset() { |
| 57 return WEBRTC_VIDEO_CODEC_OK; | 58 return WEBRTC_VIDEO_CODEC_OK; |
| 58 } | 59 } |
| 59 | 60 |
| 61 const char* FakeDecoder::kImplementationName = "fake_decoder"; |
| 62 const char* FakeDecoder::ImplementationName() const { |
| 63 return kImplementationName; |
| 64 } |
| 65 |
| 60 int32_t FakeH264Decoder::Decode(const EncodedImage& input, | 66 int32_t FakeH264Decoder::Decode(const EncodedImage& input, |
| 61 bool missing_frames, | 67 bool missing_frames, |
| 62 const RTPFragmentationHeader* fragmentation, | 68 const RTPFragmentationHeader* fragmentation, |
| 63 const CodecSpecificInfo* codec_specific_info, | 69 const CodecSpecificInfo* codec_specific_info, |
| 64 int64_t render_time_ms) { | 70 int64_t render_time_ms) { |
| 65 uint8_t value = 0; | 71 uint8_t value = 0; |
| 66 for (size_t i = 0; i < input._length; ++i) { | 72 for (size_t i = 0; i < input._length; ++i) { |
| 67 uint8_t kStartCode[] = {0, 0, 0, 1}; | 73 uint8_t kStartCode[] = {0, 0, 0, 1}; |
| 68 if (i < input._length - sizeof(kStartCode) && | 74 if (i < input._length - sizeof(kStartCode) && |
| 69 !memcmp(&input._buffer[i], kStartCode, sizeof(kStartCode))) { | 75 !memcmp(&input._buffer[i], kStartCode, sizeof(kStartCode))) { |
| 70 i += sizeof(kStartCode) + 1; // Skip start code and NAL header. | 76 i += sizeof(kStartCode) + 1; // Skip start code and NAL header. |
| 71 } | 77 } |
| 72 if (input._buffer[i] != value) { | 78 if (input._buffer[i] != value) { |
| 73 EXPECT_EQ(value, input._buffer[i]) | 79 EXPECT_EQ(value, input._buffer[i]) |
| 74 << "Bitstream mismatch between sender and receiver."; | 80 << "Bitstream mismatch between sender and receiver."; |
| 75 return -1; | 81 return -1; |
| 76 } | 82 } |
| 77 ++value; | 83 ++value; |
| 78 } | 84 } |
| 79 return FakeDecoder::Decode(input, | 85 return FakeDecoder::Decode(input, |
| 80 missing_frames, | 86 missing_frames, |
| 81 fragmentation, | 87 fragmentation, |
| 82 codec_specific_info, | 88 codec_specific_info, |
| 83 render_time_ms); | 89 render_time_ms); |
| 84 } | 90 } |
| 85 | 91 |
| 86 } // namespace test | 92 } // namespace test |
| 87 } // namespace webrtc | 93 } // namespace webrtc |
| OLD | NEW |