Index: webrtc/modules/video_coding/utility/vp8_header_parser.cc |
diff --git a/webrtc/modules/video_coding/utility/vp8_header_parser.cc b/webrtc/modules/video_coding/utility/vp8_header_parser.cc |
index 631385d0f25095903e676f79dc24e04ea1e1c6cd..1338e6ff47064c46842409d96aaf1adc0de0dd64 100644 |
--- a/webrtc/modules/video_coding/utility/vp8_header_parser.cc |
+++ b/webrtc/modules/video_coding/utility/vp8_header_parser.cc |
@@ -66,6 +66,7 @@ static void VP8InitBitReader(VP8BitReader* const br, |
br->value_ = 0; |
br->bits_ = -8; // To load the very first 8bits. |
br->eof_ = 0; |
+ br->error_ = false; |
pbos-webrtc
2016/04/18 19:25:33
Is this already covered by the eof_ flag? If so we
jackychen_
2016/04/18 20:49:47
Not really, the error here might not be the same w
pbos-webrtc
2016/04/18 20:52:02
Have you diagnosed the actual error that happens?
|
VP8LoadNewBytes(br); |
} |
@@ -75,7 +76,10 @@ static int VP8GetBit(VP8BitReader* const br, int prob) { |
if (br->bits_ < 0) { |
VP8LoadNewBytes(br); |
} |
- |
+ if (br->bits_ < 0) { |
pbos-webrtc
2016/04/18 19:25:33
Shouldn't this be set inside VP8LoadNewBytes when
jackychen_
2016/04/18 20:49:47
I want to stop the operation on br->bits here sinc
|
+ br->error_ = true; |
+ return 0; |
+ } |
const int pos = br->bits_; |
const uint8_t split = (range * prob) >> 8; |
const uint8_t value = static_cast<uint8_t>(br->value_ >> pos); |
@@ -195,6 +199,10 @@ bool GetQp(const uint8_t* buf, size_t length, int* qp) { |
LOG(LS_WARNING) << "Failed to get QP, end of file reached."; |
return false; |
} |
+ if (br.error_) { |
+ LOG(LS_WARNING) << "Failed to get QP, invalid bitstream."; |
pbos-webrtc
2016/04/18 20:56:46
Are you sure that this isn't because the stream is
|
+ return false; |
+ } |
*qp = base_q0; |
return true; |
} |