ffplay: Don't assume ic->pb is non-null

Message ID 1300715574-41591-1-git-send-email-martin@martin.st
State Committed
Commit 648c79624fa70414dfb644fcb84b9de15e6568b0
Headers show

Commit Message

Martin Storsjö March 21, 2011, 1:52 p.m.
This fixes crashes on exit when plaing some RealRTSP streams
(among other), e.g.
rtsp://dl.lib.brown.edu:554/areserves/1093545294660883.mp3.
These crashes have been present since 3e68b3ba7b015cf21.
---
 ffplay.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Ronald Bultje March 21, 2011, 2:03 p.m. | #1
Hi,

On Mon, Mar 21, 2011 at 9:52 AM, Martin Storsjö <martin@martin.st> wrote:
> This fixes crashes on exit when plaing some RealRTSP streams
> (among other), e.g.
> rtsp://dl.lib.brown.edu:554/areserves/1093545294660883.mp3.
> These crashes have been present since 3e68b3ba7b015cf21.
> ---
>  ffplay.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ffplay.c b/ffplay.c
> index 1e5244c..ddd2c4d 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -2568,9 +2568,9 @@ static int decode_thread(void *arg)
>         }
>         ret = av_read_frame(ic, pkt);
>         if (ret < 0) {
> -            if (ret == AVERROR_EOF || ic->pb->eof_reached)
> +            if (ret == AVERROR_EOF || (ic->pb && ic->pb->eof_reached))
>                 eof=1;
> -            if (ic->pb->error)
> +            if (ic->pb && ic->pb->error)
>                 break;
>             SDL_Delay(100); /* wait for user event */
>             continue;
> --
> 1.7.3.1

OK.

Ronald
Luca Barbato March 21, 2011, 2:49 p.m. | #2
On 03/21/2011 02:52 PM, Martin Storsjö wrote:
> This fixes crashes on exit when plaing some RealRTSP streams
> (among other), e.g.
> rtsp://dl.lib.brown.edu:554/areserves/1093545294660883.mp3.
> These crashes have been present since 3e68b3ba7b015cf21.

I had that locally since a while, not sure why it hadn't been sent ^^;

patch ok.
Ronald Bultje March 21, 2011, 7:08 p.m. | #3
Hi,

On Mon, Mar 21, 2011 at 10:49 AM, Luca Barbato <lu_zero@gentoo.org> wrote:
> On 03/21/2011 02:52 PM, Martin Storsjö wrote:
>> This fixes crashes on exit when plaing some RealRTSP streams
>> (among other), e.g.
>> rtsp://dl.lib.brown.edu:554/areserves/1093545294660883.mp3.
>> These crashes have been present since 3e68b3ba7b015cf21.
>
> I had that locally since a while, not sure why it hadn't been sent ^^;
>
> patch ok.

Queued. Martin, didn't you have commit access?

Ronald

Patch

diff --git a/ffplay.c b/ffplay.c
index 1e5244c..ddd2c4d 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2568,9 +2568,9 @@  static int decode_thread(void *arg)
         }
         ret = av_read_frame(ic, pkt);
         if (ret < 0) {
-            if (ret == AVERROR_EOF || ic->pb->eof_reached)
+            if (ret == AVERROR_EOF || (ic->pb && ic->pb->eof_reached))
                 eof=1;
-            if (ic->pb->error)
+            if (ic->pb && ic->pb->error)
                 break;
             SDL_Delay(100); /* wait for user event */
             continue;