Commit d4840c46 authored by Pawel Osciak's avatar Pawel Osciak Committed by Commit Bot

H264Parser: reset stream state after returning kEOStream.

Reset stream_ and bytes_left_ to avoid reusing them in any subsequent
AdvanceToNextNALU() calls if the client fails to SetStream() beforehand.

BUG=632169
TEST=vdatest,H264ParserTest

Change-Id: I5ff611989c28f0f5f1c470189b3c2dd442e1d294
Reviewed-on: https://chromium-review.googlesource.com/530908Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Commit-Queue: Pawel Osciak <posciak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#478842}
parent 1080aa57
......@@ -478,6 +478,8 @@ H264Parser::Result H264Parser::AdvanceToNextNALU(H264NALU* nalu) {
if (!LocateNALU(&nalu_size_with_start_code, &start_code_size)) {
DVLOG(4) << "Could not find next NALU, bytes left in stream: "
<< bytes_left_;
stream_ = nullptr;
bytes_left_ = 0;
return kEOStream;
}
......@@ -486,8 +488,11 @@ H264Parser::Result H264Parser::AdvanceToNextNALU(H264NALU* nalu) {
DVLOG(4) << "NALU found: size=" << nalu_size_with_start_code;
// Initialize bit reader at the start of found NALU.
if (!br_.Initialize(nalu->data, nalu->size))
if (!br_.Initialize(nalu->data, nalu->size)) {
stream_ = nullptr;
bytes_left_ = 0;
return kEOStream;
}
// Move parser state to after this NALU, so next time AdvanceToNextNALU
// is called, we will effectively be skipping it;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment