plugins: encode: fix a deadlock because of _drain()

We call gst_vaapiencode_drain() in gst_vaapiencode_change_state(),
whose context does not hold the stream lock of the encoder. The
current gst_vaapiencode_drain inside unlock/lock pair adds a extra
lock count to the stream lock of encoder and causes hang later.
We just remove the gst_vaapiencode_drain() and expand its logic
correctly according to the lock/unlock context.

Part-of: <!433>
18 jobs for master in 2 minutes and 22 seconds (queued for 15 seconds)
Status Job ID Name Coverage
  Build Docker
passed alpine amd64 manifest builder docker #11446970

00:00:44

passed android docker #11446969

00:00:44

passed cerbero fedora amd64 docker #11446968

00:00:48

passed fedora amd64 docker #11446967

00:00:43

passed gst-indent amd64 docker #11446971

00:01:51

passed windows amd64 docker #11446972
windows shell 1809

00:00:12

 
  Preparation
passed gst indent #11446974

00:00:22

manual manifest #11446973
manual
 
  Build
created build clang fedora x86_64 #11446978
created build nodebug fedora x86_64 #11446975
created build static fedora x86_64 #11446976
created build static nodebug fedora x86_64 #11446977
 
  Test
created check fedora #11446979
gstreamer
created integration testsuites fedora 1/4 #11446980
gstreamer
created integration testsuites fedora 2/4 #11446981
gstreamer
created integration testsuites fedora 3/4 #11446982
gstreamer
created integration testsuites fedora 4/4 #11446983
gstreamer
 
  Integrate
created documentation #11446984